parent
45f32386b8
commit
6cb04b8056
@ -0,0 +1,7 @@
|
||||
namespace CMSGame
|
||||
{
|
||||
public partial class GameSettings : Node
|
||||
{
|
||||
public bool PauseBattleWhenCharacterIsSelected = true;
|
||||
}
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
public partial class BattleCharacter : Sprite2D
|
||||
namespace CMSGame
|
||||
{
|
||||
public partial class BattleCharacter : Sprite2D
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,19 @@
|
||||
public partial class PauseMenu : Control
|
||||
namespace CMSGame
|
||||
{
|
||||
private GameSettings _settings;
|
||||
|
||||
public override void _Ready()
|
||||
public partial class PauseMenu : Control
|
||||
{
|
||||
_settings = GetNode<GameSettings>("/root/GameSettings");
|
||||
GetNode<CheckBox>("%CheckBoxPauseBattleWhenCharacterIsSelected").ToggleMode = _settings.PauseBattleWhenCharacterIsSelected;
|
||||
}
|
||||
private GameSettings _settings;
|
||||
|
||||
public void On_CheckBoxPauseBattleWhenCharacterIsSelected_Toggled()
|
||||
{
|
||||
_settings.PauseBattleWhenCharacterIsSelected = false;
|
||||
public override void _Ready()
|
||||
{
|
||||
_settings = GetNode<GameSettings>("/root/GameSettings");
|
||||
GetNode<CheckBox>("%CheckBoxPauseBattleWhenCharacterIsSelected").ToggleMode = _settings.PauseBattleWhenCharacterIsSelected;
|
||||
}
|
||||
|
||||
public void On_CheckBoxPauseBattleWhenCharacterIsSelected_Toggled()
|
||||
{
|
||||
_settings.PauseBattleWhenCharacterIsSelected = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
namespace CMSGame
|
||||
{
|
||||
public partial class Character : Node
|
||||
{
|
||||
private int _hp;
|
||||
|
||||
public int Hp
|
||||
{
|
||||
get => _hp;
|
||||
set => _hp = value;
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
namespace CMSGame
|
||||
{
|
||||
static class TimeHelper
|
||||
{
|
||||
public static string FormatTime(double time)
|
||||
{
|
||||
return TimeSpan.FromSeconds(time).ToString("c");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
public partial class Battle : Control
|
||||
{
|
||||
private Label _labelBattleTime;
|
||||
|
||||
public double Time;
|
||||
|
||||
public bool IsPause = false;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_labelBattleTime = GetNode<Label>("%LabelBattleTime");
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (!IsPause)
|
||||
{
|
||||
Time += delta;
|
||||
}
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent input)
|
||||
{
|
||||
if (Input.IsActionPressed("battle_pause"))
|
||||
{
|
||||
IsPause = !IsPause;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateUI()
|
||||
{
|
||||
_labelBattleTime.Text = TimeHelper.FormatTime(Time);
|
||||
}
|
||||
|
||||
public static void On_ButtonBattlePause_Pressed()
|
||||
{
|
||||
Input.ParseInputEvent(new InputEventAction { Action = "battle_pause" });
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
namespace CMSGame
|
||||
{
|
||||
public partial class BattleScene : Control
|
||||
{
|
||||
private Label _labelBattleTime;
|
||||
|
||||
public double Time;
|
||||
|
||||
public bool IsPause = false;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_labelBattleTime = GetNode<Label>("%LabelBattleTime");
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (!IsPause)
|
||||
{
|
||||
Time += delta;
|
||||
}
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent input)
|
||||
{
|
||||
if (Input.IsActionPressed("battle_pause"))
|
||||
{
|
||||
IsPause = !IsPause;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateUI()
|
||||
{
|
||||
_labelBattleTime.Text = TimeHelper.FormatTime(Time);
|
||||
}
|
||||
|
||||
public static void On_ButtonBattlePause_Pressed()
|
||||
{
|
||||
Input.ParseInputEvent(new InputEventAction { Action = "battle_pause" });
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cx6yq8awwkqv3"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scenes/Battle.cs" id="1_n6bn7"]
|
||||
[ext_resource type="Script" path="res://Scenes/BattleScene.cs" id="1_n6bn7"]
|
||||
|
||||
[node name="Battle" type="Control"]
|
||||
[node name="BattleScene" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
@ -1,3 +0,0 @@
|
||||
public partial class Main : Control
|
||||
{
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
namespace CMSGame
|
||||
{
|
||||
public partial class MainScene : Control
|
||||
{
|
||||
public static void On_ButtonBattleDemo_Pressed()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void On_ButtonSettings_Pressed()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void On_ButtonExit_Pressed()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace CMSGame
|
||||
{
|
||||
public partial class _CLASS_ : _BASE_
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
public partial class Character : Node
|
||||
{
|
||||
private int _hp;
|
||||
|
||||
public int Hp
|
||||
{
|
||||
get => _hp;
|
||||
set => _hp = value;
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
public partial class GameSettings : Node
|
||||
{
|
||||
public bool PauseBattleWhenCharacterIsSelected = true;
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
static class TimeHelper {
|
||||
public static string FormatTime(double time)
|
||||
{
|
||||
return TimeSpan.FromSeconds(time).ToString("c");
|
||||
}
|
||||
}
|
Loading…
Reference in new issue