mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Cheat buttons
This commit is contained in:
parent
0a631bf5b7
commit
e637f69ce6
7 changed files with 98 additions and 16 deletions
|
|
@ -17,6 +17,9 @@ public partial class DebugMenu : MenuBase
|
|||
[Export]
|
||||
public Container ButtonsContainer { get; private set; }
|
||||
|
||||
[Export]
|
||||
public Container CheatsContainer { get; private set; }
|
||||
|
||||
[Export]
|
||||
public Button DefaultSelectedButton { get; private set; }
|
||||
|
||||
|
|
@ -28,17 +31,47 @@ public partial class DebugMenu : MenuBase
|
|||
foreach (var level in Levels.Maps)
|
||||
{
|
||||
if (!level.Enabled) continue;
|
||||
var button = new Button();
|
||||
//button.Text = level.Split("/")[^1].Split(".")[0];
|
||||
button.Text = level.DisplayName;
|
||||
button.Icon = level.Icon;
|
||||
//button.Text = level;
|
||||
button.Theme = ButtonTheme;
|
||||
|
||||
ButtonsContainer.CallDeferred("add_child", button);
|
||||
var button = MakeButton(ButtonsContainer, level.DisplayName, level.Icon);
|
||||
|
||||
// var button = new Button();
|
||||
// //button.Text = level.Split("/")[^1].Split(".")[0];
|
||||
// button.Text = level.DisplayName;
|
||||
// button.Icon = level.Icon;
|
||||
// //button.Text = level;
|
||||
// button.Theme = ButtonTheme;
|
||||
//
|
||||
// ButtonsContainer.CallDeferred("add_child", button);
|
||||
|
||||
button.Pressed += () => ButtonOnPressed(level);
|
||||
}
|
||||
|
||||
var refillHealthButton = MakeButton(CheatsContainer, "Health", null);
|
||||
refillHealthButton.Pressed += RefillHealthButtonOnPressed;
|
||||
|
||||
var refillShieldButton = MakeButton(CheatsContainer, "Shield", null);
|
||||
refillShieldButton.Pressed += RefillShieldButtonOnPressed;
|
||||
|
||||
}
|
||||
|
||||
private void RefillHealthButtonOnPressed()
|
||||
{
|
||||
GameManager.Instance?.Player?.RefillHealth();
|
||||
}
|
||||
|
||||
private void RefillShieldButtonOnPressed()
|
||||
{
|
||||
GameManager.Instance?.Player?.RefilleShield();
|
||||
}
|
||||
|
||||
private Button MakeButton(Control parent, string text, Texture2D icon)
|
||||
{
|
||||
var button = new Button();
|
||||
button.Text = text;
|
||||
button.Icon = icon;
|
||||
button.Theme = ButtonTheme;
|
||||
parent.CallDeferred("add_child", button);
|
||||
return button;
|
||||
}
|
||||
|
||||
private void ButtonOnPressed(DebugMapSelectResource scene)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue