Intro player

This commit is contained in:
Marco 2025-02-19 17:38:54 +01:00
commit 39fc403219
22 changed files with 531 additions and 3 deletions

View file

@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=3 uid="uid://jypfiwjsk8wh"]
[ext_resource type="Script" path="res://addons/dialogic/Modules/Background/node_background_holder.gd" id="1_4gfgy"]
[node name="DialogicImage" type="Node2D"]
[node name="DialogicNode_BackgroundHolder" type="ColorRect" parent="."]
offset_left = 126.0
offset_top = 41.0
offset_right = 209.0
offset_bottom = 124.0
script = ExtResource("1_4gfgy")

View file

@ -0,0 +1,33 @@
[gd_scene load_steps=2 format=3 uid="uid://1qx7a3isffve"]
[ext_resource type="Script" path="res://addons/dialogic/Modules/Background/DefaultBackgroundScene/default_background.gd" id="1_2qy85"]
[node name="DefaultBackground" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 180.0
offset_top = 20.0
offset_right = -60.0
offset_bottom = -60.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_2qy85")
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Image" type="TextureRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 0

View file

@ -71,4 +71,4 @@ layer_info = {
}
base_overrides = {}
layers = Array[ExtResource("1_5pxx8")]([])
metadata/_latest_layer = "12"
metadata/_latest_layer = "10"

View file

@ -0,0 +1,76 @@
[gd_resource type="Resource" script_class="DialogicStyle" load_steps=18 format=3 uid="uid://cslkpptaokfkg"]
[ext_resource type="Script" path="res://addons/dialogic/Resources/dialogic_style_layer.gd" id="1_q5n8x"]
[ext_resource type="PackedScene" uid="uid://c1k5m0w3r40xf" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_FullBackground/full_background_layer.tscn" id="2_00med"]
[ext_resource type="PackedScene" uid="uid://cn674foxwedqu" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_Input/full_advance_input_layer.tscn" id="3_neejd"]
[ext_resource type="PackedScene" uid="uid://by6waso0mjpjp" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_SpeakerPortraitTextbox/textbox_with_speaker_portrait.tscn" id="4_rxcg7"]
[ext_resource type="PackedScene" uid="uid://dsbwnp5hegnu3" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_Glossary/glossary_popup_layer.tscn" id="5_vb5qu"]
[ext_resource type="PackedScene" uid="uid://dhk6j6eb6e3q" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Choices/vn_choice_layer.tscn" id="6_qdab0"]
[ext_resource type="PackedScene" uid="uid://cvgf4c6gg0tsy" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_TextInput/text_input_layer.tscn" id="7_8duix"]
[ext_resource type="PackedScene" uid="uid://lx24i8fl6uo" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_History/history_layer.tscn" id="8_w0pnw"]
[ext_resource type="Script" path="res://addons/dialogic/Resources/dialogic_style.gd" id="9_tn0x4"]
[sub_resource type="Resource" id="Resource_8gxnf"]
script = ExtResource("1_q5n8x")
overrides = {
"global_font_size": "10.0"
}
[sub_resource type="Resource" id="Resource_rknjs"]
script = ExtResource("1_q5n8x")
scene = ExtResource("2_00med")
overrides = {}
[sub_resource type="Resource" id="Resource_1uias"]
script = ExtResource("1_q5n8x")
scene = ExtResource("3_neejd")
overrides = {}
[sub_resource type="Resource" id="Resource_7eaws"]
script = ExtResource("1_q5n8x")
scene = ExtResource("4_rxcg7")
overrides = {
"box_distance": "0.0",
"box_panel": "\"res://Dialogue/Styles/intro_stylebox.tres\"",
"box_size": "Vector2(300, 60)",
"custom_normal_font": "\"res://fonts/at01.ttf\"",
"text_custom_size": "4.0"
}
[sub_resource type="Resource" id="Resource_rv6rq"]
script = ExtResource("1_q5n8x")
scene = ExtResource("5_vb5qu")
overrides = {}
[sub_resource type="Resource" id="Resource_4eko4"]
script = ExtResource("1_q5n8x")
scene = ExtResource("6_qdab0")
overrides = {}
[sub_resource type="Resource" id="Resource_mhdb2"]
script = ExtResource("1_q5n8x")
scene = ExtResource("7_8duix")
overrides = {}
[sub_resource type="Resource" id="Resource_umqyu"]
script = ExtResource("1_q5n8x")
scene = ExtResource("8_w0pnw")
overrides = {}
[resource]
script = ExtResource("9_tn0x4")
name = "Intro_Syle"
layer_list = Array[String](["10", "11", "12", "13", "14", "15", "16"])
layer_info = {
"": SubResource("Resource_8gxnf"),
"10": SubResource("Resource_rknjs"),
"11": SubResource("Resource_1uias"),
"12": SubResource("Resource_7eaws"),
"13": SubResource("Resource_rv6rq"),
"14": SubResource("Resource_4eko4"),
"15": SubResource("Resource_mhdb2"),
"16": SubResource("Resource_umqyu")
}
base_overrides = {}
layers = Array[ExtResource("1_q5n8x")]([])
metadata/_latest_layer = "12"

View file

@ -74,4 +74,4 @@ layer_info = {
}
base_overrides = {}
layers = Array[ExtResource("1_5pbjb")]([])
metadata/_latest_layer = "12"
metadata/_latest_layer = "11"

View file

@ -0,0 +1,42 @@
[gd_resource type="Resource" script_class="DialogicStyle" load_steps=8 format=3 uid="uid://nt27v2wakc1d"]
[ext_resource type="Script" path="res://addons/dialogic/Resources/dialogic_style_layer.gd" id="1_ox851"]
[ext_resource type="PackedScene" uid="uid://bquja8jyk8kbr" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/vn_textbox_layer.tscn" id="2_02p3y"]
[ext_resource type="Script" path="res://addons/dialogic/Resources/dialogic_style.gd" id="2_dpeha"]
[ext_resource type="PackedScene" uid="uid://c1k5m0w3r40xf" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_FullBackground/full_background_layer.tscn" id="3_8orul"]
[sub_resource type="Resource" id="Resource_28lt3"]
script = ExtResource("1_ox851")
overrides = {
"global_font": "\"res://fonts/at01.ttf\""
}
[sub_resource type="Resource" id="Resource_ojqkx"]
script = ExtResource("1_ox851")
scene = ExtResource("2_02p3y")
overrides = {
"box_animation_in": "0",
"box_animation_out": "0",
"box_margin_bottom": "0.0",
"box_size": "Vector2(200, 60)",
"next_indicator_enabled": "false",
"typing_sounds_enabled": "false"
}
[sub_resource type="Resource" id="Resource_q6pd1"]
script = ExtResource("1_ox851")
scene = ExtResource("3_8orul")
overrides = {}
[resource]
script = ExtResource("2_dpeha")
name = "custom_test"
layer_list = Array[String](["11", "10"])
layer_info = {
"": SubResource("Resource_28lt3"),
"10": SubResource("Resource_ojqkx"),
"11": SubResource("Resource_q6pd1")
}
base_overrides = {}
layers = Array[ExtResource("1_ox851")]([])
metadata/_latest_layer = "11"

View file

@ -0,0 +1,13 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://dsqjb8xslwm2r"]
[resource]
content_margin_left = 10.0
content_margin_top = 10.0
content_margin_right = 10.0
content_margin_bottom = 10.0
bg_color = Color(1, 1, 1, 1)
skew = Vector2(0.073, 0)
corner_radius_top_left = 10
corner_radius_top_right = 10
corner_radius_bottom_right = 10
corner_radius_bottom_left = 10

View file

@ -0,0 +1,6 @@
[style name="custom_test"]
[music path="res://Music/Title.mp3" fade="0.0" volume="0.0" loop="false"]
[background arg="res://Sprites/Briefing/Intro1small-crop.png" fade="0.6"]
In the land of Gensokyo, the forest of magic
[background scene="res://Dialogue/CustomScenes/dialogic_windowed_image.tscn" arg="res://Sprites/Briefing/Refinery.png" fade="0.0"]
A fairy plays

View file

@ -0,0 +1,18 @@
[gd_scene load_steps=5 format=3 uid="uid://oaxftu6lytvv"]
[ext_resource type="Script" path="res://Scripts/UI/IntroScenePlayer.cs" id="1_jtu71"]
[ext_resource type="Texture2D" uid="uid://4skj5ik6qpu4" path="res://Sprites/Briefing/Intro1small.png" id="2_6u3to"]
[ext_resource type="Texture2D" uid="uid://bpbygf3mi6tlf" path="res://Sprites/Briefing/Intro2small.png" id="3_5hqyp"]
[ext_resource type="Texture2D" uid="uid://cupm3ruhaj6d7" path="res://Sprites/Briefing/Intro3small.png" id="4_845v1"]
[node name="Intro" type="CanvasLayer" node_paths=PackedStringArray("PanelsHolder")]
script = ExtResource("1_jtu71")
PanelsHolder = NodePath("PanelContainer")
Images = Array[Texture2D]([ExtResource("2_6u3to"), ExtResource("3_5hqyp"), ExtResource("4_845v1")])
NextSceneName = "res://Scripts/MainMenu.cs"
[node name="PanelContainer" type="PanelContainer" parent="."]
offset_left = 92.0
offset_top = 13.0
offset_right = 232.0
offset_bottom = 119.0

35
Scripts/IntroManager.cs Normal file
View file

@ -0,0 +1,35 @@
using Godot;
namespace Cirno.Scripts;
public partial class IntroManager : Node
{
[Export] public string TimelineName { get; set; }
[Export] public string NextMap { get; set; }
private Node _dialogic;
public override void _Ready()
{
_dialogic = this.GetNode("/root/Dialogic");
_dialogic.Connect("timeline_ended", Callable.From(OnTimelineEnded));
_dialogic.Call("start", TimelineName);
}
private void OnTimelineEnded()
{
if (_dialogic.IsConnected("timeline_ended", Callable.From(OnTimelineEnded)))
{
_dialogic.Disconnect("timeline_ended", Callable.From(OnTimelineEnded));
}
DialogueEndAction();
}
private void DialogueEndAction()
{
GetTree().ChangeSceneToFile(NextMap);
}
}

View file

@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Godot;
using Godot.Collections;
namespace Cirno.Scripts.UI;
public partial class IntroScenePlayer : CanvasLayer
{
[Export]
public Control PanelsHolder { get; private set; }
[Export]
public Array<Texture2D> Images { get; private set; }
[Export]
public float TransitionTime = 5f;
[Export]
public string NextSceneName { get; set; }
private int _currentPanelIndex;
private List<TextureRect> _panels = new ();
public TextureRect CurrentPanel => _panels[_currentPanelIndex];
private double _timer = 0f;
private bool _running = false;
public override void _Ready()
{
_timer = 0;
_running = true;
foreach (var image in Images)
{
var panel = new TextureRect();
panel.Texture = image;
panel.ExpandMode = TextureRect.ExpandModeEnum.KeepSize;
panel.StretchMode = TextureRect.StretchModeEnum.KeepAspectCentered;
panel.Visible = false;
panel.SetModulate(new Color(panel.Modulate.R, panel.Modulate.G, panel.Modulate.B, 0f));
PanelsHolder.CallDeferred("add_child", panel);
_panels.Add(panel);
}
var first = _panels.First();
first.Visible = true;
first.SetModulate(new Color(first.Modulate.R, first.Modulate.G, first.Modulate.B, 1f));
}
public override void _Process(double delta)
{
if (!_running) return;
_timer += delta;
if (_timer >= TransitionTime)
{
_timer = 0;
_currentPanelIndex++;
if (_currentPanelIndex >= _panels.Count)
{
_running = false;
Finished();
return;
}
_running = false;
_ = Transition();
}
}
private void Finished()
{
GetTree().ChangeSceneToFile(NextSceneName);
}
private async Task Transition()
{
TextureRect previousPanel = _panels[_currentPanelIndex-1];
CurrentPanel.Visible = true;
var tween = GetTree().CreateTween();
tween.SetEase(Tween.EaseType.InOut);
tween.SetTrans(Tween.TransitionType.Linear);
tween.TweenProperty(previousPanel, "modulate:a", 0f, 1f);
tween.TweenProperty(CurrentPanel, "modulate:a", 1f, 1f);
await ToSignal(tween, "finished");
previousPanel.Visible = false;
_running = true;
}
}

BIN
Sprites/Briefing/Intro1.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dl3u20bwtaqgd"
path="res://.godot/imported/Intro1.png-28e02c98768b2bdad1bf87b2e0bc9fab.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/Briefing/Intro1.png"
dest_files=["res://.godot/imported/Intro1.png-28e02c98768b2bdad1bf87b2e0bc9fab.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
Sprites/Briefing/Intro1small-crop.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b1nwabn21owck"
path="res://.godot/imported/Intro1small-crop.png-a01a79341b94c5bc1e85b98302aeab3e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/Briefing/Intro1small-crop.png"
dest_files=["res://.godot/imported/Intro1small-crop.png-a01a79341b94c5bc1e85b98302aeab3e.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
Sprites/Briefing/Intro1small.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://4skj5ik6qpu4"
path="res://.godot/imported/Intro1small.png-515fe4e964dab98e5b488738a93bdcb1.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/Briefing/Intro1small.png"
dest_files=["res://.godot/imported/Intro1small.png-515fe4e964dab98e5b488738a93bdcb1.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
Sprites/Briefing/Intro2small.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bpbygf3mi6tlf"
path="res://.godot/imported/Intro2small.png-a0565052dfeddc483b93a33f61af17fc.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/Briefing/Intro2small.png"
dest_files=["res://.godot/imported/Intro2small.png-a0565052dfeddc483b93a33f61af17fc.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
Sprites/Briefing/Intro3small.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cupm3ruhaj6d7"
path="res://.godot/imported/Intro3small.png-bc378ed91acf13ba3821d90192093129.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/Briefing/Intro3small.png"
dest_files=["res://.godot/imported/Intro3small.png-bc378ed91acf13ba3821d90192093129.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -44,13 +44,14 @@ directories/dtl_directory={
"Rumia_Intro": "res://Dialogue/Timelines/Rumia_Intro.dtl",
"computer1": "res://Dialogue/Timelines/computer1.dtl",
"computer2": "res://Dialogue/Timelines/computer2.dtl",
"intro_story": "res://Dialogue/Timelines/intro_story.dtl",
"rumia_defeat": "res://Dialogue/Timelines/rumia_defeat.dtl",
"rumia_rebel_base_1": "res://Dialogue/Timelines/rumia_rebel_base_1.dtl",
"testintro": "res://Dialogue/Timelines/testintro.dtl",
"timeline": "res://Dialogue/timeline.dtl"
}
glossary/default_case_sensitive=true
layout/style_list=["res://Dialogue/Styles/Textbox_style.tres", "res://Dialogue/Styles/VN.tres", "res://Dialogue/Styles/Computer_Style.tres"]
layout/style_list=["res://Dialogue/Styles/Textbox_style.tres", "res://Dialogue/Styles/VN.tres", "res://Dialogue/Styles/Computer_Style.tres", "res://Dialogue/Styles/Intro_Syle.tres", "res://Dialogue/Styles/custom_test.tres"]
layout/default_style="res://Dialogue/Styles/Textbox_style.tres"
variables={}
extensions_folder="res://addons/dialogic_additions"