Basic sigil system implementation
This commit is contained in:
@@ -24,6 +24,8 @@ public partial class PauseDebugMenu : Control, IDebugMenu
|
||||
|
||||
[Node] public OptionButton SpawnEnemyDropDown { get; set; } = default!;
|
||||
|
||||
[Node] public OptionButton SigilDropDown { get; set; } = default!;
|
||||
|
||||
[Node] public Button LoadNextFloorButton { get; set; } = default!;
|
||||
|
||||
[Node] public Button RustButton { get; set; } = default!;
|
||||
@@ -34,6 +36,7 @@ public partial class PauseDebugMenu : Control, IDebugMenu
|
||||
|
||||
private readonly string _floorFilePath = @"res://src/map/dungeon/floors/";
|
||||
private readonly string _enemyFilePath = @"res://src/enemy/enemy_types";
|
||||
private readonly string _sigilFilePath = @"res://src/sigil";
|
||||
|
||||
private ImmutableList<IBaseInventoryItem> _spawnableItems;
|
||||
private ImmutableList<string> _spawnableEnemies;
|
||||
@@ -80,6 +83,11 @@ public partial class PauseDebugMenu : Control, IDebugMenu
|
||||
FloorSelectDropDown.AddItem(folder + "/" + file);
|
||||
}
|
||||
|
||||
var sigils = DirAccess.GetFilesAt(_sigilFilePath).Where(x => x.EndsWith(".tres"));
|
||||
foreach (var sigil in sigils)
|
||||
SigilDropDown.AddItem(sigil);
|
||||
SigilDropDown.Select(0);
|
||||
|
||||
FloorSelectDropDown.AllowReselect = true;
|
||||
SpawnItemDropDown.AllowReselect = true;
|
||||
SpawnEnemyDropDown.AllowReselect = true;
|
||||
@@ -88,9 +96,25 @@ public partial class PauseDebugMenu : Control, IDebugMenu
|
||||
SpawnItemDropDown.ItemSelected += SpawnItemDropDown_ItemSelected;
|
||||
SpawnEnemyDropDown.ItemSelected += SpawnEnemyDropDown_ItemSelected;
|
||||
|
||||
SigilDropDown.ItemSelected += SigilDropDown_ItemSelected;
|
||||
|
||||
DebugInfoCheckbox.Pressed += DebugInfoCheckbox_Pressed;
|
||||
}
|
||||
|
||||
private void SigilDropDown_ItemSelected(long index)
|
||||
{
|
||||
var sigilName = SigilDropDown.GetItemText((int)index);
|
||||
if (sigilName == "None")
|
||||
{
|
||||
_player.SigilComponent.Reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
var sigilComponent = ResourceLoader.Load<Sigil>(_sigilFilePath + "/" + sigilName);
|
||||
_player.SetSigil(sigilComponent);
|
||||
}
|
||||
}
|
||||
|
||||
private void DebugInfoCheckbox_Pressed() => _game.ShowDebugInfo(DebugInfoCheckbox.ButtonPressed);
|
||||
|
||||
public bool DebugOverlayVisible => DebugInfoCheckbox.ButtonPressed;
|
||||
|
||||
Reference in New Issue
Block a user