Move files and folders to new repo format to enable multi-project format
This commit is contained in:
54
Zennysoft.Game.Ma/src/menu/Menu.cs
Normal file
54
Zennysoft.Game.Ma/src/menu/Menu.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Zennysoft.Game.Ma;
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public interface IMenu : IControl
|
||||
{
|
||||
event Menu.NewGameEventHandler NewGame;
|
||||
event Menu.LoadGameEventHandler LoadGame;
|
||||
event Menu.QuitEventHandler Quit;
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class Menu : Control, IMenu
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Node] public IButton NewGameButton { get; set; } = default!;
|
||||
|
||||
[Node] public IButton LoadGameButton { get; set; } = default!;
|
||||
|
||||
[Node] public IButton QuitButton { get; set; } = default!;
|
||||
|
||||
[Signal]
|
||||
public delegate void NewGameEventHandler();
|
||||
[Signal]
|
||||
public delegate void LoadGameEventHandler();
|
||||
[Signal]
|
||||
public delegate void QuitEventHandler();
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
NewGameButton.Pressed += OnNewGamePressed;
|
||||
LoadGameButton.Pressed += OnLoadGamePressed;
|
||||
QuitButton.Pressed += OnQuitPressed;
|
||||
NewGameButton.GrabFocus();
|
||||
}
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
NewGameButton.Pressed -= OnNewGamePressed;
|
||||
LoadGameButton.Pressed -= OnLoadGamePressed;
|
||||
QuitButton.Pressed -= OnQuitPressed;
|
||||
}
|
||||
|
||||
public void OnNewGamePressed() => EmitSignal(SignalName.NewGame);
|
||||
|
||||
public void OnLoadGamePressed() => EmitSignal(SignalName.LoadGame);
|
||||
|
||||
public void OnQuitPressed() => EmitSignal(SignalName.Quit);
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/menu/Menu.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/menu/Menu.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://14b7o2c6cgry
|
||||
54
Zennysoft.Game.Ma/src/menu/Menu.tscn
Normal file
54
Zennysoft.Game.Ma/src/menu/Menu.tscn
Normal file
@@ -0,0 +1,54 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://rfvnddfqufho"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://14b7o2c6cgry" path="res://src/menu/Menu.cs" id="1_vehpg"]
|
||||
|
||||
[node name="Menu" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_vehpg")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 0
|
||||
theme_override_constants/margin_left = 100
|
||||
theme_override_constants/margin_top = 100
|
||||
theme_override_constants/margin_right = 100
|
||||
theme_override_constants/margin_bottom = 100
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 0
|
||||
|
||||
[node name="NewGameButton" type="Button" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
focus_neighbor_bottom = NodePath("../LoadGameButton")
|
||||
theme_override_colors/font_focus_color = Color(0.976471, 0.827451, 0, 1)
|
||||
text = "New Game"
|
||||
|
||||
[node name="LoadGameButton" type="Button" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
focus_neighbor_top = NodePath("../NewGameButton")
|
||||
focus_neighbor_bottom = NodePath("../QuitButton")
|
||||
theme_override_colors/font_focus_color = Color(0.976471, 0.827451, 0, 1)
|
||||
text = "Load Game"
|
||||
|
||||
[node name="QuitButton" type="Button" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
focus_neighbor_top = NodePath("../LoadGameButton")
|
||||
theme_override_colors/font_focus_color = Color(0.976471, 0.827451, 0, 1)
|
||||
text = "Quit
|
||||
"
|
||||
36
Zennysoft.Game.Ma/src/menu/splash/Splash.cs
Normal file
36
Zennysoft.Game.Ma/src/menu/splash/Splash.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public interface ISplash : IControl;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class Splash : Control, ISplash
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Dependency]
|
||||
public IAppRepo AppRepo => this.DependOn<IAppRepo>();
|
||||
|
||||
[Node] public IAnimationPlayer AnimationPlayer { get; set; } = default!;
|
||||
|
||||
public void OnReady() =>
|
||||
AnimationPlayer.AnimationFinished += OnAnimationFinished;
|
||||
|
||||
public void OnExitTree()
|
||||
=> AnimationPlayer.AnimationFinished -= OnAnimationFinished;
|
||||
|
||||
public void OnAnimationFinished(StringName name)
|
||||
=> AppRepo.SkipSplashScreen();
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (Input.IsActionJustPressed(GameInputs.Attack) || Input.IsActionJustPressed(GameInputs.Pause))
|
||||
{
|
||||
AppRepo.SkipSplashScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/menu/splash/Splash.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/menu/splash/Splash.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cl3shd6l7frmg
|
||||
64
Zennysoft.Game.Ma/src/menu/splash/Splash.tscn
Normal file
64
Zennysoft.Game.Ma/src/menu/splash/Splash.tscn
Normal file
@@ -0,0 +1,64 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://bd0p761qakisw"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cl3shd6l7frmg" path="res://src/menu/splash/Splash.cs" id="1_7ivmr"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_jiqgw"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ColorRect:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_7ivmr"]
|
||||
resource_name = "intro"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ColorRect:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_jiqgw"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_jiqgw"),
|
||||
&"intro": SubResource("Animation_7ivmr")
|
||||
}
|
||||
|
||||
[node name="Splash" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_7ivmr")
|
||||
|
||||
[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
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_jiqgw")
|
||||
}
|
||||
autoplay = "intro"
|
||||
Reference in New Issue
Block a user