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