diff --git a/DungeonShooting_Godot/prefab/ui/TileSetEditorTerrain.tscn b/DungeonShooting_Godot/prefab/ui/TileSetEditorTerrain.tscn index 5401633..42702d0 100644 --- a/DungeonShooting_Godot/prefab/ui/TileSetEditorTerrain.tscn +++ b/DungeonShooting_Godot/prefab/ui/TileSetEditorTerrain.tscn @@ -1,15 +1,15 @@ [gd_scene load_steps=11 format=3 uid="uid://dfqb73y4br8yd"] [ext_resource type="Script" path="res://src/game/ui/tileSetEditorTerrain/TileSetEditorTerrainPanel.cs" id="1_6jjk7"] -[ext_resource type="Texture2D" uid="uid://bn47bmilcw4x0" path="res://resource/sprite/ui/commonIcon/Select2.png" id="2_0v4fp"] -[ext_resource type="Script" path="res://src/game/ui/tileSetEditorTerrain/left/TileEditArea.cs" id="2_ynf0r"] +[ext_resource type="Script" path="res://src/game/ui/tileSetEditorTerrain/down/TileEditArea.cs" id="2_ynf0r"] [ext_resource type="Script" path="res://src/game/common/ui/EditorMaskBrush.cs" id="3_gydh0"] -[ext_resource type="Script" path="res://src/game/ui/tileSetEditorTerrain/left/TerrainCellDragHandler.cs" id="3_ssd86"] -[ext_resource type="Script" path="res://src/game/ui/tileSetEditorTerrain/right/TileEditTerrain.cs" id="5_0x7yx"] +[ext_resource type="Script" path="res://src/game/ui/tileSetEditorTerrain/down/TerrainCellDragHandler.cs" id="3_ssd86"] +[ext_resource type="Script" path="res://src/game/ui/tileSetEditorTerrain/up/TileEditTerrain.cs" id="5_0x7yx"] [ext_resource type="Texture2D" uid="uid://d2wslibovwv7w" path="res://resource/sprite/ui/commonIcon/CenterTool.png" id="5_08bc4"] +[ext_resource type="Texture2D" uid="uid://bud6ah5xyey37" path="res://resource/sprite/map/TerrainMask2.png" id="5_xabgh"] [ext_resource type="Texture2D" uid="uid://cvjj6jnmxgprw" path="res://resource/sprite/map/TerrainMask.png" id="7_g8dxk"] -[ext_resource type="Script" path="res://src/game/ui/tileSetEditorTerrain/right/TerrainBrush.cs" id="7_lmu64"] -[ext_resource type="Script" path="res://src/game/ui/tileSetEditorTerrain/right/TerrainCellDropHandler.cs" id="8_7xxcq"] +[ext_resource type="Script" path="res://src/game/ui/tileSetEditorTerrain/up/TerrainBrush.cs" id="7_lmu64"] +[ext_resource type="Script" path="res://src/game/ui/tileSetEditorTerrain/up/TerrainCellDropHandler.cs" id="8_7xxcq"] [node name="TileSetEditorTerrain" type="Control"] layout_mode = 3 @@ -46,49 +46,7 @@ theme_override_constants/margin_right = 2 theme_override_constants/margin_bottom = 2 -[node name="HBoxContainer" type="HBoxContainer" parent="VSplitContainer/LeftBottom2/MarginContainer"] -layout_mode = 2 -theme_override_constants/separation = 0 - -[node name="Panel" type="Panel" parent="VSplitContainer/LeftBottom2/MarginContainer/HBoxContainer"] -custom_minimum_size = Vector2(250, 0) -layout_mode = 2 - -[node name="ScrollContainer" type="ScrollContainer" parent="VSplitContainer/LeftBottom2/MarginContainer/HBoxContainer/Panel"] -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 = -2.0 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="VBoxContainer" type="VBoxContainer" parent="VSplitContainer/LeftBottom2/MarginContainer/HBoxContainer/Panel/ScrollContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 3 - -[node name="TabButton" type="Button" parent="VSplitContainer/LeftBottom2/MarginContainer/HBoxContainer/Panel/ScrollContainer/VBoxContainer"] -layout_mode = 2 -text = "button" - -[node name="NinePatchRect" type="NinePatchRect" parent="VSplitContainer/LeftBottom2/MarginContainer/HBoxContainer/Panel/ScrollContainer/VBoxContainer/TabButton"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -texture = ExtResource("2_0v4fp") -patch_margin_left = 3 -patch_margin_top = 3 -patch_margin_right = 3 -patch_margin_bottom = 3 - -[node name="LeftBottomBg" type="ColorRect" parent="VSplitContainer/LeftBottom2/MarginContainer/HBoxContainer"] +[node name="LeftBottomBg" type="ColorRect" parent="VSplitContainer/LeftBottom2/MarginContainer"] clip_children = 2 z_index = 1 layout_mode = 2 @@ -96,7 +54,7 @@ color = Color(0.496094, 0.496094, 0.496094, 1) script = ExtResource("5_0x7yx") -[node name="TerrainRoot" type="Control" parent="VSplitContainer/LeftBottom2/MarginContainer/HBoxContainer/LeftBottomBg"] +[node name="TerrainRoot" type="Control" parent="VSplitContainer/LeftBottom2/MarginContainer/LeftBottomBg"] layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 @@ -105,42 +63,85 @@ anchor_bottom = 0.5 offset_left = -291.0 offset_top = -92.0 -offset_right = -99.0 -offset_bottom = -28.0 +offset_right = -291.0 +offset_bottom = -92.0 grow_horizontal = 2 grow_vertical = 2 scale = Vector2(3, 3) mouse_filter = 2 -[node name="CellRoot" type="Control" parent="VSplitContainer/LeftBottom2/MarginContainer/HBoxContainer/LeftBottomBg/TerrainRoot"] +[node name="CellRoot" type="Control" parent="VSplitContainer/LeftBottom2/MarginContainer/LeftBottomBg/TerrainRoot"] layout_mode = 3 anchors_preset = 0 offset_right = 1.0 offset_bottom = 1.0 mouse_filter = 2 -[node name="RightCell" type="Control" parent="VSplitContainer/LeftBottom2/MarginContainer/HBoxContainer/LeftBottomBg/TerrainRoot/CellRoot"] +[node name="RightCell" type="Control" parent="VSplitContainer/LeftBottom2/MarginContainer/LeftBottomBg/TerrainRoot/CellRoot"] anchors_preset = 0 offset_right = 16.0 offset_bottom = 16.0 mouse_filter = 1 script = ExtResource("8_7xxcq") -[node name="CellTexture" type="Sprite2D" parent="VSplitContainer/LeftBottom2/MarginContainer/HBoxContainer/LeftBottomBg/TerrainRoot/CellRoot/RightCell"] +[node name="CellTexture" type="Sprite2D" parent="VSplitContainer/LeftBottom2/MarginContainer/LeftBottomBg/TerrainRoot/CellRoot/RightCell"] centered = false -[node name="TerrainTexture" type="TextureRect" parent="VSplitContainer/LeftBottom2/MarginContainer/HBoxContainer/LeftBottomBg/TerrainRoot"] +[node name="TerrainTexture1" type="TextureRect" parent="VSplitContainer/LeftBottom2/MarginContainer/LeftBottomBg/TerrainRoot"] self_modulate = Color(1, 1, 1, 0.27451) +custom_minimum_size = Vector2(192, 64) layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 +offset_right = 192.0 +offset_bottom = 64.0 mouse_filter = 2 texture = ExtResource("7_g8dxk") -[node name="Brush" type="Control" parent="VSplitContainer/LeftBottom2/MarginContainer/HBoxContainer/LeftBottomBg/TerrainRoot"] +[node name="Label" type="Label" parent="VSplitContainer/LeftBottom2/MarginContainer/LeftBottomBg/TerrainRoot/TerrainTexture1"] +layout_mode = 0 +offset_top = -10.0 +offset_right = 136.0 +offset_bottom = 30.0 +scale = Vector2(0.25, 0.25) +text = "顶部墙壁" + +[node name="TerrainTexture2" type="TextureRect" parent="VSplitContainer/LeftBottom2/MarginContainer/LeftBottomBg/TerrainRoot"] +self_modulate = Color(1, 1, 1, 0.27451) +custom_minimum_size = Vector2(64, 16) +layout_mode = 1 +offset_top = 80.0 +offset_right = 64.0 +offset_bottom = 96.0 +mouse_filter = 2 +texture = ExtResource("5_xabgh") + +[node name="Label" type="Label" parent="VSplitContainer/LeftBottom2/MarginContainer/LeftBottomBg/TerrainRoot/TerrainTexture2"] +layout_mode = 0 +offset_top = -10.0 +offset_right = 136.0 +offset_bottom = 30.0 +scale = Vector2(0.25, 0.25) +text = "侧方墙壁" + +[node name="TerrainTexture3" type="TextureRect" parent="VSplitContainer/LeftBottom2/MarginContainer/LeftBottomBg/TerrainRoot"] +self_modulate = Color(1, 1, 1, 0.27451) +custom_minimum_size = Vector2(64, 16) +layout_mode = 1 +offset_left = 80.0 +offset_top = 80.0 +offset_right = 144.0 +offset_bottom = 96.0 +mouse_filter = 2 +texture = ExtResource("5_xabgh") + +[node name="Label" type="Label" parent="VSplitContainer/LeftBottom2/MarginContainer/LeftBottomBg/TerrainRoot/TerrainTexture3"] +layout_mode = 0 +offset_top = -10.0 +offset_right = 136.0 +offset_bottom = 30.0 +scale = Vector2(0.25, 0.25) +text = "地板" + +[node name="Brush" type="Control" parent="VSplitContainer/LeftBottom2/MarginContainer/LeftBottomBg/TerrainRoot"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -150,7 +151,7 @@ mouse_filter = 2 script = ExtResource("7_lmu64") -[node name="Grid" type="ColorRect" parent="VSplitContainer/LeftBottom2/MarginContainer/HBoxContainer/LeftBottomBg"] +[node name="Grid" type="ColorRect" parent="VSplitContainer/LeftBottom2/MarginContainer/LeftBottomBg"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -160,7 +161,7 @@ mouse_filter = 2 color = Color(1, 1, 1, 0) -[node name="FocusBtn" type="TextureButton" parent="VSplitContainer/LeftBottom2/MarginContainer/HBoxContainer/LeftBottomBg"] +[node name="FocusBtn" type="TextureButton" parent="VSplitContainer/LeftBottom2/MarginContainer/LeftBottomBg"] layout_mode = 1 anchors_preset = 1 anchor_left = 1.0 diff --git a/DungeonShooting_Godot/resource/sprite/map/TerrainMask2.png b/DungeonShooting_Godot/resource/sprite/map/TerrainMask2.png new file mode 100644 index 0000000..0653e77 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/map/TerrainMask2.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/map/TerrainMask2.png.import b/DungeonShooting_Godot/resource/sprite/map/TerrainMask2.png.import new file mode 100644 index 0000000..701ad63 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/map/TerrainMask2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bud6ah5xyey37" +path="res://.godot/imported/TerrainMask2.png-1f32f81f65f05bff60b1eb56be6f0962.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/map/TerrainMask2.png" +dest_files=["res://.godot/imported/TerrainMask2.png-1f32f81f65f05bff60b1eb56be6f0962.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs index 86441bd..4b4c02a 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -11,7 +11,7 @@ public const string excelTool_obj_ExcelTool_csproj_nuget_dgspec_json = "res://excelTool/obj/ExcelTool.csproj.nuget.dgspec.json"; public const string excelTool_obj_project_assets_json = "res://excelTool/obj/project.assets.json"; public const string excelTool_obj_Release_net8_0_winx64_ExcelTool_csproj_FileListAbsolute_txt = "res://excelTool/obj/Release/net8.0/win-x64/ExcelTool.csproj.FileListAbsolute.txt"; - public const string excelTool_obj_Release_net8_0_winx64_PublishOutputs_a0fcfe3642_txt = "res://excelTool/obj/Release/net8.0/win-x64/PublishOutputs.a0fcfe3642.txt"; + public const string excelTool_obj_Release_net8_0_winx64_PublishOutputs_77891b5d25_txt = "res://excelTool/obj/Release/net8.0/win-x64/PublishOutputs.77891b5d25.txt"; public const string excelTool_publish_winx64_ExcelTool_deps_json = "res://excelTool/publish/win-x64/ExcelTool.deps.json"; public const string excelTool_publish_winx64_ExcelTool_runtimeconfig_json = "res://excelTool/publish/win-x64/ExcelTool.runtimeconfig.json"; public const string prefab_Cursor_tscn = "res://prefab/Cursor.tscn"; @@ -122,6 +122,7 @@ public const string resource_font_VonwaonBitmap16px_ttf = "res://resource/font/VonwaonBitmap-16px.ttf"; public const string resource_material_Blend_gdshader = "res://resource/material/Blend.gdshader"; public const string resource_material_Blend_tres = "res://resource/material/Blend.tres"; + public const string resource_material_GodRays_gdshader = "res://resource/material/GodRays.gdshader"; public const string resource_material_Grid_gdshader = "res://resource/material/Grid.gdshader"; public const string resource_material_Grid_tres = "res://resource/material/Grid.tres"; public const string resource_material_Mask_gdshader = "res://resource/material/Mask.gdshader"; @@ -223,6 +224,7 @@ public const string resource_sprite_map_PreviewTransition3_png = "res://resource/sprite/map/PreviewTransition3.png"; public const string resource_sprite_map_PreviewTransition4_png = "res://resource/sprite/map/PreviewTransition4.png"; public const string resource_sprite_map_PreviewTransition5_png = "res://resource/sprite/map/PreviewTransition5.png"; + public const string resource_sprite_map_TerrainMask_png = "res://resource/sprite/map/TerrainMask.png"; public const string resource_sprite_map_WallTransition1_png = "res://resource/sprite/map/WallTransition1.png"; public const string resource_sprite_map_WallTransition2_png = "res://resource/sprite/map/WallTransition2.png"; public const string resource_sprite_map_WallTransition3_png = "res://resource/sprite/map/WallTransition3.png"; @@ -431,7 +433,6 @@ public const string resource_tileSet_map1_TileSet1_tres = "res://resource/tileSet/map1/TileSet1.tres"; public const string resource_tileSet_map1_website_txt = "res://resource/tileSet/map1/website.txt"; public const string resource_tileSet_map2_TileSet2_tres = "res://resource/tileSet/map2/TileSet2.tres"; - public const string resource_tileSprite_TerrainMask_png = "res://resource/tileSprite/TerrainMask.png"; public const string resource_tileSprite_map1_16x16dungeoniiwallreconfigv04spritesheet_png = "res://resource/tileSprite/map1/16x16 dungeon ii wall reconfig v04 spritesheet.png"; public const string resource_tileSprite_map2_DungeonTilesetSpikes_png = "res://resource/tileSprite/map2/Dungeon Tileset + Spikes.png"; public const string resource_tileSprite_map2_DungeonTileset_png = "res://resource/tileSprite/map2/Dungeon Tileset.png"; diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TileSetEditorTerrain.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TileSetEditorTerrain.cs index 57b15ea..fcf2de7 100644 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TileSetEditorTerrain.cs +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TileSetEditorTerrain.cs @@ -25,110 +25,13 @@ public sealed override void OnInitNestedUi() { - _ = L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_HBoxContainer.L_LeftBottomBg; + _ = L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_LeftBottomBg; _ = L_VSplitContainer.L_LeftBottom.L_MarginContainer.L_LeftBg; } /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.Panel.ScrollContainer.VBoxContainer.TabButton.NinePatchRect - /// - public class NinePatchRect : UiNode - { - public NinePatchRect(TileSetEditorTerrainPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } - public override NinePatchRect Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); - } - - /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.Panel.ScrollContainer.VBoxContainer.TabButton - /// - public class TabButton : UiNode - { - /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.Panel.ScrollContainer.VBoxContainer.NinePatchRect - /// - public NinePatchRect L_NinePatchRect - { - get - { - if (_L_NinePatchRect == null) _L_NinePatchRect = new NinePatchRect(UiPanel, Instance.GetNode("NinePatchRect")); - return _L_NinePatchRect; - } - } - private NinePatchRect _L_NinePatchRect; - - public TabButton(TileSetEditorTerrainPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } - public override TabButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); - } - - /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.Panel.ScrollContainer.VBoxContainer - /// - public class VBoxContainer : UiNode - { - /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.Panel.ScrollContainer.TabButton - /// - public TabButton L_TabButton - { - get - { - if (_L_TabButton == null) _L_TabButton = new TabButton(UiPanel, Instance.GetNode("TabButton")); - return _L_TabButton; - } - } - private TabButton _L_TabButton; - - public VBoxContainer(TileSetEditorTerrainPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } - public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); - } - - /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.Panel.ScrollContainer - /// - public class ScrollContainer : UiNode - { - /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.Panel.VBoxContainer - /// - public VBoxContainer L_VBoxContainer - { - get - { - if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer(UiPanel, Instance.GetNode("VBoxContainer")); - return _L_VBoxContainer; - } - } - private VBoxContainer _L_VBoxContainer; - - public ScrollContainer(TileSetEditorTerrainPanel uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { } - public override ScrollContainer Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate()); - } - - /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.Panel - /// - public class Panel : UiNode - { - /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.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 Panel(TileSetEditorTerrainPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { } - public override Panel Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); - } - - /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.TerrainRoot.CellRoot.RightCell.CellTexture + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.CellRoot.RightCell.CellTexture /// public class CellTexture : UiNode { @@ -137,12 +40,12 @@ } /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.TerrainRoot.CellRoot.RightCell + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.CellRoot.RightCell /// public class RightCell : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.TerrainRoot.CellRoot.CellTexture + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.CellRoot.CellTexture /// public CellTexture L_CellTexture { @@ -159,12 +62,12 @@ } /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.TerrainRoot.CellRoot + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.CellRoot /// public class CellRoot : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.TerrainRoot.RightCell + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.RightCell /// public RightCell L_RightCell { @@ -181,16 +84,100 @@ } /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.TerrainRoot.TerrainTexture + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.TerrainTexture1.Label /// - public class TerrainTexture : UiNode + public class Label : UiNode { - public TerrainTexture(TileSetEditorTerrainPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } - public override TerrainTexture Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + public Label(TileSetEditorTerrainPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override Label Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); } /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.TerrainRoot.Brush + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.TerrainTexture1 + /// + public class TerrainTexture1 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.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; + + public TerrainTexture1(TileSetEditorTerrainPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override TerrainTexture1 Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.TerrainTexture2.Label + /// + public class Label_1 : UiNode + { + public Label_1(TileSetEditorTerrainPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override Label_1 Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.TerrainTexture2 + /// + public class TerrainTexture2 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.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; + + public TerrainTexture2(TileSetEditorTerrainPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override TerrainTexture2 Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.TerrainTexture3.Label + /// + public class Label_2 : UiNode + { + public Label_2(TileSetEditorTerrainPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override Label_2 Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.TerrainTexture3 + /// + public class TerrainTexture3 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.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 TerrainTexture3(TileSetEditorTerrainPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override TerrainTexture3 Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.Brush /// public class Brush : UiNode { @@ -199,12 +186,12 @@ } /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.TerrainRoot + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot /// public class TerrainRoot : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.CellRoot + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.CellRoot /// public CellRoot L_CellRoot { @@ -217,20 +204,46 @@ private CellRoot _L_CellRoot; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.TerrainTexture + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainTexture1 /// - public TerrainTexture L_TerrainTexture + public TerrainTexture1 L_TerrainTexture1 { get { - if (_L_TerrainTexture == null) _L_TerrainTexture = new TerrainTexture(UiPanel, Instance.GetNode("TerrainTexture")); - return _L_TerrainTexture; + if (_L_TerrainTexture1 == null) _L_TerrainTexture1 = new TerrainTexture1(UiPanel, Instance.GetNode("TerrainTexture1")); + return _L_TerrainTexture1; } } - private TerrainTexture _L_TerrainTexture; + private TerrainTexture1 _L_TerrainTexture1; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.Brush + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainTexture2 + /// + public TerrainTexture2 L_TerrainTexture2 + { + get + { + if (_L_TerrainTexture2 == null) _L_TerrainTexture2 = new TerrainTexture2(UiPanel, Instance.GetNode("TerrainTexture2")); + return _L_TerrainTexture2; + } + } + private TerrainTexture2 _L_TerrainTexture2; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainTexture3 + /// + public TerrainTexture3 L_TerrainTexture3 + { + get + { + if (_L_TerrainTexture3 == null) _L_TerrainTexture3 = new TerrainTexture3(UiPanel, Instance.GetNode("TerrainTexture3")); + return _L_TerrainTexture3; + } + } + private TerrainTexture3 _L_TerrainTexture3; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.Brush /// public Brush L_Brush { @@ -247,7 +260,7 @@ } /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.Grid + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.Grid /// public class Grid : UiNode { @@ -256,7 +269,7 @@ } /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.FocusBtn + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.FocusBtn /// public class FocusBtn : UiNode { @@ -265,12 +278,12 @@ } /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg /// public class LeftBottomBg : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.TerrainRoot + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.TerrainRoot /// public TerrainRoot L_TerrainRoot { @@ -283,7 +296,7 @@ private TerrainRoot _L_TerrainRoot; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.Grid + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.Grid /// public Grid L_Grid { @@ -296,7 +309,7 @@ private Grid _L_Grid; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.FocusBtn + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.FocusBtn /// public FocusBtn L_FocusBtn { @@ -313,25 +326,12 @@ } /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer /// - public class HBoxContainer : UiNode + public class MarginContainer : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.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; - - /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.LeftBottomBg /// public LeftBottomBg L_LeftBottomBg { @@ -343,28 +343,6 @@ } private LeftBottomBg _L_LeftBottomBg; - public HBoxContainer(TileSetEditorTerrainPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } - public override HBoxContainer Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); - } - - /// - /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer - /// - public class MarginContainer : UiNode - { - /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.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; - public MarginContainer(TileSetEditorTerrainPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); } @@ -613,64 +591,44 @@ /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.Panel.ScrollContainer.VBoxContainer.TabButton.NinePatchRect + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.CellRoot.RightCell.CellTexture /// - public NinePatchRect S_NinePatchRect => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_HBoxContainer.L_Panel.L_ScrollContainer.L_VBoxContainer.L_TabButton.L_NinePatchRect; + public CellTexture S_CellTexture => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_LeftBottomBg.L_TerrainRoot.L_CellRoot.L_RightCell.L_CellTexture; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.Panel.ScrollContainer.VBoxContainer.TabButton + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.CellRoot.RightCell /// - public TabButton S_TabButton => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_HBoxContainer.L_Panel.L_ScrollContainer.L_VBoxContainer.L_TabButton; + public RightCell S_RightCell => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_LeftBottomBg.L_TerrainRoot.L_CellRoot.L_RightCell; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.Panel.ScrollContainer.VBoxContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.TerrainTexture1 /// - public VBoxContainer S_VBoxContainer => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_HBoxContainer.L_Panel.L_ScrollContainer.L_VBoxContainer; + public TerrainTexture1 S_TerrainTexture1 => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_LeftBottomBg.L_TerrainRoot.L_TerrainTexture1; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.Panel.ScrollContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.TerrainTexture2 /// - public ScrollContainer S_ScrollContainer => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_HBoxContainer.L_Panel.L_ScrollContainer; + public TerrainTexture2 S_TerrainTexture2 => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_LeftBottomBg.L_TerrainRoot.L_TerrainTexture2; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.Panel + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.TerrainTexture3 /// - public Panel S_Panel => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_HBoxContainer.L_Panel; + public TerrainTexture3 S_TerrainTexture3 => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_LeftBottomBg.L_TerrainRoot.L_TerrainTexture3; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.TerrainRoot.CellRoot.RightCell.CellTexture + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot.Brush /// - public CellTexture S_CellTexture => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_HBoxContainer.L_LeftBottomBg.L_TerrainRoot.L_CellRoot.L_RightCell.L_CellTexture; + public Brush S_Brush => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_LeftBottomBg.L_TerrainRoot.L_Brush; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.TerrainRoot.CellRoot.RightCell + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg.TerrainRoot /// - public RightCell S_RightCell => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_HBoxContainer.L_LeftBottomBg.L_TerrainRoot.L_CellRoot.L_RightCell; + public TerrainRoot S_TerrainRoot => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_LeftBottomBg.L_TerrainRoot; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.TerrainRoot.TerrainTexture + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.LeftBottomBg /// - public TerrainTexture S_TerrainTexture => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_HBoxContainer.L_LeftBottomBg.L_TerrainRoot.L_TerrainTexture; - - /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.TerrainRoot.Brush - /// - public Brush S_Brush => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_HBoxContainer.L_LeftBottomBg.L_TerrainRoot.L_Brush; - - /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg.TerrainRoot - /// - public TerrainRoot S_TerrainRoot => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_HBoxContainer.L_LeftBottomBg.L_TerrainRoot; - - /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer.LeftBottomBg - /// - public LeftBottomBg S_LeftBottomBg => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_HBoxContainer.L_LeftBottomBg; - - /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2.MarginContainer.HBoxContainer - /// - public HBoxContainer S_HBoxContainer => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_HBoxContainer; + public LeftBottomBg S_LeftBottomBg => L_VSplitContainer.L_LeftBottom2.L_MarginContainer.L_LeftBottomBg; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.LeftBottom2 diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/down/MaskCell.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/down/MaskCell.cs new file mode 100644 index 0000000..1c2a77a --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/down/MaskCell.cs @@ -0,0 +1,26 @@ +using Godot; + +namespace UI.TileSetEditorTerrain; + +public class MaskCell : UiCell +{ + public override void OnInit() + { + CellNode.Instance.Init(this); + } + + public override void OnSetData(Rect2I data) + { + CellNode.Instance.SetRect(data); + } + + public override void OnSelect() + { + CellNode.Instance.DragOutline = true; + } + + public override void OnUnSelect() + { + CellNode.Instance.DragOutline = false; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/down/TerrainCellDragHandler.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/down/TerrainCellDragHandler.cs new file mode 100644 index 0000000..43873e6 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/down/TerrainCellDragHandler.cs @@ -0,0 +1,70 @@ +using Godot; + +namespace UI.TileSetEditorTerrain; + +public partial class TerrainCellDragHandler : TextureButton +{ + /// + /// 是否绘制轮廓 + /// + public bool DragOutline { get; set; } = false; + + private TextureRect _textureRect; + private Texture2D _texture; + private Rect2I _rect2I; + private MaskCell _maskCell; + private TileSetEditorTerrainPanel _panel; + + public void Init(MaskCell maskCell) + { + _maskCell = maskCell; + _panel = maskCell.CellNode.UiPanel; + _textureRect = _panel.S_LeftBg.L_TileTexture.Instance; + _texture = _textureRect.Texture; + } + + public void SetRect(Rect2I rect) + { + _rect2I = rect; + } + + public override void _Process(double delta) + { + QueueRedraw(); + if (_maskCell.Grid.SelectIndex == _maskCell.Index && _panel.IsDraggingCell) + { + if (!Input.IsActionPressed(InputAction.MouseLeft)) + { + _panel.IsDraggingCell = false; + } + } + } + + public override Variant _GetDragData(Vector2 atPosition) + { + _panel.IsDraggingCell = true; + _maskCell.Grid.SelectIndex = _maskCell.Index; + var sprite = new Sprite2D(); + sprite.Texture = _texture; + sprite.RegionEnabled = true; + sprite.RegionRect = _rect2I; + var control = new Control(); + control.AddChild(sprite); + control.ZIndex = 10; + control.Scale = _panel.S_LeftBottomBg.L_TerrainRoot.Instance.Scale; + SetDragPreview(control); + return _rect2I; + } + + public override void _Draw() + { + if (DragOutline) + { + //选中时绘制轮廓 + DrawRect( + new Rect2(Vector2.Zero, Size), + new Color(0, 1, 1), false, 2f / _textureRect.Scale.X + ); + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/down/TileEditArea.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/down/TileEditArea.cs new file mode 100644 index 0000000..c66b3f6 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/down/TileEditArea.cs @@ -0,0 +1,35 @@ +using Godot; + +namespace UI.TileSetEditorTerrain; + +public partial class TileEditArea : EditorGridBg +{ + public override void SetUiNode(IUiNode uiNode) + { + base.SetUiNode(uiNode); + InitNode(UiNode.L_TileTexture.Instance, UiNode.L_Grid.Instance); + UiNode.L_TileTexture.L_MaskBrush.Instance.Init(UiNode.L_TileTexture.Instance, UiNode.UiPanel.EditorPanel); + + UiNode.L_TileTexture.Instance.Texture = UiNode.UiPanel.EditorPanel.Texture; + + //聚焦按钮点击 + UiNode.L_FocusBtn.Instance.Pressed += OnFocusClick; + } + + /// + /// 改变TileSet纹理 + /// + public void OnChangeTileSetTexture() + { + UiNode.L_TileTexture.Instance.Size = UiNode.L_TileTexture.Instance.Texture.GetSize(); + OnFocusClick(); + } + + //聚焦按钮点击 + private void OnFocusClick() + { + var texture = UiNode.L_TileTexture.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/tileSetEditorTerrain/left/MaskCell.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/left/MaskCell.cs deleted file mode 100644 index 1c2a77a..0000000 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/left/MaskCell.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Godot; - -namespace UI.TileSetEditorTerrain; - -public class MaskCell : UiCell -{ - public override void OnInit() - { - CellNode.Instance.Init(this); - } - - public override void OnSetData(Rect2I data) - { - CellNode.Instance.SetRect(data); - } - - public override void OnSelect() - { - CellNode.Instance.DragOutline = true; - } - - public override void OnUnSelect() - { - CellNode.Instance.DragOutline = false; - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/left/TerrainCellDragHandler.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/left/TerrainCellDragHandler.cs deleted file mode 100644 index 43873e6..0000000 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/left/TerrainCellDragHandler.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Godot; - -namespace UI.TileSetEditorTerrain; - -public partial class TerrainCellDragHandler : TextureButton -{ - /// - /// 是否绘制轮廓 - /// - public bool DragOutline { get; set; } = false; - - private TextureRect _textureRect; - private Texture2D _texture; - private Rect2I _rect2I; - private MaskCell _maskCell; - private TileSetEditorTerrainPanel _panel; - - public void Init(MaskCell maskCell) - { - _maskCell = maskCell; - _panel = maskCell.CellNode.UiPanel; - _textureRect = _panel.S_LeftBg.L_TileTexture.Instance; - _texture = _textureRect.Texture; - } - - public void SetRect(Rect2I rect) - { - _rect2I = rect; - } - - public override void _Process(double delta) - { - QueueRedraw(); - if (_maskCell.Grid.SelectIndex == _maskCell.Index && _panel.IsDraggingCell) - { - if (!Input.IsActionPressed(InputAction.MouseLeft)) - { - _panel.IsDraggingCell = false; - } - } - } - - public override Variant _GetDragData(Vector2 atPosition) - { - _panel.IsDraggingCell = true; - _maskCell.Grid.SelectIndex = _maskCell.Index; - var sprite = new Sprite2D(); - sprite.Texture = _texture; - sprite.RegionEnabled = true; - sprite.RegionRect = _rect2I; - var control = new Control(); - control.AddChild(sprite); - control.ZIndex = 10; - control.Scale = _panel.S_LeftBottomBg.L_TerrainRoot.Instance.Scale; - SetDragPreview(control); - return _rect2I; - } - - public override void _Draw() - { - if (DragOutline) - { - //选中时绘制轮廓 - DrawRect( - new Rect2(Vector2.Zero, Size), - new Color(0, 1, 1), false, 2f / _textureRect.Scale.X - ); - } - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/left/TileEditArea.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/left/TileEditArea.cs deleted file mode 100644 index c66b3f6..0000000 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/left/TileEditArea.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Godot; - -namespace UI.TileSetEditorTerrain; - -public partial class TileEditArea : EditorGridBg -{ - public override void SetUiNode(IUiNode uiNode) - { - base.SetUiNode(uiNode); - InitNode(UiNode.L_TileTexture.Instance, UiNode.L_Grid.Instance); - UiNode.L_TileTexture.L_MaskBrush.Instance.Init(UiNode.L_TileTexture.Instance, UiNode.UiPanel.EditorPanel); - - UiNode.L_TileTexture.Instance.Texture = UiNode.UiPanel.EditorPanel.Texture; - - //聚焦按钮点击 - UiNode.L_FocusBtn.Instance.Pressed += OnFocusClick; - } - - /// - /// 改变TileSet纹理 - /// - public void OnChangeTileSetTexture() - { - UiNode.L_TileTexture.Instance.Size = UiNode.L_TileTexture.Instance.Texture.GetSize(); - OnFocusClick(); - } - - //聚焦按钮点击 - private void OnFocusClick() - { - var texture = UiNode.L_TileTexture.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/tileSetEditorTerrain/right/TerrainBrush.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/right/TerrainBrush.cs deleted file mode 100644 index 586560d..0000000 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/right/TerrainBrush.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Godot; - -namespace UI.TileSetEditorTerrain; - -public partial class TerrainBrush : Control -{ - public Control TerrainRoot { get; set; } - - - public override void _Process(double delta) - { - QueueRedraw(); - } - - public override void _Draw() - { - //绘制区域 - DrawRect( - new Rect2(Vector2.Zero, TerrainRoot.Size.AsVector2I()), new Color(1, 1, 0, 0.5f), false, - 2f / TerrainRoot.Scale.X - ); - - //绘制鼠标悬停区域 - if (TerrainRoot.IsMouseInRect()) - { - var pos = Utils.GetMouseCellPosition(TerrainRoot) * GameConfig.TileCellSize; - DrawRect( - new Rect2(pos,GameConfig.TileCellSizeVector2I), - Colors.Green, false, 3f / TerrainRoot.Scale.X - ); - } - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/right/TerrainCell.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/right/TerrainCell.cs deleted file mode 100644 index a63671f..0000000 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/right/TerrainCell.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Godot; - -namespace UI.TileSetEditorTerrain; - -public class TerrainCell : UiCell -{ - public override void OnInit() - { - CellNode.Instance.Init(this); - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/right/TerrainCellDropHandler.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/right/TerrainCellDropHandler.cs deleted file mode 100644 index e3387d9..0000000 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/right/TerrainCellDropHandler.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Godot; - -namespace UI.TileSetEditorTerrain; - -public partial class TerrainCellDropHandler : Control -{ - /// - /// 是否放置了图块 - /// - public bool IsPutDownTexture { get; set; } - - private TerrainCell _cell; - private TileSetEditorTerrainPanel _panel; - - public void Init(TerrainCell cell) - { - _cell = cell; - _panel = cell.CellNode.UiPanel; - } - - public override bool _CanDropData(Vector2 atPosition, Variant data) - { - return data.VariantType == Variant.Type.Rect2I; - } - - public override void _DropData(Vector2 atPosition, Variant data) - { - var rect = data.AsRect2I(); - var sprite2D = _cell.CellNode.L_CellTexture.Instance; - sprite2D.Texture = _panel.EditorPanel.Texture; - sprite2D.RegionEnabled = true; - sprite2D.RegionRect = rect; - IsPutDownTexture = true; - } - - public override void _GuiInput(InputEvent @event) - { - //右键擦除图块 - if (@event is InputEventMouseButton mouseEvent && mouseEvent.ButtonIndex == MouseButton.Right && mouseEvent.Pressed) - { - AcceptEvent(); - _cell.CellNode.L_CellTexture.Instance.Texture = null; - IsPutDownTexture = false; - } - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/right/TileEditTerrain.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/right/TileEditTerrain.cs deleted file mode 100644 index 7a40a66..0000000 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/right/TileEditTerrain.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Godot; - -namespace UI.TileSetEditorTerrain; - -public partial class TileEditTerrain : EditorGridBg -{ - public override void SetUiNode(IUiNode uiNode) - { - base.SetUiNode(uiNode); - var tileTexture = UiNode.L_TerrainRoot; - InitNode(tileTexture.Instance, UiNode.L_Grid.Instance); - tileTexture.L_Brush.Instance.TerrainRoot = tileTexture.Instance; - - //聚焦按钮点击 - UiNode.L_FocusBtn.Instance.Pressed += OnFocusClick; - } - - /// - /// 改变TileSet纹理 - /// - public void OnChangeTileSetTexture() - { - //UiNode.L_TileTexture.Instance.Size = UiNode.L_TileTexture.Instance.Texture.GetSize(); - OnFocusClick(); - } - - //聚焦按钮点击 - private void OnFocusClick() - { - var root = UiNode.L_TerrainRoot.Instance; - Utils.DoFocusNode(ContainerRoot, Size, root.Size); - RefreshGridTrans(); - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainBrush.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainBrush.cs new file mode 100644 index 0000000..586560d --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainBrush.cs @@ -0,0 +1,33 @@ +using Godot; + +namespace UI.TileSetEditorTerrain; + +public partial class TerrainBrush : Control +{ + public Control TerrainRoot { get; set; } + + + public override void _Process(double delta) + { + QueueRedraw(); + } + + public override void _Draw() + { + //绘制区域 + DrawRect( + new Rect2(Vector2.Zero, TerrainRoot.Size.AsVector2I()), new Color(1, 1, 0, 0.5f), false, + 2f / TerrainRoot.Scale.X + ); + + //绘制鼠标悬停区域 + if (TerrainRoot.IsMouseInRect()) + { + var pos = Utils.GetMouseCellPosition(TerrainRoot) * GameConfig.TileCellSize; + DrawRect( + new Rect2(pos,GameConfig.TileCellSizeVector2I), + Colors.Green, false, 3f / TerrainRoot.Scale.X + ); + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainCell.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainCell.cs new file mode 100644 index 0000000..a63671f --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainCell.cs @@ -0,0 +1,11 @@ +using Godot; + +namespace UI.TileSetEditorTerrain; + +public class TerrainCell : UiCell +{ + public override void OnInit() + { + CellNode.Instance.Init(this); + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainCellDropHandler.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainCellDropHandler.cs new file mode 100644 index 0000000..e3387d9 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainCellDropHandler.cs @@ -0,0 +1,46 @@ +using Godot; + +namespace UI.TileSetEditorTerrain; + +public partial class TerrainCellDropHandler : Control +{ + /// + /// 是否放置了图块 + /// + public bool IsPutDownTexture { get; set; } + + private TerrainCell _cell; + private TileSetEditorTerrainPanel _panel; + + public void Init(TerrainCell cell) + { + _cell = cell; + _panel = cell.CellNode.UiPanel; + } + + public override bool _CanDropData(Vector2 atPosition, Variant data) + { + return data.VariantType == Variant.Type.Rect2I; + } + + public override void _DropData(Vector2 atPosition, Variant data) + { + var rect = data.AsRect2I(); + var sprite2D = _cell.CellNode.L_CellTexture.Instance; + sprite2D.Texture = _panel.EditorPanel.Texture; + sprite2D.RegionEnabled = true; + sprite2D.RegionRect = rect; + IsPutDownTexture = true; + } + + public override void _GuiInput(InputEvent @event) + { + //右键擦除图块 + if (@event is InputEventMouseButton mouseEvent && mouseEvent.ButtonIndex == MouseButton.Right && mouseEvent.Pressed) + { + AcceptEvent(); + _cell.CellNode.L_CellTexture.Instance.Texture = null; + IsPutDownTexture = false; + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainTabData.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainTabData.cs new file mode 100644 index 0000000..9424b6f --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainTabData.cs @@ -0,0 +1,15 @@ +using System; + +namespace UI.TileSetEditorTerrain; + +public class TerrainTabData +{ + public string Text; + public TileSetEditorTerrain.LeftBottomBg LeftBottomBg; + + public TerrainTabData(string text, TileSetEditorTerrain.LeftBottomBg leftBottomBg) + { + Text = text; + LeftBottomBg = leftBottomBg; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TileEditTerrain.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TileEditTerrain.cs new file mode 100644 index 0000000..7a40a66 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TileEditTerrain.cs @@ -0,0 +1,34 @@ +using Godot; + +namespace UI.TileSetEditorTerrain; + +public partial class TileEditTerrain : EditorGridBg +{ + public override void SetUiNode(IUiNode uiNode) + { + base.SetUiNode(uiNode); + var tileTexture = UiNode.L_TerrainRoot; + InitNode(tileTexture.Instance, UiNode.L_Grid.Instance); + tileTexture.L_Brush.Instance.TerrainRoot = tileTexture.Instance; + + //聚焦按钮点击 + UiNode.L_FocusBtn.Instance.Pressed += OnFocusClick; + } + + /// + /// 改变TileSet纹理 + /// + public void OnChangeTileSetTexture() + { + //UiNode.L_TileTexture.Instance.Size = UiNode.L_TileTexture.Instance.Texture.GetSize(); + OnFocusClick(); + } + + //聚焦按钮点击 + private void OnFocusClick() + { + var root = UiNode.L_TerrainRoot.Instance; + Utils.DoFocusNode(ContainerRoot, Size, root.Size); + RefreshGridTrans(); + } +} \ No newline at end of file