Add debug info folder that got filtered by git

This commit is contained in:
2026-02-13 16:12:34 -08:00
parent 638946d23a
commit b17c134c9a
3 changed files with 123 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Godot;
using System.Linq;
using Zennysoft.Game.Ma;
using Zennysoft.Ma.Adapter;
using Zennysoft.Ma.Adapter.Entity;
[Meta(typeof(IAutoNode)), Id("debug")]
public partial class DebugInfo : Control
{
public override void _Notification(int what) => this.Notify(what);
[Dependency] private IGame _game => this.DependOn<IGame>();
[Dependency] private IGameRepo _gameRepo => this.DependOn<IGameRepo>();
[Dependency] private IMap _map => this.DependOn<IMap>();
[Dependency] private IPlayer _player => this.DependOn<IPlayer>();
[Node] public Label MapName { get; set; }
[Node] public Label EnemyCount { get; set; }
[Node] public Label DeathCount { get; set; }
public void OnResolved()
{
_map.FloorLoaded += _map_FloorLoaded;
_gameRepo.EnemyDied += _gameRepo_EnemyDied;
_player.PlayerDied += _player_PlayerDied;
DeathCount.Text = _game.QuestData.DeathCount.ToString();
}
private void _gameRepo_EnemyDied(IEnemy obj) => EnemyCount.Text = (EnemyCount.Text.ToInt() - 1).ToString();
private void _map_FloorLoaded()
{
MapName.Text = _map.CurrentFloor.SceneFilePath.GetFile().TrimSuffix(".tscn");
EnemyCount.Text = _map.CurrentFloor.GetChild(0).GetChildren().OfType<IDungeonRoom>().Select(x => x.GetChildren().OfType<IEnemy>()).Count().ToString();
}
private void _player_PlayerDied() => DeathCount.Text = _game.QuestData.DeathCount.ToString();
}

View File

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

View File

@@ -0,0 +1,82 @@
[gd_scene load_steps=4 format=3 uid="uid://t22s2y1t8ktc"]
[ext_resource type="Script" uid="uid://c4g3frcpt0h36" path="res://src/debug_info/DebugInfo.cs" id="1_6tk84"]
[ext_resource type="LabelSettings" uid="uid://b6f8ggy3ulonb" path="res://src/ui/label_settings/GeorgiaItalic.tres" id="1_i766g"]
[ext_resource type="Script" uid="uid://3fpuxsgdl8xe" path="res://src/utils/FpsCounter.cs" id="3_rco7p"]
[node name="DebugInfo" 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_6tk84")
[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
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="VFlowContainer" type="VFlowContainer" parent="MarginContainer"]
layout_mode = 2
alignment = 2
[node name="FPS" type="HBoxContainer" parent="MarginContainer/VFlowContainer"]
layout_mode = 2
[node name="FPSLabel" type="Label" parent="MarginContainer/VFlowContainer/FPS"]
layout_mode = 2
text = "FPS:"
label_settings = ExtResource("1_i766g")
[node name="FPSCounter" type="Label" parent="MarginContainer/VFlowContainer/FPS"]
layout_mode = 2
label_settings = ExtResource("1_i766g")
script = ExtResource("3_rco7p")
[node name="MapInfo" type="HBoxContainer" parent="MarginContainer/VFlowContainer"]
layout_mode = 2
[node name="Map Name Label" type="Label" parent="MarginContainer/VFlowContainer/MapInfo"]
layout_mode = 2
text = "Map Name:"
label_settings = ExtResource("1_i766g")
[node name="MapName" type="Label" parent="MarginContainer/VFlowContainer/MapInfo"]
unique_name_in_owner = true
layout_mode = 2
label_settings = ExtResource("1_i766g")
[node name="EnemyInfo" type="HBoxContainer" parent="MarginContainer/VFlowContainer"]
layout_mode = 2
[node name="Enemy Count Label" type="Label" parent="MarginContainer/VFlowContainer/EnemyInfo"]
layout_mode = 2
text = "Number of enemies:"
label_settings = ExtResource("1_i766g")
[node name="EnemyCount" type="Label" parent="MarginContainer/VFlowContainer/EnemyInfo"]
unique_name_in_owner = true
layout_mode = 2
label_settings = ExtResource("1_i766g")
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VFlowContainer"]
layout_mode = 2
[node name="DeathCountLabel" type="Label" parent="MarginContainer/VFlowContainer/HBoxContainer"]
layout_mode = 2
text = "Player Death Count:"
label_settings = ExtResource("1_i766g")
[node name="DeathCount" type="Label" parent="MarginContainer/VFlowContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
label_settings = ExtResource("1_i766g")