2025-02-19 13:34:15 +01:00
|
|
|
using Godot;
|
|
|
|
|
using System;
|
2025-02-21 11:39:22 +01:00
|
|
|
using Cirno.Scripts.Resources;
|
|
|
|
|
using Cirno.Scripts.Resources.DebugMenu;
|
2025-02-19 13:34:15 +01:00
|
|
|
using Godot.Collections;
|
2025-02-21 11:39:22 +01:00
|
|
|
using DebugMapSelectData = Cirno.Scripts.Resources.DebugMenu.DebugMapSelectData;
|
2025-02-19 13:34:15 +01:00
|
|
|
|
2025-02-25 21:21:07 +01:00
|
|
|
public partial class DebugMenu : MenuBase
|
2025-02-19 13:34:15 +01:00
|
|
|
{
|
2025-02-27 10:37:10 +01:00
|
|
|
|
2025-02-19 13:34:15 +01:00
|
|
|
[Export]
|
|
|
|
|
public Theme ButtonTheme { get; private set; }
|
2025-02-27 10:37:10 +01:00
|
|
|
|
2025-02-19 13:34:15 +01:00
|
|
|
[Export]
|
2025-02-21 11:39:22 +01:00
|
|
|
public DebugMapSelectData Levels { get; set; }
|
2025-02-27 10:37:10 +01:00
|
|
|
|
2025-02-19 13:34:15 +01:00
|
|
|
[Export]
|
|
|
|
|
public Container ButtonsContainer { get; private set; }
|
2025-03-12 15:47:57 +01:00
|
|
|
|
|
|
|
|
[Export]
|
|
|
|
|
public Button DefaultSelectedButton { get; private set; }
|
2025-02-19 13:34:15 +01:00
|
|
|
|
|
|
|
|
// Called when the node enters the scene tree for the first time.
|
|
|
|
|
public override void _Ready()
|
|
|
|
|
{
|
2025-03-12 15:47:57 +01:00
|
|
|
DefaultSelectedButton.GrabFocus();
|
|
|
|
|
|
2025-02-21 11:39:22 +01:00
|
|
|
foreach (var level in Levels.Maps)
|
2025-02-19 13:34:15 +01:00
|
|
|
{
|
2025-02-21 11:39:22 +01:00
|
|
|
if (!level.Enabled) continue;
|
2025-02-19 13:34:15 +01:00
|
|
|
var button = new Button();
|
2025-02-21 11:39:22 +01:00
|
|
|
//button.Text = level.Split("/")[^1].Split(".")[0];
|
|
|
|
|
button.Text = level.DisplayName;
|
|
|
|
|
button.Icon = level.Icon;
|
2025-02-19 15:45:21 +01:00
|
|
|
//button.Text = level;
|
2025-02-19 13:34:15 +01:00
|
|
|
button.Theme = ButtonTheme;
|
2025-02-27 10:37:10 +01:00
|
|
|
|
2025-02-19 13:34:15 +01:00
|
|
|
ButtonsContainer.CallDeferred("add_child", button);
|
2025-02-27 10:37:10 +01:00
|
|
|
|
2025-02-19 13:34:15 +01:00
|
|
|
button.Pressed += () => ButtonOnPressed(level);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-21 11:39:22 +01:00
|
|
|
private void ButtonOnPressed(DebugMapSelectResource scene)
|
2025-02-19 13:34:15 +01:00
|
|
|
{
|
2025-02-24 10:58:00 +01:00
|
|
|
if (GameManager.Instance is not null)
|
|
|
|
|
{
|
|
|
|
|
GameManager.Instance.Unpause();
|
|
|
|
|
}
|
2025-02-21 11:39:22 +01:00
|
|
|
GlobalState.Instance.GoToScene(scene.Path, scene.StartData);
|
2025-02-19 13:34:15 +01:00
|
|
|
}
|
|
|
|
|
|
2025-02-27 08:37:55 +01:00
|
|
|
private void _on_check_box_toggled(bool state)
|
|
|
|
|
{
|
|
|
|
|
GlobalState.Instance.SessionSettings.SkipDialogues = state;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-19 13:34:15 +01:00
|
|
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
|
public override void _Process(double delta)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|