mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:35:34 +00:00
Difficulty Selection
This commit is contained in:
parent
8779b4426e
commit
a2319b3b88
21 changed files with 188 additions and 55 deletions
|
|
@ -37,6 +37,10 @@ public partial class MainMenu : CanvasLayer
|
|||
[Export]
|
||||
public PackedScene OptionsMenuTemplate { get; set; }
|
||||
|
||||
[ExportCategory("Difficulty Menu")]
|
||||
[Export]
|
||||
public PackedScene DifficultyMenuTemplate { get; set; }
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
|
|
@ -50,10 +54,10 @@ public partial class MainMenu : CanvasLayer
|
|||
|
||||
private void _on_start_button_pressed()
|
||||
{
|
||||
if (GameScene == null) return;
|
||||
GlobalState.Session.NewSession();
|
||||
GlobalState.Session.AllowSaving = true;
|
||||
GlobalState.Instance.GotoScene(GameScene);
|
||||
SpawnMenu<DifficultyMenu>(DifficultyMenuTemplate, SubMenuHolder);
|
||||
|
||||
return;
|
||||
|
||||
//GetTree().ChangeSceneToFile(GameScene);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ using DebugMapSelectData = Cirno.Scripts.Resources.DebugMenu.DebugMapSelectData;
|
|||
|
||||
public partial class DebugMenu : MenuBase
|
||||
{
|
||||
|
||||
[Export]
|
||||
public Theme ButtonTheme { get; private set; }
|
||||
|
||||
|
|
|
|||
39
Scripts/UI/DifficultyMenu.cs
Normal file
39
Scripts/UI/DifficultyMenu.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using Cirno.Scripts.Enums;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.UI;
|
||||
|
||||
public partial class DifficultyMenu : MenuBase
|
||||
{
|
||||
[Export] public MapResource StartMap { get; private set; }
|
||||
|
||||
private void StartEasy()
|
||||
{
|
||||
StartGame(DifficultyLevel.Easy);
|
||||
}
|
||||
|
||||
private void StartNormal()
|
||||
{
|
||||
StartGame(DifficultyLevel.Normal);
|
||||
}
|
||||
|
||||
private void StartHard()
|
||||
{
|
||||
StartGame(DifficultyLevel.Hard);
|
||||
}
|
||||
|
||||
private void StartLunatic()
|
||||
{
|
||||
StartGame(DifficultyLevel.Lunatic);
|
||||
}
|
||||
|
||||
public void StartGame(DifficultyLevel difficultyLevel)
|
||||
{
|
||||
if (StartMap is null) return;
|
||||
GlobalState.Session.NewSession();
|
||||
GlobalState.Session.AllowSaving = true;
|
||||
GlobalState.Session.Difficulty = difficultyLevel;
|
||||
GlobalState.Instance.GotoScene(StartMap);
|
||||
}
|
||||
}
|
||||
1
Scripts/UI/DifficultyMenu.cs.uid
Normal file
1
Scripts/UI/DifficultyMenu.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bst70cv5631js
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cirno.Scripts.Enums;
|
||||
|
||||
namespace Cirno.Scripts.Utils;
|
||||
|
||||
|
|
@ -8,6 +9,7 @@ public class SessionSettings
|
|||
public bool SkipDialogues { get; set; } = false;
|
||||
public bool GodMode { get; set; } = false;
|
||||
|
||||
public DifficultyLevel Difficulty { get; set; } = DifficultyLevel.Normal;
|
||||
public bool AllowSaving { get; set; } = false;
|
||||
|
||||
public Godot.Collections.Dictionary<string, int> Items { get; set; } = new();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue