From ec11ee3b4d9cf812efbd10c8d89653cadca288f9 Mon Sep 17 00:00:00 2001 From: lightyears Date: Sun, 19 Feb 2023 20:52:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E8=B1=A1=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Components/BattleCharacter.cs | 6 ------ Components/BattleCharacter.tscn | 21 ------------------- Entities/BattleCharacter.cs | 9 ++++++++ Entities/BattleCharacter.tscn | 37 +++++++++++++++++++++++++++++++++ Entities/BattleField.cs | 14 +++++++++++++ Entities/BattleFieldPosition.cs | 18 ++++++++++++++++ Scenes/BattleScene.tscn | 1 + Tests/BattleSceneTest.cs | 10 +++++++++ Tests/BattleSceneTest.tscn | 21 +++++++++++++++++++ project.godot | 5 +++++ 10 files changed, 115 insertions(+), 27 deletions(-) delete mode 100644 Components/BattleCharacter.cs delete mode 100644 Components/BattleCharacter.tscn create mode 100644 Entities/BattleCharacter.cs create mode 100644 Entities/BattleCharacter.tscn create mode 100644 Entities/BattleField.cs create mode 100644 Entities/BattleFieldPosition.cs create mode 100644 Tests/BattleSceneTest.cs create mode 100644 Tests/BattleSceneTest.tscn diff --git a/Components/BattleCharacter.cs b/Components/BattleCharacter.cs deleted file mode 100644 index 17d7670..0000000 --- a/Components/BattleCharacter.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace CMSGame -{ - public partial class BattleCharacter : Sprite2D - { - } -} diff --git a/Components/BattleCharacter.tscn b/Components/BattleCharacter.tscn deleted file mode 100644 index 930653f..0000000 --- a/Components/BattleCharacter.tscn +++ /dev/null @@ -1,21 +0,0 @@ -[gd_scene load_steps=3 format=3] - -[ext_resource type="Texture2D" uid="uid://dgl6fv3okxuoc" path="res://Temp/Characters/1.png" id="1_wpp45"] -[ext_resource type="Script" path="res://Components/BattleCharacter.cs" id="2_upe33"] - -[node name="BattleCharacter" type="Sprite2D"] -texture = ExtResource("1_wpp45") -script = ExtResource("2_upe33") - -[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] - -[node name="LabelName" type="Label" parent="."] -anchors_preset = 4 -anchor_top = 0.5 -anchor_bottom = 0.5 -offset_left = -128.0 -offset_top = -165.5 -offset_right = -81.0 -offset_bottom = -139.5 -grow_vertical = 2 -text = "Name" diff --git a/Entities/BattleCharacter.cs b/Entities/BattleCharacter.cs new file mode 100644 index 0000000..1f4a3b1 --- /dev/null +++ b/Entities/BattleCharacter.cs @@ -0,0 +1,9 @@ +namespace CMSGame +{ + public partial class BattleCharacter : Node2D + { + public BattleFieldPosition BattleFieldPosition; + + public Character Character; + } +} diff --git a/Entities/BattleCharacter.tscn b/Entities/BattleCharacter.tscn new file mode 100644 index 0000000..a5764b0 --- /dev/null +++ b/Entities/BattleCharacter.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=3 format=3 uid="uid://d08cohfp183wp"] + +[ext_resource type="Texture2D" uid="uid://cnilysgmgw8n4" path="res://Temp/Characters/1_19.png" id="1_o3tjt"] +[ext_resource type="Script" path="res://Entities/BattleCharacter.cs" id="2_vbdi8"] + +[node name="BattleCharacter" type="Node2D"] +script = ExtResource("2_vbdi8") + +[node name="Sprite2D" type="Sprite2D" parent="."] +scale = Vector2(0.5, 0.5) +texture = ExtResource("1_o3tjt") + +[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="Sprite2D"] +unique_name_in_owner = true + +[node name="TopStatusLabel" type="Label" parent="."] +unique_name_in_owner = true +offset_left = -64.0 +offset_top = -144.0 +offset_right = 64.0 +offset_bottom = -80.0 +text = "状态指示器(上)" +vertical_alignment = 2 +autowrap_mode = 3 +clip_text = true +text_overrun_behavior = 4 + +[node name="ButtomStatusLabel" type="Label" parent="."] +unique_name_in_owner = true +offset_left = -64.0 +offset_top = 64.0 +offset_right = 64.0 +offset_bottom = 128.0 +text = "状态指示器(下)" +autowrap_mode = 3 +clip_text = true +text_overrun_behavior = 4 diff --git a/Entities/BattleField.cs b/Entities/BattleField.cs new file mode 100644 index 0000000..5a228eb --- /dev/null +++ b/Entities/BattleField.cs @@ -0,0 +1,14 @@ +namespace CMSGame +{ + /// + /// 2D 战场 + /// + public class BattleField + { + /// 战场宽度 + public int Width = 20; + + /// 战场长度 + public int Length = 100; + } +} diff --git a/Entities/BattleFieldPosition.cs b/Entities/BattleFieldPosition.cs new file mode 100644 index 0000000..dba2f95 --- /dev/null +++ b/Entities/BattleFieldPosition.cs @@ -0,0 +1,18 @@ +namespace CMSGame +{ + /// + /// 2D 战场坐标 + /// + public class BattleFieldPosition + { + /// + /// 坐标点相对于 2D 摄像机镜头所在竖直平面的距离 + /// + public int Depth; + + /// + /// 坐标点相对于 2D 摄像机初始对准位置的偏移量 + /// + public int Offset; + } +} diff --git a/Scenes/BattleScene.tscn b/Scenes/BattleScene.tscn index ec7719e..d73b1a6 100644 --- a/Scenes/BattleScene.tscn +++ b/Scenes/BattleScene.tscn @@ -27,6 +27,7 @@ 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="CanvasLayer/HUD"] layout_mode = 1 diff --git a/Tests/BattleSceneTest.cs b/Tests/BattleSceneTest.cs new file mode 100644 index 0000000..6bc3e33 --- /dev/null +++ b/Tests/BattleSceneTest.cs @@ -0,0 +1,10 @@ +namespace CMSGame +{ + public partial class BattleSceneTest : Node2D + { + public override void _Ready() + { + } + } +} + diff --git a/Tests/BattleSceneTest.tscn b/Tests/BattleSceneTest.tscn new file mode 100644 index 0000000..2ae1e5e --- /dev/null +++ b/Tests/BattleSceneTest.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=3 format=3 uid="uid://6phl40durwor"] + +[ext_resource type="PackedScene" uid="uid://cx6yq8awwkqv3" path="res://Scenes/BattleScene.tscn" id="1_fdqdi"] + +[sub_resource type="CSharpScript" id="CSharpScript_cjbd5"] +script/source = "namespace CMSGame +{ + public partial class BattleSceneTest : Node2D + { + public override void _Ready() + { + } + } +} + +" + +[node name="BattleSceneTest" type="Node2D"] +script = SubResource("CSharpScript_cjbd5") + +[node name="BattleScene" parent="." instance=ExtResource("1_fdqdi")] diff --git a/project.godot b/project.godot index 9998e71..7f0e341 100644 --- a/project.godot +++ b/project.godot @@ -19,6 +19,11 @@ config/icon="res://icon.svg" GameSettings="*res://Autoloads/GameSettings.cs" +[display] + +window/size/viewport_width=1600 +window/size/viewport_height=960 + [dotnet] project/assembly_name="CMSGame"