diff --git a/.gitignore b/.gitignore
index 1bb776c..647b4e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,9 @@ Temp
.mono
*.old
-# Large binary assets
+# Fonts
*.ttf
*.otf
+
+# Audio
+*.ogg
diff --git a/Autoloads/BackgroundMusicPlayer.tscn b/Autoloads/BackgroundMusicPlayer.tscn
new file mode 100644
index 0000000..3ba5cf5
--- /dev/null
+++ b/Autoloads/BackgroundMusicPlayer.tscn
@@ -0,0 +1,5 @@
+[gd_scene format=3 uid="uid://dw6hyqtfehxqr"]
+
+[node name="BackgroundMusicPlayer" type="AudioStreamPlayer"]
+autoplay = true
+bus = &"Music"
diff --git a/Autoloads/GameSettings.cs b/Autoloads/GameSettings.cs
index 4269602..7d8fdc9 100644
--- a/Autoloads/GameSettings.cs
+++ b/Autoloads/GameSettings.cs
@@ -1,5 +1,4 @@
using Newtonsoft.Json;
-using System.Runtime;
namespace CMSGame
{
@@ -109,4 +108,17 @@ namespace CMSGame
public record class VideoSettings : SettingsBase
{ }
+
+ public record class AudioSettings : SettingsBase
+ {
+ ///
+ /// 音乐音量
+ ///
+ public double MusicVolume = 80;
+
+ ///
+ /// 音效音量
+ ///
+ public double SoundEffectVolume = 80;
+ }
}
diff --git a/Components/BattleActionMenu.cs b/Components/BattleActionMenu.cs
deleted file mode 100644
index 700584c..0000000
--- a/Components/BattleActionMenu.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-namespace CMSGame
-{
- public partial class BattleActionMenu : VBoxContainer
- {
- public VBoxContainer? DynamicActions;
-
- public Button? ItemActionButton;
-
- public Button? SkillActionButton;
-
- public Button? CommandActionButton;
-
- public override void _Ready()
- {
- this.GetUniqueNode(ref ItemActionButton, nameof(ItemActionButton));
- this.GetUniqueNode(ref DynamicActions, nameof(DynamicActions));
- this.GetUniqueNode(ref SkillActionButton, nameof(SkillActionButton));
- this.GetUniqueNode(ref CommandActionButton, nameof(CommandActionButton));
- }
- }
-}
diff --git a/Components/BattleActionMenu.tscn b/Components/BattleActionMenu.tscn
deleted file mode 100644
index b45be65..0000000
--- a/Components/BattleActionMenu.tscn
+++ /dev/null
@@ -1,32 +0,0 @@
-[gd_scene load_steps=2 format=3 uid="uid://bktklsml5d0jg"]
-
-[ext_resource type="Script" path="res://Components/BattleActionMenu.cs" id="1_0bfmk"]
-
-[node name="BattleActionMenu" type="VBoxContainer"]
-anchors_preset = 4
-anchor_top = 0.5
-anchor_bottom = 0.5
-offset_top = -15.5
-offset_right = 40.0
-offset_bottom = 15.5
-grow_vertical = 2
-script = ExtResource("1_0bfmk")
-
-[node name="ItemActionButton" type="Button" parent="."]
-unique_name_in_owner = true
-layout_mode = 2
-text = "物品"
-
-[node name="DynamicActions" type="VBoxContainer" parent="."]
-unique_name_in_owner = true
-layout_mode = 2
-
-[node name="SkillActionButton" type="Button" parent="."]
-unique_name_in_owner = true
-layout_mode = 2
-text = "技能"
-
-[node name="CommandActionButton" type="Button" parent="."]
-unique_name_in_owner = true
-layout_mode = 2
-text = "指挥"
diff --git a/Components/BattleHUD.cs b/Components/BattleHUD.cs
deleted file mode 100644
index 1e42862..0000000
--- a/Components/BattleHUD.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-namespace CMSGame
-{
- public partial class BattleHUD : Control
- {
- public Vector2 LastMousePressedPosition;
-
- public Label? BattleTimeLabel;
-
- public Popup? PauseMenuPopup;
-
- public Popup? SettingsMenuPopup;
-
- public BattleActionMenu? BattleActionMenu;
-
- public override void _Ready()
- {
- this.GetUniqueNode(ref BattleTimeLabel, nameof(BattleTimeLabel));
- this.GetUniqueNode(ref PauseMenuPopup, nameof(PauseMenuPopup));
- this.GetUniqueNode(ref SettingsMenuPopup, nameof(SettingsMenuPopup));
- this.GetUniqueNode(ref BattleActionMenu, nameof(BattleActionMenu));
- }
-
- public override void _GuiInput(InputEvent @event)
- {
- if (@event is InputEventMouseButton mouseButtonEvent)
- {
- if (mouseButtonEvent.Pressed)
- {
- LastMousePressedPosition = mouseButtonEvent.Position;
- var battleActionMenuRect = new Rect2(BattleActionMenu!.Position, BattleActionMenu.Size);
- if (!battleActionMenuRect.HasPoint(LastMousePressedPosition))
- {
- BattleActionMenu.Visible = false;
- }
-
- }
- }
- }
-
- public void ShowActionMenu(Vector2 position)
- {
- if (!BattleActionMenu!.Visible)
- {
- BattleActionMenu.Position = position;
- BattleActionMenu.Visible = true;
- }
- }
- }
-}
diff --git a/Components/BattleHUD.tscn b/Components/BattleHUD.tscn
deleted file mode 100644
index bf3d3a9..0000000
--- a/Components/BattleHUD.tscn
+++ /dev/null
@@ -1,89 +0,0 @@
-[gd_scene load_steps=4 format=3 uid="uid://dyyrp4px1km16"]
-
-[ext_resource type="Script" path="res://Components/BattleHUD.cs" id="1_12a1x"]
-[ext_resource type="PackedScene" path="res://Components/SettingsMenuPopup.tscn" id="2_t66a0"]
-[ext_resource type="PackedScene" uid="uid://bktklsml5d0jg" path="res://Components/BattleActionMenu.tscn" id="3_0nyue"]
-
-[node name="BattleHUD" type="Control"]
-layout_mode = 3
-anchors_preset = 15
-anchor_right = 1.0
-anchor_bottom = 1.0
-grow_horizontal = 2
-grow_vertical = 2
-mouse_filter = 1
-script = ExtResource("1_12a1x")
-
-[node name="BattleTimeLabel" type="Label" parent="."]
-unique_name_in_owner = true
-layout_mode = 1
-offset_right = 41.0
-offset_bottom = 26.0
-text = "00:00"
-metadata/_edit_use_anchors_ = true
-
-[node name="PauseBattleButton" type="Button" parent="."]
-layout_mode = 1
-anchors_preset = 7
-anchor_left = 0.5
-anchor_top = 1.0
-anchor_right = 0.5
-anchor_bottom = 1.0
-offset_left = -20.0
-offset_top = -23.0
-offset_right = 20.0
-grow_horizontal = 2
-grow_vertical = 0
-focus_mode = 0
-text = "按下 Space 暂停时间"
-
-[node name="PauseMenuPopup" type="Popup" parent="."]
-unique_name_in_owner = true
-size = Vector2i(242, 306)
-borderless = false
-
-[node name="PauseMenu" type="VBoxContainer" parent="PauseMenuPopup"]
-anchors_preset = 8
-anchor_left = 0.5
-anchor_top = 0.5
-anchor_right = 0.5
-anchor_bottom = 0.5
-offset_left = -86.0
-offset_top = -50.5
-offset_right = 86.0
-offset_bottom = 50.5
-grow_horizontal = 2
-grow_vertical = 2
-size_flags_horizontal = 4
-size_flags_vertical = 4
-
-[node name="ResumeBattleButton" type="Button" parent="PauseMenuPopup/PauseMenu"]
-unique_name_in_owner = true
-layout_mode = 2
-text = "继续战斗"
-
-[node name="SettingsMenuButton" type="Button" parent="PauseMenuPopup/PauseMenu"]
-unique_name_in_owner = true
-layout_mode = 2
-text = "游戏设置"
-
-[node name="EscapeFromBattleButton" type="Button" parent="PauseMenuPopup/PauseMenu"]
-unique_name_in_owner = true
-layout_mode = 2
-text = "退出战斗"
-
-[node name="SettingsMenuPopup" parent="." instance=ExtResource("2_t66a0")]
-unique_name_in_owner = true
-visible = false
-borderless = false
-
-[node name="BattleActionMenu" parent="." instance=ExtResource("3_0nyue")]
-unique_name_in_owner = true
-visible = false
-layout_mode = 0
-anchors_preset = 0
-anchor_top = 0.0
-anchor_bottom = 0.0
-offset_top = 0.0
-offset_bottom = 31.0
-grow_vertical = 1
diff --git a/Components/PrebattleMenu.tscn b/Components/PrebattleMenu.tscn
deleted file mode 100644
index 667041a..0000000
--- a/Components/PrebattleMenu.tscn
+++ /dev/null
@@ -1,35 +0,0 @@
-[gd_scene format=3 uid="uid://blobono0y4pqs"]
-
-[node name="PreBattleMenu" type="Control"]
-layout_mode = 3
-anchors_preset = 15
-anchor_right = 1.0
-anchor_bottom = 1.0
-grow_horizontal = 2
-grow_vertical = 2
-
-[node name="VBoxContainer" type="VBoxContainer" parent="."]
-layout_mode = 1
-anchors_preset = 8
-anchor_left = 0.5
-anchor_top = 0.5
-anchor_right = 0.5
-anchor_bottom = 0.5
-offset_left = -20.0
-offset_top = -20.0
-offset_right = 20.0
-offset_bottom = 20.0
-grow_horizontal = 2
-grow_vertical = 2
-
-[node name="PrepareForBattleButton" type="Button" parent="VBoxContainer"]
-layout_mode = 2
-text = "战前准备"
-
-[node name="BeginBattleButton" type="Button" parent="VBoxContainer"]
-layout_mode = 2
-text = "开始战斗"
-
-[node name="EscapeFromBattleButton" type="Button" parent="VBoxContainer"]
-layout_mode = 2
-text = "逃跑"
diff --git a/Components/SettingsMenu.cs b/Components/SettingsMenu.cs
index 01fe463..17ce223 100644
--- a/Components/SettingsMenu.cs
+++ b/Components/SettingsMenu.cs
@@ -10,13 +10,10 @@ namespace CMSGame
{
this.GetAutoloadNode(ref Settings, nameof(GameSettings));
this.GetUniqueNode(ref PauseBattleWhenCharacterIsSelectedCheckBox, nameof(PauseBattleWhenCharacterIsSelectedCheckBox));
-
- PauseBattleWhenCharacterIsSelectedCheckBox!.ButtonPressed = Settings!.BattleSettings!.PauseBattleWhenCharacterIsSelected;
}
public void On_PauseBattleWhenCharacterIsSelectedCheckBox_Toggled(bool pressed)
{
- Settings!.BattleSettings!.PauseBattleWhenCharacterIsSelected = pressed;
}
}
}
diff --git a/Entities/GameSave.cs b/Entities/GameSave.cs
index a23d6b7..634a27a 100644
--- a/Entities/GameSave.cs
+++ b/Entities/GameSave.cs
@@ -1,7 +1,6 @@
namespace CMSGame
{
- public class GameSave
+ public record class GameSave
{
- public List Characters = new();
}
}
diff --git a/ModelData/BattleGoals.cs b/ModelData/BattleGoals.cs
deleted file mode 100644
index 7885d35..0000000
--- a/ModelData/BattleGoals.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-namespace CMSGame
-{
- public static class BattleGoals
- {
- public static readonly Goal Escape = new()
- {
- Name = "保命要紧",
- BasePriority = -50
- };
-
- public static readonly Goal SelfRegulatory = new()
- {
- Name = "自律行动",
- BasePriority = 0
- };
-
- public static readonly Goal FollowOrder = new()
- {
- Name = "服从指令",
- BasePriority = 50
- };
-
- public static List> AllGoals()
- {
- return new() {
- Escape,
- SelfRegulatory,
- FollowOrder
- };
- }
- }
-}
diff --git a/ModelData/Characters.cs b/ModelData/Characters.cs
deleted file mode 100644
index ed36632..0000000
--- a/ModelData/Characters.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace CMSGame
-{
- public static class Characters
- {
-
- }
-}
diff --git a/Models/Base/Action.cs b/Models/Base/Action.cs
deleted file mode 100644
index ea96607..0000000
--- a/Models/Base/Action.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-namespace CMSGame
-{
- public abstract class Action
- {
- public string Name = string.Empty;
-
- public ActionTargetTypes TargetType;
-
- public List Targets = new();
-
- public IActionTarget? Target => Targets.Count > 0 ? Targets[0] : null;
- }
-
- public enum ActionTargetTypes
- {
- None,
- Single,
- Multiple
- }
-
- public interface IActionTarget
- {
- }
-}
diff --git a/Models/Base/Character.cs b/Models/Base/Character.cs
deleted file mode 100644
index e0fff61..0000000
--- a/Models/Base/Character.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace CMSGame
-{
- public class Character
- {
- public string FamilyName = string.Empty;
-
- public string GivenName = string.Empty;
-
- public string Name => FamilyName + GivenName;
-
- public int HealthPoint;
-
- public int MaxHealthPoint;
- }
-}
diff --git a/Models/Base/Effect.cs b/Models/Base/Effect.cs
deleted file mode 100644
index c8f1765..0000000
--- a/Models/Base/Effect.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace CMSGame
-{
- public abstract class Effect
- {
- public string Name = string.Empty;
-
- public string Description = string.Empty;
-
- public abstract void Perform(Character character);
- }
-}
diff --git a/Models/Base/Goal.cs b/Models/Base/Goal.cs
deleted file mode 100644
index 97d7267..0000000
--- a/Models/Base/Goal.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-namespace CMSGame
-{
- public class Goal where TContext : IGoalContext
- {
- public string Name = string.Empty;
-
- public int BasePriority;
-
- public List> ValidityModifiers = new();
-
- public List> PriorityModifiers = new();
-
- public bool IsValid()
- {
- return ValidityModifiers.All(modifier => modifier.Execute());
- }
-
- public int Priority()
- {
- return BasePriority + PriorityModifiers.Sum(modifier => modifier.Execute());
- }
- }
-
- public interface IGoalContext
- {
- IList ListActions();
- }
-
- public abstract class GoalModifier
- {
- public string Name = string.Empty;
-
- public TContext Context;
-
- protected GoalModifier(TContext context)
- {
- Context = context;
- }
- }
-
- public abstract class GoalValidityModifier : GoalModifier
- {
- protected GoalValidityModifier(TContext context) : base(context)
- {
- }
-
- public abstract bool Execute();
- }
-
- public abstract class GoalPriorityModifier : GoalModifier
- {
- protected GoalPriorityModifier(TContext context) : base(context)
- {
- }
-
- public abstract int Execute();
- }
-}
diff --git a/Models/Base/Plan.cs b/Models/Base/Plan.cs
deleted file mode 100644
index 2f22e81..0000000
--- a/Models/Base/Plan.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace CMSGame
-{
- public class Plan
- {
- public readonly List Actions = new();
- }
-}
diff --git a/Models/Base/Planner.cs b/Models/Base/Planner.cs
deleted file mode 100644
index 7a03331..0000000
--- a/Models/Base/Planner.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-namespace CMSGame
-{
- public abstract class Planner where TContext : IGoalContext
- {
- public TContext Context;
-
- public Planner(TContext context)
- {
- Context = context;
- }
-
- public abstract Plan MakePlan();
- }
-}
diff --git a/Models/Base/Skill.cs b/Models/Base/Skill.cs
deleted file mode 100644
index 88398ec..0000000
--- a/Models/Base/Skill.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Collections.Generic;
-
-namespace CMSGame
-{
- public abstract class Skill
- {
- public string Name = string.Empty;
-
- public List Effects = new();
- }
-}
diff --git a/Models/Battle/Battle.cs b/Models/Battle/Battle.cs
deleted file mode 100644
index 12454d2..0000000
--- a/Models/Battle/Battle.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System.Collections.Generic;
-
-namespace CMSGame
-{
- public class Battle
- {
- public List Parties = new();
-
- public BattleParty Attacker;
-
- public BattleParty Defender;
-
- public BattleParty PlayerParty;
-
- public Battle(BattleParty attacker, BattleParty defender, BattleParty playerParty)
- {
- Attacker = attacker;
- Defender = defender;
- PlayerParty = playerParty;
- }
-
- public void Begin()
- {
- }
- }
-}
diff --git a/Models/Battle/BattleCharacter.cs b/Models/Battle/BattleCharacter.cs
deleted file mode 100644
index 97049ae..0000000
--- a/Models/Battle/BattleCharacter.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace CMSGame
-{
- public class BattleCharacter
- {
- public List> Goals = new();
-
- public Character Character;
-
- public BattleCharacter(Character character)
- {
- Character = character;
- EstablishGoals();
- }
-
- private void EstablishGoals()
- {
- Goals = BattleGoals.AllGoals();
- }
- }
-}
diff --git a/Models/Battle/BattleContext.cs b/Models/Battle/BattleContext.cs
deleted file mode 100644
index 6a6e67e..0000000
--- a/Models/Battle/BattleContext.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace CMSGame
-{
- public class BattleContext : IGoalContext
- {
- public IList ListActions()
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/Models/Battle/BattleField.cs b/Models/Battle/BattleField.cs
deleted file mode 100644
index 5a228eb..0000000
--- a/Models/Battle/BattleField.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-namespace CMSGame
-{
- ///
- /// 2D 战场
- ///
- public class BattleField
- {
- /// 战场宽度
- public int Width = 20;
-
- /// 战场长度
- public int Length = 100;
- }
-}
diff --git a/Models/Battle/BattleFieldPosition.cs b/Models/Battle/BattleFieldPosition.cs
deleted file mode 100644
index dba2f95..0000000
--- a/Models/Battle/BattleFieldPosition.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace CMSGame
-{
- ///
- /// 2D 战场坐标
- ///
- public class BattleFieldPosition
- {
- ///
- /// 坐标点相对于 2D 摄像机镜头所在竖直平面的距离
- ///
- public int Depth;
-
- ///
- /// 坐标点相对于 2D 摄像机初始对准位置的偏移量
- ///
- public int Offset;
- }
-}
diff --git a/Models/Battle/BattleParty.cs b/Models/Battle/BattleParty.cs
deleted file mode 100644
index 44b0b6e..0000000
--- a/Models/Battle/BattleParty.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Collections.Generic;
-
-namespace CMSGame
-{
- public class BattleParty
- {
- public bool IsAttacker;
-
- public bool IsDefender;
-
- public bool IsPlayerParty;
-
- public List Characters = new();
- }
-}
diff --git a/Nodes/BattleCharacterNode.cs b/Nodes/BattleCharacterNode.cs
deleted file mode 100644
index e2e1035..0000000
--- a/Nodes/BattleCharacterNode.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-namespace CMSGame
-{
- public partial class BattleCharacterNode : CharacterBody3D
- {
- [Signal]
- public delegate void MousePressedEventHandler(Vector3 position);
-
- [Export]
- public Texture SpriteTexture = new();
-
- public BattleFieldPosition? BattleFieldPosition;
-
- public Character? Character;
-
- public Sprite3D? Sprite3D;
-
- public Label3D? StatusLabel;
-
- public int ActionPoint;
-
- public double ActionPointGathering;
-
- public override void _Ready()
- {
- this.GetUniqueNode(ref Sprite3D, nameof(Sprite3D));
- this.GetUniqueNode(ref StatusLabel, nameof(StatusLabel));
- }
-
- public override void _Process(double delta)
- {
- UpdateStatus(delta);
- UpdateUI();
- }
-
- public void UpdateStatus(double delta)
- {
- ActionPointGathering += delta;
- ActionPoint += (int)ActionPointGathering / 10;
- ActionPointGathering %= 10;
- }
-
- public void UpdateUI()
- {
- StatusLabel!.Text = $"HP {Character!.HealthPoint}/{Character.MaxHealthPoint}\nAP {ActionPoint}";
- }
-
- public override void _InputEvent(Camera3D camera, InputEvent @event, Vector3 position, Vector3 normal, int shapeIdx)
- {
- if (@event is InputEventMouseButton mouseButtonEvent)
- {
- if (mouseButtonEvent.Pressed)
- {
- EmitSignal(SignalName.MousePressed, position);
- }
- }
- }
- }
-}
diff --git a/Nodes/BattleCharacterNode.tscn b/Nodes/BattleCharacterNode.tscn
deleted file mode 100644
index 46c530f..0000000
--- a/Nodes/BattleCharacterNode.tscn
+++ /dev/null
@@ -1,31 +0,0 @@
-[gd_scene load_steps=4 format=3 uid="uid://dje5jk73mjb6a"]
-
-[ext_resource type="Texture2D" uid="uid://cnilysgmgw8n4" path="res://Temp/Characters/1_19.png" id="1_o3tjt"]
-[ext_resource type="Script" path="res://Nodes/BattleCharacterNode.cs" id="2_vbdi8"]
-
-[sub_resource type="BoxShape3D" id="BoxShape3D_r28jb"]
-size = Vector3(0.84, 1.46, 0.17)
-
-[node name="BattleCharacter" type="CharacterBody3D"]
-script = ExtResource("2_vbdi8")
-
-[node name="AudioStreamPlayer2D" type="AudioStreamPlayer3D" parent="."]
-unique_name_in_owner = true
-
-[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.23, 0)
-shape = SubResource("BoxShape3D_r28jb")
-
-[node name="Sprite3D" type="Sprite3D" parent="."]
-unique_name_in_owner = true
-transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
-shaded = true
-alpha_cut = 2
-texture = ExtResource("1_o3tjt")
-
-[node name="StatusLabel" type="Label3D" parent="."]
-unique_name_in_owner = true
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.74, 0)
-text = "状态标签"
-vertical_alignment = 2
-autowrap_mode = 3
diff --git a/Scenes/BattleScene.cs b/Scenes/BattleScene.cs
index aa5f336..0e713bc 100644
--- a/Scenes/BattleScene.cs
+++ b/Scenes/BattleScene.cs
@@ -1,82 +1,6 @@
namespace CMSGame
{
- public partial class BattleScene : Node3D
+ public partial class BattleScene : Node2D
{
- public BattleHUD? HUD;
-
- public Popup? PauseMenuPopup;
-
- public Popup? SettingsMenuPopup;
-
- public double Time;
-
- public bool IsPause = false;
-
- private bool IsPauseBeforePauseMenuPopup = false;
-
- public override void _Ready()
- {
- this.GetUniqueNode(ref HUD, nameof(HUD));
- PauseMenuPopup = HUD!.PauseMenuPopup;
- SettingsMenuPopup = HUD.SettingsMenuPopup;
- }
-
- public override void _Process(double delta)
- {
- if (!IsPause)
- {
- Time += delta;
- }
- UpdateUI();
- }
-
- public override void _UnhandledInput(InputEvent input)
- {
- if (input.IsActionPressed("battle_pause_toggle"))
- {
- TogglePauseBattle();
- }
- else if (input.IsActionPressed("battle_pause"))
- {
- ShowPauseMenu();
- }
- }
-
- public void UpdateUI()
- {
- HUD!.BattleTimeLabel!.Text = TimeHelper.FormatTime(Time);
- }
-
- private void TogglePauseBattle()
- {
- IsPause = !IsPause;
- }
-
- private void ShowPauseMenu()
- {
- IsPauseBeforePauseMenuPopup = IsPause;
- IsPause = true;
- PauseMenuPopup!.PopupCentered();
- }
-
- private void On_PauseBattleButton_Pressed()
- {
- TogglePauseBattle();
- }
-
- private void On_PauseMenuPopup_PopupHide()
- {
- IsPause = IsPauseBeforePauseMenuPopup;
- }
-
- private void On_ResumeBattleButton_Pressed()
- {
- PauseMenuPopup!.Hide();
- }
-
- private void On_SettingsMenuButton_Pressed()
- {
- SettingsMenuPopup!.PopupCentered();
- }
}
}
diff --git a/Scenes/BattleScene.tscn b/Scenes/BattleScene.tscn
index 3b2c6ec..da23ff7 100644
--- a/Scenes/BattleScene.tscn
+++ b/Scenes/BattleScene.tscn
@@ -1,63 +1,6 @@
-[gd_scene load_steps=10 format=3 uid="uid://cp6aa655vykt1"]
+[gd_scene load_steps=2 format=3 uid="uid://cp6aa655vykt1"]
[ext_resource type="Script" path="res://Scenes/BattleScene.cs" id="1_n6bn7"]
-[ext_resource type="PackedScene" uid="uid://dyyrp4px1km16" path="res://Components/BattleHUD.tscn" id="2_u4666"]
-[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_vrgig"]
-sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
-ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
-
-[sub_resource type="Sky" id="Sky_26whx"]
-sky_material = SubResource("ProceduralSkyMaterial_vrgig")
-
-[sub_resource type="Environment" id="Environment_hv4sx"]
-background_mode = 2
-sky = SubResource("Sky_26whx")
-tonemap_mode = 2
-glow_enabled = true
-
-[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_udghy"]
-uv1_scale = Vector3(20, 20, 20)
-
-[sub_resource type="PlaneMesh" id="PlaneMesh_30sfg"]
-material = SubResource("StandardMaterial3D_udghy")
-size = Vector2(40, 20)
-
-[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_a4f8m"]
-
-[node name="BattleScene" type="Node3D"]
+[node name="BattleScene" type="Node2D"]
script = ExtResource("1_n6bn7")
-
-[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
-environment = SubResource("Environment_hv4sx")
-
-[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
-transform = Transform3D(1, 0, 0, 0, 0.558497, 0.829506, 0, -0.829506, 0.558497, 0, 10.6856, 0)
-shadow_enabled = true
-
-[node name="Camera3D" type="Camera3D" parent="."]
-transform = Transform3D(1, 0, 0, 0, 0.939693, 0.34202, 0, -0.34202, 0.939693, 0, 2.35115, 0)
-
-[node name="CanvasLayer" type="CanvasLayer" parent="Camera3D"]
-
-[node name="HUD" parent="Camera3D/CanvasLayer" instance=ExtResource("2_u4666")]
-unique_name_in_owner = true
-
-[node name="Ground" type="Node3D" parent="."]
-unique_name_in_owner = true
-
-[node name="Area3D" type="Area3D" parent="Ground"]
-
-[node name="MeshInstance3D" type="MeshInstance3D" parent="Ground/Area3D"]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -10)
-mesh = SubResource("PlaneMesh_30sfg")
-skeleton = NodePath("../..")
-
-[node name="CollisionShape3D" type="CollisionShape3D" parent="Ground/Area3D"]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -10)
-shape = SubResource("WorldBoundaryShape3D_a4f8m")
-
-[node name="Characters" type="Node3D" parent="."]
-unique_name_in_owner = true
-
-[node name="Objects" type="Node3D" parent="."]
diff --git a/Scenes/MainScene.cs b/Scenes/MainScene.cs
index 80b0d52..7548423 100644
--- a/Scenes/MainScene.cs
+++ b/Scenes/MainScene.cs
@@ -2,11 +2,6 @@ namespace CMSGame
{
public partial class MainScene : Control
{
- public void On_BattleDemo1Button_Pressed()
- {
- GetTree().ChangeSceneToFile("res://Scenes/BattleScene.tscn");
- }
-
public void On_SettingsPopupButton_Pressed()
{
GetNode("%SettingsPopup").PopupCentered();
diff --git a/Scenes/MainScene.tscn b/Scenes/MainScene.tscn
index cd84027..1c14afe 100644
--- a/Scenes/MainScene.tscn
+++ b/Scenes/MainScene.tscn
@@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://c3ovsoq6o7y3t"]
[ext_resource type="Script" path="res://Scenes/MainScene.cs" id="1_kso8c"]
-[ext_resource type="PackedScene" uid="uid://cslqihnfw0me2" path="res://Components/SettingsMenuPopup.tscn" id="2_d0nn6"]
+[ext_resource type="Theme" uid="uid://cn55cr5w4yy3n" path="res://Themes/UI.tres" id="1_y72s3"]
[node name="MainScene" type="Control"]
layout_mode = 3
@@ -10,6 +10,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
+theme = ExtResource("1_y72s3")
script = ExtResource("1_kso8c")
[node name="BackgroundImage" type="Label" parent="."]
@@ -34,10 +35,6 @@ offset_right = 221.0
offset_bottom = 50.5
grow_vertical = 2
-[node name="ContinueButton" type="Button" parent="GameMenu"]
-layout_mode = 2
-text = "战斗场景 Demo 1 (第3版)"
-
[node name="StartButton" type="Button" parent="GameMenu"]
layout_mode = 2
text = "开始游戏"
@@ -50,10 +47,6 @@ text = "设置"
layout_mode = 2
text = "退出"
-[node name="SettingsPopup" parent="." instance=ExtResource("2_d0nn6")]
-unique_name_in_owner = true
-visible = false
-
[connection signal="pressed" from="GameMenu/StartButton" to="." method="On_BattleDemo1Button_Pressed"]
[connection signal="pressed" from="GameMenu/SettingsButton" to="." method="On_SettingsPopupButton_Pressed"]
[connection signal="pressed" from="GameMenu/QuitButton" to="." method="On_QuitButton_Pressed"]
diff --git a/Tests/BattleSceneTest.cs b/Tests/BattleSceneTest.cs
deleted file mode 100644
index 7994254..0000000
--- a/Tests/BattleSceneTest.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace CMSGame
-{
- public partial class BattleSceneTest : Node3D
- {
- public BattleScene? BattleScene;
-
- public override void _Ready()
- {
- BattleScene = GetNode("BattleScene");
- }
-
- public void On_BattleCharacter_MousePressed(Vector3 _)
- {
- BattleScene!.HUD!.ShowActionMenu(BattleScene.HUD.LastMousePressedPosition);
- }
- }
-}
diff --git a/Tests/BattleSceneTest.tscn b/Tests/BattleSceneTest.tscn
deleted file mode 100644
index de27818..0000000
--- a/Tests/BattleSceneTest.tscn
+++ /dev/null
@@ -1,63 +0,0 @@
-[gd_scene load_steps=10 format=3 uid="uid://dgi0d8jybvlk0"]
-
-[ext_resource type="PackedScene" uid="uid://cp6aa655vykt1" path="res://Scenes/BattleScene.tscn" id="1_fdqdi"]
-[ext_resource type="Script" path="res://Tests/BattleSceneTest.cs" id="1_tuul4"]
-[ext_resource type="PackedScene" uid="uid://dje5jk73mjb6a" path="res://Nodes/BattleCharacterNode.tscn" id="3_nau0d"]
-[ext_resource type="Texture2D" uid="uid://w6qckexp2he1" path="res://Temp/Characters/2_73.png" id="4_jnah0"]
-[ext_resource type="Texture2D" uid="uid://du6o3upum6lkr" path="res://Temp/Characters/3_0.png" id="5_4vahd"]
-[ext_resource type="Texture2D" uid="uid://cl11bl8lcnwha" path="res://Temp/Characters/4_2.png" id="6_6563q"]
-[ext_resource type="Texture2D" uid="uid://dc27ugd4sik7m" path="res://Temp/Characters/5_4.png" id="7_a35tl"]
-[ext_resource type="Texture2D" uid="uid://cl8nkrx2bk76n" path="res://Temp/Characters/6_1.png" id="8_oklwm"]
-[ext_resource type="Texture2D" uid="uid://ch0pdjtnr3y7r" path="res://Temp/Characters/7.png" id="9_wor4w"]
-
-[node name="BattleSceneTest" type="Node3D"]
-script = ExtResource("1_tuul4")
-
-[node name="BattleScene" parent="." instance=ExtResource("1_fdqdi")]
-
-[node name="BattleCharacter" parent="BattleScene/Characters" index="0" instance=ExtResource("3_nau0d")]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.1026, 0.524168, -2.96058)
-
-[node name="BattleCharacter2" parent="BattleScene/Characters" index="1" instance=ExtResource("3_nau0d")]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.25622, 0.524168, -2.87261)
-
-[node name="Sprite3D" parent="BattleScene/Characters/BattleCharacter2" index="2"]
-texture = ExtResource("4_jnah0")
-
-[node name="BattleCharacter3" parent="BattleScene/Characters" index="2" instance=ExtResource("3_nau0d")]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.524168, -4.12488)
-
-[node name="Sprite3D" parent="BattleScene/Characters/BattleCharacter3" index="2"]
-texture = ExtResource("5_4vahd")
-
-[node name="BattleCharacter4" parent="BattleScene/Characters" index="3" instance=ExtResource("3_nau0d")]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.737777, 0.524168, -3.35854)
-
-[node name="Sprite3D" parent="BattleScene/Characters/BattleCharacter4" index="2"]
-texture = ExtResource("6_6563q")
-
-[node name="BattleCharacter5" parent="BattleScene/Characters" index="4" instance=ExtResource("3_nau0d")]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.6372, 0.524168, -3.47228)
-
-[node name="Sprite3D" parent="BattleScene/Characters/BattleCharacter5" index="2"]
-texture = ExtResource("7_a35tl")
-
-[node name="BattleCharacter6" parent="BattleScene/Characters" index="5" instance=ExtResource("3_nau0d")]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.27585, 0.524168, -5.80874)
-
-[node name="Sprite3D" parent="BattleScene/Characters/BattleCharacter6" index="2"]
-texture = ExtResource("8_oklwm")
-
-[node name="BattleCharacter7" parent="BattleScene/Characters" index="6" instance=ExtResource("3_nau0d")]
-transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.44713, 0.524168, -12.3572)
-
-[node name="Sprite3D" parent="BattleScene/Characters/BattleCharacter7" index="2"]
-texture = ExtResource("9_wor4w")
-
-[editable path="BattleScene"]
-[editable path="BattleScene/Characters/BattleCharacter2"]
-[editable path="BattleScene/Characters/BattleCharacter3"]
-[editable path="BattleScene/Characters/BattleCharacter4"]
-[editable path="BattleScene/Characters/BattleCharacter5"]
-[editable path="BattleScene/Characters/BattleCharacter6"]
-[editable path="BattleScene/Characters/BattleCharacter7"]
diff --git a/Tests/GameSaves/GameSaves.cs b/Tests/GameSaves/GameSaves.cs
deleted file mode 100644
index 22b2aee..0000000
--- a/Tests/GameSaves/GameSaves.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-namespace CMSGame
-{
- public static class GameSaves
- {
- public static readonly GameSave Demo1 = new()
- {
- Characters = new() {
- new Character {
- FamilyName = "腾",
- GivenName = "牧心",
- HealthPoint = 80
- }
- }
- };
- };
-}
diff --git a/Themes/UI.tres b/Themes/UI.tres
new file mode 100644
index 0000000..beae552
--- /dev/null
+++ b/Themes/UI.tres
@@ -0,0 +1,7 @@
+[gd_resource type="Theme" load_steps=2 format=3 uid="uid://cn55cr5w4yy3n"]
+
+[ext_resource type="FontFile" uid="uid://tfubgavtu25o" path="res://Assets/Fonts/Tiejili/TiejiliSC-Regular.otf" id="1_usckb"]
+
+[resource]
+default_font = ExtResource("1_usckb")
+default_font_size = 32
diff --git a/default_bus_layout.tres b/default_bus_layout.tres
new file mode 100644
index 0000000..03948d4
--- /dev/null
+++ b/default_bus_layout.tres
@@ -0,0 +1,9 @@
+[gd_resource type="AudioBusLayout" format=3 uid="uid://ca3y006advrdf"]
+
+[resource]
+bus/1/name = &"Music"
+bus/1/solo = false
+bus/1/mute = false
+bus/1/bypass_fx = false
+bus/1/volume_db = 0.0
+bus/1/send = &"Master"
diff --git a/project.godot b/project.godot
index a770e6b..0988869 100644
--- a/project.godot
+++ b/project.godot
@@ -23,6 +23,7 @@ config/icon="res://icon.svg"
[autoload]
GameSettings="*res://Autoloads/GameSettings.cs"
+BackgroundMusicPlayer="*res://Autoloads/BackgroundMusicPlayer.tscn"
[display]