diff --git a/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs b/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs
index 198c613..b7a8ba6 100644
--- a/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs
+++ b/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs
@@ -7,7 +7,7 @@
namespace Plugin
{
[Tool]
- public partial class Plugin : EditorPlugin
+ public partial class Plugin : EditorPlugin, ISerializationListener
{
///
/// 自定义节点类型数据
@@ -60,7 +60,7 @@
{
Instance = this;
- if (_uiMonitor != null)
+ if (_uiMonitor != null && Instance == this)
{
_uiMonitor.Process((float) delta);
}
@@ -76,6 +76,8 @@
{
Instance = this;
+ #region MyRegion
+
if (_customTypeInfos != null)
{
//注册自定义节点
@@ -116,16 +118,28 @@
Debug.LogError(e.ToString());
}
-
_MakeVisible(false);
+ #endregion
+
//场景切换事件
SceneChanged += OnSceneChanged;
_uiMonitor = new NodeMonitor();
_uiMonitor.SceneNodeChangeEvent += GenerateUiCode;
+
OnSceneChanged(GetEditorInterface().GetEditedSceneRoot());
}
+
+ public void OnBeforeSerialize()
+ {
+ SceneChanged -= OnSceneChanged;
+ }
+
+ public void OnAfterDeserialize()
+ {
+ SceneChanged += OnSceneChanged;
+ }
public override void _ExitTree()
{
@@ -252,7 +266,6 @@
}
}
}
-
}
}
#endif
diff --git a/DungeonShooting_Godot/addons/dungeonShooting_plugin/generator/UiGenerator.cs b/DungeonShooting_Godot/addons/dungeonShooting_plugin/generator/UiGenerator.cs
index 849d21d..d4c0da8 100644
--- a/DungeonShooting_Godot/addons/dungeonShooting_plugin/generator/UiGenerator.cs
+++ b/DungeonShooting_Godot/addons/dungeonShooting_plugin/generator/UiGenerator.cs
@@ -81,7 +81,7 @@
if (open)
{
Plugin.Plugin.Instance.GetEditorInterface().OpenSceneFromPath(prefabResPath);
- }
+ }
}
catch (Exception e)
diff --git a/DungeonShooting_Godot/prefab/role/Role0001.tscn b/DungeonShooting_Godot/prefab/role/Role0001.tscn
index d877f44..04aa1b8 100644
--- a/DungeonShooting_Godot/prefab/role/Role0001.tscn
+++ b/DungeonShooting_Godot/prefab/role/Role0001.tscn
@@ -49,6 +49,9 @@
sprite_frames = ExtResource("4_galcc")
animation = &"roll"
+[node name="Collision" parent="." index="3"]
+position = Vector2(0, 0)
+
[node name="HurtCollision" parent="HurtArea" index="0"]
shape = SubResource("RectangleShape2D_ve262")
diff --git a/DungeonShooting_Godot/prefab/role/template/RoleTemplate.tscn b/DungeonShooting_Godot/prefab/role/template/RoleTemplate.tscn
index faf3e36..d6187e3 100644
--- a/DungeonShooting_Godot/prefab/role/template/RoleTemplate.tscn
+++ b/DungeonShooting_Godot/prefab/role/template/RoleTemplate.tscn
@@ -39,7 +39,7 @@
offset = Vector2(0, -12)
[node name="Collision" type="CollisionShape2D" parent="."]
-position = Vector2(0, -4)
+position = Vector2(0, -2)
shape = SubResource("CircleShape2D_5pj80")
[node name="HurtArea" type="Area2D" parent="."]
diff --git a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn
index 8015e82..7cab8a4 100644
--- a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn
+++ b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=15 format=3 uid="uid://csbxfkdupsckv"]
+[gd_scene load_steps=16 format=3 uid="uid://csbxfkdupsckv"]
[ext_resource type="Script" path="res://src/game/ui/mapEditor/MapEditorPanel.cs" id="1_5s7a0"]
[ext_resource type="Texture2D" uid="uid://cajcnlimvoxk" path="res://resource/sprite/ui/commonIcon/Back.png" id="2_gkcw7"]
@@ -10,6 +10,7 @@
[ext_resource type="PackedScene" uid="uid://b4u66mxndxbrg" path="res://prefab/ui/MapEditorTools.tscn" id="6_7pvgu"]
[ext_resource type="PackedScene" uid="uid://bb2ekkpxifd7g" path="res://prefab/ui/MapEditorMapLayer.tscn" id="7_ychtn"]
[ext_resource type="PackedScene" uid="uid://peo0n8bl15y5" path="res://prefab/ui/MapEditorMapMark.tscn" id="8_8tgeu"]
+[ext_resource type="PackedScene" uid="uid://tjbfj67t5akm" path="res://prefab/ui/MapEditorMapTile.tscn" id="10_4fu5v"]
[sub_resource type="NavigationPolygon" id="NavigationPolygon_oidah"]
resource_local_to_scene = true
@@ -172,7 +173,7 @@
size_flags_vertical = 3
[node name="Left" type="Panel" parent="Bg/VBoxContainer/HSplitContainer"]
-custom_minimum_size = Vector2(1000, 0)
+custom_minimum_size = Vector2(600, 0)
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 7.0
@@ -234,7 +235,7 @@
layout_mode = 2
[node name="Right" type="Panel" parent="Bg/VBoxContainer/HSplitContainer"]
-custom_minimum_size = Vector2(300, 0)
+custom_minimum_size = Vector2(450, 0)
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 3.0
@@ -267,6 +268,9 @@
layout_mode = 2
theme_override_constants/margin_top = 10
+[node name="MapEditorMapTile" parent="Bg/VBoxContainer/HSplitContainer/Right/MarginContainer/TabContainer/MapTile" instance=ExtResource("10_4fu5v")]
+layout_mode = 2
+
[node name="MapMark" type="MarginContainer" parent="Bg/VBoxContainer/HSplitContainer/Right/MarginContainer/TabContainer"]
visible = false
layout_mode = 2
diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorMapTile.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorMapTile.tscn
new file mode 100644
index 0000000..a234b36
--- /dev/null
+++ b/DungeonShooting_Godot/prefab/ui/MapEditorMapTile.tscn
@@ -0,0 +1,196 @@
+[gd_scene load_steps=7 format=3 uid="uid://tjbfj67t5akm"]
+
+[ext_resource type="Script" path="res://src/game/ui/mapEditorMapTile/MapEditorMapTilePanel.cs" id="1_gtth6"]
+[ext_resource type="Script" path="res://src/game/ui/mapEditorMapTile/SingleTileTab.cs" id="2_jqu4q"]
+[ext_resource type="Texture2D" uid="uid://d2wslibovwv7w" path="res://resource/sprite/ui/commonIcon/CenterTool.png" id="3_sibps"]
+[ext_resource type="Script" path="res://src/game/ui/mapEditorMapTile/TerrainTileTab.cs" id="4_jxcal"]
+[ext_resource type="Texture2D" uid="uid://bn47bmilcw4x0" path="res://resource/sprite/ui/commonIcon/Select2.png" id="5_f4thw"]
+[ext_resource type="Script" path="res://src/game/ui/mapEditorMapTile/CombinationTileTab.cs" id="5_ty17f"]
+
+[node name="MapEditorMapTile" type="Control"]
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+script = ExtResource("1_gtth6")
+
+[node name="VBoxContainer" type="VBoxContainer" parent="."]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+
+[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
+layout_mode = 2
+
+[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer"]
+custom_minimum_size = Vector2(200, 0)
+layout_mode = 2
+text = "资源:"
+
+[node name="SourceOption" type="OptionButton" parent="VBoxContainer/HBoxContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+
+[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
+layout_mode = 2
+
+[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2"]
+custom_minimum_size = Vector2(200, 0)
+layout_mode = 2
+text = "笔刷类型:"
+
+[node name="HandleOption" type="OptionButton" parent="VBoxContainer/HBoxContainer2"]
+layout_mode = 2
+size_flags_horizontal = 3
+item_count = 3
+selected = 0
+popup/item_0/text = "单格"
+popup/item_0/id = 0
+popup/item_1/text = "地形"
+popup/item_1/id = 1
+popup/item_2/text = "组合"
+popup/item_2/id = 2
+
+[node name="Panel" type="Panel" parent="VBoxContainer"]
+layout_mode = 2
+size_flags_vertical = 3
+
+[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/Panel"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme_override_constants/margin_left = 2
+theme_override_constants/margin_top = 2
+theme_override_constants/margin_right = 2
+theme_override_constants/margin_bottom = 2
+
+[node name="Tab1" type="ColorRect" parent="VBoxContainer/Panel/MarginContainer"]
+visible = false
+clip_children = 2
+layout_mode = 2
+color = Color(0.145098, 0.145098, 0.145098, 1)
+script = ExtResource("2_jqu4q")
+
+[node name="TabRoot" type="Control" parent="VBoxContainer/Panel/MarginContainer/Tab1"]
+layout_mode = 1
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -0.5
+offset_top = -0.5
+offset_right = 0.5
+offset_bottom = 0.5
+grow_horizontal = 2
+grow_vertical = 2
+mouse_filter = 2
+
+[node name="TileSprite" type="Sprite2D" parent="VBoxContainer/Panel/MarginContainer/Tab1/TabRoot"]
+centered = false
+
+[node name="Grid" type="ColorRect" parent="VBoxContainer/Panel/MarginContainer/Tab1"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+mouse_filter = 2
+color = Color(1, 1, 1, 0)
+
+[node name="FocusBtn" type="TextureButton" parent="VBoxContainer/Panel/MarginContainer/Tab1"]
+layout_mode = 1
+anchors_preset = 1
+anchor_left = 1.0
+anchor_right = 1.0
+offset_left = -79.0
+offset_top = 14.0
+offset_right = -15.0
+offset_bottom = 78.0
+grow_horizontal = 0
+tooltip_text = "聚焦"
+texture_normal = ExtResource("3_sibps")
+ignore_texture_size = true
+stretch_mode = 5
+
+[node name="Tab2" type="Control" parent="VBoxContainer/Panel/MarginContainer"]
+layout_mode = 2
+script = ExtResource("4_jxcal")
+
+[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer/Panel/MarginContainer/Tab2"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+
+[node name="TerrainItem" type="Button" parent="VBoxContainer/Panel/MarginContainer/Tab2/ScrollContainer"]
+custom_minimum_size = Vector2(0, 400)
+layout_mode = 2
+size_flags_horizontal = 3
+
+[node name="Select" type="NinePatchRect" parent="VBoxContainer/Panel/MarginContainer/Tab2/ScrollContainer/TerrainItem"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+texture = ExtResource("5_f4thw")
+patch_margin_left = 3
+patch_margin_top = 3
+patch_margin_right = 3
+patch_margin_bottom = 3
+
+[node name="TerrainName" type="Label" parent="VBoxContainer/Panel/MarginContainer/Tab2/ScrollContainer/TerrainItem"]
+layout_mode = 1
+anchors_preset = 10
+anchor_right = 1.0
+offset_top = 3.0
+offset_bottom = 43.0
+grow_horizontal = 2
+text = "Name"
+horizontal_alignment = 1
+vertical_alignment = 1
+
+[node name="TerrainPreview" type="TextureRect" parent="VBoxContainer/Panel/MarginContainer/Tab2/ScrollContainer/TerrainItem"]
+layout_mode = 1
+anchors_preset = 12
+anchor_top = 1.0
+anchor_right = 1.0
+anchor_bottom = 1.0
+offset_left = 3.0
+offset_top = -357.0
+offset_right = -3.0
+offset_bottom = -3.0
+grow_horizontal = 2
+grow_vertical = 0
+expand_mode = 2
+stretch_mode = 5
+
+[node name="Tab3" type="Control" parent="VBoxContainer/Panel/MarginContainer"]
+visible = false
+layout_mode = 2
+script = ExtResource("5_ty17f")
+
+[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer/Panel/MarginContainer/Tab3"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+
+[node name="Label" type="Label" parent="VBoxContainer/Panel/MarginContainer/Tab3/ScrollContainer"]
+layout_mode = 2
+text = "组合"
diff --git a/DungeonShooting_Godot/prefab/ui/TileSetEditorImport.tscn b/DungeonShooting_Godot/prefab/ui/TileSetEditorImport.tscn
index ed54c7e..1666fc6 100644
--- a/DungeonShooting_Godot/prefab/ui/TileSetEditorImport.tscn
+++ b/DungeonShooting_Godot/prefab/ui/TileSetEditorImport.tscn
@@ -21,7 +21,7 @@
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
-color = Color(0.278431, 0.278431, 0.278431, 1)
+color = Color(0.145098, 0.145098, 0.145098, 1)
[node name="ImportButton" type="Button" parent="."]
layout_mode = 1
diff --git a/DungeonShooting_Godot/project.godot b/DungeonShooting_Godot/project.godot
index e571370..2588b93 100644
--- a/DungeonShooting_Godot/project.godot
+++ b/DungeonShooting_Godot/project.godot
@@ -217,7 +217,7 @@
}
mouse_right={
"deadzone": 0.5,
-"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(154, 20),"global_position":Vector2(158, 61),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null)
+"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(304, 18),"global_position":Vector2(308, 59),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/Preview.png b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/Preview.png
index ccdc961..9ae850f 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/Preview.png
+++ b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/Preview.png
Binary files differ
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/RoomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/RoomInfo.json
index daafc6c..1abac37 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/RoomInfo.json
+++ b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/RoomInfo.json
@@ -1 +1 @@
-{"Position":{"X":-4,"Y":-6},"Size":{"X":11,"Y":10},"DoorAreaInfos":[],"GroupName":"Test1","RoomType":1,"RoomName":"Start1","Weight":100,"Remark":""}
\ No newline at end of file
+{"Position":{"X":-4,"Y":-6},"Size":{"X":10,"Y":10},"DoorAreaInfos":[],"GroupName":"Test1","RoomType":1,"RoomName":"Start1","Weight":100,"Remark":""}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/TileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/TileInfo.json
index 158475e..514959a 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/TileInfo.json
+++ b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/TileInfo.json
@@ -1 +1 @@
-{"NavigationVertices":[{"X":74,"Y":34},{"X":-26,"Y":34},{"X":-26,"Y":-42},{"X":74,"Y":-42}],"NavigationPolygon":[[0,1,2,3]],"Floor":[4,-2,0,3,3,-2,0,3,2,-2,0,3,1,-2,0,3,0,-2,0,3,-1,-2,0,3,-2,-2,0,3,-2,-1,0,3,-1,-1,0,3,0,-1,0,3,1,-1,0,3,2,-1,0,3,3,-1,0,3,4,-1,0,3,4,0,0,3,3,0,0,3,2,0,0,3,1,0,0,3,0,0,0,3,-1,0,0,3,-2,0,0,3,-2,1,0,3,-1,1,0,3,0,1,0,3,1,1,0,3,2,1,0,3,3,1,0,3,4,1,0,3,4,-3,0,3,3,-3,0,3,2,-3,0,3,1,-3,0,3,0,-3,0,3,-1,-3,0,3,-2,-3,0,3],"Middle":[-2,-5,63,1,-2,-4,2,2,-1,-5,63,1,-1,-4,2,2,0,-5,63,1,0,-4,2,2,1,-5,63,1,1,-4,2,2,2,-5,63,1,2,-4,2,2,3,-5,63,1,3,-4,2,2,4,-5,63,1,4,-4,2,2],"Top":[-4,-6,511,1,-4,-5,511,1,-4,-4,511,1,-4,-3,511,1,-4,-2,511,1,-4,-1,511,1,-4,0,511,1,-4,1,511,1,-4,2,511,1,-4,3,511,1,-3,-6,511,1,-3,-5,255,1,-3,-4,219,1,-3,-3,219,1,-3,-2,219,1,-3,-1,219,1,-3,0,219,1,-3,1,219,1,-3,2,507,1,-3,3,511,1,-2,-6,511,1,-2,2,504,1,-2,3,511,1,-1,-6,511,1,-1,2,504,1,-1,3,511,1,0,-6,511,1,0,2,504,1,0,3,511,1,1,-6,511,1,1,2,504,1,1,3,511,1,2,-6,511,1,2,2,504,1,2,3,511,1,3,-6,511,1,3,2,504,1,3,3,511,1,4,-6,511,1,4,2,504,1,4,3,511,1,5,-6,511,1,5,-5,447,1,5,-4,438,1,5,-3,438,1,5,-2,438,1,5,-1,438,1,5,0,438,1,5,1,438,1,5,2,510,1,5,3,511,1,6,-6,511,1,6,-5,511,1,6,-4,511,1,6,-3,511,1,6,-2,511,1,6,-1,511,1,6,0,511,1,6,1,511,1,6,2,511,1,6,3,511,1]}
\ No newline at end of file
+{"NavigationVertices":[{"X":58,"Y":34},{"X":-26,"Y":34},{"X":-26,"Y":-42},{"X":58,"Y":-42}],"NavigationPolygon":[[0,1,2,3]],"Floor":[3,-2,0,3,2,-2,0,3,1,-2,0,3,0,-2,0,3,-1,-2,0,3,-2,-2,0,3,-2,-1,0,3,-1,-1,0,3,0,-1,0,3,1,-1,0,3,2,-1,0,3,3,-1,0,3,3,0,0,3,2,0,0,3,1,0,0,3,0,0,0,3,-1,0,0,3,-2,0,0,3,-2,1,0,3,-1,1,0,3,0,1,0,3,1,1,0,3,2,1,0,3,3,1,0,3,3,-3,0,3,2,-3,0,3,1,-3,0,3,0,-3,0,3,-1,-3,0,3,-2,-3,0,3],"Middle":[-2,-5,63,1,-2,-4,2,2,-1,-5,63,1,-1,-4,2,2,0,-5,63,1,0,-4,2,2,1,-5,63,1,1,-4,2,2,2,-5,63,1,2,-4,2,2,3,-5,63,1,3,-4,2,2],"Top":[-4,-6,511,1,-4,-5,511,1,-4,-4,511,1,-4,-3,511,1,-4,-2,511,1,-4,-1,511,1,-4,0,511,1,-4,1,511,1,-4,2,511,1,-4,3,511,1,-3,-6,511,1,-3,-5,255,1,-3,-4,219,1,-3,-3,219,1,-3,-2,219,1,-3,-1,219,1,-3,0,219,1,-3,1,219,1,-3,2,507,1,-3,3,511,1,-2,-6,511,1,-2,2,504,1,-2,3,511,1,-1,-6,511,1,-1,2,504,1,-1,3,511,1,0,-6,511,1,0,2,504,1,0,3,511,1,1,-6,511,1,1,2,504,1,1,3,511,1,2,-6,511,1,2,2,504,1,2,3,511,1,3,-6,511,1,3,2,504,1,3,3,511,1,4,-6,511,1,4,-5,447,1,4,-4,438,1,4,-3,438,1,4,-2,438,1,4,-1,438,1,4,0,438,1,4,1,438,1,4,2,510,1,4,3,511,1,5,-6,511,1,5,-5,511,1,5,-4,511,1,5,-3,511,1,5,-2,511,1,5,-1,511,1,5,0,511,1,5,1,511,1,5,2,511,1,5,3,511,1]}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/map/tileSet/TileSet1/TileSet.json b/DungeonShooting_Godot/resource/map/tileSet/TileSet1/TileSet.json
index 841aa19..702785d 100644
--- a/DungeonShooting_Godot/resource/map/tileSet/TileSet1/TileSet.json
+++ b/DungeonShooting_Godot/resource/map/tileSet/TileSet1/TileSet.json
@@ -223,6 +223,19 @@
},
"TerrainType": 0,
"Ready": true
+ },
+ {
+ "Name": "Test1",
+ "F": {},
+ "M": {},
+ "T": {
+ "341": [
+ 80,
+ 64
+ ]
+ },
+ "TerrainType": 1,
+ "Ready": false
}
],
"Combination": []
diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
index f361dc8..3f2bec8 100644
--- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
+++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
@@ -85,6 +85,7 @@
public const string prefab_ui_MapEditorCreateRoom_tscn = "res://prefab/ui/MapEditorCreateRoom.tscn";
public const string prefab_ui_MapEditorMapLayer_tscn = "res://prefab/ui/MapEditorMapLayer.tscn";
public const string prefab_ui_MapEditorMapMark_tscn = "res://prefab/ui/MapEditorMapMark.tscn";
+ public const string prefab_ui_MapEditorMapTile_tscn = "res://prefab/ui/MapEditorMapTile.tscn";
public const string prefab_ui_MapEditorProject_tscn = "res://prefab/ui/MapEditorProject.tscn";
public const string prefab_ui_MapEditorSelectObject_tscn = "res://prefab/ui/MapEditorSelectObject.tscn";
public const string prefab_ui_MapEditorTools_tscn = "res://prefab/ui/MapEditorTools.tscn";
diff --git a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs
index 3f4a528..420d68e 100644
--- a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs
+++ b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs
@@ -23,6 +23,7 @@
public const string MapEditorCreateRoom = "MapEditorCreateRoom";
public const string MapEditorMapLayer = "MapEditorMapLayer";
public const string MapEditorMapMark = "MapEditorMapMark";
+ public const string MapEditorMapTile = "MapEditorMapTile";
public const string MapEditorProject = "MapEditorProject";
public const string MapEditorSelectObject = "MapEditorSelectObject";
public const string MapEditorTools = "MapEditorTools";
@@ -903,6 +904,54 @@
}
///
+ /// 创建 MapEditorMapTile, 并返回UI实例, 该函数不会打开 Ui
+ ///
+ public static UI.MapEditorMapTile.MapEditorMapTilePanel Create_MapEditorMapTile()
+ {
+ return CreateUi(UiNames.MapEditorMapTile);
+ }
+
+ ///
+ /// 打开 MapEditorMapTile, 并返回UI实例
+ ///
+ public static UI.MapEditorMapTile.MapEditorMapTilePanel Open_MapEditorMapTile()
+ {
+ return OpenUi(UiNames.MapEditorMapTile);
+ }
+
+ ///
+ /// 隐藏 MapEditorMapTile 的所有实例
+ ///
+ public static void Hide_MapEditorMapTile()
+ {
+ var uiInstance = Get_MapEditorMapTile_Instance();
+ foreach (var uiPanel in uiInstance)
+ {
+ uiPanel.HideUi();
+ }
+ }
+
+ ///
+ /// 销毁 MapEditorMapTile 的所有实例
+ ///
+ public static void Destroy_MapEditorMapTile()
+ {
+ var uiInstance = Get_MapEditorMapTile_Instance();
+ foreach (var uiPanel in uiInstance)
+ {
+ uiPanel.Destroy();
+ }
+ }
+
+ ///
+ /// 获取所有 MapEditorMapTile 的实例, 如果没有实例, 则返回一个空数组
+ ///
+ public static UI.MapEditorMapTile.MapEditorMapTilePanel[] Get_MapEditorMapTile_Instance()
+ {
+ return GetUiInstance(nameof(UI.MapEditorMapTile.MapEditorMapTile));
+ }
+
+ ///
/// 创建 MapEditorProject, 并返回UI实例, 该函数不会打开 Ui
///
public static UI.MapEditorProject.MapEditorProjectPanel Create_MapEditorProject()
diff --git a/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs
index 07195e8..b4a17af 100644
--- a/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs
@@ -15,7 +15,7 @@
/// Godot编辑器扩展工具
///
[Tool]
-public partial class EditorToolsPanel : EditorTools
+public partial class EditorToolsPanel : EditorTools, ISerializationListener
{
#if TOOLS
@@ -81,6 +81,15 @@
container.L_HBoxContainer7.L_Button.Instance.Pressed -= ExportExcel;
container.L_HBoxContainer8.L_Button.Instance.Pressed -= OpenExportExcelFolder;
}
+
+ public void OnBeforeSerialize()
+ {
+ OnHideUi();
+ }
+ public void OnAfterDeserialize()
+ {
+ OnShowUi();
+ }
///
/// Tips 关闭信号回调
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs
index 993bedc..da79403 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs
@@ -37,10 +37,15 @@
inst2.L_MapEditorMapLayer.Instance.OnCreateUi();
inst2.L_MapEditorMapLayer.Instance.OnInitNestedUi();
- var inst3 = L_Bg.L_VBoxContainer.L_HSplitContainer.L_Right.L_MarginContainer.L_TabContainer.L_MapMark;
- RecordNestedUi(inst3.L_MapEditorMapMark.Instance, inst3, UiManager.RecordType.Open);
- inst3.L_MapEditorMapMark.Instance.OnCreateUi();
- inst3.L_MapEditorMapMark.Instance.OnInitNestedUi();
+ var inst3 = L_Bg.L_VBoxContainer.L_HSplitContainer.L_Right.L_MarginContainer.L_TabContainer.L_MapTile;
+ RecordNestedUi(inst3.L_MapEditorMapTile.Instance, inst3, UiManager.RecordType.Open);
+ inst3.L_MapEditorMapTile.Instance.OnCreateUi();
+ inst3.L_MapEditorMapTile.Instance.OnInitNestedUi();
+
+ var inst4 = L_Bg.L_VBoxContainer.L_HSplitContainer.L_Right.L_MarginContainer.L_TabContainer.L_MapMark;
+ RecordNestedUi(inst4.L_MapEditorMapMark.Instance, inst4, UiManager.RecordType.Open);
+ inst4.L_MapEditorMapMark.Instance.OnCreateUi();
+ inst4.L_MapEditorMapMark.Instance.OnInitNestedUi();
}
@@ -460,10 +465,39 @@
}
///
+ /// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Right.MarginContainer.TabContainer.MapTile.MapEditorMapTile
+ ///
+ public class MapEditorMapTile : UiNode
+ {
+ public MapEditorMapTile(MapEditorPanel uiPanel, UI.MapEditorMapTile.MapEditorMapTilePanel node) : base(uiPanel, node) { }
+ public override MapEditorMapTile Clone()
+ {
+ var uiNode = new MapEditorMapTile(UiPanel, (UI.MapEditorMapTile.MapEditorMapTilePanel)Instance.Duplicate());
+ UiPanel.RecordNestedUi(uiNode.Instance, this, UiManager.RecordType.Open);
+ uiNode.Instance.OnCreateUi();
+ uiNode.Instance.OnInitNestedUi();
+ return uiNode;
+ }
+ }
+
+ ///
/// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Right.MarginContainer.TabContainer.MapTile
///
public class MapTile : UiNode
{
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Right.MarginContainer.TabContainer.MapEditorMapTile
+ ///
+ public MapEditorMapTile L_MapEditorMapTile
+ {
+ get
+ {
+ if (_L_MapEditorMapTile == null) _L_MapEditorMapTile = new MapEditorMapTile(UiPanel, Instance.GetNode("MapEditorMapTile"));
+ return _L_MapEditorMapTile;
+ }
+ }
+ private MapEditorMapTile _L_MapEditorMapTile;
+
public MapTile(MapEditorPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { }
public override MapTile Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate());
}
@@ -787,6 +821,11 @@
public MapLayer S_MapLayer => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Right.L_MarginContainer.L_TabContainer.L_MapLayer;
///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Right.MarginContainer.TabContainer.MapTile.MapEditorMapTile
+ ///
+ public MapEditorMapTile S_MapEditorMapTile => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Right.L_MarginContainer.L_TabContainer.L_MapTile.L_MapEditorMapTile;
+
+ ///
/// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Right.MarginContainer.TabContainer.MapTile
///
public MapTile S_MapTile => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Right.L_MarginContainer.L_TabContainer.L_MapTile;
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
index 6da38ff..be16f6f 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
@@ -27,10 +27,6 @@
public override void OnCreateUi()
{
- //临时处理, 加载TileSet
- var tileSetSplit = GameApplication.Instance.TileSetConfig.First().Value;
- S_TileMap.Instance.InitTileSet(tileSetSplit);
-
S_TabContainer.Instance.SetTabTitle(0, "图层");
S_TabContainer.Instance.SetTabTitle(1, "图块");
S_TabContainer.Instance.SetTabTitle(2, "对象");
@@ -87,11 +83,16 @@
///
/// 加载地牢, 返回是否加载成功
///
- public bool LoadMap(DungeonRoomSplit roomSplit)
+ public bool LoadMap(DungeonRoomSplit roomSplit, TileSetSplit tileSetSplit)
{
_title = "正在编辑:" + roomSplit.RoomInfo.RoomName;
S_Title.Instance.Text = _title;
- var loadMap = S_TileMap.Instance.Load(roomSplit);
+
+ //加载MapTile面板
+ S_MapEditorMapTile.Instance.InitData(tileSetSplit);
+
+ //加载Tile
+ var loadMap = S_TileMap.Instance.Load(roomSplit, tileSetSplit);
S_MapEditorMapMark.Instance.RefreshPreinstallSelect();
return loadMap;
}
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
index be88d9e..44af8af 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
@@ -152,19 +152,6 @@
private MapEditor.TileMap _editorTileMap;
private EventFactory _eventFactory;
- ///
- /// 初始化图块集。
- ///
- /// 要初始化的图块集
- public void InitTileSet(TileSetSplit tileSetSplit)
- {
- TileSet = tileSetSplit.GetTileSet();
-
- // 创建AutoTileConfig对象
- // 使用第一个图块集源作为参数
- _autoTileConfig = new AutoTileConfig(0, tileSetSplit.TileSetInfo.Sources[0].Terrain[0]);
- }
-
public void SetUiNode(IUiNode uiNode)
{
_editorTileMap = (MapEditor.TileMap)uiNode;
@@ -498,8 +485,10 @@
///
/// 加载地牢, 返回是否加载成功
///
- public bool Load(DungeonRoomSplit roomSplit)
+ public bool Load(DungeonRoomSplit roomSplit, TileSetSplit tileSetSplit)
{
+ InitTileSet(tileSetSplit);
+
//重新加载数据
roomSplit.ReloadRoomInfo();
roomSplit.ReloadTileInfo();
@@ -559,6 +548,19 @@
OnClickCenterTool(null);
return true;
}
+
+ ///
+ /// 初始化图块集。
+ ///
+ /// 要初始化的图块集
+ private void InitTileSet(TileSetSplit tileSetSplit)
+ {
+ TileSet = tileSetSplit.GetTileSet();
+
+ // 创建AutoTileConfig对象
+ // 使用第一个图块集源作为参数
+ _autoTileConfig = new AutoTileConfig(0, tileSetSplit.TileSetInfo.Sources[0].Terrain[0]);
+ }
private void InitLayer()
{
@@ -999,7 +1001,9 @@
}
else //聚焦地图中心点
{
- SetMapPosition(pos - (CurrRoomPosition + CurrRoomSize / 2) * TileSet.TileSize * Scale);
+ var roomPos = new Vector2(CurrRoomPosition.X, CurrRoomPosition.Y);
+ var roomSize = new Vector2(CurrRoomSize.X, CurrRoomSize.Y);
+ SetMapPosition(pos - (roomPos + roomSize / 2) * TileSet.TileSize * Scale);
}
}
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/CombinationTileTab.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/CombinationTileTab.cs
new file mode 100644
index 0000000..eca5a78
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/CombinationTileTab.cs
@@ -0,0 +1,21 @@
+using Godot;
+
+namespace UI.MapEditorMapTile;
+
+///
+/// 组合笔刷页签
+///
+public partial class CombinationTileTab : Control, IUiNodeScript
+{
+ private MapEditorMapTile.Tab3 _uiNode;
+
+ public void SetUiNode(IUiNode uiNode)
+ {
+ _uiNode = (MapEditorMapTile.Tab3)uiNode;
+ }
+
+ public void OnDestroy()
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTile.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTile.cs
new file mode 100644
index 0000000..7c00406
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTile.cs
@@ -0,0 +1,618 @@
+namespace UI.MapEditorMapTile;
+
+///
+/// Ui代码, 该类是根据ui场景自动生成的, 请不要手动编辑该类, 以免造成代码丢失
+///
+public abstract partial class MapEditorMapTile : UiBase
+{
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer
+ ///
+ public VBoxContainer L_VBoxContainer
+ {
+ get
+ {
+ if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer((MapEditorMapTilePanel)this, GetNode("VBoxContainer"));
+ return _L_VBoxContainer;
+ }
+ }
+ private VBoxContainer _L_VBoxContainer;
+
+
+ public MapEditorMapTile() : base(nameof(MapEditorMapTile))
+ {
+ }
+
+ public sealed override void OnInitNestedUi()
+ {
+ _ = L_VBoxContainer.L_Panel.L_MarginContainer.L_Tab1;
+ _ = L_VBoxContainer.L_Panel.L_MarginContainer.L_Tab2;
+ _ = L_VBoxContainer.L_Panel.L_MarginContainer.L_Tab3;
+
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.HBoxContainer.Label
+ ///
+ public class Label : UiNode
+ {
+ public Label(MapEditorMapTilePanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
+ public override Label Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.HBoxContainer.SourceOption
+ ///
+ public class SourceOption : UiNode
+ {
+ public SourceOption(MapEditorMapTilePanel uiPanel, Godot.OptionButton node) : base(uiPanel, node) { }
+ public override SourceOption Clone() => new (UiPanel, (Godot.OptionButton)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.HBoxContainer
+ ///
+ public class HBoxContainer : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Label
+ ///
+ public Label L_Label
+ {
+ get
+ {
+ if (_L_Label == null) _L_Label = new Label(UiPanel, Instance.GetNode("Label"));
+ return _L_Label;
+ }
+ }
+ private Label _L_Label;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.SourceOption
+ ///
+ public SourceOption L_SourceOption
+ {
+ get
+ {
+ if (_L_SourceOption == null) _L_SourceOption = new SourceOption(UiPanel, Instance.GetNode("SourceOption"));
+ return _L_SourceOption;
+ }
+ }
+ private SourceOption _L_SourceOption;
+
+ public HBoxContainer(MapEditorMapTilePanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
+ public override HBoxContainer Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.HBoxContainer2.Label
+ ///
+ public class Label_1 : UiNode
+ {
+ public Label_1(MapEditorMapTilePanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
+ public override Label_1 Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.HBoxContainer2.HandleOption
+ ///
+ public class HandleOption : UiNode
+ {
+ public HandleOption(MapEditorMapTilePanel uiPanel, Godot.OptionButton node) : base(uiPanel, node) { }
+ public override HandleOption Clone() => new (UiPanel, (Godot.OptionButton)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.HBoxContainer2
+ ///
+ public class HBoxContainer2 : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Label
+ ///
+ public Label_1 L_Label
+ {
+ get
+ {
+ if (_L_Label == null) _L_Label = new Label_1(UiPanel, Instance.GetNode("Label"));
+ return _L_Label;
+ }
+ }
+ private Label_1 _L_Label;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.HandleOption
+ ///
+ public HandleOption L_HandleOption
+ {
+ get
+ {
+ if (_L_HandleOption == null) _L_HandleOption = new HandleOption(UiPanel, Instance.GetNode("HandleOption"));
+ return _L_HandleOption;
+ }
+ }
+ private HandleOption _L_HandleOption;
+
+ public HBoxContainer2(MapEditorMapTilePanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
+ public override HBoxContainer2 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab1.TabRoot.TileSprite
+ ///
+ public class TileSprite : UiNode
+ {
+ public TileSprite(MapEditorMapTilePanel uiPanel, Godot.Sprite2D node) : base(uiPanel, node) { }
+ public override TileSprite Clone() => new (UiPanel, (Godot.Sprite2D)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab1.TabRoot
+ ///
+ public class TabRoot : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab1.TileSprite
+ ///
+ public TileSprite L_TileSprite
+ {
+ get
+ {
+ if (_L_TileSprite == null) _L_TileSprite = new TileSprite(UiPanel, Instance.GetNode("TileSprite"));
+ return _L_TileSprite;
+ }
+ }
+ private TileSprite _L_TileSprite;
+
+ public TabRoot(MapEditorMapTilePanel uiPanel, Godot.Control node) : base(uiPanel, node) { }
+ public override TabRoot Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab1.Grid
+ ///
+ public class Grid : UiNode
+ {
+ public Grid(MapEditorMapTilePanel uiPanel, Godot.ColorRect node) : base(uiPanel, node) { }
+ public override Grid Clone() => new (UiPanel, (Godot.ColorRect)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab1.FocusBtn
+ ///
+ public class FocusBtn : UiNode
+ {
+ public FocusBtn(MapEditorMapTilePanel uiPanel, Godot.TextureButton node) : base(uiPanel, node) { }
+ public override FocusBtn Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab1
+ ///
+ public class Tab1 : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.TabRoot
+ ///
+ public TabRoot L_TabRoot
+ {
+ get
+ {
+ if (_L_TabRoot == null) _L_TabRoot = new TabRoot(UiPanel, Instance.GetNode("TabRoot"));
+ return _L_TabRoot;
+ }
+ }
+ private TabRoot _L_TabRoot;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Grid
+ ///
+ public Grid L_Grid
+ {
+ get
+ {
+ if (_L_Grid == null) _L_Grid = new Grid(UiPanel, Instance.GetNode("Grid"));
+ return _L_Grid;
+ }
+ }
+ private Grid _L_Grid;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.FocusBtn
+ ///
+ public FocusBtn L_FocusBtn
+ {
+ get
+ {
+ if (_L_FocusBtn == null) _L_FocusBtn = new FocusBtn(UiPanel, Instance.GetNode("FocusBtn"));
+ return _L_FocusBtn;
+ }
+ }
+ private FocusBtn _L_FocusBtn;
+
+ public Tab1(MapEditorMapTilePanel uiPanel, UI.MapEditorMapTile.SingleTileTab node) : base(uiPanel, node) { }
+ public override Tab1 Clone() => new (UiPanel, (UI.MapEditorMapTile.SingleTileTab)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2.ScrollContainer.TerrainItem.Select
+ ///
+ public class Select : UiNode
+ {
+ public Select(MapEditorMapTilePanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { }
+ public override Select Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2.ScrollContainer.TerrainItem.TerrainName
+ ///
+ public class TerrainName : UiNode
+ {
+ public TerrainName(MapEditorMapTilePanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
+ public override TerrainName Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2.ScrollContainer.TerrainItem.TerrainPreview
+ ///
+ public class TerrainPreview : UiNode
+ {
+ public TerrainPreview(MapEditorMapTilePanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { }
+ public override TerrainPreview Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2.ScrollContainer.TerrainItem
+ ///
+ public class TerrainItem : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2.ScrollContainer.Select
+ ///
+ public Select L_Select
+ {
+ get
+ {
+ if (_L_Select == null) _L_Select = new Select(UiPanel, Instance.GetNode("Select"));
+ return _L_Select;
+ }
+ }
+ private Select _L_Select;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2.ScrollContainer.TerrainName
+ ///
+ public TerrainName L_TerrainName
+ {
+ get
+ {
+ if (_L_TerrainName == null) _L_TerrainName = new TerrainName(UiPanel, Instance.GetNode("TerrainName"));
+ return _L_TerrainName;
+ }
+ }
+ private TerrainName _L_TerrainName;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2.ScrollContainer.TerrainPreview
+ ///
+ public TerrainPreview L_TerrainPreview
+ {
+ get
+ {
+ if (_L_TerrainPreview == null) _L_TerrainPreview = new TerrainPreview(UiPanel, Instance.GetNode("TerrainPreview"));
+ return _L_TerrainPreview;
+ }
+ }
+ private TerrainPreview _L_TerrainPreview;
+
+ public TerrainItem(MapEditorMapTilePanel uiPanel, Godot.Button node) : base(uiPanel, node) { }
+ public override TerrainItem Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2.ScrollContainer
+ ///
+ public class ScrollContainer : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2.TerrainItem
+ ///
+ public TerrainItem L_TerrainItem
+ {
+ get
+ {
+ if (_L_TerrainItem == null) _L_TerrainItem = new TerrainItem(UiPanel, Instance.GetNode("TerrainItem"));
+ return _L_TerrainItem;
+ }
+ }
+ private TerrainItem _L_TerrainItem;
+
+ public ScrollContainer(MapEditorMapTilePanel uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { }
+ public override ScrollContainer Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2
+ ///
+ public class Tab2 : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.ScrollContainer
+ ///
+ public ScrollContainer L_ScrollContainer
+ {
+ get
+ {
+ if (_L_ScrollContainer == null) _L_ScrollContainer = new ScrollContainer(UiPanel, Instance.GetNode("ScrollContainer"));
+ return _L_ScrollContainer;
+ }
+ }
+ private ScrollContainer _L_ScrollContainer;
+
+ public Tab2(MapEditorMapTilePanel uiPanel, UI.MapEditorMapTile.TerrainTileTab node) : base(uiPanel, node) { }
+ public override Tab2 Clone() => new (UiPanel, (UI.MapEditorMapTile.TerrainTileTab)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab3.ScrollContainer.Label
+ ///
+ public class Label_2 : UiNode
+ {
+ public Label_2(MapEditorMapTilePanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
+ public override Label_2 Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab3.ScrollContainer
+ ///
+ public class ScrollContainer_1 : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab3.Label
+ ///
+ public Label_2 L_Label
+ {
+ get
+ {
+ if (_L_Label == null) _L_Label = new Label_2(UiPanel, Instance.GetNode("Label"));
+ return _L_Label;
+ }
+ }
+ private Label_2 _L_Label;
+
+ public ScrollContainer_1(MapEditorMapTilePanel uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { }
+ public override ScrollContainer_1 Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab3
+ ///
+ public class Tab3 : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.ScrollContainer
+ ///
+ public ScrollContainer_1 L_ScrollContainer
+ {
+ get
+ {
+ if (_L_ScrollContainer == null) _L_ScrollContainer = new ScrollContainer_1(UiPanel, Instance.GetNode("ScrollContainer"));
+ return _L_ScrollContainer;
+ }
+ }
+ private ScrollContainer_1 _L_ScrollContainer;
+
+ public Tab3(MapEditorMapTilePanel uiPanel, UI.MapEditorMapTile.CombinationTileTab node) : base(uiPanel, node) { }
+ public override Tab3 Clone() => new (UiPanel, (UI.MapEditorMapTile.CombinationTileTab)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer
+ ///
+ public class MarginContainer : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.Tab1
+ ///
+ public Tab1 L_Tab1
+ {
+ get
+ {
+ if (_L_Tab1 == null) _L_Tab1 = new Tab1(UiPanel, Instance.GetNode("Tab1"));
+ return _L_Tab1;
+ }
+ }
+ private Tab1 _L_Tab1;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.Tab2
+ ///
+ public Tab2 L_Tab2
+ {
+ get
+ {
+ if (_L_Tab2 == null) _L_Tab2 = new Tab2(UiPanel, Instance.GetNode("Tab2"));
+ return _L_Tab2;
+ }
+ }
+ private Tab2 _L_Tab2;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.Tab3
+ ///
+ public Tab3 L_Tab3
+ {
+ get
+ {
+ if (_L_Tab3 == null) _L_Tab3 = new Tab3(UiPanel, Instance.GetNode("Tab3"));
+ return _L_Tab3;
+ }
+ }
+ private Tab3 _L_Tab3;
+
+ public MarginContainer(MapEditorMapTilePanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { }
+ public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer.Panel
+ ///
+ public class Panel : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.MarginContainer
+ ///
+ public MarginContainer L_MarginContainer
+ {
+ get
+ {
+ if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer(UiPanel, Instance.GetNode("MarginContainer"));
+ return _L_MarginContainer;
+ }
+ }
+ private MarginContainer _L_MarginContainer;
+
+ public Panel(MapEditorMapTilePanel uiPanel, Godot.Panel node) : base(uiPanel, node) { }
+ public override Panel Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.VBoxContainer
+ ///
+ public class VBoxContainer : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.HBoxContainer
+ ///
+ public HBoxContainer L_HBoxContainer
+ {
+ get
+ {
+ if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer(UiPanel, Instance.GetNode("HBoxContainer"));
+ return _L_HBoxContainer;
+ }
+ }
+ private HBoxContainer _L_HBoxContainer;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.HBoxContainer2
+ ///
+ public HBoxContainer2 L_HBoxContainer2
+ {
+ get
+ {
+ if (_L_HBoxContainer2 == null) _L_HBoxContainer2 = new HBoxContainer2(UiPanel, Instance.GetNode("HBoxContainer2"));
+ return _L_HBoxContainer2;
+ }
+ }
+ private HBoxContainer2 _L_HBoxContainer2;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.Panel
+ ///
+ public Panel L_Panel
+ {
+ get
+ {
+ if (_L_Panel == null) _L_Panel = new Panel(UiPanel, Instance.GetNode("Panel"));
+ return _L_Panel;
+ }
+ }
+ private Panel _L_Panel;
+
+ public VBoxContainer(MapEditorMapTilePanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { }
+ public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate());
+ }
+
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.HBoxContainer.SourceOption
+ ///
+ public SourceOption S_SourceOption => L_VBoxContainer.L_HBoxContainer.L_SourceOption;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.HBoxContainer
+ ///
+ public HBoxContainer S_HBoxContainer => L_VBoxContainer.L_HBoxContainer;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.HBoxContainer2.HandleOption
+ ///
+ public HandleOption S_HandleOption => L_VBoxContainer.L_HBoxContainer2.L_HandleOption;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.HBoxContainer2
+ ///
+ public HBoxContainer2 S_HBoxContainer2 => L_VBoxContainer.L_HBoxContainer2;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab1.TabRoot.TileSprite
+ ///
+ public TileSprite S_TileSprite => L_VBoxContainer.L_Panel.L_MarginContainer.L_Tab1.L_TabRoot.L_TileSprite;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab1.TabRoot
+ ///
+ public TabRoot S_TabRoot => L_VBoxContainer.L_Panel.L_MarginContainer.L_Tab1.L_TabRoot;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab1.Grid
+ ///
+ public Grid S_Grid => L_VBoxContainer.L_Panel.L_MarginContainer.L_Tab1.L_Grid;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab1.FocusBtn
+ ///
+ public FocusBtn S_FocusBtn => L_VBoxContainer.L_Panel.L_MarginContainer.L_Tab1.L_FocusBtn;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab1
+ ///
+ public Tab1 S_Tab1 => L_VBoxContainer.L_Panel.L_MarginContainer.L_Tab1;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2.ScrollContainer.TerrainItem.Select
+ ///
+ public Select S_Select => L_VBoxContainer.L_Panel.L_MarginContainer.L_Tab2.L_ScrollContainer.L_TerrainItem.L_Select;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2.ScrollContainer.TerrainItem.TerrainName
+ ///
+ public TerrainName S_TerrainName => L_VBoxContainer.L_Panel.L_MarginContainer.L_Tab2.L_ScrollContainer.L_TerrainItem.L_TerrainName;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2.ScrollContainer.TerrainItem.TerrainPreview
+ ///
+ public TerrainPreview S_TerrainPreview => L_VBoxContainer.L_Panel.L_MarginContainer.L_Tab2.L_ScrollContainer.L_TerrainItem.L_TerrainPreview;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2.ScrollContainer.TerrainItem
+ ///
+ public TerrainItem S_TerrainItem => L_VBoxContainer.L_Panel.L_MarginContainer.L_Tab2.L_ScrollContainer.L_TerrainItem;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab2
+ ///
+ public Tab2 S_Tab2 => L_VBoxContainer.L_Panel.L_MarginContainer.L_Tab2;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer.Tab3
+ ///
+ public Tab3 S_Tab3 => L_VBoxContainer.L_Panel.L_MarginContainer.L_Tab3;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel.MarginContainer
+ ///
+ public MarginContainer S_MarginContainer => L_VBoxContainer.L_Panel.L_MarginContainer;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.Panel
+ ///
+ public Panel S_Panel => L_VBoxContainer.L_Panel;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer
+ ///
+ public VBoxContainer S_VBoxContainer => L_VBoxContainer;
+
+}
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTilePanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTilePanel.cs
new file mode 100644
index 0000000..26d2c9d
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTilePanel.cs
@@ -0,0 +1,100 @@
+using Godot;
+
+namespace UI.MapEditorMapTile;
+
+public partial class MapEditorMapTilePanel : MapEditorMapTile
+{
+ ///
+ /// 使用的TileSet数据
+ ///
+ public TileSetSplit TileSetSplit { get; private set; }
+
+ ///
+ /// 选中的资源 Id
+ ///
+ public int SourceIndex { get; private set; } = -1;
+
+ ///
+ /// 选中的 Source
+ ///
+ public TileSetSourceInfo TileSetSourceInfo
+ {
+ get
+ {
+ if (SourceIndex < 0)
+ {
+ return null;
+ }
+ return TileSetSplit.TileSetInfo.Sources[SourceIndex];
+ }
+ }
+
+ public override void OnCreateUi()
+ {
+ //切换资源
+ S_SourceOption.Instance.ItemSelected += OnChangeSource;
+ //切换笔刷类型
+ S_HandleOption.Instance.ItemSelected += OnChangeBrush;
+ OnChangeBrush(0);
+ }
+
+ public override void OnDestroyUi()
+ {
+
+ }
+
+ ///
+ /// 初始化TileSet数据
+ ///
+ public void InitData(TileSetSplit tileSetSplit)
+ {
+ TileSetSplit = tileSetSplit;
+ //初始化Source下拉框
+ var optionButton = S_SourceOption.Instance;
+ foreach (var sourceInfo in tileSetSplit.TileSetInfo.Sources)
+ {
+ optionButton.AddItem(sourceInfo.Name);
+ }
+
+ optionButton.Selected = 0;
+ OnChangeSource(0);
+ }
+
+ // 切换选中的资源
+ private void OnChangeSource(long index)
+ {
+ SourceIndex = (int)index;
+ if (index >= 0)
+ {
+ var sourceInfo = TileSetSourceInfo;
+ //单格页签纹理
+ S_Tab1.Instance.SetImage(sourceInfo.GetSourceImage());
+ //地形页签
+ S_Tab2.Instance.RefreshTerrain(sourceInfo);
+ }
+ }
+
+ //切换笔刷类型
+ private void OnChangeBrush(long index)
+ {
+ var v1 = false;
+ var v2 = false;
+ var v3 = false;
+ if (index == 0) //单格
+ {
+ v1 = true;
+ }
+ else if (index == 1) //地形
+ {
+ v2 = true;
+ }
+ else if (index == 2) //组合
+ {
+ v3 = true;
+ }
+
+ S_Tab1.Instance.Visible = v1;
+ S_Tab2.Instance.Visible = v2;
+ S_Tab3.Instance.Visible = v3;
+ }
+}
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/SingleTileTab.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/SingleTileTab.cs
new file mode 100644
index 0000000..9b4fdaa
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/SingleTileTab.cs
@@ -0,0 +1,40 @@
+using Godot;
+
+namespace UI.MapEditorMapTile;
+
+///
+/// 单格笔刷页签
+///
+public partial class SingleTileTab : EditorGridBg
+{
+ private ImageTexture _texture;
+
+ public override void SetUiNode(IUiNode uiNode)
+ {
+ base.SetUiNode(uiNode);
+ InitNode(UiNode.L_TabRoot.Instance, UiNode.L_Grid.Instance);
+ _texture = new ImageTexture();
+ UiNode.L_TabRoot.L_TileSprite.Instance.Texture = _texture;
+
+ //聚焦按钮
+ UiNode.L_FocusBtn.Instance.Pressed += OnFocusClick;
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ _texture.Dispose();
+ }
+
+ public void SetImage(Image image)
+ {
+ _texture.SetImage(image);
+ }
+
+ //聚焦按钮点击
+ private void OnFocusClick()
+ {
+ var texture = UiNode.L_TabRoot.L_TileSprite.Instance.Texture;
+ Utils.DoFocusNode(ContainerRoot, Size, texture != null ? texture.GetSize() : Vector2.Zero);
+ RefreshGridTrans();
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/TerrainCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/TerrainCell.cs
new file mode 100644
index 0000000..f5b7f6c
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/TerrainCell.cs
@@ -0,0 +1,30 @@
+namespace UI.MapEditorMapTile;
+
+///
+/// 地形选项, Data 为 TileSetTerrainInfo 的 index
+///
+public class TerrainCell : UiCell
+{
+ public TileSetTerrainInfo TileSetTerrainInfo;
+
+ public override void OnInit()
+ {
+ CellNode.L_Select.Instance.Visible = false;
+ }
+
+ public override void OnSetData(int data)
+ {
+ TileSetTerrainInfo = CellNode.UiPanel.TileSetSourceInfo.Terrain[data];
+ CellNode.L_TerrainName.Instance.Text = TileSetTerrainInfo.Name;
+ }
+
+ public override void OnSelect()
+ {
+ CellNode.L_Select.Instance.Visible = true;
+ }
+
+ public override void OnUnSelect()
+ {
+ CellNode.L_Select.Instance.Visible = false;
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/TerrainTileTab.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/TerrainTileTab.cs
new file mode 100644
index 0000000..1bad5af
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/TerrainTileTab.cs
@@ -0,0 +1,37 @@
+using Godot;
+
+namespace UI.MapEditorMapTile;
+
+///
+/// 地形笔刷页签
+///
+public partial class TerrainTileTab : Control, IUiNodeScript
+{
+ private MapEditorMapTile.Tab2 _uiNode;
+
+ private UiGrid _uiGrid;
+
+ public void SetUiNode(IUiNode uiNode)
+ {
+ _uiNode = (MapEditorMapTile.Tab2)uiNode;
+ _uiGrid = _uiNode.UiPanel.CreateUiGrid(_uiNode.L_ScrollContainer.L_TerrainItem);
+ _uiGrid.SetColumns(1);
+ _uiGrid.SetCellOffset(new Vector2I(0, 8));
+ _uiGrid.SetHorizontalExpand(true);
+ }
+
+ public void OnDestroy()
+ {
+
+ }
+
+ public void RefreshTerrain(TileSetSourceInfo sourceInfo)
+ {
+ _uiGrid.RemoveAll();
+ var start = _uiNode.UiPanel.SourceIndex == 0 ? 1 : 0; //跳过 Main Source 中的 Main Terrain
+ for (var i = start; i < sourceInfo.Terrain.Count; i++)
+ {
+ _uiGrid.Add(i);
+ }
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs
index a49962a..aaca269 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs
@@ -101,14 +101,14 @@
///
/// 选择地图并打开地图编辑器
///
- public void OpenSelectRoom(DungeonRoomSplit room)
+ public void OpenSelectRoom(DungeonRoomSplit room, TileSetSplit tileSetSplit)
{
HideUi();
//创建地牢Ui
var mapEditor = UiManager.Create_MapEditor();
mapEditor.PrevUi = this;
//加载地牢
- mapEditor.LoadMap(room);
+ mapEditor.LoadMap(room, tileSetSplit);
//打开Ui
mapEditor.ShowUi();
}
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs
index 878061a..8f116b7 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs
@@ -1,4 +1,6 @@
+using System.Linq;
using Godot;
+using UI.TileSetEditor;
namespace UI.MapEditorProject;
@@ -45,8 +47,23 @@
public override void OnDoubleClick()
{
- //打开房间编辑器
- CellNode.UiPanel.OpenSelectRoom(Data);
+ //打开房间编辑器, 临时处理加载TileSet
+ var tileSetSplit = GameApplication.Instance.TileSetConfig.First().Value;
+ //判断tileSet是否可以使用
+ if (string.IsNullOrEmpty(tileSetSplit.TileSetInfo.Sources[0].SourcePath))
+ {
+ EditorWindowManager.ShowConfirm("错误", "当前房间绑定的 TileSet 中 Main Source 未被赋予纹理数据!\n是否前往编辑 TileSet?", (v) =>
+ {
+ if (v)
+ {
+ //跳转编辑TileSet页面
+ var tileSetEditorPanel = CellNode.UiPanel.OpenNextUi(UiManager.UiNames.TileSetEditor);
+ tileSetEditorPanel.InitData(tileSetSplit);
+ }
+ });
+ return;
+ }
+ CellNode.UiPanel.OpenSelectRoom(Data, tileSetSplit);
}
public override void OnSelect()
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditor.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditor.cs
index eb9b76b..624b834 100644
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditor.cs
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditor.cs
@@ -197,15 +197,6 @@
}
///
- /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab.Select
- ///
- public class Select : UiNode
- {
- public Select(TileSetEditorPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { }
- public override Select Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate());
- }
-
- ///
/// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab.ErrorIcon
///
public class ErrorIcon : UiNode
@@ -215,24 +206,20 @@
}
///
+ /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab.Select
+ ///
+ public class Select : UiNode
+ {
+ public Select(TileSetEditorPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { }
+ public override Select Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate());
+ }
+
+ ///
/// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab
///
public class Tab : UiNode
{
///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Select
- ///
- public Select L_Select
- {
- get
- {
- if (_L_Select == null) _L_Select = new Select(UiPanel, Instance.GetNode("Select"));
- return _L_Select;
- }
- }
- private Select _L_Select;
-
- ///
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.ErrorIcon
///
public ErrorIcon L_ErrorIcon
@@ -245,6 +232,19 @@
}
private ErrorIcon _L_ErrorIcon;
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Select
+ ///
+ public Select L_Select
+ {
+ get
+ {
+ if (_L_Select == null) _L_Select = new Select(UiPanel, Instance.GetNode("Select"));
+ return _L_Select;
+ }
+ }
+ private Select _L_Select;
+
public Tab(TileSetEditorPanel uiPanel, Godot.Button node) : base(uiPanel, node) { }
public override Tab Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
}
@@ -502,16 +502,16 @@
public ColorRect S_ColorRect => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_ColorRect;
///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab.Select
- ///
- public Select S_Select => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_ScrollContainer.L_Tab.L_Select;
-
- ///
/// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab.ErrorIcon
///
public ErrorIcon S_ErrorIcon => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_ScrollContainer.L_Tab.L_ErrorIcon;
///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab.Select
+ ///
+ public Select S_Select => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_ScrollContainer.L_Tab.L_Select;
+
+ ///
/// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab
///
public Tab S_Tab => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_ScrollContainer.L_Tab;