mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
57 lines
1.4 KiB
C#
57 lines
1.4 KiB
C#
using Godot;
|
|
using System;
|
|
using Cirno.Scripts.Resources;
|
|
using Cirno.Scripts.Resources.DebugMenu;
|
|
using Godot.Collections;
|
|
using DebugMapSelectData = Cirno.Scripts.Resources.DebugMenu.DebugMapSelectData;
|
|
|
|
public partial class DebugMenu : MenuBase
|
|
{
|
|
|
|
[Export]
|
|
public Theme ButtonTheme { get; private set; }
|
|
|
|
[Export]
|
|
public DebugMapSelectData Levels { get; set; }
|
|
|
|
[Export]
|
|
public Container ButtonsContainer { get; private set; }
|
|
|
|
// Called when the node enters the scene tree for the first time.
|
|
public override void _Ready()
|
|
{
|
|
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);
|
|
|
|
button.Pressed += () => ButtonOnPressed(level);
|
|
}
|
|
}
|
|
|
|
private void ButtonOnPressed(DebugMapSelectResource scene)
|
|
{
|
|
if (GameManager.Instance is not null)
|
|
{
|
|
GameManager.Instance.Unpause();
|
|
}
|
|
GlobalState.Instance.GoToScene(scene.Path, scene.StartData);
|
|
}
|
|
|
|
private void _on_check_box_toggled(bool state)
|
|
{
|
|
GlobalState.Instance.SessionSettings.SkipDialogues = state;
|
|
}
|
|
|
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
public override void _Process(double delta)
|
|
{
|
|
}
|
|
}
|