Move files and folders to new repo format to enable multi-project format

This commit is contained in:
2025-03-06 22:07:25 -08:00
parent 12cbb82ac9
commit a09f6ec5a5
3973 changed files with 1781 additions and 2938 deletions

View File

@@ -0,0 +1,90 @@
using Chickensoft.AutoInject;
using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection;
using Godot;
namespace Zennysoft.Game.Ma;
public interface IPlayerInfoUI : IControl
{
public void DisplayMessage(string message);
}
[Meta(typeof(IAutoNode))]
public partial class PlayerInfoUI : Control, IPlayerInfoUI
{
public override void _Notification(int what) => this.Notify(what);
private LabelSettings _labelSettings { get; set; }
#region Nodes
[Node] public VBoxContainer PlayerInfo { get; set; } = default!;
[Node] public Label LevelNumber { get; set; } = default!;
[Node] public Label HPNumber { get; set; } = default!;
[Node] public Label VTNumber { get; set; } = default!;
#endregion
[Dependency] public IPlayer Player => this.DependOn<IPlayer>();
public void OnResolved()
{
_labelSettings = GD.Load<LabelSettings>("res://src/ui/label_settings/InventoryFullAlertLabelSetting.tres");
Player.Stats.CurrentHP.Sync += CurrentHP_Sync;
Player.Stats.MaximumHP.Sync += MaximumHP_Sync;
Player.Stats.CurrentVT.Sync += CurrentVT_Sync;
Player.Stats.MaximumVT.Sync += MaximumVT_Sync;
Player.Stats.CurrentLevel.Sync += CurrentLevel_Sync;
}
private void CurrentLevel_Sync(int obj)
{
LevelNumber.Text = $"{obj}";
}
private void MaximumVT_Sync(int obj)
{
VTNumber.Text = $"{Player.Stats.CurrentVT.Value}/{obj}";
}
private void CurrentVT_Sync(int obj)
{
VTNumber.Text = $"{obj}/{Player.Stats.MaximumVT.Value}";
}
private void MaximumHP_Sync(int obj)
{
HPNumber.Text = $"{Player.Stats.CurrentHP.Value}/{obj}";
}
private void CurrentHP_Sync(int obj)
{
HPNumber.Text = $"{obj}/{Player.Stats.MaximumHP.Value}";
}
public async void DisplayInventoryFullMessage(string rejectedItemName)
{
var newLabel = new Label() { Text = $"Could not pick up {rejectedItemName}.", LabelSettings = _labelSettings };
PlayerInfo.AddChild(newLabel);
GetTree().CreateTimer(3f).Timeout += () =>
{
PlayerInfo.RemoveChild(newLabel);
};
}
public async void DisplayMessage(string message)
{
var newLabel = new Label() { Text = message, LabelSettings = _labelSettings };
PlayerInfo.AddChild(newLabel);
GetTree().CreateTimer(3f).Timeout += () =>
{
PlayerInfo.RemoveChild(newLabel);
};
}
}

View File

@@ -0,0 +1 @@
uid://b65cbirtijlii

View File

@@ -0,0 +1,99 @@
[gd_scene load_steps=5 format=3 uid="uid://dxl8il8f13c2x"]
[ext_resource type="Texture2D" uid="uid://hg2kraa5nrnl" path="res://src/ui/textures/blank level symbol.png" id="1_78qrq"]
[ext_resource type="Script" uid="uid://b65cbirtijlii" path="res://src/ui/player_ui/PlayerInfoUI.cs" id="1_d8yyu"]
[ext_resource type="LabelSettings" uid="uid://ca1q6yu8blwxf" path="res://src/ui/label_settings/InventoryMainTextBold.tres" id="2_aa7fx"]
[ext_resource type="LabelSettings" uid="uid://dupifadnagodp" path="res://src/ui/label_settings/MainTextRegular.tres" id="3_xdjh1"]
[node name="PlayerInfoUI" 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_d8yyu")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 9
anchor_bottom = 1.0
offset_right = 426.0
grow_vertical = 2
theme_override_constants/margin_left = 32
theme_override_constants/margin_top = 20
[node name="PlayerInfo" type="VBoxContainer" parent="MarginContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/PlayerInfo"]
layout_mode = 2
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/PlayerInfo/HBoxContainer"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="MarginContainer/PlayerInfo/HBoxContainer/CenterContainer"]
custom_minimum_size = Vector2(128, 128)
layout_mode = 2
size_flags_vertical = 3
texture = ExtResource("1_78qrq")
expand_mode = 1
stretch_mode = 4
[node name="LevelNumber" type="Label" parent="MarginContainer/PlayerInfo/HBoxContainer/CenterContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(80, 80)
layout_mode = 2
text = "99"
label_settings = ExtResource("2_aa7fx")
horizontal_alignment = 1
vertical_alignment = 1
[node name="VBox" type="VBoxContainer" parent="MarginContainer/PlayerInfo/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_constants/separation = 15
[node name="HBox" type="HBoxContainer" parent="MarginContainer/PlayerInfo/HBoxContainer/VBox"]
layout_mode = 2
size_flags_horizontal = 3
[node name="HP" type="Label" parent="MarginContainer/PlayerInfo/HBoxContainer/VBox/HBox"]
layout_mode = 2
text = "HP: "
label_settings = ExtResource("2_aa7fx")
[node name="ReferenceRect" type="ReferenceRect" parent="MarginContainer/PlayerInfo/HBoxContainer/VBox/HBox"]
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
border_width = 0.0
[node name="HPNumber" type="Label" parent="MarginContainer/PlayerInfo/HBoxContainer/VBox/HBox"]
unique_name_in_owner = true
layout_mode = 2
text = "222/222"
label_settings = ExtResource("3_xdjh1")
[node name="HBox2" type="HBoxContainer" parent="MarginContainer/PlayerInfo/HBoxContainer/VBox"]
layout_mode = 2
[node name="VT" type="Label" parent="MarginContainer/PlayerInfo/HBoxContainer/VBox/HBox2"]
layout_mode = 2
text = "VT:"
label_settings = ExtResource("2_aa7fx")
[node name="ReferenceRect" type="ReferenceRect" parent="MarginContainer/PlayerInfo/HBoxContainer/VBox/HBox2"]
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
border_width = 0.0
[node name="VTNumber" type="Label" parent="MarginContainer/PlayerInfo/HBoxContainer/VBox/HBox2"]
unique_name_in_owner = true
layout_mode = 2
text = "444/444"
label_settings = ExtResource("3_xdjh1")
[node name="TextureButton" type="TextureButton" parent="MarginContainer"]
layout_mode = 2