diff --git a/DungeonShooting_Godot/prefab/ui/TileSetEditorCombination.tscn b/DungeonShooting_Godot/prefab/ui/TileSetEditorCombination.tscn
new file mode 100644
index 0000000..383b76c
--- /dev/null
+++ b/DungeonShooting_Godot/prefab/ui/TileSetEditorCombination.tscn
@@ -0,0 +1,255 @@
+[gd_scene load_steps=11 format=3 uid="uid://daias2tkvj20c"]
+
+[ext_resource type="Script" path="res://src/game/ui/tileSetEditorCombination/TileSetEditorCombinationPanel.cs" id="1_to1lc"]
+[ext_resource type="Script" path="res://src/game/ui/tileSetEditorCombination/leftBottom/TileEditArea.cs" id="2_h43yx"]
+[ext_resource type="Shader" path="res://resource/material/Grid.gdshader" id="2_t1p2n"]
+[ext_resource type="Texture2D" uid="uid://uhhfgdhpk7i4" path="res://icon.png" id="2_wr143"]
+[ext_resource type="Script" path="res://src/game/ui/tileSetEditorCombination/leftBottom/MaskBrush.cs" id="4_ytys0"]
+[ext_resource type="Script" path="res://src/game/ui/tileSetEditorCombination/leftTop/TileEditCombination.cs" id="6_bb3jf"]
+[ext_resource type="Texture2D" uid="uid://bn47bmilcw4x0" path="res://resource/sprite/ui/commonIcon/Select2.png" id="6_g5ey6"]
+[ext_resource type="Script" path="res://src/game/ui/tileSetEditorCombination/right/TileSelected.cs" id="6_gql80"]
+
+[sub_resource type="ShaderMaterial" id="ShaderMaterial_df7va"]
+resource_local_to_scene = true
+shader = ExtResource("2_t1p2n")
+shader_parameter/color = Color(0.529412, 0.529412, 0.529412, 0.0431373)
+shader_parameter/size = Vector2(1334, 1076)
+shader_parameter/line_width = 2
+shader_parameter/offset = Vector2(0, 0)
+shader_parameter/grid_size = 16.0
+
+[sub_resource type="ShaderMaterial" id="ShaderMaterial_llwpd"]
+resource_local_to_scene = true
+shader = ExtResource("2_t1p2n")
+shader_parameter/color = Color(0.529412, 0.529412, 0.529412, 0.0431373)
+shader_parameter/size = Vector2(1334, 1076)
+shader_parameter/line_width = 2
+shader_parameter/offset = Vector2(0, 0)
+shader_parameter/grid_size = 16.0
+
+[node name="TileSetEditorCombination" 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_to1lc")
+
+[node name="HSplitContainer" type="HSplitContainer" parent="."]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+
+[node name="VSplitContainer" type="VSplitContainer" parent="HSplitContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_stretch_ratio = 69.0
+
+[node name="LeftTop" type="Panel" parent="HSplitContainer/VSplitContainer"]
+layout_mode = 2
+size_flags_vertical = 3
+size_flags_stretch_ratio = 31.0
+
+[node name="MarginContainer" type="MarginContainer" parent="HSplitContainer/VSplitContainer/LeftTop"]
+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="LeftTopBg" type="ColorRect" parent="HSplitContainer/VSplitContainer/LeftTop/MarginContainer"]
+clip_children = 2
+z_index = 1
+layout_mode = 2
+color = Color(0.203922, 0.203922, 0.203922, 1)
+script = ExtResource("6_bb3jf")
+
+[node name="CombinationRoot" type="Control" parent="HSplitContainer/VSplitContainer/LeftTop/MarginContainer/LeftTopBg"]
+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
+scale = Vector2(3, 3)
+mouse_filter = 2
+
+[node name="Grid" type="ColorRect" parent="HSplitContainer/VSplitContainer/LeftTop/MarginContainer/LeftTopBg"]
+material = SubResource("ShaderMaterial_df7va")
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+mouse_filter = 2
+
+[node name="LeftBottom" type="Panel" parent="HSplitContainer/VSplitContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_vertical = 3
+size_flags_stretch_ratio = 68.0
+
+[node name="MarginContainer" type="MarginContainer" parent="HSplitContainer/VSplitContainer/LeftBottom"]
+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="LeftBottomBg" type="ColorRect" parent="HSplitContainer/VSplitContainer/LeftBottom/MarginContainer"]
+clip_children = 2
+z_index = 1
+layout_mode = 2
+color = Color(0.203922, 0.203922, 0.203922, 1)
+script = ExtResource("2_h43yx")
+
+[node name="TileTexture" type="TextureRect" parent="HSplitContainer/VSplitContainer/LeftBottom/MarginContainer/LeftBottomBg"]
+layout_mode = 1
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -32.0
+offset_top = -32.0
+offset_right = 32.0
+offset_bottom = 32.0
+grow_horizontal = 2
+grow_vertical = 2
+scale = Vector2(2, 2)
+mouse_filter = 2
+texture = ExtResource("2_wr143")
+
+[node name="MaskRoot" type="Control" parent="HSplitContainer/VSplitContainer/LeftBottom/MarginContainer/LeftBottomBg/TileTexture"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+mouse_filter = 2
+
+[node name="MaskRect" type="ColorRect" parent="HSplitContainer/VSplitContainer/LeftBottom/MarginContainer/LeftBottomBg/TileTexture/MaskRoot"]
+layout_mode = 1
+offset_right = 16.0
+offset_bottom = 16.0
+mouse_filter = 2
+color = Color(0, 0, 0, 0.588235)
+
+[node name="MaskBrush" type="Control" parent="HSplitContainer/VSplitContainer/LeftBottom/MarginContainer/LeftBottomBg/TileTexture"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+mouse_filter = 2
+script = ExtResource("4_ytys0")
+
+[node name="Grid" type="ColorRect" parent="HSplitContainer/VSplitContainer/LeftBottom/MarginContainer/LeftBottomBg"]
+material = SubResource("ShaderMaterial_llwpd")
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+mouse_filter = 2
+
+[node name="Right" type="Panel" parent="HSplitContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_stretch_ratio = 31.0
+
+[node name="MarginContainer" type="MarginContainer" parent="HSplitContainer/Right"]
+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="RightBg" type="VBoxContainer" parent="HSplitContainer/Right/MarginContainer"]
+layout_mode = 2
+script = ExtResource("6_gql80")
+
+[node name="Label" type="Label" parent="HSplitContainer/Right/MarginContainer/RightBg"]
+layout_mode = 2
+text = "已经导入的组合(双击移除):"
+
+[node name="ScrollContainer" type="ScrollContainer" parent="HSplitContainer/Right/MarginContainer/RightBg"]
+layout_mode = 2
+size_flags_vertical = 3
+
+[node name="CellButton" type="Button" parent="HSplitContainer/Right/MarginContainer/RightBg/ScrollContainer"]
+custom_minimum_size = Vector2(120, 160)
+layout_mode = 2
+
+[node name="PreviewImage" type="TextureRect" parent="HSplitContainer/Right/MarginContainer/RightBg/ScrollContainer/CellButton"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+offset_left = 2.0
+offset_top = 2.0
+offset_right = -2.0
+offset_bottom = -42.0
+grow_horizontal = 2
+grow_vertical = 2
+mouse_filter = 2
+stretch_mode = 5
+
+[node name="CellId" type="Label" parent="HSplitContainer/Right/MarginContainer/RightBg/ScrollContainer/CellButton"]
+layout_mode = 1
+anchors_preset = 12
+anchor_top = 1.0
+anchor_right = 1.0
+anchor_bottom = 1.0
+offset_top = -27.0
+offset_bottom = -3.0
+grow_horizontal = 2
+grow_vertical = 0
+text = "#999"
+horizontal_alignment = 1
+vertical_alignment = 1
+clip_text = true
+text_overrun_behavior = 1
+
+[node name="SelectTexture" type="NinePatchRect" parent="HSplitContainer/Right/MarginContainer/RightBg/ScrollContainer/CellButton"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+texture = ExtResource("6_g5ey6")
+region_rect = Rect2(0, 0, 36, 36)
+patch_margin_left = 3
+patch_margin_top = 3
+patch_margin_right = 3
+patch_margin_bottom = 3
diff --git a/DungeonShooting_Godot/prefab/ui/TileSetEditorSegment.tscn b/DungeonShooting_Godot/prefab/ui/TileSetEditorSegment.tscn
deleted file mode 100644
index 760796b..0000000
--- a/DungeonShooting_Godot/prefab/ui/TileSetEditorSegment.tscn
+++ /dev/null
@@ -1,189 +0,0 @@
-[gd_scene load_steps=9 format=3 uid="uid://daias2tkvj20c"]
-
-[ext_resource type="Script" path="res://src/game/ui/tileSetEditorSegment/TileSetEditorSegmentPanel.cs" id="1_to1lc"]
-[ext_resource type="Script" path="res://src/game/ui/tileSetEditorSegment/TileEditArea.cs" id="2_h43yx"]
-[ext_resource type="Shader" path="res://resource/material/Grid.gdshader" id="2_t1p2n"]
-[ext_resource type="Texture2D" uid="uid://uhhfgdhpk7i4" path="res://icon.png" id="2_wr143"]
-[ext_resource type="Script" path="res://src/game/ui/tileSetEditorSegment/MaskBrush.cs" id="4_ytys0"]
-[ext_resource type="Texture2D" uid="uid://bn47bmilcw4x0" path="res://resource/sprite/ui/commonIcon/Select2.png" id="6_g5ey6"]
-[ext_resource type="Script" path="res://src/game/ui/tileSetEditorSegment/TileSelected.cs" id="6_gql80"]
-
-[sub_resource type="ShaderMaterial" id="ShaderMaterial_u3xqn"]
-shader = ExtResource("2_t1p2n")
-shader_parameter/color = Color(0.529412, 0.529412, 0.529412, 0.0431373)
-shader_parameter/size = Vector2(1334, 1076)
-shader_parameter/line_width = 2
-shader_parameter/offset = Vector2(0, 0)
-shader_parameter/grid_size = 16.0
-
-[node name="TileSetEditorSegment" 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_to1lc")
-
-[node name="HSplitContainer" type="HSplitContainer" parent="."]
-layout_mode = 1
-anchors_preset = 15
-anchor_right = 1.0
-anchor_bottom = 1.0
-grow_horizontal = 2
-grow_vertical = 2
-
-[node name="Left" type="Panel" parent="HSplitContainer"]
-layout_mode = 2
-size_flags_horizontal = 3
-size_flags_stretch_ratio = 68.0
-
-[node name="MarginContainer" type="MarginContainer" parent="HSplitContainer/Left"]
-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="LeftBg" type="ColorRect" parent="HSplitContainer/Left/MarginContainer"]
-clip_children = 2
-z_index = 1
-layout_mode = 2
-color = Color(0.203922, 0.203922, 0.203922, 1)
-script = ExtResource("2_h43yx")
-
-[node name="TileTexture" type="TextureRect" parent="HSplitContainer/Left/MarginContainer/LeftBg"]
-layout_mode = 1
-anchors_preset = 8
-anchor_left = 0.5
-anchor_top = 0.5
-anchor_right = 0.5
-anchor_bottom = 0.5
-offset_left = -32.0
-offset_top = -32.0
-offset_right = 32.0
-offset_bottom = 32.0
-grow_horizontal = 2
-grow_vertical = 2
-scale = Vector2(2, 2)
-mouse_filter = 2
-texture = ExtResource("2_wr143")
-
-[node name="MaskRoot" type="Control" parent="HSplitContainer/Left/MarginContainer/LeftBg/TileTexture"]
-layout_mode = 1
-anchors_preset = 15
-anchor_right = 1.0
-anchor_bottom = 1.0
-grow_horizontal = 2
-grow_vertical = 2
-mouse_filter = 2
-
-[node name="MaskRect" type="ColorRect" parent="HSplitContainer/Left/MarginContainer/LeftBg/TileTexture/MaskRoot"]
-layout_mode = 1
-offset_right = 16.0
-offset_bottom = 16.0
-mouse_filter = 2
-color = Color(0, 0, 0, 0.588235)
-
-[node name="MaskBrush" type="Control" parent="HSplitContainer/Left/MarginContainer/LeftBg/TileTexture"]
-layout_mode = 1
-anchors_preset = 15
-anchor_right = 1.0
-anchor_bottom = 1.0
-grow_horizontal = 2
-grow_vertical = 2
-mouse_filter = 2
-script = ExtResource("4_ytys0")
-
-[node name="Grid" type="ColorRect" parent="HSplitContainer/Left/MarginContainer/LeftBg"]
-material = SubResource("ShaderMaterial_u3xqn")
-layout_mode = 1
-anchors_preset = 15
-anchor_right = 1.0
-anchor_bottom = 1.0
-grow_horizontal = 2
-grow_vertical = 2
-mouse_filter = 2
-
-[node name="Right" type="Panel" parent="HSplitContainer"]
-layout_mode = 2
-size_flags_horizontal = 3
-size_flags_stretch_ratio = 31.0
-
-[node name="MarginContainer" type="MarginContainer" parent="HSplitContainer/Right"]
-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="RightBg" type="VBoxContainer" parent="HSplitContainer/Right/MarginContainer"]
-layout_mode = 2
-script = ExtResource("6_gql80")
-
-[node name="Label" type="Label" parent="HSplitContainer/Right/MarginContainer/RightBg"]
-layout_mode = 2
-text = "已经导入的图块(双击移除):"
-
-[node name="ScrollContainer" type="ScrollContainer" parent="HSplitContainer/Right/MarginContainer/RightBg"]
-layout_mode = 2
-size_flags_vertical = 3
-
-[node name="CellButton" type="Button" parent="HSplitContainer/Right/MarginContainer/RightBg/ScrollContainer"]
-custom_minimum_size = Vector2(120, 145)
-layout_mode = 2
-
-[node name="PreviewImage" type="TextureRect" parent="HSplitContainer/Right/MarginContainer/RightBg/ScrollContainer/CellButton"]
-layout_mode = 1
-anchors_preset = 15
-anchor_right = 1.0
-anchor_bottom = 1.0
-offset_left = 2.0
-offset_top = 2.0
-offset_right = -2.0
-offset_bottom = -27.0
-grow_horizontal = 2
-grow_vertical = 2
-mouse_filter = 2
-stretch_mode = 5
-
-[node name="CellId" type="Label" parent="HSplitContainer/Right/MarginContainer/RightBg/ScrollContainer/CellButton"]
-layout_mode = 1
-anchors_preset = 12
-anchor_top = 1.0
-anchor_right = 1.0
-anchor_bottom = 1.0
-offset_top = -27.0
-offset_bottom = -3.0
-grow_horizontal = 2
-grow_vertical = 0
-theme_override_font_sizes/font_size = 16
-text = "(0,0)"
-horizontal_alignment = 1
-vertical_alignment = 1
-clip_text = true
-text_overrun_behavior = 1
-
-[node name="SelectTexture" type="NinePatchRect" parent="HSplitContainer/Right/MarginContainer/RightBg/ScrollContainer/CellButton"]
-layout_mode = 1
-anchors_preset = 15
-anchor_right = 1.0
-anchor_bottom = 1.0
-grow_horizontal = 2
-grow_vertical = 2
-texture = ExtResource("6_g5ey6")
-region_rect = Rect2(0, 0, 36, 36)
-patch_margin_left = 3
-patch_margin_top = 3
-patch_margin_right = 3
-patch_margin_bottom = 3
diff --git a/DungeonShooting_Godot/src/game/event/EventEnum.cs b/DungeonShooting_Godot/src/game/event/EventEnum.cs
index bb4fb22..7cab6b1 100644
--- a/DungeonShooting_Godot/src/game/event/EventEnum.cs
+++ b/DungeonShooting_Godot/src/game/event/EventEnum.cs
@@ -157,11 +157,11 @@
///
OnSetTileSetBgColor,
///
- /// 导入选中的Cell图块, 参数为
+ /// 选中组合模式下的Cell图块, 参数为
///
- OnImportTileCell,
+ OnSelectContainerCell,
///
- /// 移除选中的Cell图块, 参数为
+ /// 清除组合模式下的Cell图块
///
- OnRemoveTileCell,
+ OnClearContainerCell,
}
diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
index f20e1ee..c77d205 100644
--- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
+++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
@@ -85,9 +85,9 @@
public const string prefab_ui_Setting_tscn = "res://prefab/ui/Setting.tscn";
public const string prefab_ui_Settlement_tscn = "res://prefab/ui/Settlement.tscn";
public const string prefab_ui_TileSetEditor_tscn = "res://prefab/ui/TileSetEditor.tscn";
+ public const string prefab_ui_TileSetEditorCombination_tscn = "res://prefab/ui/TileSetEditorCombination.tscn";
public const string prefab_ui_TileSetEditorImport_tscn = "res://prefab/ui/TileSetEditorImport.tscn";
public const string prefab_ui_TileSetEditorProject_tscn = "res://prefab/ui/TileSetEditorProject.tscn";
- public const string prefab_ui_TileSetEditorSegment_tscn = "res://prefab/ui/TileSetEditorSegment.tscn";
public const string prefab_ui_TileSetEditorTerrain_tscn = "res://prefab/ui/TileSetEditorTerrain.tscn";
public const string prefab_weapon_Weapon0001_tscn = "res://prefab/weapon/Weapon0001.tscn";
public const string prefab_weapon_Weapon0002_tscn = "res://prefab/weapon/Weapon0002.tscn";
diff --git a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs
index d24d818..b4eb5bf 100644
--- a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs
+++ b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs
@@ -29,9 +29,9 @@
public const string Setting = "Setting";
public const string Settlement = "Settlement";
public const string TileSetEditor = "TileSetEditor";
+ public const string TileSetEditorCombination = "TileSetEditorCombination";
public const string TileSetEditorImport = "TileSetEditorImport";
public const string TileSetEditorProject = "TileSetEditorProject";
- public const string TileSetEditorSegment = "TileSetEditorSegment";
public const string TileSetEditorTerrain = "TileSetEditorTerrain";
}
@@ -1188,6 +1188,54 @@
}
///
+ /// 创建 TileSetEditorCombination, 并返回UI实例, 该函数不会打开 Ui
+ ///
+ public static UI.TileSetEditorCombination.TileSetEditorCombinationPanel Create_TileSetEditorCombination()
+ {
+ return CreateUi(UiNames.TileSetEditorCombination);
+ }
+
+ ///
+ /// 打开 TileSetEditorCombination, 并返回UI实例
+ ///
+ public static UI.TileSetEditorCombination.TileSetEditorCombinationPanel Open_TileSetEditorCombination()
+ {
+ return OpenUi(UiNames.TileSetEditorCombination);
+ }
+
+ ///
+ /// 隐藏 TileSetEditorCombination 的所有实例
+ ///
+ public static void Hide_TileSetEditorCombination()
+ {
+ var uiInstance = Get_TileSetEditorCombination_Instance();
+ foreach (var uiPanel in uiInstance)
+ {
+ uiPanel.HideUi();
+ }
+ }
+
+ ///
+ /// 销毁 TileSetEditorCombination 的所有实例
+ ///
+ public static void Destroy_TileSetEditorCombination()
+ {
+ var uiInstance = Get_TileSetEditorCombination_Instance();
+ foreach (var uiPanel in uiInstance)
+ {
+ uiPanel.Destroy();
+ }
+ }
+
+ ///
+ /// 获取所有 TileSetEditorCombination 的实例, 如果没有实例, 则返回一个空数组
+ ///
+ public static UI.TileSetEditorCombination.TileSetEditorCombinationPanel[] Get_TileSetEditorCombination_Instance()
+ {
+ return GetUiInstance(nameof(UI.TileSetEditorCombination.TileSetEditorCombination));
+ }
+
+ ///
/// 创建 TileSetEditorImport, 并返回UI实例, 该函数不会打开 Ui
///
public static UI.TileSetEditorImport.TileSetEditorImportPanel Create_TileSetEditorImport()
@@ -1284,54 +1332,6 @@
}
///
- /// 创建 TileSetEditorSegment, 并返回UI实例, 该函数不会打开 Ui
- ///
- public static UI.TileSetEditorSegment.TileSetEditorSegmentPanel Create_TileSetEditorSegment()
- {
- return CreateUi(UiNames.TileSetEditorSegment);
- }
-
- ///
- /// 打开 TileSetEditorSegment, 并返回UI实例
- ///
- public static UI.TileSetEditorSegment.TileSetEditorSegmentPanel Open_TileSetEditorSegment()
- {
- return OpenUi(UiNames.TileSetEditorSegment);
- }
-
- ///
- /// 隐藏 TileSetEditorSegment 的所有实例
- ///
- public static void Hide_TileSetEditorSegment()
- {
- var uiInstance = Get_TileSetEditorSegment_Instance();
- foreach (var uiPanel in uiInstance)
- {
- uiPanel.HideUi();
- }
- }
-
- ///
- /// 销毁 TileSetEditorSegment 的所有实例
- ///
- public static void Destroy_TileSetEditorSegment()
- {
- var uiInstance = Get_TileSetEditorSegment_Instance();
- foreach (var uiPanel in uiInstance)
- {
- uiPanel.Destroy();
- }
- }
-
- ///
- /// 获取所有 TileSetEditorSegment 的实例, 如果没有实例, 则返回一个空数组
- ///
- public static UI.TileSetEditorSegment.TileSetEditorSegmentPanel[] Get_TileSetEditorSegment_Instance()
- {
- return GetUiInstance(nameof(UI.TileSetEditorSegment.TileSetEditorSegment));
- }
-
- ///
/// 创建 TileSetEditorTerrain, 并返回UI实例, 该函数不会打开 Ui
///
public static UI.TileSetEditorTerrain.TileSetEditorTerrainPanel Create_TileSetEditorTerrain()
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs
index 2188e8e..d6d34fc 100644
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs
@@ -49,13 +49,13 @@
});
TabGrid.Add(new TileSetEditorTabData()
{
- Text = "图块",
- UiName = UiManager.UiNames.TileSetEditorSegment,
+ Text = "地形",
+ UiName = UiManager.UiNames.TileSetEditorTerrain,
});
TabGrid.Add(new TileSetEditorTabData()
{
- Text = "地形",
- UiName = UiManager.UiNames.TileSetEditorTerrain,
+ Text = "组合",
+ UiName = UiManager.UiNames.TileSetEditorCombination,
});
}
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/GridBg.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/GridBg.cs
new file mode 100644
index 0000000..4606c98
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/GridBg.cs
@@ -0,0 +1,119 @@
+using Godot;
+
+namespace UI.TileSetEditorCombination;
+
+public abstract partial class GridBg : ColorRect, IUiNodeScript where T : IUiNode
+{
+ public ColorRect Grid { get; protected set; }
+ public Control ContainerRoot { get; protected set; }
+ public T UiNode { get; private set; }
+
+ private DragBinder _dragBinder;
+
+ public virtual void SetUiNode(IUiNode uiNode)
+ {
+ UiNode = (T)uiNode;
+ _dragBinder = DragUiManager.BindDrag(this, "mouse_middle", OnDrag);
+ Resized += OnLeftBgResize;
+ }
+
+ public virtual void OnDestroy()
+ {
+ _dragBinder.UnBind();
+ }
+
+ ///
+ /// 当前Ui被显示出来时调用
+ ///
+ public void OnShow()
+ {
+ OnLeftBgResize();
+ }
+
+ public override void _UnhandledInput(InputEvent @event)
+ {
+ //Ui未打开
+ var uiPanel = UiNode.GetUiPanel();
+ if (!uiPanel.IsOpen)
+ {
+ return;
+ }
+ if (@event is InputEventMouseButton mouseButton)
+ {
+ if (uiPanel.IsOpen)
+ {
+ if (mouseButton.ButtonIndex == MouseButton.WheelDown)
+ {
+ if (GetGlobalRect().HasPoint(mouseButton.GlobalPosition))
+ {
+ //缩小
+ Shrink();
+ }
+ }
+ else if (mouseButton.ButtonIndex == MouseButton.WheelUp)
+ {
+ if (GetGlobalRect().HasPoint(mouseButton.GlobalPosition))
+ {
+ //放大
+ Magnify();
+ }
+ }
+ }
+ }
+ }
+
+ //缩小
+ private void Shrink()
+ {
+ var offset = ContainerRoot.GetLocalMousePosition();
+ var prevScale = ContainerRoot.Scale;
+ var newScale = prevScale / 1.1f;
+ if (newScale.LengthSquared() >= 0.5f)
+ {
+ ContainerRoot.Scale = newScale;
+ var position = ContainerRoot.Position + offset * 0.1f * newScale;
+ ContainerRoot.Position = position;
+ SetGridTransform(position, newScale.X);
+ }
+ }
+ //放大
+ private void Magnify()
+ {
+ var offset = ContainerRoot.GetLocalMousePosition();
+ var prevScale = ContainerRoot.Scale;
+ var newScale = prevScale * 1.1f;
+ if (newScale.LengthSquared() <= 2000)
+ {
+ ContainerRoot.Scale = newScale;
+ var position = ContainerRoot.Position - offset * 0.1f * prevScale;
+ ContainerRoot.Position = position;
+ SetGridTransform(position, newScale.X);
+ }
+ }
+
+ //拖拽回调
+ private void OnDrag(DragState state, Vector2 pos)
+ {
+ if (state == DragState.DragMove)
+ {
+ ContainerRoot.Position += pos;
+ OnLeftBgResize();
+ }
+ }
+
+
+ //背景宽度变化
+ private void OnLeftBgResize()
+ {
+ Grid.Material.SetShaderMaterialParameter(ShaderParamNames.Size, Size);
+ SetGridTransform(ContainerRoot.Position, ContainerRoot.Scale.X);
+ }
+
+ //设置网格位置和缩放
+ private void SetGridTransform(Vector2 pos, float scale)
+ {
+ Grid.Material.SetShaderMaterialParameter(ShaderParamNames.GridSize, GameConfig.TileCellSize * scale);
+ Grid.Material.SetShaderMaterialParameter(ShaderParamNames.Offset, -pos);
+ }
+
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/TileSetEditorCombination.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/TileSetEditorCombination.cs
new file mode 100644
index 0000000..9056d5b
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/TileSetEditorCombination.cs
@@ -0,0 +1,645 @@
+namespace UI.TileSetEditorCombination;
+
+///
+/// Ui代码, 该类是根据ui场景自动生成的, 请不要手动编辑该类, 以免造成代码丢失
+///
+public abstract partial class TileSetEditorCombination : UiBase
+{
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer
+ ///
+ public HSplitContainer L_HSplitContainer
+ {
+ get
+ {
+ if (_L_HSplitContainer == null) _L_HSplitContainer = new HSplitContainer((TileSetEditorCombinationPanel)this, GetNode("HSplitContainer"));
+ return _L_HSplitContainer;
+ }
+ }
+ private HSplitContainer _L_HSplitContainer;
+
+
+ public TileSetEditorCombination() : base(nameof(TileSetEditorCombination))
+ {
+ }
+
+ public sealed override void OnInitNestedUi()
+ {
+ _ = L_HSplitContainer.L_VSplitContainer.L_LeftTop.L_MarginContainer.L_LeftTopBg;
+ _ = L_HSplitContainer.L_VSplitContainer.L_LeftBottom.L_MarginContainer.L_LeftBottomBg;
+ _ = L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg;
+
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftTop.MarginContainer.LeftTopBg.CombinationRoot
+ ///
+ public class CombinationRoot : UiNode
+ {
+ public CombinationRoot(TileSetEditorCombinationPanel uiPanel, Godot.Control node) : base(uiPanel, node) { }
+ public override CombinationRoot Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftTop.MarginContainer.LeftTopBg.Grid
+ ///
+ public class Grid : UiNode
+ {
+ public Grid(TileSetEditorCombinationPanel uiPanel, Godot.ColorRect node) : base(uiPanel, node) { }
+ public override Grid Clone() => new (UiPanel, (Godot.ColorRect)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftTop.MarginContainer.LeftTopBg
+ ///
+ public class LeftTopBg : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftTop.MarginContainer.CombinationRoot
+ ///
+ public CombinationRoot L_CombinationRoot
+ {
+ get
+ {
+ if (_L_CombinationRoot == null) _L_CombinationRoot = new CombinationRoot(UiPanel, Instance.GetNode("CombinationRoot"));
+ return _L_CombinationRoot;
+ }
+ }
+ private CombinationRoot _L_CombinationRoot;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftTop.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;
+
+ public LeftTopBg(TileSetEditorCombinationPanel uiPanel, UI.TileSetEditorCombination.TileEditCombination node) : base(uiPanel, node) { }
+ public override LeftTopBg Clone() => new (UiPanel, (UI.TileSetEditorCombination.TileEditCombination)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftTop.MarginContainer
+ ///
+ public class MarginContainer : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftTop.LeftTopBg
+ ///
+ public LeftTopBg L_LeftTopBg
+ {
+ get
+ {
+ if (_L_LeftTopBg == null) _L_LeftTopBg = new LeftTopBg(UiPanel, Instance.GetNode("LeftTopBg"));
+ return _L_LeftTopBg;
+ }
+ }
+ private LeftTopBg _L_LeftTopBg;
+
+ public MarginContainer(TileSetEditorCombinationPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { }
+ public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftTop
+ ///
+ public class LeftTop : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.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 LeftTop(TileSetEditorCombinationPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { }
+ public override LeftTop Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.LeftBottomBg.TileTexture.MaskRoot.MaskRect
+ ///
+ public class MaskRect : UiNode
+ {
+ public MaskRect(TileSetEditorCombinationPanel uiPanel, Godot.ColorRect node) : base(uiPanel, node) { }
+ public override MaskRect Clone() => new (UiPanel, (Godot.ColorRect)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.LeftBottomBg.TileTexture.MaskRoot
+ ///
+ public class MaskRoot : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.LeftBottomBg.TileTexture.MaskRect
+ ///
+ public MaskRect L_MaskRect
+ {
+ get
+ {
+ if (_L_MaskRect == null) _L_MaskRect = new MaskRect(UiPanel, Instance.GetNode("MaskRect"));
+ return _L_MaskRect;
+ }
+ }
+ private MaskRect _L_MaskRect;
+
+ public MaskRoot(TileSetEditorCombinationPanel uiPanel, Godot.Control node) : base(uiPanel, node) { }
+ public override MaskRoot Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.LeftBottomBg.TileTexture.MaskBrush
+ ///
+ public class MaskBrush : UiNode
+ {
+ public MaskBrush(TileSetEditorCombinationPanel uiPanel, UI.TileSetEditorCombination.MaskBrush node) : base(uiPanel, node) { }
+ public override MaskBrush Clone() => new (UiPanel, (UI.TileSetEditorCombination.MaskBrush)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.LeftBottomBg.TileTexture
+ ///
+ public class TileTexture : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.LeftBottomBg.MaskRoot
+ ///
+ public MaskRoot L_MaskRoot
+ {
+ get
+ {
+ if (_L_MaskRoot == null) _L_MaskRoot = new MaskRoot(UiPanel, Instance.GetNode("MaskRoot"));
+ return _L_MaskRoot;
+ }
+ }
+ private MaskRoot _L_MaskRoot;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.LeftBottomBg.MaskBrush
+ ///
+ public MaskBrush L_MaskBrush
+ {
+ get
+ {
+ if (_L_MaskBrush == null) _L_MaskBrush = new MaskBrush(UiPanel, Instance.GetNode("MaskBrush"));
+ return _L_MaskBrush;
+ }
+ }
+ private MaskBrush _L_MaskBrush;
+
+ public TileTexture(TileSetEditorCombinationPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { }
+ public override TileTexture Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.LeftBottomBg.Grid
+ ///
+ public class Grid_1 : UiNode
+ {
+ public Grid_1(TileSetEditorCombinationPanel uiPanel, Godot.ColorRect node) : base(uiPanel, node) { }
+ public override Grid_1 Clone() => new (UiPanel, (Godot.ColorRect)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.LeftBottomBg
+ ///
+ public class LeftBottomBg : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.TileTexture
+ ///
+ public TileTexture L_TileTexture
+ {
+ get
+ {
+ if (_L_TileTexture == null) _L_TileTexture = new TileTexture(UiPanel, Instance.GetNode("TileTexture"));
+ return _L_TileTexture;
+ }
+ }
+ private TileTexture _L_TileTexture;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.Grid
+ ///
+ public Grid_1 L_Grid
+ {
+ get
+ {
+ if (_L_Grid == null) _L_Grid = new Grid_1(UiPanel, Instance.GetNode("Grid"));
+ return _L_Grid;
+ }
+ }
+ private Grid_1 _L_Grid;
+
+ public LeftBottomBg(TileSetEditorCombinationPanel uiPanel, UI.TileSetEditorCombination.TileEditArea node) : base(uiPanel, node) { }
+ public override LeftBottomBg Clone() => new (UiPanel, (UI.TileSetEditorCombination.TileEditArea)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer
+ ///
+ public class MarginContainer_1 : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.LeftBottomBg
+ ///
+ public LeftBottomBg L_LeftBottomBg
+ {
+ get
+ {
+ if (_L_LeftBottomBg == null) _L_LeftBottomBg = new LeftBottomBg(UiPanel, Instance.GetNode("LeftBottomBg"));
+ return _L_LeftBottomBg;
+ }
+ }
+ private LeftBottomBg _L_LeftBottomBg;
+
+ public MarginContainer_1(TileSetEditorCombinationPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { }
+ public override MarginContainer_1 Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom
+ ///
+ public class LeftBottom : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.MarginContainer
+ ///
+ public MarginContainer_1 L_MarginContainer
+ {
+ get
+ {
+ if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer_1(UiPanel, Instance.GetNode("MarginContainer"));
+ return _L_MarginContainer;
+ }
+ }
+ private MarginContainer_1 _L_MarginContainer;
+
+ public LeftBottom(TileSetEditorCombinationPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { }
+ public override LeftBottom Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.VSplitContainer
+ ///
+ public class VSplitContainer : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.LeftTop
+ ///
+ public LeftTop L_LeftTop
+ {
+ get
+ {
+ if (_L_LeftTop == null) _L_LeftTop = new LeftTop(UiPanel, Instance.GetNode("LeftTop"));
+ return _L_LeftTop;
+ }
+ }
+ private LeftTop _L_LeftTop;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.LeftBottom
+ ///
+ public LeftBottom L_LeftBottom
+ {
+ get
+ {
+ if (_L_LeftBottom == null) _L_LeftBottom = new LeftBottom(UiPanel, Instance.GetNode("LeftBottom"));
+ return _L_LeftBottom;
+ }
+ }
+ private LeftBottom _L_LeftBottom;
+
+ public VSplitContainer(TileSetEditorCombinationPanel uiPanel, Godot.VSplitContainer node) : base(uiPanel, node) { }
+ public override VSplitContainer Clone() => new (UiPanel, (Godot.VSplitContainer)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.Label
+ ///
+ public class Label : UiNode
+ {
+ public Label(TileSetEditorCombinationPanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
+ public override Label Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton.PreviewImage
+ ///
+ public class PreviewImage : UiNode
+ {
+ public PreviewImage(TileSetEditorCombinationPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { }
+ public override PreviewImage Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton.CellId
+ ///
+ public class CellId : UiNode
+ {
+ public CellId(TileSetEditorCombinationPanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
+ public override CellId Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton.SelectTexture
+ ///
+ public class SelectTexture : UiNode
+ {
+ public SelectTexture(TileSetEditorCombinationPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { }
+ public override SelectTexture Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton
+ ///
+ public class CellButton : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.PreviewImage
+ ///
+ public PreviewImage L_PreviewImage
+ {
+ get
+ {
+ if (_L_PreviewImage == null) _L_PreviewImage = new PreviewImage(UiPanel, Instance.GetNode("PreviewImage"));
+ return _L_PreviewImage;
+ }
+ }
+ private PreviewImage _L_PreviewImage;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellId
+ ///
+ public CellId L_CellId
+ {
+ get
+ {
+ if (_L_CellId == null) _L_CellId = new CellId(UiPanel, Instance.GetNode("CellId"));
+ return _L_CellId;
+ }
+ }
+ private CellId _L_CellId;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.SelectTexture
+ ///
+ public SelectTexture L_SelectTexture
+ {
+ get
+ {
+ if (_L_SelectTexture == null) _L_SelectTexture = new SelectTexture(UiPanel, Instance.GetNode("SelectTexture"));
+ return _L_SelectTexture;
+ }
+ }
+ private SelectTexture _L_SelectTexture;
+
+ public CellButton(TileSetEditorCombinationPanel uiPanel, Godot.Button node) : base(uiPanel, node) { }
+ public override CellButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer
+ ///
+ public class ScrollContainer : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.CellButton
+ ///
+ public CellButton L_CellButton
+ {
+ get
+ {
+ if (_L_CellButton == null) _L_CellButton = new CellButton(UiPanel, Instance.GetNode("CellButton"));
+ return _L_CellButton;
+ }
+ }
+ private CellButton _L_CellButton;
+
+ public ScrollContainer(TileSetEditorCombinationPanel uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { }
+ public override ScrollContainer Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg
+ ///
+ public class RightBg : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.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 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right.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 RightBg(TileSetEditorCombinationPanel uiPanel, UI.TileSetEditorCombination.TileSelected node) : base(uiPanel, node) { }
+ public override RightBg Clone() => new (UiPanel, (UI.TileSetEditorCombination.TileSelected)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer
+ ///
+ public class MarginContainer_2 : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right.RightBg
+ ///
+ public RightBg L_RightBg
+ {
+ get
+ {
+ if (_L_RightBg == null) _L_RightBg = new RightBg(UiPanel, Instance.GetNode("RightBg"));
+ return _L_RightBg;
+ }
+ }
+ private RightBg _L_RightBg;
+
+ public MarginContainer_2(TileSetEditorCombinationPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { }
+ public override MarginContainer_2 Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer.Right
+ ///
+ public class Right : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.MarginContainer
+ ///
+ public MarginContainer_2 L_MarginContainer
+ {
+ get
+ {
+ if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer_2(UiPanel, Instance.GetNode("MarginContainer"));
+ return _L_MarginContainer;
+ }
+ }
+ private MarginContainer_2 _L_MarginContainer;
+
+ public Right(TileSetEditorCombinationPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { }
+ public override Right Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: TileSetEditorCombination.HSplitContainer
+ ///
+ public class HSplitContainer : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.VSplitContainer
+ ///
+ public VSplitContainer L_VSplitContainer
+ {
+ get
+ {
+ if (_L_VSplitContainer == null) _L_VSplitContainer = new VSplitContainer(UiPanel, Instance.GetNode("VSplitContainer"));
+ return _L_VSplitContainer;
+ }
+ }
+ private VSplitContainer _L_VSplitContainer;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorCombination.Right
+ ///
+ public Right L_Right
+ {
+ get
+ {
+ if (_L_Right == null) _L_Right = new Right(UiPanel, Instance.GetNode("Right"));
+ return _L_Right;
+ }
+ }
+ private Right _L_Right;
+
+ public HSplitContainer(TileSetEditorCombinationPanel uiPanel, Godot.HSplitContainer node) : base(uiPanel, node) { }
+ public override HSplitContainer Clone() => new (UiPanel, (Godot.HSplitContainer)Instance.Duplicate());
+ }
+
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftTop.MarginContainer.LeftTopBg.CombinationRoot
+ ///
+ public CombinationRoot S_CombinationRoot => L_HSplitContainer.L_VSplitContainer.L_LeftTop.L_MarginContainer.L_LeftTopBg.L_CombinationRoot;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftTop.MarginContainer.LeftTopBg
+ ///
+ public LeftTopBg S_LeftTopBg => L_HSplitContainer.L_VSplitContainer.L_LeftTop.L_MarginContainer.L_LeftTopBg;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftTop
+ ///
+ public LeftTop S_LeftTop => L_HSplitContainer.L_VSplitContainer.L_LeftTop;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.LeftBottomBg.TileTexture.MaskRoot.MaskRect
+ ///
+ public MaskRect S_MaskRect => L_HSplitContainer.L_VSplitContainer.L_LeftBottom.L_MarginContainer.L_LeftBottomBg.L_TileTexture.L_MaskRoot.L_MaskRect;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.LeftBottomBg.TileTexture.MaskRoot
+ ///
+ public MaskRoot S_MaskRoot => L_HSplitContainer.L_VSplitContainer.L_LeftBottom.L_MarginContainer.L_LeftBottomBg.L_TileTexture.L_MaskRoot;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.LeftBottomBg.TileTexture.MaskBrush
+ ///
+ public MaskBrush S_MaskBrush => L_HSplitContainer.L_VSplitContainer.L_LeftBottom.L_MarginContainer.L_LeftBottomBg.L_TileTexture.L_MaskBrush;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.LeftBottomBg.TileTexture
+ ///
+ public TileTexture S_TileTexture => L_HSplitContainer.L_VSplitContainer.L_LeftBottom.L_MarginContainer.L_LeftBottomBg.L_TileTexture;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom.MarginContainer.LeftBottomBg
+ ///
+ public LeftBottomBg S_LeftBottomBg => L_HSplitContainer.L_VSplitContainer.L_LeftBottom.L_MarginContainer.L_LeftBottomBg;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer.LeftBottom
+ ///
+ public LeftBottom S_LeftBottom => L_HSplitContainer.L_VSplitContainer.L_LeftBottom;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.VSplitContainer
+ ///
+ public VSplitContainer S_VSplitContainer => L_HSplitContainer.L_VSplitContainer;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.Label
+ ///
+ public Label S_Label => L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg.L_Label;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton.PreviewImage
+ ///
+ public PreviewImage S_PreviewImage => L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg.L_ScrollContainer.L_CellButton.L_PreviewImage;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton.CellId
+ ///
+ public CellId S_CellId => L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg.L_ScrollContainer.L_CellButton.L_CellId;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton.SelectTexture
+ ///
+ public SelectTexture S_SelectTexture => L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg.L_ScrollContainer.L_CellButton.L_SelectTexture;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton
+ ///
+ public CellButton S_CellButton => L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg.L_ScrollContainer.L_CellButton;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer
+ ///
+ public ScrollContainer S_ScrollContainer => L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg.L_ScrollContainer;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right.MarginContainer.RightBg
+ ///
+ public RightBg S_RightBg => L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer.Right
+ ///
+ public Right S_Right => L_HSplitContainer.L_Right;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorCombination.HSplitContainer
+ ///
+ public HSplitContainer S_HSplitContainer => L_HSplitContainer;
+
+}
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/TileSetEditorCombinationPanel.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/TileSetEditorCombinationPanel.cs
new file mode 100644
index 0000000..6a9e253
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/TileSetEditorCombinationPanel.cs
@@ -0,0 +1,61 @@
+using Godot;
+using UI.TileSetEditor;
+
+namespace UI.TileSetEditorCombination;
+
+public partial class TileSetEditorCombinationPanel : TileSetEditorCombination
+{
+ ///
+ /// 父Ui
+ ///
+ public TileSetEditorPanel EditorPanel;
+
+ public override void OnCreateUi()
+ {
+ EditorPanel = (TileSetEditorPanel)ParentUi;
+
+ //改变纹理事件
+ AddEventListener(EventEnum.OnSetTileTexture, OnSetTileTexture);
+ //改变背景颜色事件
+ AddEventListener(EventEnum.OnSetTileSetBgColor, OnSetTileSetBgColor);
+ }
+
+ public override void OnShowUi()
+ {
+ if (EditorPanel.Texture == null)
+ {
+ EditorWindowManager.ShowTips("警告", "请先导入纹理!", () =>
+ {
+ EditorPanel.TabGrid.SelectIndex = 0;
+ });
+ }
+
+ S_LeftTopBg.Instance.OnShow();
+ S_LeftBottomBg.Instance.OnShow();
+ }
+
+ public override void OnDestroyUi()
+ {
+
+ }
+
+ //改变TileSet纹理
+ private void OnSetTileTexture(object arg)
+ {
+ if (arg is Texture2D texture)
+ {
+ S_LeftBottomBg.Instance.OnChangeTileSetTexture(texture);
+ S_RightBg.Instance.OnChangeTileSetTexture(texture);
+ }
+ }
+
+ //改变TileSet背景颜色
+ private void OnSetTileSetBgColor(object arg)
+ {
+ //背景颜色
+ if (arg is Color color)
+ {
+ S_LeftTopBg.Instance.Color = color;
+ }
+ }
+}
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftBottom/MaskBrush.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftBottom/MaskBrush.cs
new file mode 100644
index 0000000..0dc9697
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftBottom/MaskBrush.cs
@@ -0,0 +1,44 @@
+using Godot;
+
+namespace UI.TileSetEditorCombination;
+
+public partial class MaskBrush : Control
+{
+ ///
+ /// 绑定的地图纹理节点
+ ///
+ public TextureRect TileTexture { get; set; }
+
+ ///
+ /// 绑定的TileSet编辑区域节点
+ ///
+ public TileEditArea TileEditArea { get; set; }
+
+ public override void _Process(double delta)
+ {
+ QueueRedraw();
+ }
+
+ public override void _Draw()
+ {
+ //绘制texture区域
+ if (TileTexture.Texture != null)
+ {
+ DrawRect(
+ new Rect2(Vector2.Zero, TileTexture.Size),
+ new Color(1, 1, 0, 0.5f), false,
+ 2f / TileTexture.Scale.X
+ );
+ }
+
+ //绘制鼠标悬停区域
+ if (TileTexture.IsMouseInRect())
+ {
+ var pos = TileEditArea.GetMouseCellPosition() * GameConfig.TileCellSize;
+ DrawRect(
+ new Rect2(pos,GameConfig.TileCellSizeVector2I),
+ Colors.Green, false, 3f / TileTexture.Scale.X
+ );
+ }
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftBottom/MaskRectCell.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftBottom/MaskRectCell.cs
new file mode 100644
index 0000000..284d596
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftBottom/MaskRectCell.cs
@@ -0,0 +1,34 @@
+using Godot;
+
+namespace UI.TileSetEditorCombination;
+
+public class MaskRectCell : UiCell
+{
+ public override void OnInit()
+ {
+ CellNode.Instance.Draw += OnDraw;
+ }
+
+ public override void OnSetData(bool data)
+ {
+ //选择当前cell时显示透明颜色
+ CellNode.Instance.Color = data ? new Color(0, 0, 0, 0) : new Color(0, 0, 0, 0.7f);
+ }
+
+ public override void Process(float delta)
+ {
+ CellNode.Instance.QueueRedraw();
+ }
+
+ private void OnDraw()
+ {
+ if (Data)
+ {
+ //选中时绘制轮廓
+ CellNode.Instance.DrawRect(
+ new Rect2(Vector2.Zero, CellNode.Instance.Size),
+ new Color(0, 1, 1), false, 2 / CellNode.UiPanel.S_TileTexture.Instance.Scale.X
+ );
+ }
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftBottom/TileEditArea.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftBottom/TileEditArea.cs
new file mode 100644
index 0000000..47c6b9c
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftBottom/TileEditArea.cs
@@ -0,0 +1,124 @@
+using System.Collections.Generic;
+using Godot;
+
+namespace UI.TileSetEditorCombination;
+
+public partial class TileEditArea : GridBg
+{
+ private UiGrid _maskGrid;
+ private readonly HashSet _useMask = new HashSet();
+
+ public override void SetUiNode(IUiNode uiNode)
+ {
+ base.SetUiNode(uiNode);
+ Grid = UiNode.L_Grid.Instance;
+ ContainerRoot = UiNode.L_TileTexture.Instance;
+
+ var maskBrush = UiNode.L_TileTexture.L_MaskBrush.Instance;
+ maskBrush.TileTexture = UiNode.L_TileTexture.Instance;
+ maskBrush.TileEditArea = this;
+
+ _maskGrid = new UiGrid(UiNode.L_TileTexture.L_MaskRoot.L_MaskRect, typeof(MaskRectCell));
+ _maskGrid.SetCellOffset(Vector2I.Zero);
+ _maskGrid.GridContainer.MouseFilter = MouseFilterEnum.Ignore;
+ }
+
+ public override void OnDestroy()
+ {
+ base.OnDestroy();
+ _maskGrid.Destroy();
+ }
+
+ public override void _Process(double delta)
+ {
+ //Ui未打开
+ if (!UiNode.UiPanel.IsOpen)
+ {
+ return;
+ }
+
+ if (Input.IsMouseButtonPressed(MouseButton.Left)) //左键选中
+ {
+ if (this.IsMouseInRect())
+ {
+ var cellPosition = GetMouseCellPosition();
+ if (UiNode.UiPanel.EditorPanel.IsCellPositionInTexture(cellPosition))
+ {
+ if (Input.IsActionJustPressed("mouse_left")) //刚按下, 清除之前的选中
+ {
+ OnRemoveCell();
+ }
+ OnSelectCell(cellPosition);
+ }
+ }
+ }
+ }
+
+ ///
+ /// 选中Cell图块
+ ///
+ private void OnSelectCell(Vector2I cell)
+ {
+ if (!_useMask.Contains(cell))
+ {
+ var cellIndex = UiNode.UiPanel.EditorPanel.CellPositionToIndex(cell);
+ var uiCell = _maskGrid.GetCell(cellIndex);
+ if (uiCell != null && !uiCell.Data)
+ {
+ _useMask.Add(cell);
+ uiCell.SetData(true);
+
+ EventManager.EmitEvent(EventEnum.OnSelectContainerCell, cell);
+ }
+ }
+ }
+
+ ///
+ /// 移除选中的Cell图块
+ ///
+ private void OnRemoveCell()
+ {
+ _useMask.Clear();
+ var count = _maskGrid.Count;
+ for (var i = 0; i < count; i++)
+ {
+ var uiCell = _maskGrid.GetCell(i);
+ if (uiCell.Data)
+ {
+ uiCell.SetData(false);
+ }
+ }
+
+ EventManager.EmitEvent(EventEnum.OnClearContainerCell);
+ }
+
+ ///
+ /// 改变TileSet纹理
+ ///
+ public void OnChangeTileSetTexture(Texture2D texture)
+ {
+ UiNode.L_TileTexture.Instance.Texture = texture;
+ var width = UiNode.UiPanel.EditorPanel.CellHorizontal;
+ var height = UiNode.UiPanel.EditorPanel.CellVertical;
+ _maskGrid.RemoveAll();
+ _useMask.Clear();
+ _maskGrid.SetColumns(width);
+ for (var i = 0; i < width; i++)
+ {
+ for (var j = 0; j < height; j++)
+ {
+ _maskGrid.Add(false);
+ }
+ }
+ }
+
+ ///
+ /// 返回鼠标所在的单元格位置, 相对于纹理左上角
+ ///
+ public Vector2I GetMouseCellPosition()
+ {
+ var textureRect = UiNode.L_TileTexture.Instance;
+ var pos = textureRect.GetLocalMousePosition() / GameConfig.TileCellSize;
+ return pos.AsVector2I();
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftTop/TileEditCombination.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftTop/TileEditCombination.cs
new file mode 100644
index 0000000..7b7cc8e
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftTop/TileEditCombination.cs
@@ -0,0 +1,37 @@
+using System.Collections.Generic;
+using Godot;
+
+namespace UI.TileSetEditorCombination;
+
+public partial class TileEditCombination : GridBg
+{
+ private Dictionary _brushData;
+
+ public override void SetUiNode(IUiNode uiNode)
+ {
+ base.SetUiNode(uiNode);
+ Grid = UiNode.L_Grid.Instance;
+ ContainerRoot = UiNode.L_CombinationRoot.Instance;
+
+ UiNode.UiPanel.AddEventListener(EventEnum.OnSelectContainerCell, OnSelectContainerCell);
+ UiNode.UiPanel.AddEventListener(EventEnum.OnClearContainerCell, OnClearContainerCell);
+ }
+
+ private void OnSelectContainerCell(object obj)
+ {
+ if (obj is Vector2I cell)
+ {
+ var src = UiNode.UiPanel.EditorPanel.TextureImage;
+ var image = Image.Create(GameConfig.TileCellSize, GameConfig.TileCellSize, false, Image.Format.Rgba8);
+ image.BlitRect(src,
+ new Rect2I(cell * GameConfig.TileCellSizeVector2I, GameConfig.TileCellSize, GameConfig.TileCellSize),
+ Vector2I.Zero);
+ //UiNode.L_CombinationRoot.L_TextureRect.Instance.Texture = ImageTexture.CreateFromImage(image);;
+ }
+ }
+
+ private void OnClearContainerCell(object obj)
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/right/TileCell.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/right/TileCell.cs
new file mode 100644
index 0000000..d4148f2
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/right/TileCell.cs
@@ -0,0 +1,56 @@
+using Godot;
+
+namespace UI.TileSetEditorCombination;
+
+public class TileCell : UiCell
+{
+ private Image _image;
+ private ImageTexture _previewTexture;
+
+ public override void OnInit()
+ {
+ CellNode.L_SelectTexture.Instance.Visible = false;
+ _image = Image.Create(GameConfig.TileCellSize, GameConfig.TileCellSize, false, Image.Format.Rgba8);
+ _previewTexture = ImageTexture.CreateFromImage(_image);
+ CellNode.L_PreviewImage.Instance.Texture = _previewTexture;
+ }
+
+
+ public override void OnSetData(Vector2I data)
+ {
+ var image = CellNode.UiPanel.EditorPanel.TextureImage;
+ _image.BlitRect(image, new Rect2I(data * GameConfig.TileCellSizeVector2I, GameConfig.TileCellSizeVector2I), Vector2I.Zero);
+ _previewTexture.Update(_image);
+ CellNode.L_CellId.Instance.Text = data.ToString();
+ }
+
+ public override void OnDoubleClick()
+ {
+ //双击移除Cell数据
+ //EventManager.EmitEvent(EventEnum.OnRemoveTileCell, Data);
+ }
+
+ public override void OnDestroy()
+ {
+ _previewTexture.Dispose();
+ }
+
+ public override void OnSelect()
+ {
+ CellNode.L_SelectTexture.Instance.Visible = true;
+ }
+
+ public override void OnUnSelect()
+ {
+ CellNode.L_SelectTexture.Instance.Visible = false;
+ }
+
+ public override int OnSort(UiCell other)
+ {
+ if (Data.Y != other.Data.Y)
+ {
+ return Data.Y - other.Data.Y;
+ }
+ return Data.X - other.Data.X;
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/right/TileSelected.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/right/TileSelected.cs
new file mode 100644
index 0000000..3bb201d
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/right/TileSelected.cs
@@ -0,0 +1,63 @@
+using Godot;
+
+namespace UI.TileSetEditorCombination;
+
+public partial class TileSelected : VBoxContainer, IUiNodeScript
+{
+ private TileSetEditorCombination.RightBg _rightBg;
+ private UiGrid _grid;
+
+ public void SetUiNode(IUiNode uiNode)
+ {
+ _rightBg = (TileSetEditorCombination.RightBg)uiNode;
+
+ _grid = new UiGrid(_rightBg.L_ScrollContainer.L_CellButton, typeof(TileCell));
+ _grid.SetCellOffset(new Vector2I(5, 5));
+ _grid.SetAutoColumns(true);
+ _grid.SetHorizontalExpand(true);
+
+ // _rightBg.UiPanel.AddEventListener(EventEnum.OnImportTileCell, OnImportCell);
+ // _rightBg.UiPanel.AddEventListener(EventEnum.OnRemoveTileCell, OnRemoveCell);
+ }
+
+ ///
+ /// 导入选中的Cell图块
+ ///
+ private void OnImportCell(object obj)
+ {
+ if (obj is Vector2I cell)
+ {
+ _grid.Add(cell);
+ _grid.Sort();
+ }
+ }
+
+ ///
+ /// 移除选中的Cell图块
+ ///
+ private void OnRemoveCell(object obj)
+ {
+ if (obj is Vector2I cell)
+ {
+ var uiCell = _grid.Find(c => c.Data == cell);
+ if (uiCell != null)
+ {
+ _grid.RemoveByIndex(uiCell.Index);
+ }
+ }
+ }
+
+ public void OnDestroy()
+ {
+ _grid.Destroy();
+ }
+
+
+ ///
+ /// 改变TileSet纹理
+ ///
+ public void OnChangeTileSetTexture(Texture2D texture)
+ {
+ _grid.RemoveAll();
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/MaskBrush.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/MaskBrush.cs
deleted file mode 100644
index 636992d..0000000
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/MaskBrush.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using Godot;
-
-namespace UI.TileSetEditorSegment;
-
-public partial class MaskBrush : Control
-{
- ///
- /// 绑定的地图纹理节点
- ///
- public TextureRect TileTexture { get; set; }
-
- ///
- /// 绑定的TileSet编辑区域节点
- ///
- public TileEditArea TileEditArea { get; set; }
-
- public override void _Process(double delta)
- {
- QueueRedraw();
- }
-
- public override void _Draw()
- {
- //绘制texture区域
- if (TileTexture.Texture != null)
- {
- DrawRect(
- new Rect2(Vector2.Zero, TileTexture.Size),
- new Color(1, 1, 0, 0.5f), false,
- 2f / TileTexture.Scale.X
- );
- }
-
- //绘制鼠标悬停区域
- if (TileTexture.IsMouseInRect())
- {
- var pos = TileEditArea.GetMouseCellPosition() * GameConfig.TileCellSize;
- DrawRect(
- new Rect2(pos,GameConfig.TileCellSizeVector2I),
- Colors.Green, false, 3f / TileTexture.Scale.X
- );
- }
- }
-}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/MaskRectCell.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/MaskRectCell.cs
deleted file mode 100644
index 9336e91..0000000
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/MaskRectCell.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using Godot;
-
-namespace UI.TileSetEditorSegment;
-
-public class MaskRectCell : UiCell
-{
- public override void OnInit()
- {
- CellNode.Instance.Draw += OnDraw;
- }
-
- public override void OnSetData(bool data)
- {
- //选择当前cell时显示透明颜色
- CellNode.Instance.Color = data ? new Color(0, 0, 0, 0) : new Color(0, 0, 0, 0.7f);
- }
-
- public override void Process(float delta)
- {
- CellNode.Instance.QueueRedraw();
- }
-
- private void OnDraw()
- {
- if (Data)
- {
- //选中时绘制轮廓
- CellNode.Instance.DrawRect(
- new Rect2(Vector2.Zero, CellNode.Instance.Size),
- new Color(0, 1, 1), false, 2 / CellNode.UiPanel.S_TileTexture.Instance.Scale.X
- );
- }
- }
-}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileCell.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileCell.cs
deleted file mode 100644
index 0004169..0000000
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileCell.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using Godot;
-
-namespace UI.TileSetEditorSegment;
-
-public class TileCell : UiCell
-{
- private Image _image;
- private ImageTexture _previewTexture;
-
- public override void OnInit()
- {
- CellNode.L_SelectTexture.Instance.Visible = false;
- _image = Image.Create(GameConfig.TileCellSize, GameConfig.TileCellSize, false, Image.Format.Rgba8);
- _previewTexture = ImageTexture.CreateFromImage(_image);
- CellNode.L_PreviewImage.Instance.Texture = _previewTexture;
- }
-
-
- public override void OnSetData(Vector2I data)
- {
- var image = CellNode.UiPanel.EditorPanel.TextureImage;
- _image.BlitRect(image, new Rect2I(data * GameConfig.TileCellSizeVector2I, GameConfig.TileCellSizeVector2I), Vector2I.Zero);
- _previewTexture.Update(_image);
- CellNode.L_CellId.Instance.Text = data.ToString();
- }
-
- public override void OnDoubleClick()
- {
- //双击移除Cell数据
- EventManager.EmitEvent(EventEnum.OnRemoveTileCell, Data);
- }
-
- public override void OnDestroy()
- {
- _previewTexture.Dispose();
- }
-
- public override void OnSelect()
- {
- CellNode.L_SelectTexture.Instance.Visible = true;
- }
-
- public override void OnUnSelect()
- {
- CellNode.L_SelectTexture.Instance.Visible = false;
- }
-
- public override int OnSort(UiCell other)
- {
- if (Data.Y != other.Data.Y)
- {
- return Data.Y - other.Data.Y;
- }
- return Data.X - other.Data.X;
- }
-}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileEditArea.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileEditArea.cs
deleted file mode 100644
index 907ed2a..0000000
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileEditArea.cs
+++ /dev/null
@@ -1,229 +0,0 @@
-using System.Collections.Generic;
-using Godot;
-
-namespace UI.TileSetEditorSegment;
-
-public partial class TileEditArea : ColorRect, IUiNodeScript
-{
- private TileSetEditorSegment.LeftBg _leftBg;
- private DragBinder _dragBinder;
- private UiGrid _maskGrid;
- private readonly HashSet _useMask = new HashSet();
-
- public void SetUiNode(IUiNode uiNode)
- {
- _leftBg = (TileSetEditorSegment.LeftBg)uiNode;
- var maskBrush = _leftBg.L_TileTexture.L_MaskBrush.Instance;
- maskBrush.TileTexture = _leftBg.L_TileTexture.Instance;
- maskBrush.TileEditArea = this;
-
- _dragBinder = DragUiManager.BindDrag(this, "mouse_middle", OnDrag);
- Resized += OnLeftBgResize;
-
- _maskGrid = new UiGrid(_leftBg.L_TileTexture.L_MaskRoot.L_MaskRect, typeof(MaskRectCell));
- _maskGrid.SetCellOffset(Vector2I.Zero);
- _maskGrid.GridContainer.MouseFilter = MouseFilterEnum.Ignore;
-
- _leftBg.UiPanel.AddEventListener(EventEnum.OnImportTileCell, OnImportCell);
- _leftBg.UiPanel.AddEventListener(EventEnum.OnRemoveTileCell, OnRemoveCell);
-
- }
-
- public void OnDestroy()
- {
- _dragBinder.UnBind();
- _maskGrid.Destroy();
- }
-
- private void OnDrag(DragState state, Vector2 pos)
- {
- if (state == DragState.DragMove)
- {
- _leftBg.L_TileTexture.Instance.Position += pos;
- OnLeftBgResize();
- }
- }
-
- public override void _Input(InputEvent @event)
- {
- //Ui未打开
- if (!_leftBg.UiPanel.IsOpen)
- {
- return;
- }
- if (@event is InputEventMouseButton mouseButton)
- {
- if (_leftBg.UiPanel.IsOpen)
- {
- if (mouseButton.ButtonIndex == MouseButton.WheelDown)
- {
- if (GetGlobalRect().HasPoint(mouseButton.GlobalPosition))
- {
- //缩小
- Shrink();
- }
- }
- else if (mouseButton.ButtonIndex == MouseButton.WheelUp)
- {
- if (GetGlobalRect().HasPoint(mouseButton.GlobalPosition))
- {
- //放大
- Magnify();
- }
- }
- }
- }
- }
-
- public override void _Process(double delta)
- {
- //Ui未打开
- if (!_leftBg.UiPanel.IsOpen)
- {
- return;
- }
-
- if (Input.IsMouseButtonPressed(MouseButton.Left)) //左键导入
- {
- if (this.IsMouseInRect())
- {
- var cellPosition = GetMouseCellPosition();
- if (_leftBg.UiPanel.EditorPanel.IsCellPositionInTexture(cellPosition) && !_useMask.Contains(cellPosition))
- {
- EventManager.EmitEvent(EventEnum.OnImportTileCell, cellPosition);
- }
- }
- }
- else if (Input.IsMouseButtonPressed(MouseButton.Right)) //右键移除
- {
- if (this.IsMouseInRect())
- {
- var cellPosition = GetMouseCellPosition();
- if (_leftBg.UiPanel.EditorPanel.IsCellPositionInTexture(cellPosition) && _useMask.Contains(cellPosition))
- {
- EventManager.EmitEvent(EventEnum.OnRemoveTileCell, cellPosition);
- }
- }
- }
- }
-
- ///
- /// 导入选中的Cell图块
- ///
- private void OnImportCell(object arg)
- {
- if (arg is Vector2I cell)
- {
- var cellIndex = _leftBg.UiPanel.EditorPanel.CellPositionToIndex(cell);
- var uiCell = _maskGrid.GetCell(cellIndex);
- if (uiCell != null && !uiCell.Data)
- {
- _useMask.Add(cell);
- uiCell.SetData(true);
- }
- }
- }
-
- ///
- /// 移除选中的Cell图块
- ///
- private void OnRemoveCell(object arg)
- {
- if (arg is Vector2I cell)
- {
- var cellIndex = _leftBg.UiPanel.EditorPanel.CellPositionToIndex(cell);
- var uiCell = _maskGrid.GetCell(cellIndex);
- if (uiCell != null && uiCell.Data)
- {
- _useMask.Remove(cell);
- uiCell.SetData(false);
- }
- }
- }
-
- //缩小
- private void Shrink()
- {
- var textureRect = _leftBg.L_TileTexture.Instance;
- var offset = textureRect.GetLocalMousePosition();
- var prevScale = textureRect.Scale;
- var newScale = prevScale / 1.1f;
- if (newScale.LengthSquared() >= 0.5f)
- {
- textureRect.Scale = newScale;
- var position = textureRect.Position + offset * 0.1f * newScale;
- textureRect.Position = position;
- SetGridTransform(position, newScale.X);
- }
- }
- //放大
- private void Magnify()
- {
- var textureRect = _leftBg.L_TileTexture.Instance;
- var offset = textureRect.GetLocalMousePosition();
- var prevScale = textureRect.Scale;
- var newScale = prevScale * 1.1f;
- if (newScale.LengthSquared() <= 2000)
- {
- textureRect.Scale = newScale;
- var position = textureRect.Position - offset * 0.1f * prevScale;
- textureRect.Position = position;
- SetGridTransform(position, newScale.X);
- }
- }
-
- ///
- /// 当前Ui被显示出来时调用
- ///
- public void OnShow()
- {
- OnLeftBgResize();
- }
-
- //背景宽度变化
- private void OnLeftBgResize()
- {
- var sprite = _leftBg.L_TileTexture.Instance;
- var colorRect = _leftBg.L_Grid.Instance;
- colorRect.Material.SetShaderMaterialParameter(ShaderParamNames.Size, Size);
- SetGridTransform(sprite.Position, sprite.Scale.X);
- }
-
- ///
- /// 改变TileSet纹理
- ///
- public void OnChangeTileSetTexture(Texture2D texture)
- {
- _leftBg.L_TileTexture.Instance.Texture = texture;
- var width = _leftBg.UiPanel.EditorPanel.CellHorizontal;
- var height = _leftBg.UiPanel.EditorPanel.CellVertical;
- _maskGrid.RemoveAll();
- _useMask.Clear();
- _maskGrid.SetColumns(width);
- for (var i = 0; i < width; i++)
- {
- for (var j = 0; j < height; j++)
- {
- _maskGrid.Add(false);
- }
- }
- }
-
- //设置网格位置和缩放
- private void SetGridTransform(Vector2 pos, float scale)
- {
- var colorRect = _leftBg.L_Grid.Instance;
- colorRect.Material.SetShaderMaterialParameter(ShaderParamNames.GridSize, GameConfig.TileCellSize * scale);
- colorRect.Material.SetShaderMaterialParameter(ShaderParamNames.Offset, -pos);
- }
-
- ///
- /// 返回鼠标所在的单元格位置, 相对于纹理左上角
- ///
- public Vector2I GetMouseCellPosition()
- {
- var textureRect = _leftBg.L_TileTexture.Instance;
- var pos = textureRect.GetLocalMousePosition() / GameConfig.TileCellSize;
- return pos.AsVector2I();
- }
-}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileSelected.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileSelected.cs
deleted file mode 100644
index a601bc6..0000000
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileSelected.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using Godot;
-
-namespace UI.TileSetEditorSegment;
-
-public partial class TileSelected : VBoxContainer, IUiNodeScript
-{
- private TileSetEditorSegment.RightBg _rightBg;
- private UiGrid _grid;
-
- public void SetUiNode(IUiNode uiNode)
- {
- _rightBg = (TileSetEditorSegment.RightBg)uiNode;
-
- _grid = new UiGrid(_rightBg.L_ScrollContainer.L_CellButton, typeof(TileCell));
- _grid.SetCellOffset(new Vector2I(5, 5));
- _grid.SetAutoColumns(true);
- _grid.SetHorizontalExpand(true);
-
- _rightBg.UiPanel.AddEventListener(EventEnum.OnImportTileCell, OnImportCell);
- _rightBg.UiPanel.AddEventListener(EventEnum.OnRemoveTileCell, OnRemoveCell);
- }
-
- ///
- /// 导入选中的Cell图块
- ///
- private void OnImportCell(object obj)
- {
- if (obj is Vector2I cell)
- {
- _grid.Add(cell);
- _grid.Sort();
- }
- }
-
- ///
- /// 移除选中的Cell图块
- ///
- private void OnRemoveCell(object obj)
- {
- if (obj is Vector2I cell)
- {
- var uiCell = _grid.Find(c => c.Data == cell);
- if (uiCell != null)
- {
- _grid.RemoveByIndex(uiCell.Index);
- }
- }
- }
-
- public void OnDestroy()
- {
- _grid.Destroy();
- }
-
-
- ///
- /// 改变TileSet纹理
- ///
- public void OnChangeTileSetTexture(Texture2D texture)
- {
- _grid.RemoveAll();
- }
-}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileSetEditorSegment.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileSetEditorSegment.cs
deleted file mode 100644
index a71a4e9..0000000
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileSetEditorSegment.cs
+++ /dev/null
@@ -1,496 +0,0 @@
-namespace UI.TileSetEditorSegment;
-
-///
-/// Ui代码, 该类是根据ui场景自动生成的, 请不要手动编辑该类, 以免造成代码丢失
-///
-public abstract partial class TileSetEditorSegment : UiBase
-{
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer
- ///
- public HSplitContainer L_HSplitContainer
- {
- get
- {
- if (_L_HSplitContainer == null) _L_HSplitContainer = new HSplitContainer((TileSetEditorSegmentPanel)this, GetNode("HSplitContainer"));
- return _L_HSplitContainer;
- }
- }
- private HSplitContainer _L_HSplitContainer;
-
-
- public TileSetEditorSegment() : base(nameof(TileSetEditorSegment))
- {
- }
-
- public sealed override void OnInitNestedUi()
- {
- _ = L_HSplitContainer.L_Left.L_MarginContainer.L_LeftBg;
-
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg.TileTexture.MaskRoot.MaskRect
- ///
- public class MaskRect : UiNode
- {
- public MaskRect(TileSetEditorSegmentPanel uiPanel, Godot.ColorRect node) : base(uiPanel, node) { }
- public override MaskRect Clone() => new (UiPanel, (Godot.ColorRect)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg.TileTexture.MaskRoot
- ///
- public class MaskRoot : UiNode
- {
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg.TileTexture.MaskRect
- ///
- public MaskRect L_MaskRect
- {
- get
- {
- if (_L_MaskRect == null) _L_MaskRect = new MaskRect(UiPanel, Instance.GetNode("MaskRect"));
- return _L_MaskRect;
- }
- }
- private MaskRect _L_MaskRect;
-
- public MaskRoot(TileSetEditorSegmentPanel uiPanel, Godot.Control node) : base(uiPanel, node) { }
- public override MaskRoot Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg.TileTexture.MaskBrush
- ///
- public class MaskBrush : UiNode
- {
- public MaskBrush(TileSetEditorSegmentPanel uiPanel, UI.TileSetEditorSegment.MaskBrush node) : base(uiPanel, node) { }
- public override MaskBrush Clone() => new (UiPanel, (UI.TileSetEditorSegment.MaskBrush)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg.TileTexture
- ///
- public class TileTexture : UiNode
- {
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg.MaskRoot
- ///
- public MaskRoot L_MaskRoot
- {
- get
- {
- if (_L_MaskRoot == null) _L_MaskRoot = new MaskRoot(UiPanel, Instance.GetNode("MaskRoot"));
- return _L_MaskRoot;
- }
- }
- private MaskRoot _L_MaskRoot;
-
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg.MaskBrush
- ///
- public MaskBrush L_MaskBrush
- {
- get
- {
- if (_L_MaskBrush == null) _L_MaskBrush = new MaskBrush(UiPanel, Instance.GetNode("MaskBrush"));
- return _L_MaskBrush;
- }
- }
- private MaskBrush _L_MaskBrush;
-
- public TileTexture(TileSetEditorSegmentPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { }
- public override TileTexture Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg.Grid
- ///
- public class Grid : UiNode
- {
- public Grid(TileSetEditorSegmentPanel uiPanel, Godot.ColorRect node) : base(uiPanel, node) { }
- public override Grid Clone() => new (UiPanel, (Godot.ColorRect)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg
- ///
- public class LeftBg : UiNode
- {
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.TileTexture
- ///
- public TileTexture L_TileTexture
- {
- get
- {
- if (_L_TileTexture == null) _L_TileTexture = new TileTexture(UiPanel, Instance.GetNode("TileTexture"));
- return _L_TileTexture;
- }
- }
- private TileTexture _L_TileTexture;
-
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Left.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;
-
- public LeftBg(TileSetEditorSegmentPanel uiPanel, UI.TileSetEditorSegment.TileEditArea node) : base(uiPanel, node) { }
- public override LeftBg Clone() => new (UiPanel, (UI.TileSetEditorSegment.TileEditArea)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer
- ///
- public class MarginContainer : UiNode
- {
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Left.LeftBg
- ///
- public LeftBg L_LeftBg
- {
- get
- {
- if (_L_LeftBg == null) _L_LeftBg = new LeftBg(UiPanel, Instance.GetNode("LeftBg"));
- return _L_LeftBg;
- }
- }
- private LeftBg _L_LeftBg;
-
- public MarginContainer(TileSetEditorSegmentPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { }
- public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Left
- ///
- public class Left : UiNode
- {
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.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 Left(TileSetEditorSegmentPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { }
- public override Left Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.Label
- ///
- public class Label : UiNode
- {
- public Label(TileSetEditorSegmentPanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
- public override Label Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton.PreviewImage
- ///
- public class PreviewImage : UiNode
- {
- public PreviewImage(TileSetEditorSegmentPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { }
- public override PreviewImage Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton.CellId
- ///
- public class CellId : UiNode
- {
- public CellId(TileSetEditorSegmentPanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
- public override CellId Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton.SelectTexture
- ///
- public class SelectTexture : UiNode
- {
- public SelectTexture(TileSetEditorSegmentPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { }
- public override SelectTexture Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton
- ///
- public class CellButton : UiNode
- {
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.PreviewImage
- ///
- public PreviewImage L_PreviewImage
- {
- get
- {
- if (_L_PreviewImage == null) _L_PreviewImage = new PreviewImage(UiPanel, Instance.GetNode("PreviewImage"));
- return _L_PreviewImage;
- }
- }
- private PreviewImage _L_PreviewImage;
-
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellId
- ///
- public CellId L_CellId
- {
- get
- {
- if (_L_CellId == null) _L_CellId = new CellId(UiPanel, Instance.GetNode("CellId"));
- return _L_CellId;
- }
- }
- private CellId _L_CellId;
-
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.SelectTexture
- ///
- public SelectTexture L_SelectTexture
- {
- get
- {
- if (_L_SelectTexture == null) _L_SelectTexture = new SelectTexture(UiPanel, Instance.GetNode("SelectTexture"));
- return _L_SelectTexture;
- }
- }
- private SelectTexture _L_SelectTexture;
-
- public CellButton(TileSetEditorSegmentPanel uiPanel, Godot.Button node) : base(uiPanel, node) { }
- public override CellButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer
- ///
- public class ScrollContainer : UiNode
- {
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.CellButton
- ///
- public CellButton L_CellButton
- {
- get
- {
- if (_L_CellButton == null) _L_CellButton = new CellButton(UiPanel, Instance.GetNode("CellButton"));
- return _L_CellButton;
- }
- }
- private CellButton _L_CellButton;
-
- public ScrollContainer(TileSetEditorSegmentPanel uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { }
- public override ScrollContainer Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg
- ///
- public class RightBg : UiNode
- {
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.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 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right.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 RightBg(TileSetEditorSegmentPanel uiPanel, UI.TileSetEditorSegment.TileSelected node) : base(uiPanel, node) { }
- public override RightBg Clone() => new (UiPanel, (UI.TileSetEditorSegment.TileSelected)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer
- ///
- public class MarginContainer_1 : UiNode
- {
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right.RightBg
- ///
- public RightBg L_RightBg
- {
- get
- {
- if (_L_RightBg == null) _L_RightBg = new RightBg(UiPanel, Instance.GetNode("RightBg"));
- return _L_RightBg;
- }
- }
- private RightBg _L_RightBg;
-
- public MarginContainer_1(TileSetEditorSegmentPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { }
- public override MarginContainer_1 Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer.Right
- ///
- public class Right : UiNode
- {
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.MarginContainer
- ///
- public MarginContainer_1 L_MarginContainer
- {
- get
- {
- if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer_1(UiPanel, Instance.GetNode("MarginContainer"));
- return _L_MarginContainer;
- }
- }
- private MarginContainer_1 _L_MarginContainer;
-
- public Right(TileSetEditorSegmentPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { }
- public override Right Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate());
- }
-
- ///
- /// 类型: , 路径: TileSetEditorSegment.HSplitContainer
- ///
- public class HSplitContainer : UiNode
- {
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.Left
- ///
- public Left L_Left
- {
- get
- {
- if (_L_Left == null) _L_Left = new Left(UiPanel, Instance.GetNode("Left"));
- return _L_Left;
- }
- }
- private Left _L_Left;
-
- ///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorSegment.Right
- ///
- public Right L_Right
- {
- get
- {
- if (_L_Right == null) _L_Right = new Right(UiPanel, Instance.GetNode("Right"));
- return _L_Right;
- }
- }
- private Right _L_Right;
-
- public HSplitContainer(TileSetEditorSegmentPanel uiPanel, Godot.HSplitContainer node) : base(uiPanel, node) { }
- public override HSplitContainer Clone() => new (UiPanel, (Godot.HSplitContainer)Instance.Duplicate());
- }
-
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg.TileTexture.MaskRoot.MaskRect
- ///
- public MaskRect S_MaskRect => L_HSplitContainer.L_Left.L_MarginContainer.L_LeftBg.L_TileTexture.L_MaskRoot.L_MaskRect;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg.TileTexture.MaskRoot
- ///
- public MaskRoot S_MaskRoot => L_HSplitContainer.L_Left.L_MarginContainer.L_LeftBg.L_TileTexture.L_MaskRoot;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg.TileTexture.MaskBrush
- ///
- public MaskBrush S_MaskBrush => L_HSplitContainer.L_Left.L_MarginContainer.L_LeftBg.L_TileTexture.L_MaskBrush;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg.TileTexture
- ///
- public TileTexture S_TileTexture => L_HSplitContainer.L_Left.L_MarginContainer.L_LeftBg.L_TileTexture;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg.Grid
- ///
- public Grid S_Grid => L_HSplitContainer.L_Left.L_MarginContainer.L_LeftBg.L_Grid;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Left.MarginContainer.LeftBg
- ///
- public LeftBg S_LeftBg => L_HSplitContainer.L_Left.L_MarginContainer.L_LeftBg;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Left
- ///
- public Left S_Left => L_HSplitContainer.L_Left;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.Label
- ///
- public Label S_Label => L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg.L_Label;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton.PreviewImage
- ///
- public PreviewImage S_PreviewImage => L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg.L_ScrollContainer.L_CellButton.L_PreviewImage;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton.CellId
- ///
- public CellId S_CellId => L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg.L_ScrollContainer.L_CellButton.L_CellId;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton.SelectTexture
- ///
- public SelectTexture S_SelectTexture => L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg.L_ScrollContainer.L_CellButton.L_SelectTexture;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer.CellButton
- ///
- public CellButton S_CellButton => L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg.L_ScrollContainer.L_CellButton;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg.ScrollContainer
- ///
- public ScrollContainer S_ScrollContainer => L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg.L_ScrollContainer;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right.MarginContainer.RightBg
- ///
- public RightBg S_RightBg => L_HSplitContainer.L_Right.L_MarginContainer.L_RightBg;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer.Right
- ///
- public Right S_Right => L_HSplitContainer.L_Right;
-
- ///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorSegment.HSplitContainer
- ///
- public HSplitContainer S_HSplitContainer => L_HSplitContainer;
-
-}
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileSetEditorSegmentPanel.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileSetEditorSegmentPanel.cs
deleted file mode 100644
index 2059814..0000000
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileSetEditorSegmentPanel.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using Godot;
-using UI.TileSetEditor;
-
-namespace UI.TileSetEditorSegment;
-
-public partial class TileSetEditorSegmentPanel : TileSetEditorSegment
-{
- ///
- /// 父Ui
- ///
- public TileSetEditorPanel EditorPanel;
-
- public override void OnCreateUi()
- {
- EditorPanel = (TileSetEditorPanel)ParentUi;
-
- //改变纹理事件
- AddEventListener(EventEnum.OnSetTileTexture, OnSetTileTexture);
- //改变背景颜色事件
- AddEventListener(EventEnum.OnSetTileSetBgColor, OnSetTileSetBgColor);
- }
-
- public override void OnShowUi()
- {
- if (EditorPanel.Texture == null)
- {
- EditorWindowManager.ShowTips("警告", "请先导入纹理!", () =>
- {
- EditorPanel.TabGrid.SelectIndex = 0;
- });
- }
-
- S_LeftBg.Instance.OnShow();
- }
-
- public override void OnDestroyUi()
- {
-
- }
-
- //改变TileSet纹理
- private void OnSetTileTexture(object arg)
- {
- if (arg is Texture2D texture)
- {
- S_LeftBg.Instance.OnChangeTileSetTexture(texture);
- S_RightBg.Instance.OnChangeTileSetTexture(texture);
- }
- }
-
- //改变TileSet背景颜色
- private void OnSetTileSetBgColor(object arg)
- {
- //背景颜色
- if (arg is Color color)
- {
- S_LeftBg.Instance.Color = color;
- }
- }
-}