mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-20 06:23:47 +00:00
Cirno Loading
This commit is contained in:
parent
23ac25ee3f
commit
313f773fc9
2 changed files with 31 additions and 7 deletions
|
|
@ -32,9 +32,8 @@ animations = [{
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
[node name="LoadingPlaque" type="CanvasLayer"]
|
[node name="LoadingPlaque" type="VBoxContainer"]
|
||||||
|
z_index = 4
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
|
||||||
anchors_preset = 3
|
anchors_preset = 3
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
anchor_top = 1.0
|
anchor_top = 1.0
|
||||||
|
|
@ -45,17 +44,17 @@ offset_top = -40.0
|
||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="VBoxContainer"]
|
[node name="Label" type="Label" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Cirno is preparing..."
|
text = "Cirno is preparing..."
|
||||||
label_settings = ExtResource("1_t7lr0")
|
label_settings = ExtResource("1_t7lr0")
|
||||||
|
|
||||||
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer"]
|
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="VBoxContainer/CenterContainer"]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="CenterContainer"]
|
||||||
position = Vector2(-2, 6)
|
position = Vector2(-2, 6)
|
||||||
sprite_frames = SubResource("SpriteFrames_6kit5")
|
sprite_frames = SubResource("SpriteFrames_6kit5")
|
||||||
autoplay = "default"
|
autoplay = "default"
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ public partial class GlobalState : Node
|
||||||
|
|
||||||
public SessionSettings SessionSettings { get; set; }
|
public SessionSettings SessionSettings { get; set; }
|
||||||
|
|
||||||
|
private PackedScene _plaqueTemplate;
|
||||||
|
|
||||||
|
private Control _loadingPlaque;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
|
@ -26,6 +30,8 @@ public partial class GlobalState : Node
|
||||||
CurrentScene = root.GetChild(-1);
|
CurrentScene = root.GetChild(-1);
|
||||||
|
|
||||||
_fader = CreateFader();
|
_fader = CreateFader();
|
||||||
|
|
||||||
|
//LoadPlaque();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GotoScene(string path)
|
public void GotoScene(string path)
|
||||||
|
|
@ -47,6 +53,10 @@ public partial class GlobalState : Node
|
||||||
public void GoToScene(string path, MapStartDataResource startData)
|
public void GoToScene(string path, MapStartDataResource startData)
|
||||||
{
|
{
|
||||||
GTweenSequenceBuilder.New()
|
GTweenSequenceBuilder.New()
|
||||||
|
.AppendCallback(() =>
|
||||||
|
{
|
||||||
|
_loadingPlaque?.Show();
|
||||||
|
})
|
||||||
//.Append(_fader.TweenModulateAlpha(0, 0f))
|
//.Append(_fader.TweenModulateAlpha(0, 0f))
|
||||||
.Append(_fader.TweenModulateAlpha(1, 0.5f))
|
.Append(_fader.TweenModulateAlpha(1, 0.5f))
|
||||||
.AppendCallback(() =>
|
.AppendCallback(() =>
|
||||||
|
|
@ -96,12 +106,21 @@ public partial class GlobalState : Node
|
||||||
GameManager.Instance?.ApplyMapStartData(resource);
|
GameManager.Instance?.ApplyMapStartData(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Control LoadPlaque()
|
||||||
|
{
|
||||||
|
_plaqueTemplate = GD.Load<PackedScene>("res://Scenes/HUD/LoadingPlaque.tscn");
|
||||||
|
|
||||||
|
return _plaqueTemplate.Instantiate<Control>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private ColorRect CreateFader()
|
private ColorRect CreateFader()
|
||||||
{
|
{
|
||||||
var canvas = new CanvasLayer();
|
var canvas = new CanvasLayer();
|
||||||
canvas.ProcessMode = ProcessModeEnum.Always;
|
canvas.ProcessMode = ProcessModeEnum.Always;
|
||||||
|
|
||||||
var rect = new ColorRect();
|
var rect = new ColorRect();
|
||||||
|
rect.ZIndex = 2;
|
||||||
rect.SetAnchorsPreset(Control.LayoutPreset.FullRect);
|
rect.SetAnchorsPreset(Control.LayoutPreset.FullRect);
|
||||||
rect.Color = new Color(Colors.Black, 1f);
|
rect.Color = new Color(Colors.Black, 1f);
|
||||||
rect.ProcessMode = ProcessModeEnum.Always;
|
rect.ProcessMode = ProcessModeEnum.Always;
|
||||||
|
|
@ -114,16 +133,22 @@ public partial class GlobalState : Node
|
||||||
|
|
||||||
this.CallDeferred("add_child", canvas);
|
this.CallDeferred("add_child", canvas);
|
||||||
|
|
||||||
|
_loadingPlaque = LoadPlaque();
|
||||||
|
canvas.CallDeferred("add_child", _loadingPlaque);
|
||||||
|
_loadingPlaque.Hide();
|
||||||
|
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FadeOut()
|
public void FadeOut()
|
||||||
{
|
{
|
||||||
_fader.TweenModulateAlpha(1, 0.5f).PlayUnpausable();
|
_fader.TweenModulateAlpha(1, 0.5f).PlayUnpausable();
|
||||||
|
_loadingPlaque?.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FadeIn()
|
public void FadeIn()
|
||||||
{
|
{
|
||||||
|
_loadingPlaque?.Hide();
|
||||||
_fader.TweenModulateAlpha(0, 1f).PlayUnpausable();
|
_fader.TweenModulateAlpha(0, 1f).PlayUnpausable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue