地牢编辑器移植完成
This commit is contained in:
parent
871758594c
commit
57db6b1b3e
Binary file not shown.
Binary file not shown.
33
DungeonShooting_Godot/prefab/dungeonitem/Dungenitem0002.tscn
Normal file
33
DungeonShooting_Godot/prefab/dungeonitem/Dungenitem0002.tscn
Normal file
|
@ -0,0 +1,33 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://c4ds87128cvpy"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bkc3fxmnxe7nh" path="res://resource/sprite/item/Items.png" id="1_dgsm7"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6ikro"]
|
||||
atlas = ExtResource("1_dgsm7")
|
||||
region = Rect2(336, 209, 42, 64)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_bq02g"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6ikro")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8wvh6"]
|
||||
size = Vector2(20, 14)
|
||||
|
||||
[node name="Dungenitem0002" type="CharacterBody2D"]
|
||||
collision_layer = 512
|
||||
collision_mask = 0
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(6, -24)
|
||||
sprite_frames = SubResource("SpriteFrames_bq02g")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(-1, 0)
|
||||
shape = SubResource("RectangleShape2D_8wvh6")
|
|
@ -4,7 +4,6 @@
|
|||
[ext_resource type="Shader" path="res://resource/shader/Blend.gdshader" id="2_0claj"]
|
||||
[ext_resource type="Texture2D" uid="uid://bt3rvgedbniwq" path="res://resource/sprite/item/hall_a/Slice_22.png" id="3_os210"]
|
||||
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_wh4b7"]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource("2_0claj")
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
|
||||
[node name="MoveComponent" type="CharacterBody2D"]
|
||||
|
||||
[node name="Collision" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=16 format=3 uid="uid://csbxfkdupsckv"]
|
||||
[gd_scene load_steps=18 format=3 uid="uid://csbxfkdupsckv"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/game/ui/mapEditor/MapEditorPanel.cs" id="1_5s7a0"]
|
||||
[ext_resource type="Texture2D" uid="uid://cajcnlimvoxk" path="res://resource/sprite/ui/commonIcon/Back.png" id="2_gkcw7"]
|
||||
|
@ -8,10 +8,12 @@
|
|||
[ext_resource type="Script" path="res://src/game/ui/mapEditor/tileView/EditorTileMap.cs" id="4_mhy1a"]
|
||||
[ext_resource type="Texture2D" uid="uid://bpbfjyj6258da" path="res://resource/sprite/ui/commonIcon/Setting.png" id="5_ubl8b"]
|
||||
[ext_resource type="PackedScene" uid="uid://b4u66mxndxbrg" path="res://prefab/ui/MapEditorTools.tscn" id="6_7pvgu"]
|
||||
[ext_resource type="PackedScene" uid="uid://ckurrh15w3yrt" path="res://prefab/ui/MapEditorConfigObject.tscn" id="7_42mx1"]
|
||||
[ext_resource type="PackedScene" uid="uid://bb2ekkpxifd7g" path="res://prefab/ui/MapEditorMapLayer.tscn" id="7_ychtn"]
|
||||
[ext_resource type="PackedScene" uid="uid://peo0n8bl15y5" path="res://prefab/ui/MapEditorMapMark.tscn" id="8_8tgeu"]
|
||||
[ext_resource type="NavigationPolygon" uid="uid://brpcle7mygiml" path="res://resource/navigation/NavigationPolygon.tres" id="8_t7nq5"]
|
||||
[ext_resource type="PackedScene" uid="uid://tjbfj67t5akm" path="res://prefab/ui/MapEditorMapTile.tscn" id="10_4fu5v"]
|
||||
[ext_resource type="PackedScene" uid="uid://6a4l0o8pmegw" path="res://prefab/ui/MapEditorObject.tscn" id="12_vpk4h"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_o3btm"]
|
||||
length = 0.001
|
||||
|
@ -184,10 +186,10 @@ layout_mode = 2
|
|||
|
||||
[node name="MapEditorMapLayer" parent="Bg/VBoxContainer/HSplitContainer/HSplitContainer2/HBoxContainer/LayerPanel" instance=ExtResource("7_ychtn")]
|
||||
layout_mode = 1
|
||||
offset_left = 2.0
|
||||
offset_top = 2.0
|
||||
offset_right = -2.0
|
||||
offset_bottom = -2.0
|
||||
|
||||
[node name="MapEditorConfigObject" parent="Bg/VBoxContainer/HSplitContainer/HSplitContainer2/HBoxContainer/LayerPanel" instance=ExtResource("7_42mx1")]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
[node name="Left" type="Panel" parent="Bg/VBoxContainer/HSplitContainer/HSplitContainer2/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(300, 0)
|
||||
|
@ -283,6 +285,14 @@ theme_override_constants/margin_top = 10
|
|||
[node name="MapEditorMapTile" parent="Bg/VBoxContainer/HSplitContainer/HSplitContainer2/Right/MarginContainer/TabContainer/MapTile" instance=ExtResource("10_4fu5v")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MapObject" type="MarginContainer" parent="Bg/VBoxContainer/HSplitContainer/HSplitContainer2/Right/MarginContainer/TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_top = 10
|
||||
|
||||
[node name="MapEditorObject" parent="Bg/VBoxContainer/HSplitContainer/HSplitContainer2/Right/MarginContainer/TabContainer/MapObject" instance=ExtResource("12_vpk4h")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MapMark" type="MarginContainer" parent="Bg/VBoxContainer/HSplitContainer/HSplitContainer2/Right/MarginContainer/TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
|
93
DungeonShooting_Godot/prefab/ui/MapEditorConfigObject.tscn
Normal file
93
DungeonShooting_Godot/prefab/ui/MapEditorConfigObject.tscn
Normal file
|
@ -0,0 +1,93 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://1kdlshgpe3q2"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/game/ui/mapEditorConfigObject/MapEditorConfigObjectPanel.cs" id="1_qm00b"]
|
||||
[ext_resource type="Texture2D" uid="uid://blfvsup876agh" path="res://resource/sprite/ui/commonIcon/Search.png" id="2_rkdcy"]
|
||||
[ext_resource type="Texture2D" uid="uid://bn47bmilcw4x0" path="res://resource/sprite/ui/commonIcon/Select2.png" id="3_65sjj"]
|
||||
|
||||
[node name="MapEditorConfigObject" 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_qm00b")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
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="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 45)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="SearchInput" type="LineEdit" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "搜索"
|
||||
|
||||
[node name="SearchButton" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
icon = ExtResource("2_rkdcy")
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="CellButton" type="Button" parent="VBoxContainer/ScrollContainer"]
|
||||
custom_minimum_size = Vector2(112, 162)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PreviewImage" type="TextureRect" parent="VBoxContainer/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 = -52.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
expand_mode = 2
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="CellName" type="Label" parent="VBoxContainer/ScrollContainer/CellButton"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 12
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -52.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
theme_override_font_sizes/font_size = 16
|
||||
text = "名称"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
autowrap_mode = 2
|
||||
clip_text = true
|
||||
text_overrun_behavior = 2
|
||||
|
||||
[node name="SelectTexture" type="NinePatchRect" parent="VBoxContainer/ScrollContainer/CellButton"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("3_65sjj")
|
||||
region_rect = Rect2(0, 0, 36, 36)
|
||||
patch_margin_left = 4
|
||||
patch_margin_top = 4
|
||||
patch_margin_right = 4
|
||||
patch_margin_bottom = 4
|
119
DungeonShooting_Godot/prefab/ui/MapEditorObject.tscn
Normal file
119
DungeonShooting_Godot/prefab/ui/MapEditorObject.tscn
Normal file
|
@ -0,0 +1,119 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://6a4l0o8pmegw"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/game/ui/mapEditorObject/MapEditorObjectPanel.cs" id="1_yphyn"]
|
||||
[ext_resource type="Texture2D" uid="uid://blfvsup876agh" path="res://resource/sprite/ui/commonIcon/Search.png" id="2_e3a41"]
|
||||
[ext_resource type="Texture2D" uid="uid://btetxb0hqoifk" path="res://resource/sprite/ui/commonIcon/MarkCell_placeholder.png" id="3_s35vd"]
|
||||
[ext_resource type="Shader" path="res://resource/shader/Blend.gdshader" id="4_by2nt"]
|
||||
[ext_resource type="Texture2D" uid="uid://bn47bmilcw4x0" path="res://resource/sprite/ui/commonIcon/Select2.png" id="5_caspl"]
|
||||
[ext_resource type="Texture2D" uid="uid://c5778ntk2rdon" path="res://resource/sprite/ui/commonIcon/Delete.png" id="7_8ld0o"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_wkboy"]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource("4_by2nt")
|
||||
shader_parameter/blend = Color(1, 1, 1, 1)
|
||||
shader_parameter/schedule = 0.0
|
||||
shader_parameter/modulate = Color(1, 1, 1, 1)
|
||||
shader_parameter/show_outline = true
|
||||
shader_parameter/outline_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/outline_rainbow = false
|
||||
shader_parameter/outline_use_blend = false
|
||||
shader_parameter/grey = 0.0
|
||||
|
||||
[node name="MapEditorObject" 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_yphyn")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 45)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="SearchInput" type="LineEdit" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "搜索"
|
||||
|
||||
[node name="SearchButton" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
icon = ExtResource("2_e3a41")
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2"]
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
text = "物体层级:"
|
||||
|
||||
[node name="LayerOption" type="OptionButton" parent="VBoxContainer/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
item_count = 2
|
||||
selected = 0
|
||||
popup/item_0/text = "Normal"
|
||||
popup/item_0/id = 0
|
||||
popup/item_1/text = "YSort"
|
||||
popup/item_1/id = 1
|
||||
|
||||
[node name="ItemRoot" type="ScrollContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Item" type="HBoxContainer" parent="VBoxContainer/ItemRoot"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ItemButton" type="Button" parent="VBoxContainer/ItemRoot/Item"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "名称"
|
||||
icon = ExtResource("3_s35vd")
|
||||
alignment = 0
|
||||
text_overrun_behavior = 3
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="VBoxContainer/ItemRoot/Item/ItemButton"]
|
||||
material = SubResource("ShaderMaterial_wkboy")
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 2.0
|
||||
offset_top = -32.0
|
||||
offset_right = 66.0
|
||||
offset_bottom = 32.0
|
||||
grow_vertical = 2
|
||||
expand_mode = 2
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Select" type="NinePatchRect" parent="VBoxContainer/ItemRoot/Item/ItemButton"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("5_caspl")
|
||||
patch_margin_left = 4
|
||||
patch_margin_top = 4
|
||||
patch_margin_right = 4
|
||||
patch_margin_bottom = 4
|
||||
|
||||
[node name="DynamicDeleteButton" type="Button" parent="."]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
offset_right = 44.0
|
||||
offset_bottom = 40.0
|
||||
icon = ExtResource("7_8ld0o")
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=12 format=3 uid="uid://b4u66mxndxbrg"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://b4u66mxndxbrg"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/game/ui/mapEditorTools/MapEditorToolsPanel.cs" id="1_mqp1c"]
|
||||
[ext_resource type="Script" path="res://src/game/ui/mapEditorTools/DoorHoverArea.cs" id="2_6qfy3"]
|
||||
|
@ -10,7 +10,7 @@
|
|||
[ext_resource type="Texture2D" uid="uid://dnty1a2tcawos" path="res://resource/sprite/ui/commonIcon/Mark.png" id="6_n7h3g"]
|
||||
[ext_resource type="Script" path="res://src/game/ui/mapEditorTools/MarkTool.cs" id="7_ekxcj"]
|
||||
[ext_resource type="Texture2D" uid="uid://cuntr7hec044f" path="res://resource/sprite/ui/commonIcon/Select.png" id="7_mqmd6"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/game/ui/mapEditorTools/CustomObject.cs" id="9_mdsqu"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_wxp5t"]
|
||||
resource_local_to_scene = true
|
||||
|
@ -24,6 +24,9 @@ shader_parameter/outline_rainbow = false
|
|||
shader_parameter/outline_use_blend = false
|
||||
shader_parameter/grey = 0.0
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0a2r0"]
|
||||
size = Vector2(16, 16)
|
||||
|
||||
[node name="MapEditorTools" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
|
@ -175,6 +178,21 @@ expand_mode = 2
|
|||
stretch_mode = 5
|
||||
script = ExtResource("7_ekxcj")
|
||||
|
||||
[node name="ObjectTemplate" type="Area2D" parent="."]
|
||||
collision_layer = 8192
|
||||
collision_mask = 0
|
||||
monitoring = false
|
||||
monitorable = false
|
||||
script = ExtResource("9_mdsqu")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="ObjectTemplate"]
|
||||
shape = SubResource("RectangleShape2D_0a2r0")
|
||||
|
||||
[node name="Bar" type="Node2D" parent="ObjectTemplate"]
|
||||
|
||||
[node name="RectBrush" type="Node2D" parent="ObjectTemplate"]
|
||||
z_index = 15
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
[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"]
|
||||
[ext_resource type="Script" path="res://src/game/common/ui/EditorMaskBrush.cs" id="7_k0dkc"]
|
||||
[ext_resource type="Script" path="res://src/game/common/editor/EditorMaskBrush.cs" id="7_k0dkc"]
|
||||
[ext_resource type="Texture2D" uid="uid://d2wslibovwv7w" path="res://resource/sprite/ui/commonIcon/CenterTool.png" id="7_mbnpy"]
|
||||
|
||||
[node name="TileSetEditorCombination" type="Control"]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
[ext_resource type="Script" path="res://src/game/ui/tileSetEditorTerrain/TileSetEditorTerrainPanel.cs" id="1_6jjk7"]
|
||||
[ext_resource type="Texture2D" uid="uid://n4atvj5fkcpg" path="res://resource/sprite/ui/commonIcon/Add.png" id="2_ns54l"]
|
||||
[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/common/editor/EditorMaskBrush.cs" id="3_gydh0"]
|
||||
[ext_resource type="Texture2D" uid="uid://c5778ntk2rdon" path="res://resource/sprite/ui/commonIcon/Delete.png" id="3_jn1bd"]
|
||||
[ext_resource type="Texture2D" uid="uid://dggb6p4sdmfry" path="res://resource/sprite/ui/commonIcon/Edit.png" id="3_xmuhh"]
|
||||
[ext_resource type="Texture2D" uid="uid://bn47bmilcw4x0" path="res://resource/sprite/ui/commonIcon/Select2.png" id="4_ka47m"]
|
||||
|
|
|
@ -939,7 +939,7 @@
|
|||
},
|
||||
{
|
||||
"Id": "item_0003",
|
||||
"Name": "",
|
||||
"Name": "\u6321\u677F",
|
||||
"Type": 99,
|
||||
"Quality": 0,
|
||||
"Price": 0,
|
||||
|
@ -948,7 +948,7 @@
|
|||
"IsStatic": true,
|
||||
"__Material": "",
|
||||
"Prefab": "res://prefab/item/Item0003.tscn",
|
||||
"Icon": "",
|
||||
"Icon": "res://resource/sprite/item/hall_b/item-32.png",
|
||||
"ShowInMapEditor": false
|
||||
},
|
||||
{
|
||||
|
@ -967,7 +967,7 @@
|
|||
},
|
||||
{
|
||||
"Id": "item_0005",
|
||||
"Name": "",
|
||||
"Name": "\u4FDD\u9669\u7BB1",
|
||||
"Type": 99,
|
||||
"Quality": 0,
|
||||
"Price": 0,
|
||||
|
@ -976,7 +976,7 @@
|
|||
"IsStatic": true,
|
||||
"__Material": "",
|
||||
"Prefab": "res://prefab/item/Item0005.tscn",
|
||||
"Icon": "",
|
||||
"Icon": "res://resource/sprite/item/hall_b/item-01.png",
|
||||
"ShowInMapEditor": false
|
||||
},
|
||||
{
|
||||
|
@ -1186,7 +1186,7 @@
|
|||
"IsStatic": true,
|
||||
"__Material": "",
|
||||
"Prefab": "res://prefab/item/Item0020.tscn",
|
||||
"Icon": "",
|
||||
"Icon": "res://resource/sprite/item/hall_a/Slice_42.png",
|
||||
"ShowInMapEditor": false
|
||||
},
|
||||
{
|
||||
|
@ -1228,7 +1228,7 @@
|
|||
"IsStatic": true,
|
||||
"__Material": "",
|
||||
"Prefab": "res://prefab/item/Item0023.tscn",
|
||||
"Icon": "",
|
||||
"Icon": "res://resource/sprite/item/hall_a/Slice_40.png",
|
||||
"ShowInMapEditor": false
|
||||
},
|
||||
{
|
||||
|
|
|
@ -27,186 +27,11 @@
|
|||
"Prefab": "item_0023",
|
||||
"Icon": ""
|
||||
},
|
||||
{
|
||||
"Id": "0005",
|
||||
"Name": "\u751F\u65E5\u86CB\u7CD5",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0001.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0001_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0006",
|
||||
"Name": "\u76F8\u673A",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0002.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0002_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0007",
|
||||
"Name": "\u5893\u7891",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0003.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0003_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0008",
|
||||
"Name": "\u74F6\u5B5001",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0004.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0004_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0009",
|
||||
"Name": "\u9EC4\u7CD6\u68CD-\u5DE6",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0005.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0005_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0010",
|
||||
"Name": "\u7EA2\u7CD6\u68CD-\u5DE6",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0006.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0006_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0011",
|
||||
"Name": "\u9EC4\u7CD6\u68CD-\u53F3",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0007.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0007_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0012",
|
||||
"Name": "\u7EA2\u7CD6\u68CD-\u53F3",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0008.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0008_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0013",
|
||||
"Name": "\u7EA2\u68D2\u68D2\u7CD6",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0009.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0009_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0014",
|
||||
"Name": "\u9EC4\u68D2\u68D2\u7CD6",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0010.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0010_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0015",
|
||||
"Name": "\u751C\u751C\u5708",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0011.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0011_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0016",
|
||||
"Name": "\u9999\u8549",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0012.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0012_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0017",
|
||||
"Name": "\u68A8\u5B50",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0013.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0013_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0018",
|
||||
"Name": "\u897F\u74DC",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0014.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0014_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0019",
|
||||
"Name": "\u5C71\u7AF9",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0015.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0015_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0020",
|
||||
"Name": "\u6A59\u5B50",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0016.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0016_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0021",
|
||||
"Name": "\u7B3C\u5B50",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0017.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0017_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0022",
|
||||
"Name": "\u6C99\u53D1",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0018.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0018_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0023",
|
||||
"Name": "\u6905\u5B5001",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0019.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0019_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0024",
|
||||
"Name": "\u996E\u6C34\u673A",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0020.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0020_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0025",
|
||||
"Name": "\u6728\u7BB1",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0021.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0021_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0026",
|
||||
"Name": "\u74F6\u5B5002",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0022.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0022_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0027",
|
||||
"Name": "\u9152\u6876-\u5173",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0023.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0023_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0028",
|
||||
"Name": "\u9152\u6876-\u5F00",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0024.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0024_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0029",
|
||||
"Name": "\u5DE7\u514B\u529B\u5757",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0025.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0025_ICON.png"
|
||||
},
|
||||
{
|
||||
"Id": "0030",
|
||||
"Name": "\u6728\u677F",
|
||||
"Remark": "",
|
||||
"Prefab": "res://prefab/dungeonitem/Dungenitem0026.tscn",
|
||||
"Icon": "res://resource/DungeonitemICON/Dungeonitem0026_ICON.png"
|
||||
"Icon": "res://resource/sprite/itemIcon/item0002_icon.png"
|
||||
}
|
||||
]
|
|
@ -47,6 +47,10 @@
|
|||
{
|
||||
"ErrorType": 0,
|
||||
"Path": "resource/map/tileMaps/Test1/inlet/Start2"
|
||||
},
|
||||
{
|
||||
"ErrorType": 0,
|
||||
"Path": "resource/map/tileMaps/Test1/inlet/StartTest"
|
||||
}
|
||||
],
|
||||
"OutletList": [
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":true,"WaveList":[[{"Position":{"X":0,"Y":0},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]}]]}]
|
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://catkx4ioplk7r"
|
||||
path="res://.godot/imported/Preview.png-28e265a85fcd3d3f19005e05f4081de2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://resource/map/tileMaps/Test1/inlet/StartTest/Preview.png"
|
||||
dest_files=["res://.godot/imported/Preview.png-28e265a85fcd3d3f19005e05f4081de2.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
|
|
@ -0,0 +1 @@
|
|||
{"Position":{"X":-12,"Y":-11},"Size":{"X":20,"Y":19},"DoorAreaInfos":[],"GroupName":"Test1","RoomType":2,"RoomName":"StartTest","Weight":100,"Remark":""}
|
|
@ -0,0 +1 @@
|
|||
{"NavigationVertices":[{"X":90,"Y":106},{"X":-154,"Y":106},{"X":-154,"Y":-122},{"X":90,"Y":-122}],"NavigationPolygon":[[0,1,2,3]],"Floor":[-10,-8,0,3,-10,-7,0,3,-10,-6,0,3,-10,-5,0,3,-10,-4,0,3,-10,-3,0,3,-10,-2,0,3,-10,-1,0,3,-10,0,0,3,-10,1,0,3,-10,2,0,3,-10,3,0,3,-10,4,0,3,-10,5,0,3,-9,-8,0,3,-9,-7,0,3,-9,-6,0,3,-9,-5,0,3,-9,-4,0,3,-9,-3,0,3,-9,-2,0,3,-9,-1,0,3,-9,0,0,3,-9,1,0,3,-9,2,0,3,-9,3,0,3,-9,4,0,3,-9,5,0,3,-8,-8,0,3,-8,-7,0,3,-8,-6,0,3,-8,-5,0,3,-8,-4,0,3,-8,-3,0,3,-8,-2,0,3,-8,-1,0,3,-8,0,0,3,-8,1,0,3,-8,2,0,3,-8,3,0,3,-8,4,0,3,-8,5,0,3,-7,-8,0,3,-7,-7,0,3,-7,-6,0,3,-7,-5,0,3,-7,-4,0,3,-7,-3,0,3,-7,-2,0,3,-7,-1,0,3,-7,0,0,3,-7,1,0,3,-7,2,0,3,-7,3,0,3,-7,4,0,3,-7,5,0,3,-6,-8,0,3,-6,-7,0,3,-6,-6,0,3,-6,-5,0,3,-6,-4,0,3,-6,-3,0,3,-6,-2,0,3,-6,-1,0,3,-6,0,0,3,-6,1,0,3,-6,2,0,3,-6,3,0,3,-6,4,0,3,-6,5,0,3,-5,-8,0,3,-5,-7,0,3,-5,-6,0,3,-5,-5,0,3,-5,-4,0,3,-5,-3,0,3,-5,-2,0,3,-5,-1,0,3,-5,0,0,3,-5,1,0,3,-5,2,0,3,-5,3,0,3,-5,4,0,3,-5,5,0,3,-4,-8,0,3,-4,-7,0,3,-4,-6,0,3,-4,-5,0,3,-4,-4,0,3,-4,-3,0,3,-4,-2,0,3,-4,-1,0,3,-4,0,0,3,-4,1,0,3,-4,2,0,3,-4,3,0,3,-4,4,0,3,-4,5,0,3,-3,-8,0,3,-3,-7,0,3,-3,-6,0,3,-3,-5,0,3,-3,-4,0,3,-3,-3,0,3,-3,-2,0,3,-3,-1,0,3,-3,0,0,3,-3,1,0,3,-3,2,0,3,-3,3,0,3,-3,4,0,3,-3,5,0,3,-2,-8,0,3,-2,-7,0,3,-2,-6,0,3,-2,-5,0,3,-2,-4,0,3,-2,-3,0,3,-2,-2,0,3,-2,-1,0,3,-2,0,0,3,-2,1,0,3,-2,2,0,3,-2,3,0,3,-2,4,0,3,-2,5,0,3,-1,-8,0,3,-1,-7,0,3,-1,-6,0,3,-1,-5,0,3,-1,-4,0,3,-1,-3,0,3,-1,-2,0,3,-1,-1,0,3,-1,0,0,3,-1,1,0,3,-1,2,0,3,-1,3,0,3,-1,4,0,3,-1,5,0,3,0,-8,0,3,0,-7,0,3,0,-6,0,3,0,-5,0,3,0,-4,0,3,0,-3,0,3,0,-2,0,3,0,-1,0,3,0,0,0,3,0,1,0,3,0,2,0,3,0,3,0,3,0,4,0,3,0,5,0,3,1,-8,0,3,1,-7,0,3,1,-6,0,3,1,-5,0,3,1,-4,0,3,1,-3,0,3,1,-2,0,3,1,-1,0,3,1,0,0,3,1,1,0,3,1,2,0,3,1,3,0,3,1,4,0,3,1,5,0,3,2,-8,0,3,2,-7,0,3,2,-6,0,3,2,-5,0,3,2,-4,0,3,2,-3,0,3,2,-2,0,3,2,-1,0,3,2,0,0,3,2,1,0,3,2,2,0,3,2,3,0,3,2,4,0,3,2,5,0,3,3,-8,0,3,3,-7,0,3,3,-6,0,3,3,-5,0,3,3,-4,0,3,3,-3,0,3,3,-2,0,3,3,-1,0,3,3,0,0,3,3,1,0,3,3,2,0,3,3,3,0,3,3,4,0,3,3,5,0,3,4,-8,0,3,4,-7,0,3,4,-6,0,3,4,-5,0,3,4,-4,0,3,4,-3,0,3,4,-2,0,3,4,-1,0,3,4,0,0,3,4,1,0,3,4,2,0,3,4,3,0,3,4,4,0,3,4,5,0,3,5,-8,0,3,5,-7,0,3,5,-6,0,3,5,-5,0,3,5,-4,0,3,5,-3,0,3,5,-2,0,3,5,-1,0,3,5,0,0,3,5,1,0,3,5,2,0,3,5,3,0,3,5,4,0,3,5,5,0,3],"CustomFloor1":[],"CustomFloor2":[],"CustomFloor3":[],"CustomMiddle1":[],"CustomMiddle2":[],"CustomTop":[],"NormalLayerObjects":[],"YSortLayerObjects":[{"Id":"0006","X":-77,"Y":-38},{"Id":"0006","X":21,"Y":41}]}
|
BIN
DungeonShooting_Godot/resource/sprite/item/Items.png
Normal file
BIN
DungeonShooting_Godot/resource/sprite/item/Items.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
34
DungeonShooting_Godot/resource/sprite/item/Items.png.import
Normal file
34
DungeonShooting_Godot/resource/sprite/item/Items.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bkc3fxmnxe7nh"
|
||||
path="res://.godot/imported/Items.png-c7f11029206f49e1dc7f04d29807e764.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://resource/sprite/item/Items.png"
|
||||
dest_files=["res://.godot/imported/Items.png-c7f11029206f49e1dc7f04d29807e764.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
|
BIN
DungeonShooting_Godot/resource/sprite/itemIcon/item0002_icon.png
Normal file
BIN
DungeonShooting_Godot/resource/sprite/itemIcon/item0002_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 837 B |
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://vr2wbuxvn6e2"
|
||||
path="res://.godot/imported/item0002_icon.png-0ef326b8a821685b6961de25b0df6160.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://resource/sprite/itemIcon/item0002_icon.png"
|
||||
dest_files=["res://.godot/imported/item0002_icon.png-0ef326b8a821685b6961de25b0df6160.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
|
|
@ -90,14 +90,13 @@ position = Vector2(502, 214)
|
|||
|
||||
[node name="DungeonEntrance" type="Area2D" parent="." index="4"]
|
||||
z_index = 15
|
||||
position = Vector2(346, 179)
|
||||
position = Vector2(483, 182)
|
||||
collision_layer = 0
|
||||
collision_mask = 8
|
||||
monitorable = false
|
||||
script = ExtResource("3_t3my6")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DungeonEntrance" index="0"]
|
||||
position = Vector2(137.5, 2)
|
||||
shape = SubResource("RectangleShape2D_ru8u4")
|
||||
|
||||
[node name="ItemRoot" type="Node2D" parent="." index="5"]
|
||||
|
|
|
@ -344,7 +344,7 @@ public partial class ActivityObject
|
|||
/// </summary>
|
||||
public const string Id_item_0002 = "item_0002";
|
||||
/// <summary>
|
||||
/// 名称: <br/>
|
||||
/// 名称: 挡板 <br/>
|
||||
/// 简介:
|
||||
/// </summary>
|
||||
public const string Id_item_0003 = "item_0003";
|
||||
|
@ -354,7 +354,7 @@ public partial class ActivityObject
|
|||
/// </summary>
|
||||
public const string Id_item_0004 = "item_0004";
|
||||
/// <summary>
|
||||
/// 名称: <br/>
|
||||
/// 名称: 保险箱 <br/>
|
||||
/// 简介:
|
||||
/// </summary>
|
||||
public const string Id_item_0005 = "item_0005";
|
||||
|
|
|
@ -347,9 +347,43 @@ public class UiGrid<TUiCellNode, TData> : IUiGrid where TUiCellNode : IUiCellNod
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置当前网格组件中的所有 Cell 数据, 性能较低
|
||||
/// </summary>
|
||||
public void SetDataList(List<TData> array)
|
||||
{
|
||||
//取消选中
|
||||
SelectIndex = -1;
|
||||
if (array.Count > _cellList.Count)
|
||||
{
|
||||
do
|
||||
{
|
||||
var cell = GetCellInstance();
|
||||
GridContainer.AddChild(cell.CellNode.GetUiInstance());
|
||||
} while (array.Count > _cellList.Count);
|
||||
}
|
||||
else if (array.Count < _cellList.Count)
|
||||
{
|
||||
do
|
||||
{
|
||||
var cell = _cellList[_cellList.Count - 1];
|
||||
_cellList.RemoveAt(_cellList.Count - 1);
|
||||
ReclaimCellInstance(cell);
|
||||
} while (array.Count < _cellList.Count);
|
||||
}
|
||||
|
||||
for (var i = 0; i < _cellList.Count; i++)
|
||||
{
|
||||
var data = array[i];
|
||||
_cellList[i].UpdateData(data);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置当前网格组件中的所有 Cell 数据, 该函数为协程函数,可用于分帧处理大量数据
|
||||
/// </summary>
|
||||
/// <param name="array">数据集合</param>
|
||||
/// <returns></returns>
|
||||
public IEnumerator SetDataListCoroutine(ICollection<TData> array)
|
||||
{
|
||||
RemoveAll();
|
||||
|
|
|
@ -121,7 +121,7 @@ public partial class GameApplication : Node2D, ICoroutine
|
|||
FirstDungeonConfig = GetDungeonConfig(DungeonGroupList[0], 1);
|
||||
|
||||
//临时处理
|
||||
RoomConfig[DungeonGroupList[0]].BgColor = new Color("0a0a19");
|
||||
//RoomConfig[DungeonGroupList[0]].BgColor = new Color("0a0a19");
|
||||
RoomConfig[DungeonGroupList[0]].SoundId = null; //"level1_bgm";
|
||||
}
|
||||
|
||||
|
|
16
DungeonShooting_Godot/src/game/common/editor/IEditorTab.cs
Normal file
16
DungeonShooting_Godot/src/game/common/editor/IEditorTab.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
/// <summary>
|
||||
/// 编辑器页签
|
||||
/// </summary>
|
||||
public interface IEditorTab
|
||||
{
|
||||
/// <summary>
|
||||
/// 选中页签
|
||||
/// </summary>
|
||||
void OnSelectTab();
|
||||
|
||||
/// <summary>
|
||||
/// 取消选中页签
|
||||
/// </summary>
|
||||
void OnUnSelectTab();
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
using UI.MapEditor;
|
||||
|
||||
/// <summary>
|
||||
/// 聚焦按钮
|
||||
/// </summary>
|
||||
public class EditorFocus : EditorToolBase
|
||||
{
|
||||
public EditorFocus(EditorTileMap editorTileMap) : base(
|
||||
ResourcePath.resource_sprite_ui_commonIcon_CenterTool_png, "聚焦", false, editorTileMap, EditorToolEnum.Focus)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
EditorTileMap.OnFocusClick();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
using UI.MapEditor;
|
||||
|
||||
/// <summary>
|
||||
/// 编辑物体标记
|
||||
/// </summary>
|
||||
public class EditorMarkTool : EditorToolBase
|
||||
{
|
||||
public EditorMarkTool(EditorTileMap editorTileMap) : base(
|
||||
ResourcePath.resource_sprite_ui_commonIcon_DoorTool_png, "编辑物体标记", true, editorTileMap, EditorToolEnum.MarkTool)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnSetSelected(bool selected)
|
||||
{
|
||||
if (selected)
|
||||
{
|
||||
EditorTileMap.MapEditorPanel.S_MapEditorMapLayer.Instance.SetLayerVisible(MapLayer.MarkLayer, true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
|
||||
using Godot;
|
||||
using UI.MapEditor;
|
||||
|
||||
/// <summary>
|
||||
/// 移动视角按钮
|
||||
/// </summary>
|
||||
public class EditorMove : EditorToolBase
|
||||
{
|
||||
private bool _isPressed;
|
||||
|
||||
public EditorMove(EditorTileMap editorTileMap) : base(
|
||||
ResourcePath.resource_sprite_ui_commonIcon_DragTool_png, "移动视角", true, editorTileMap, EditorToolEnum.Move)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnMapInputEvent(InputEvent @event)
|
||||
{
|
||||
if (@event is InputEventMouseButton mouseButton)
|
||||
{
|
||||
if (mouseButton.ButtonIndex == MouseButton.Left || mouseButton.ButtonIndex == MouseButton.Right || mouseButton.ButtonIndex == MouseButton.Middle)
|
||||
{
|
||||
_isPressed = mouseButton.Pressed;
|
||||
}
|
||||
}
|
||||
else if (@event is InputEventMouseMotion motion)
|
||||
{
|
||||
if (_isPressed)
|
||||
{
|
||||
EditorTileMap.SetMapPosition(EditorTileMap.Position + motion.Relative);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
|
||||
using Godot;
|
||||
using UI.MapEditor;
|
||||
|
||||
public class EditorObjectPen : EditorToolBase
|
||||
{
|
||||
private bool _isPressed;
|
||||
|
||||
public EditorObjectPen(EditorTileMap editorTileMap) : base(
|
||||
ResourcePath.resource_sprite_ui_commonIcon_PenTool_png, "绘制物体", true, editorTileMap, EditorToolEnum.ObjectPen)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnMapInputEvent(InputEvent @event)
|
||||
{
|
||||
if (@event is InputEventMouseButton mouseButton)
|
||||
{
|
||||
if (mouseButton.ButtonIndex == MouseButton.Left)
|
||||
{
|
||||
_isPressed = mouseButton.Pressed;
|
||||
if (_isPressed)
|
||||
{
|
||||
DoPutObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DoPutObject()
|
||||
{
|
||||
var config = EditorTileMap.MapEditorPanel.S_MapEditorConfigObject.Instance.GetSelectConfig();
|
||||
if (config != null)
|
||||
{
|
||||
var pos = EditorTileMap.GetLocalMousePosition().AsVector2I();
|
||||
EventManager.EmitEvent(EventEnum.OnPutObject, new RoomObjectInfo()
|
||||
{
|
||||
Id = config.Id,
|
||||
X = pos.X,
|
||||
Y = pos.Y
|
||||
});
|
||||
EventManager.EmitEvent(EventEnum.OnTileMapDirty);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorWindowManager.ShowTips("提示", "请先在左侧面板选择一个物体!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
using Godot;
|
||||
using UI.MapEditor;
|
||||
using UI.MapEditorObject;
|
||||
using UI.MapEditorTools;
|
||||
|
||||
public class EditorObjectTool : EditorToolBase
|
||||
{
|
||||
private bool _isPressed;
|
||||
private int _flag = 0;
|
||||
//private Vector2 _offset;
|
||||
|
||||
private UiGrid<MapEditorObject.Item, RoomObjectInfo> _objectGrid;
|
||||
private Dictionary<RoomObjectInfo, MapEditorToolsPanel.CustonObjectData> _customObjecMapping;
|
||||
|
||||
|
||||
public EditorObjectTool(EditorTileMap editorTileMap) : base(
|
||||
ResourcePath.resource_sprite_ui_commonIcon_DoorTool_png, "编辑物体", true, editorTileMap, EditorToolEnum.ObjectTool)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnSetSelected(bool selected)
|
||||
{
|
||||
_objectGrid = EditorTileMap.MapEditorPanel.S_MapEditorObject.Instance.ObjectGrid;
|
||||
_customObjecMapping = EditorTileMap.MapEditorToolsPanel.CustomObjecMapping;
|
||||
}
|
||||
|
||||
public override void OnMapInputEvent(InputEvent @event)
|
||||
{
|
||||
if (@event is InputEventMouseButton mouseButton)
|
||||
{
|
||||
if (mouseButton.ButtonIndex == MouseButton.Left)
|
||||
{
|
||||
_isPressed = mouseButton.Pressed;
|
||||
if (_isPressed)
|
||||
{
|
||||
DoSelectObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
_flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_isPressed && _flag > 0 && _objectGrid.SelectData != null && @event is InputEventMouseMotion)
|
||||
{
|
||||
DoMoveObject();
|
||||
}
|
||||
}
|
||||
|
||||
private void DoSelectObject()
|
||||
{
|
||||
var result = DoCollision();
|
||||
if (result != null)
|
||||
{
|
||||
if (_objectGrid.SelectData != result.Info)
|
||||
{
|
||||
//_offset = result.Position - EditorTileMap.GetLocalMousePosition();
|
||||
EventManager.EmitEvent(EventEnum.OnSelectObject, result.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
_flag++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_flag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void DoMoveObject()
|
||||
{
|
||||
if (_objectGrid.SelectData != null && _customObjecMapping.TryGetValue(_objectGrid.SelectData, out var objectData))
|
||||
{
|
||||
var position = EditorTileMap.GetLocalMousePosition();// - _offset;
|
||||
var nodeInstance = objectData.Node.Instance;
|
||||
nodeInstance.Position = position;
|
||||
nodeInstance.Info.X = (int)position.X;
|
||||
nodeInstance.Info.Y = (int)position.Y;
|
||||
|
||||
EventManager.EmitEvent(EventEnum.OnTileMapDirty);
|
||||
}
|
||||
}
|
||||
|
||||
private CustomObject DoCollision()
|
||||
{
|
||||
var param = new PhysicsPointQueryParameters2D();
|
||||
param.Position = EditorTileMap.GetGlobalMousePosition();
|
||||
param.CollisionMask = PhysicsLayer.UiMouse;
|
||||
param.CollideWithAreas = true;
|
||||
var result = EditorTileMap.GetWorld2D().DirectSpaceState.IntersectPoint(param);
|
||||
|
||||
if (result.Count > 0)
|
||||
{
|
||||
foreach (var dictionary in result)
|
||||
{
|
||||
if (dictionary.TryGetValue("collider", out var collider))
|
||||
{
|
||||
if ((Node2D)collider is CustomObject customObject)
|
||||
{
|
||||
return customObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
|
||||
using Godot;
|
||||
using UI.MapEditor;
|
||||
|
||||
/// <summary>
|
||||
/// 瓷砖区域画笔
|
||||
/// </summary>
|
||||
public class EditorTileAreaPen : EditorToolBase
|
||||
{
|
||||
private bool _isPressed;
|
||||
private MouseButton _buttonIndex;
|
||||
|
||||
private Vector2 _mousePosition;
|
||||
private Vector2I _mouseCellPosition;
|
||||
|
||||
//绘制填充区域
|
||||
private bool _drawFullRect = false;
|
||||
private Vector2I _mouseStartCellPosition;
|
||||
|
||||
public EditorTileAreaPen(EditorTileMap editorTileMap) : base(
|
||||
ResourcePath.resource_sprite_ui_commonIcon_AreaTool_png, "绘制区域瓷砖", true, editorTileMap, EditorToolEnum.TileAreaPen)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Process(float delta)
|
||||
{
|
||||
var mousePosition = EditorTileMap.GetLocalMousePosition();
|
||||
_mouseCellPosition = EditorTileMap.LocalToMap(mousePosition);
|
||||
_mousePosition = _mouseCellPosition * GameConfig.TileCellSize;
|
||||
}
|
||||
|
||||
public override void OnMapInputEvent(InputEvent @event)
|
||||
{
|
||||
if (@event is InputEventMouseButton mouseButton)
|
||||
{
|
||||
_buttonIndex = mouseButton.ButtonIndex;
|
||||
if (mouseButton.ButtonIndex == MouseButton.Left || mouseButton.ButtonIndex == MouseButton.Right)
|
||||
{
|
||||
_isPressed = mouseButton.Pressed;
|
||||
if (_isPressed) //开始按下
|
||||
{
|
||||
_mouseStartCellPosition = EditorTileMap.LocalToMap(EditorTileMap.GetLocalMousePosition());
|
||||
_drawFullRect = true;
|
||||
}
|
||||
else if (!_isPressed && _drawFullRect) //松手提交
|
||||
{
|
||||
_drawFullRect = false;
|
||||
if (_buttonIndex == MouseButton.Left) //绘制
|
||||
{
|
||||
DoDrawCell();
|
||||
}
|
||||
else //擦除
|
||||
{
|
||||
DoEraseCell();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DoDrawCell()
|
||||
{
|
||||
EditorTileMap.SetRectCell(_mouseStartCellPosition, _mouseCellPosition);
|
||||
}
|
||||
|
||||
private void DoEraseCell()
|
||||
{
|
||||
EditorTileMap.EraseRectCell(_mouseStartCellPosition, _mouseCellPosition);
|
||||
}
|
||||
|
||||
public override void OnMapDrawTool(CanvasItem brush)
|
||||
{
|
||||
if (_drawFullRect)
|
||||
{
|
||||
var canvasItem = brush;
|
||||
var size = EditorTileMap.TileSet.TileSize;
|
||||
var cellPos = _mouseStartCellPosition;
|
||||
var temp = size;
|
||||
if (_mouseStartCellPosition.X > _mouseCellPosition.X)
|
||||
{
|
||||
cellPos.X += 1;
|
||||
temp.X -= size.X;
|
||||
}
|
||||
|
||||
if (_mouseStartCellPosition.Y > _mouseCellPosition.Y)
|
||||
{
|
||||
cellPos.Y += 1;
|
||||
temp.Y -= size.Y;
|
||||
}
|
||||
|
||||
var p = cellPos * size;
|
||||
var s = _mousePosition.AsVector2I() - p + temp;
|
||||
|
||||
if (s.X < 0)
|
||||
{
|
||||
p.X += s.X;
|
||||
s.X *= -1;
|
||||
}
|
||||
|
||||
if (s.Y < 0)
|
||||
{
|
||||
p.Y += s.Y;
|
||||
s.Y *= -1;
|
||||
}
|
||||
|
||||
//绘制边框
|
||||
canvasItem.DrawRect(new Rect2(p, s), Colors.White, false, 2f / EditorTileMap.Scale.X);
|
||||
|
||||
if (EditorTileMap.CurrLayer.Layer != MapLayer.AutoFloorLayer &&
|
||||
(EditorTileMap.CurrBrushType == EditorTileMap.TileMapDrawMode.Free ||
|
||||
EditorTileMap.CurrBrushType == EditorTileMap.TileMapDrawMode.Combination)) //自由绘制 或者 绘制组合
|
||||
{
|
||||
if (_isPressed && _buttonIndex == MouseButton.Left && EditorTileMap.BrushWidth > 0 && EditorTileMap.BrushHeight > 0) //左键绘制
|
||||
{
|
||||
var w = s.X / GameConfig.TileCellSize;
|
||||
var h = s.Y / GameConfig.TileCellSize;
|
||||
for (var i = 0; i < w; i++)
|
||||
{
|
||||
for (var j = 0; j < h; j++)
|
||||
{
|
||||
var x = i % EditorTileMap.BrushWidth + EditorTileMap.BrushStartX;
|
||||
var y = j % EditorTileMap.BrushHeight + EditorTileMap.BrushStartY;
|
||||
if (EditorTileMap.CurrBrush.TryGetValue(new Vector2I(x, y), out var v))
|
||||
{
|
||||
var rect = new Rect2(p + (new Vector2I(i, j)) * GameConfig.TileCellSize,
|
||||
GameConfig.TileCellSize, GameConfig.TileCellSize);
|
||||
var srcRect = new Rect2(v * GameConfig.TileCellSize, GameConfig.TileCellSize,
|
||||
GameConfig.TileCellSize);
|
||||
canvasItem.DrawTextureRectRegion(EditorTileMap.CurrBrushTexture, rect, srcRect,
|
||||
new Color(1, 1, 1, 0.3f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
|
||||
using Godot;
|
||||
using UI.MapEditor;
|
||||
|
||||
/// <summary>
|
||||
/// 瓷砖画笔
|
||||
/// </summary>
|
||||
public class EditorTilePen : EditorToolBase
|
||||
{
|
||||
private bool _isPressed;
|
||||
private MouseButton _buttonIndex;
|
||||
|
||||
//单次绘制是否改变过tile数据
|
||||
private bool _changeFlag = false;
|
||||
|
||||
private Vector2 _mousePosition;
|
||||
private Vector2I _mouseCellPosition;
|
||||
|
||||
//上一帧鼠标所在的cell坐标
|
||||
private Vector2I _prevMouseCellPosition = new Vector2I(-99999, -99999);
|
||||
|
||||
public EditorTilePen(EditorTileMap editorTileMap) : base(
|
||||
ResourcePath.resource_sprite_ui_commonIcon_PenTool_png, "绘制瓷砖", true, editorTileMap, EditorToolEnum.TilePen)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Process(float delta)
|
||||
{
|
||||
var mousePosition = EditorTileMap.GetLocalMousePosition();
|
||||
//绘制2x2地形
|
||||
if ((!_isPressed || _buttonIndex != MouseButton.Right) &&
|
||||
EditorTileMap.CurrBrushType == EditorTileMap.TileMapDrawMode.Terrain &&
|
||||
EditorTileMap.CurrTerrain != null &&
|
||||
EditorTileMap.CurrTerrain.TerrainInfo.TerrainType == 1)
|
||||
{
|
||||
mousePosition -= new Vector2(GameConfig.TileCellSize / 2f, GameConfig.TileCellSize / 2f);
|
||||
}
|
||||
|
||||
_mouseCellPosition = EditorTileMap.LocalToMap(mousePosition);
|
||||
_mousePosition = _mouseCellPosition * GameConfig.TileCellSize;
|
||||
}
|
||||
|
||||
public override void OnMapInputEvent(InputEvent @event)
|
||||
{
|
||||
if (@event is InputEventMouseButton mouseButton)
|
||||
{
|
||||
_buttonIndex = mouseButton.ButtonIndex;
|
||||
if (mouseButton.ButtonIndex == MouseButton.Left || mouseButton.ButtonIndex == MouseButton.Right)
|
||||
{
|
||||
_isPressed = mouseButton.Pressed;
|
||||
if (!_isPressed)
|
||||
{
|
||||
_changeFlag = false;
|
||||
}
|
||||
else if (_buttonIndex == MouseButton.Left) //绘制
|
||||
{
|
||||
DoDrawCell();
|
||||
}
|
||||
else if (_buttonIndex == MouseButton.Right) //擦除
|
||||
{
|
||||
DoEraseCell();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (@event is InputEventMouseMotion && _isPressed)
|
||||
{
|
||||
if (_buttonIndex == MouseButton.Left) //绘制
|
||||
{
|
||||
DoDrawCell();
|
||||
}
|
||||
else if (_buttonIndex == MouseButton.Right) //擦除
|
||||
{
|
||||
DoEraseCell();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DoDrawCell()
|
||||
{
|
||||
if (_prevMouseCellPosition != _mouseCellPosition || !_changeFlag) //鼠标位置变过
|
||||
{
|
||||
_changeFlag = true;
|
||||
_prevMouseCellPosition = _mouseCellPosition;
|
||||
//绘制图块
|
||||
EditorTileMap.SetSingleCell(_mouseCellPosition);
|
||||
}
|
||||
}
|
||||
|
||||
private void DoEraseCell()
|
||||
{
|
||||
var position = EditorTileMap.GetLocalMousePosition();
|
||||
var mouseCellPosition = EditorTileMap.LocalToMap(position);
|
||||
if (_prevMouseCellPosition != mouseCellPosition || !_changeFlag) //鼠标位置变过
|
||||
{
|
||||
_changeFlag = true;
|
||||
_prevMouseCellPosition = mouseCellPosition;
|
||||
//绘制图块
|
||||
EditorTileMap.EraseSingleCell(mouseCellPosition);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnMapDrawTool(CanvasItem brush)
|
||||
{
|
||||
var canvasItem = brush;
|
||||
if (EditorTileMap.CurrLayer.Layer == MapLayer.AutoFloorLayer) //选择自动地板层
|
||||
{
|
||||
DrawCellOutline(canvasItem);
|
||||
}
|
||||
else //自定义层
|
||||
{
|
||||
if (EditorTileMap.CurrBrushType == EditorTileMap.TileMapDrawMode.Free ||
|
||||
EditorTileMap.CurrBrushType == EditorTileMap.TileMapDrawMode.Combination) //自由绘制 或者 绘制组合
|
||||
{
|
||||
if (_isPressed && _buttonIndex == MouseButton.Right) //按下了左键擦除
|
||||
{
|
||||
DrawCellOutline(canvasItem);
|
||||
}
|
||||
else //正常绘制
|
||||
{
|
||||
foreach (var item in EditorTileMap.CurrBrush)
|
||||
{
|
||||
var rect = new Rect2(
|
||||
_mousePosition + (item.Key + EditorTileMap.BrushOffset) * GameConfig.TileCellSize,
|
||||
GameConfig.TileCellSize, GameConfig.TileCellSize);
|
||||
var srcRect = new Rect2(item.Value * GameConfig.TileCellSize, GameConfig.TileCellSize,
|
||||
GameConfig.TileCellSize);
|
||||
canvasItem.DrawTextureRectRegion(EditorTileMap.CurrBrushTexture, rect, srcRect,
|
||||
new Color(1, 1, 1, 0.3f));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (EditorTileMap.CurrBrushType == EditorTileMap.TileMapDrawMode.Terrain) //绘制地形
|
||||
{
|
||||
if (EditorTileMap.CurrTerrain == null) //未选择地形
|
||||
{
|
||||
DrawCellOutline(canvasItem);
|
||||
}
|
||||
else if (EditorTileMap.CurrTerrain.TerrainInfo.TerrainType == 0) //3x3
|
||||
{
|
||||
DrawCellOutline(canvasItem);
|
||||
}
|
||||
else //2x2
|
||||
{
|
||||
DrawCellOutline(canvasItem);
|
||||
if (!_isPressed || _buttonIndex != MouseButton.Right) //没按下左键擦除
|
||||
{
|
||||
DrawCellOutline(canvasItem, new Vector2I(GameConfig.TileCellSize, 0));
|
||||
DrawCellOutline(canvasItem, new Vector2I(0, GameConfig.TileCellSize));
|
||||
DrawCellOutline(canvasItem,
|
||||
new Vector2I(GameConfig.TileCellSize, GameConfig.TileCellSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCellOutline(CanvasItem canvasItem)
|
||||
{
|
||||
canvasItem.DrawRect(new Rect2(_mousePosition, EditorTileMap.TileSet.TileSize),
|
||||
Colors.White, false, 2f / EditorTileMap.Scale.X);
|
||||
}
|
||||
|
||||
private void DrawCellOutline(CanvasItem canvasItem, Vector2I offset)
|
||||
{
|
||||
canvasItem.DrawRect(
|
||||
new Rect2(_mousePosition + offset, EditorTileMap.TileSet.TileSize),
|
||||
Colors.White, false, 2f / EditorTileMap.Scale.X);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
|
||||
using Godot;
|
||||
using UI.MapEditor;
|
||||
|
||||
/// <summary>
|
||||
/// 地图编辑器工具栏图标逻辑基类
|
||||
/// </summary>
|
||||
public abstract class EditorToolBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 工具图标
|
||||
/// </summary>
|
||||
public string Icon { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 工具提示名称
|
||||
/// </summary>
|
||||
public string TipText { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以选中
|
||||
/// </summary>
|
||||
public bool CanSelect { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 绑定的 TileMap
|
||||
/// </summary>
|
||||
public EditorTileMap EditorTileMap { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 工具枚举类型
|
||||
/// </summary>
|
||||
public EditorToolEnum EditorToolType { get; }
|
||||
|
||||
public EditorToolBase(string icon, string tipText, bool canSelect, EditorTileMap editorTileMap, EditorToolEnum editorToolType)
|
||||
{
|
||||
Icon = icon;
|
||||
CanSelect = canSelect;
|
||||
EditorTileMap = editorTileMap;
|
||||
EditorToolType = editorToolType;
|
||||
TipText = tipText;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击时回调
|
||||
/// </summary>
|
||||
public virtual void OnClick()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 改变选中状态时回调
|
||||
/// </summary>
|
||||
public virtual void OnSetSelected(bool selected)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中后每帧调用
|
||||
/// </summary>
|
||||
public virtual void Process(float delta)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中后处理的 TileMap 输入事件, 仅在选中时才会调用
|
||||
/// </summary>
|
||||
public virtual void OnMapInputEvent(InputEvent @event)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绘制工具, 仅在选中时才会调用
|
||||
/// </summary>
|
||||
public virtual void OnMapDrawTool(CanvasItem brush)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
|
||||
public enum EditorToolEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 未选择
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// 切换移动模式
|
||||
/// </summary>
|
||||
Move,
|
||||
/// <summary>
|
||||
/// 瓷砖画笔
|
||||
/// </summary>
|
||||
TilePen,
|
||||
/// <summary>
|
||||
/// 瓷砖区域画笔
|
||||
/// </summary>
|
||||
TileAreaPen,
|
||||
/// <summary>
|
||||
/// 物体画笔
|
||||
/// </summary>
|
||||
ObjectPen,
|
||||
/// <summary>
|
||||
/// 物体编辑工具
|
||||
/// </summary>
|
||||
ObjectTool,
|
||||
/// <summary>
|
||||
/// 标记工具
|
||||
/// </summary>
|
||||
MarkTool,
|
||||
/// <summary>
|
||||
/// 聚焦
|
||||
/// </summary>
|
||||
Focus
|
||||
}
|
|
@ -51,4 +51,9 @@ public class PhysicsLayer
|
|||
/// 可被子弹击中的区域
|
||||
/// </summary>
|
||||
public const uint HurtArea = 0b10000000000;
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标检测的Ui
|
||||
/// </summary>
|
||||
public const uint UiMouse = 0b10000000000000;
|
||||
}
|
|
@ -217,4 +217,32 @@ public enum EventEnum
|
|||
/// 修改组合名称, 参数为<see cref="ImportCombinationData"/>
|
||||
/// </summary>
|
||||
OnUpdateCombination,
|
||||
/// <summary>
|
||||
/// 当地牢编辑器选中对象配置时调用, 参数为<see cref="ExcelConfig.EditorObject"/>
|
||||
/// </summary>
|
||||
OnSelectObjectConfig,
|
||||
/// <summary>
|
||||
/// 放置对象, 参数为<see cref="RoomObjectInfo"/>
|
||||
/// </summary>
|
||||
OnPutObject,
|
||||
/// <summary>
|
||||
/// 移除对象, 参数为<see cref="RoomObjectInfo"/>
|
||||
/// </summary>
|
||||
OnRemoveObject,
|
||||
/// <summary>
|
||||
/// 更新对象位置, 参数为<see cref="RoomObjectInfo"/>
|
||||
/// </summary>
|
||||
OnUpdateObject,
|
||||
/// <summary>
|
||||
/// 选中对象, 参数为<see cref="RoomObjectInfo"/>
|
||||
/// </summary>
|
||||
OnSelectObject,
|
||||
/// <summary>
|
||||
/// 地图编辑器保存预览图片开始, 无参数
|
||||
/// </summary>
|
||||
OnSavePreviewImageBegin,
|
||||
/// <summary>
|
||||
/// 地图编辑器保存预览图片完成, 无参数
|
||||
/// </summary>
|
||||
OnSavePreviewImageFinish,
|
||||
}
|
||||
|
|
|
@ -240,4 +240,28 @@ public static class ResourceManager
|
|||
|
||||
return name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载地牢编辑器中自定义对象, 返回的节点已经被禁用了所有逻辑
|
||||
/// </summary>
|
||||
public static Node2D LoadEditorObject(ExcelConfig.EditorObject config)
|
||||
{
|
||||
Node2D node;
|
||||
if (config.IsActivity())
|
||||
{
|
||||
var activityBase = ExcelConfig.ActivityBase_Map[config.Prefab];
|
||||
node = LoadAndInstantiate<Node2D>(activityBase.Prefab);
|
||||
}
|
||||
else
|
||||
{
|
||||
node = LoadAndInstantiate<Node2D>(config.Prefab);
|
||||
}
|
||||
node.SetProcess(false);
|
||||
node.SetPhysicsProcess(false);
|
||||
node.SetProcessInput(false);
|
||||
node.SetPhysicsProcessInternal(false);
|
||||
node.SetProcessInput(false);
|
||||
node.ProcessMode = Node.ProcessModeEnum.WhenPaused;
|
||||
return node;
|
||||
}
|
||||
}
|
|
@ -22,9 +22,11 @@ public static partial class UiManager
|
|||
public const string BottomTips = "BottomTips";
|
||||
public const string EditorTileImage = "EditorTileImage";
|
||||
public const string EditorDungeonGroup = "EditorDungeonGroup";
|
||||
public const string MapEditorConfigObject = "MapEditorConfigObject";
|
||||
public const string EditorForm = "EditorForm";
|
||||
public const string Setting = "Setting";
|
||||
public const string Loading = "Loading";
|
||||
public const string MapEditorObject = "MapEditorObject";
|
||||
public const string WeaponRoulette = "WeaponRoulette";
|
||||
public const string MapEditorTools = "MapEditorTools";
|
||||
public const string TileSetEditor = "TileSetEditor";
|
||||
|
@ -861,6 +863,54 @@ public static partial class UiManager
|
|||
return GetUiInstance<UI.EditorDungeonGroup.EditorDungeonGroupPanel>(nameof(UI.EditorDungeonGroup.EditorDungeonGroup));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建 MapEditorConfigObject, 并返回UI实例, 该函数不会打开 Ui
|
||||
/// </summary>
|
||||
public static UI.MapEditorConfigObject.MapEditorConfigObjectPanel Create_MapEditorConfigObject()
|
||||
{
|
||||
return CreateUi<UI.MapEditorConfigObject.MapEditorConfigObjectPanel>(UiNames.MapEditorConfigObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开 MapEditorConfigObject, 并返回UI实例
|
||||
/// </summary>
|
||||
public static UI.MapEditorConfigObject.MapEditorConfigObjectPanel Open_MapEditorConfigObject()
|
||||
{
|
||||
return OpenUi<UI.MapEditorConfigObject.MapEditorConfigObjectPanel>(UiNames.MapEditorConfigObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏 MapEditorConfigObject 的所有实例
|
||||
/// </summary>
|
||||
public static void Hide_MapEditorConfigObject()
|
||||
{
|
||||
var uiInstance = Get_MapEditorConfigObject_Instance();
|
||||
foreach (var uiPanel in uiInstance)
|
||||
{
|
||||
uiPanel.HideUi();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁 MapEditorConfigObject 的所有实例
|
||||
/// </summary>
|
||||
public static void Destroy_MapEditorConfigObject()
|
||||
{
|
||||
var uiInstance = Get_MapEditorConfigObject_Instance();
|
||||
foreach (var uiPanel in uiInstance)
|
||||
{
|
||||
uiPanel.Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有 MapEditorConfigObject 的实例, 如果没有实例, 则返回一个空数组
|
||||
/// </summary>
|
||||
public static UI.MapEditorConfigObject.MapEditorConfigObjectPanel[] Get_MapEditorConfigObject_Instance()
|
||||
{
|
||||
return GetUiInstance<UI.MapEditorConfigObject.MapEditorConfigObjectPanel>(nameof(UI.MapEditorConfigObject.MapEditorConfigObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建 EditorForm, 并返回UI实例, 该函数不会打开 Ui
|
||||
/// </summary>
|
||||
|
@ -1005,6 +1055,54 @@ public static partial class UiManager
|
|||
return GetUiInstance<UI.Loading.LoadingPanel>(nameof(UI.Loading.Loading));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建 MapEditorObject, 并返回UI实例, 该函数不会打开 Ui
|
||||
/// </summary>
|
||||
public static UI.MapEditorObject.MapEditorObjectPanel Create_MapEditorObject()
|
||||
{
|
||||
return CreateUi<UI.MapEditorObject.MapEditorObjectPanel>(UiNames.MapEditorObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开 MapEditorObject, 并返回UI实例
|
||||
/// </summary>
|
||||
public static UI.MapEditorObject.MapEditorObjectPanel Open_MapEditorObject()
|
||||
{
|
||||
return OpenUi<UI.MapEditorObject.MapEditorObjectPanel>(UiNames.MapEditorObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏 MapEditorObject 的所有实例
|
||||
/// </summary>
|
||||
public static void Hide_MapEditorObject()
|
||||
{
|
||||
var uiInstance = Get_MapEditorObject_Instance();
|
||||
foreach (var uiPanel in uiInstance)
|
||||
{
|
||||
uiPanel.HideUi();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁 MapEditorObject 的所有实例
|
||||
/// </summary>
|
||||
public static void Destroy_MapEditorObject()
|
||||
{
|
||||
var uiInstance = Get_MapEditorObject_Instance();
|
||||
foreach (var uiPanel in uiInstance)
|
||||
{
|
||||
uiPanel.Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有 MapEditorObject 的实例, 如果没有实例, 则返回一个空数组
|
||||
/// </summary>
|
||||
public static UI.MapEditorObject.MapEditorObjectPanel[] Get_MapEditorObject_Instance()
|
||||
{
|
||||
return GetUiInstance<UI.MapEditorObject.MapEditorObjectPanel>(nameof(UI.MapEditorObject.MapEditorObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建 WeaponRoulette, 并返回UI实例, 该函数不会打开 Ui
|
||||
/// </summary>
|
||||
|
|
|
@ -18,8 +18,8 @@ public partial class Dungeon : World
|
|||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
//Color = Colors.Black;
|
||||
Debug.Log("[临时处理]: 这里设置房间迷雾");
|
||||
Color = Colors.Black;
|
||||
//Debug.Log("[临时处理]: 这里设置房间迷雾");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -487,8 +487,8 @@ public partial class DungeonManager : Node2D
|
|||
//初始化所有房间
|
||||
yield return _dungeonGenerator.EachRoomCoroutine(InitRoom);
|
||||
|
||||
Debug.Log("[临时处理]: 关闭房间迷雾");
|
||||
CurrWorld.FogMaskRoot.Visible = false;
|
||||
//Debug.Log("[临时处理]: 关闭房间迷雾");
|
||||
//CurrWorld.FogMaskRoot.Visible = false;
|
||||
|
||||
//房间背景颜色
|
||||
RenderingServer.SetDefaultClearColor(_dungeonGenerator.RoomGroup.BgColor);
|
||||
|
|
|
@ -32,20 +32,30 @@ public abstract partial class MapEditor : UiBase
|
|||
inst1.L_MapEditorMapLayer.Instance.OnCreateUi();
|
||||
inst1.L_MapEditorMapLayer.Instance.OnInitNestedUi();
|
||||
|
||||
var inst2 = L_Bg.L_VBoxContainer.L_HSplitContainer.L_HSplitContainer2.L_HBoxContainer.L_Left.L_MarginContainer.L_MapView.L_SubViewport.L_CanvasLayer;
|
||||
RecordNestedUi(inst2.L_MapEditorTools.Instance, inst2, UiManager.RecordType.Open);
|
||||
inst2.L_MapEditorTools.Instance.OnCreateUi();
|
||||
inst2.L_MapEditorTools.Instance.OnInitNestedUi();
|
||||
var inst2 = L_Bg.L_VBoxContainer.L_HSplitContainer.L_HSplitContainer2.L_HBoxContainer.L_LayerPanel;
|
||||
RecordNestedUi(inst2.L_MapEditorConfigObject.Instance, inst2, UiManager.RecordType.Open);
|
||||
inst2.L_MapEditorConfigObject.Instance.OnCreateUi();
|
||||
inst2.L_MapEditorConfigObject.Instance.OnInitNestedUi();
|
||||
|
||||
var inst3 = L_Bg.L_VBoxContainer.L_HSplitContainer.L_HSplitContainer2.L_Right.L_MarginContainer.L_TabContainer.L_MapTile;
|
||||
RecordNestedUi(inst3.L_MapEditorMapTile.Instance, inst3, UiManager.RecordType.Open);
|
||||
inst3.L_MapEditorMapTile.Instance.OnCreateUi();
|
||||
inst3.L_MapEditorMapTile.Instance.OnInitNestedUi();
|
||||
var inst3 = L_Bg.L_VBoxContainer.L_HSplitContainer.L_HSplitContainer2.L_HBoxContainer.L_Left.L_MarginContainer.L_MapView.L_SubViewport.L_CanvasLayer;
|
||||
RecordNestedUi(inst3.L_MapEditorTools.Instance, inst3, UiManager.RecordType.Open);
|
||||
inst3.L_MapEditorTools.Instance.OnCreateUi();
|
||||
inst3.L_MapEditorTools.Instance.OnInitNestedUi();
|
||||
|
||||
var inst4 = L_Bg.L_VBoxContainer.L_HSplitContainer.L_HSplitContainer2.L_Right.L_MarginContainer.L_TabContainer.L_MapMark;
|
||||
RecordNestedUi(inst4.L_MapEditorMapMark.Instance, inst4, UiManager.RecordType.Open);
|
||||
inst4.L_MapEditorMapMark.Instance.OnCreateUi();
|
||||
inst4.L_MapEditorMapMark.Instance.OnInitNestedUi();
|
||||
var inst4 = L_Bg.L_VBoxContainer.L_HSplitContainer.L_HSplitContainer2.L_Right.L_MarginContainer.L_TabContainer.L_MapTile;
|
||||
RecordNestedUi(inst4.L_MapEditorMapTile.Instance, inst4, UiManager.RecordType.Open);
|
||||
inst4.L_MapEditorMapTile.Instance.OnCreateUi();
|
||||
inst4.L_MapEditorMapTile.Instance.OnInitNestedUi();
|
||||
|
||||
var inst5 = L_Bg.L_VBoxContainer.L_HSplitContainer.L_HSplitContainer2.L_Right.L_MarginContainer.L_TabContainer.L_MapObject;
|
||||
RecordNestedUi(inst5.L_MapEditorObject.Instance, inst5, UiManager.RecordType.Open);
|
||||
inst5.L_MapEditorObject.Instance.OnCreateUi();
|
||||
inst5.L_MapEditorObject.Instance.OnInitNestedUi();
|
||||
|
||||
var inst6 = L_Bg.L_VBoxContainer.L_HSplitContainer.L_HSplitContainer2.L_Right.L_MarginContainer.L_TabContainer.L_MapMark;
|
||||
RecordNestedUi(inst6.L_MapEditorMapMark.Instance, inst6, UiManager.RecordType.Open);
|
||||
inst6.L_MapEditorMapMark.Instance.OnCreateUi();
|
||||
inst6.L_MapEditorMapMark.Instance.OnInitNestedUi();
|
||||
|
||||
}
|
||||
|
||||
|
@ -184,6 +194,22 @@ public abstract partial class MapEditor : UiBase
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="UI.MapEditorConfigObject.MapEditorConfigObjectPanel"/>, 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.HSplitContainer2.HBoxContainer.LayerPanel.MapEditorConfigObject
|
||||
/// </summary>
|
||||
public class MapEditorConfigObject : UiNode<MapEditorPanel, UI.MapEditorConfigObject.MapEditorConfigObjectPanel, MapEditorConfigObject>
|
||||
{
|
||||
public MapEditorConfigObject(MapEditorPanel uiPanel, UI.MapEditorConfigObject.MapEditorConfigObjectPanel node) : base(uiPanel, node) { }
|
||||
public override MapEditorConfigObject Clone()
|
||||
{
|
||||
var uiNode = new MapEditorConfigObject(UiPanel, (UI.MapEditorConfigObject.MapEditorConfigObjectPanel)Instance.Duplicate());
|
||||
UiPanel.RecordNestedUi(uiNode.Instance, this, UiManager.RecordType.Open);
|
||||
uiNode.Instance.OnCreateUi();
|
||||
uiNode.Instance.OnInitNestedUi();
|
||||
return uiNode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.Panel"/>, 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.HSplitContainer2.HBoxContainer.LayerPanel
|
||||
/// </summary>
|
||||
|
@ -202,6 +228,19 @@ public abstract partial class MapEditor : UiBase
|
|||
}
|
||||
private MapEditorMapLayer _L_MapEditorMapLayer;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="UI.MapEditorConfigObject.MapEditorConfigObjectPanel"/>, 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.HSplitContainer2.HBoxContainer.MapEditorConfigObject
|
||||
/// </summary>
|
||||
public MapEditorConfigObject L_MapEditorConfigObject
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_MapEditorConfigObject == null) _L_MapEditorConfigObject = new MapEditorConfigObject(UiPanel, Instance.GetNode<UI.MapEditorConfigObject.MapEditorConfigObjectPanel>("MapEditorConfigObject"));
|
||||
return _L_MapEditorConfigObject;
|
||||
}
|
||||
}
|
||||
private MapEditorConfigObject _L_MapEditorConfigObject;
|
||||
|
||||
public LayerPanel(MapEditorPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { }
|
||||
public override LayerPanel Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate());
|
||||
}
|
||||
|
@ -537,6 +576,44 @@ public abstract partial class MapEditor : UiBase
|
|||
public override MapTile Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="UI.MapEditorObject.MapEditorObjectPanel"/>, 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.HSplitContainer2.Right.MarginContainer.TabContainer.MapObject.MapEditorObject
|
||||
/// </summary>
|
||||
public class MapEditorObject : UiNode<MapEditorPanel, UI.MapEditorObject.MapEditorObjectPanel, MapEditorObject>
|
||||
{
|
||||
public MapEditorObject(MapEditorPanel uiPanel, UI.MapEditorObject.MapEditorObjectPanel node) : base(uiPanel, node) { }
|
||||
public override MapEditorObject Clone()
|
||||
{
|
||||
var uiNode = new MapEditorObject(UiPanel, (UI.MapEditorObject.MapEditorObjectPanel)Instance.Duplicate());
|
||||
UiPanel.RecordNestedUi(uiNode.Instance, this, UiManager.RecordType.Open);
|
||||
uiNode.Instance.OnCreateUi();
|
||||
uiNode.Instance.OnInitNestedUi();
|
||||
return uiNode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.MarginContainer"/>, 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.HSplitContainer2.Right.MarginContainer.TabContainer.MapObject
|
||||
/// </summary>
|
||||
public class MapObject : UiNode<MapEditorPanel, Godot.MarginContainer, MapObject>
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="UI.MapEditorObject.MapEditorObjectPanel"/>, 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.HSplitContainer2.Right.MarginContainer.TabContainer.MapEditorObject
|
||||
/// </summary>
|
||||
public MapEditorObject L_MapEditorObject
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_MapEditorObject == null) _L_MapEditorObject = new MapEditorObject(UiPanel, Instance.GetNode<UI.MapEditorObject.MapEditorObjectPanel>("MapEditorObject"));
|
||||
return _L_MapEditorObject;
|
||||
}
|
||||
}
|
||||
private MapEditorObject _L_MapEditorObject;
|
||||
|
||||
public MapObject(MapEditorPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { }
|
||||
public override MapObject Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="UI.MapEditorMapMark.MapEditorMapMarkPanel"/>, 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.HSplitContainer2.Right.MarginContainer.TabContainer.MapMark.MapEditorMapMark
|
||||
/// </summary>
|
||||
|
@ -593,6 +670,19 @@ public abstract partial class MapEditor : UiBase
|
|||
}
|
||||
private MapTile _L_MapTile;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.MarginContainer"/>, 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.HSplitContainer2.Right.MarginContainer.MapObject
|
||||
/// </summary>
|
||||
public MapObject L_MapObject
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_MapObject == null) _L_MapObject = new MapObject(UiPanel, Instance.GetNode<Godot.MarginContainer>("MapObject"));
|
||||
return _L_MapObject;
|
||||
}
|
||||
}
|
||||
private MapObject _L_MapObject;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.MarginContainer"/>, 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.HSplitContainer2.Right.MarginContainer.MapMark
|
||||
/// </summary>
|
||||
|
@ -804,6 +894,11 @@ public abstract partial class MapEditor : UiBase
|
|||
/// </summary>
|
||||
public MapEditorMapLayer S_MapEditorMapLayer => L_Bg.L_VBoxContainer.L_HSplitContainer.L_HSplitContainer2.L_HBoxContainer.L_LayerPanel.L_MapEditorMapLayer;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="UI.MapEditorConfigObject.MapEditorConfigObjectPanel"/>, 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.HSplitContainer2.HBoxContainer.LayerPanel.MapEditorConfigObject
|
||||
/// </summary>
|
||||
public MapEditorConfigObject S_MapEditorConfigObject => L_Bg.L_VBoxContainer.L_HSplitContainer.L_HSplitContainer2.L_HBoxContainer.L_LayerPanel.L_MapEditorConfigObject;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Panel"/>, 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.HSplitContainer2.HBoxContainer.LayerPanel
|
||||
/// </summary>
|
||||
|
@ -879,6 +974,16 @@ public abstract partial class MapEditor : UiBase
|
|||
/// </summary>
|
||||
public MapTile S_MapTile => L_Bg.L_VBoxContainer.L_HSplitContainer.L_HSplitContainer2.L_Right.L_MarginContainer.L_TabContainer.L_MapTile;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="UI.MapEditorObject.MapEditorObjectPanel"/>, 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.HSplitContainer2.Right.MarginContainer.TabContainer.MapObject.MapEditorObject
|
||||
/// </summary>
|
||||
public MapEditorObject S_MapEditorObject => L_Bg.L_VBoxContainer.L_HSplitContainer.L_HSplitContainer2.L_Right.L_MarginContainer.L_TabContainer.L_MapObject.L_MapEditorObject;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.MarginContainer"/>, 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.HSplitContainer2.Right.MarginContainer.TabContainer.MapObject
|
||||
/// </summary>
|
||||
public MapObject S_MapObject => L_Bg.L_VBoxContainer.L_HSplitContainer.L_HSplitContainer2.L_Right.L_MarginContainer.L_TabContainer.L_MapObject;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="UI.MapEditorMapMark.MapEditorMapMarkPanel"/>, 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.HSplitContainer2.Right.MarginContainer.TabContainer.MapMark.MapEditorMapMark
|
||||
/// </summary>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Godot;
|
||||
|
||||
|
@ -23,26 +24,91 @@ public partial class MapEditorPanel : MapEditor
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前选中的页签
|
||||
/// </summary>
|
||||
public MapEditorTab TabType
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (S_TabContainer.Instance.CurrentTab)
|
||||
{
|
||||
case 0: return MapEditorTab.MapTile;
|
||||
case 1: return MapEditorTab.MapObject;
|
||||
case 2: return MapEditorTab.MapMark;
|
||||
}
|
||||
|
||||
return MapEditorTab.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
private string _title;
|
||||
|
||||
private long _currTab = -1;
|
||||
private Dictionary<long, EditorToolEnum> _cacheToolType = new Dictionary<long, EditorToolEnum>();
|
||||
//暂未用到, 后面补逻辑
|
||||
private List<IEditorTab> _tabs = new List<IEditorTab>();
|
||||
private int _prevTabIndex = -1;
|
||||
|
||||
public override void OnCreateUi()
|
||||
{
|
||||
S_TabContainer.Instance.SetTabTitle(0, "图块");
|
||||
S_TabContainer.Instance.SetTabTitle(1, "对象");
|
||||
S_TabContainer.Instance.TabChanged += OnTabChanged;
|
||||
var tabContainer = S_TabContainer.Instance;
|
||||
tabContainer.SetTabTitle(0, "图块");
|
||||
tabContainer.SetTabTitle(1, "对象");
|
||||
tabContainer.SetTabTitle(2, "预设");
|
||||
tabContainer.TabChanged += OnTabChanged;
|
||||
//S_MapLayer.Instance.Init(S_MapLayer);
|
||||
S_Left.Instance.Resized += OnMapViewResized;
|
||||
S_Back.Instance.Pressed += OnBackClick;
|
||||
S_Save.Instance.Pressed += OnSave;
|
||||
S_Play.Instance.Pressed += OnPlay;
|
||||
|
||||
OnTabChanged(0);
|
||||
//初始化页签
|
||||
var childCount = tabContainer.GetChildCount();
|
||||
for (var i = 0; i < childCount; i++)
|
||||
{
|
||||
var tabChild = tabContainer.GetChild(i);
|
||||
if (tabChild.GetChildCount() > 0)
|
||||
{
|
||||
var temp = tabChild.GetChild(0);
|
||||
_tabs.Add((IEditorTab)temp);
|
||||
}
|
||||
}
|
||||
|
||||
//默认选中第一个
|
||||
this.CallDelay(0, () => { OnTabChanged(0); });
|
||||
}
|
||||
|
||||
//切换页签
|
||||
private void OnTabChanged(long tab)
|
||||
{
|
||||
S_LayerPanel.Instance.Visible = tab == 0;
|
||||
var toolsPanel = S_MapEditorTools.Instance;
|
||||
_cacheToolType[_currTab] = toolsPanel.ActiveToolType;
|
||||
|
||||
if (_prevTabIndex >= 0)
|
||||
{
|
||||
_tabs[_prevTabIndex].OnUnSelectTab();
|
||||
}
|
||||
_tabs[(int)tab].OnSelectTab();
|
||||
_prevTabIndex = (int)tab;
|
||||
|
||||
//还原所选工具
|
||||
if (_cacheToolType.TryGetValue(tab, out var toolType))
|
||||
{
|
||||
if (toolType == EditorToolEnum.None)
|
||||
{
|
||||
toolsPanel.SetActiviteTool(EditorToolEnum.Move);
|
||||
}
|
||||
else
|
||||
{
|
||||
toolsPanel.SetActiviteTool(toolType);
|
||||
}
|
||||
}
|
||||
else if (toolType == EditorToolEnum.None)
|
||||
{
|
||||
toolsPanel.SetActiviteTool(EditorToolEnum.Move);
|
||||
}
|
||||
_currTab = tab;
|
||||
}
|
||||
|
||||
public override void OnShowUi()
|
||||
|
@ -105,6 +171,9 @@ public partial class MapEditorPanel : MapEditor
|
|||
|
||||
//加载Tile
|
||||
var loadMap = S_TileMap.Instance.Load(roomSplit, tileSetSplit);
|
||||
//刷新物体页签
|
||||
S_MapEditorObject.Instance.InitData();
|
||||
//刷新预设页签
|
||||
S_MapEditorMapMark.Instance.RefreshPreinstallSelect();
|
||||
return loadMap;
|
||||
}
|
||||
|
|
21
DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorTab.cs
Normal file
21
DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorTab.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
namespace UI.MapEditor;
|
||||
|
||||
public enum MapEditorTab
|
||||
{
|
||||
/// <summary>
|
||||
/// 未知
|
||||
/// </summary>
|
||||
Unknown,
|
||||
/// <summary>
|
||||
/// 图块
|
||||
/// </summary>
|
||||
MapTile,
|
||||
/// <summary>
|
||||
/// 对象
|
||||
/// </summary>
|
||||
MapObject,
|
||||
/// <summary>
|
||||
/// 预设
|
||||
/// </summary>
|
||||
MapMark
|
||||
}
|
|
@ -10,30 +10,6 @@ namespace UI.MapEditor;
|
|||
public partial class EditorTileMap : TileMap, IUiNodeScript
|
||||
{
|
||||
|
||||
public enum MouseButtonType
|
||||
{
|
||||
/// <summary>
|
||||
/// 无状态
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// 拖拽模式
|
||||
/// </summary>
|
||||
Drag,
|
||||
/// <summary>
|
||||
/// 笔
|
||||
/// </summary>
|
||||
Pen,
|
||||
/// <summary>
|
||||
/// 绘制区域模式
|
||||
/// </summary>
|
||||
Area,
|
||||
/// <summary>
|
||||
/// 编辑工具模式
|
||||
/// </summary>
|
||||
Edit,
|
||||
}
|
||||
|
||||
public enum TileMapDrawMode
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -54,6 +30,16 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
Combination
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 输入事件
|
||||
/// </summary>
|
||||
public event Action<InputEvent> MapInputEvent;
|
||||
|
||||
/// <summary>
|
||||
/// 绘制工具事件
|
||||
/// </summary>
|
||||
public event Action<CanvasItem> MapDrawToolEvent;
|
||||
|
||||
/// <summary>
|
||||
/// 所属地图编辑器UI
|
||||
/// </summary>
|
||||
|
@ -65,29 +51,14 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
public MapEditorToolsPanel MapEditorToolsPanel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 左键功能
|
||||
/// 当前选中的工具
|
||||
/// </summary>
|
||||
public MouseButtonType MouseType { get; private set; } = MouseButtonType.Pen;
|
||||
public EditorToolEnum ActiveToolType => MapEditorToolsPanel.ActiveToolType;
|
||||
|
||||
//鼠标坐标
|
||||
private Vector2 _mousePosition;
|
||||
//鼠标所在的cell坐标
|
||||
private Vector2I _mouseCellPosition;
|
||||
//上一帧鼠标所在的cell坐标
|
||||
private Vector2I _prevMouseCellPosition = new Vector2I(-99999, -99999);
|
||||
//单次绘制是否改变过tile数据
|
||||
private bool _changeFlag = false;
|
||||
//左键开始按下时鼠标所在的坐标
|
||||
private Vector2I _mouseStartCellPosition;
|
||||
//鼠标中建是否按下
|
||||
private bool _isMiddlePressed = false;
|
||||
private Vector2 _moveOffset;
|
||||
//左键是否按下
|
||||
private bool _isLeftPressed = false;
|
||||
//右键是否按下
|
||||
private bool _isRightPressed = false;
|
||||
//绘制填充区域
|
||||
private bool _drawFullRect = false;
|
||||
|
||||
//负责存储自动图块数据
|
||||
private InfiniteGrid<bool> _autoCellLayerGrid = new InfiniteGrid<bool>();
|
||||
//停止绘制多久后开始执行生成操作
|
||||
|
@ -165,14 +136,26 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
/// </summary>
|
||||
public Texture2D CurrBrushTexture { get; private set; }
|
||||
|
||||
private int _brushStartX = 0;
|
||||
private int _brushStartY = 0;
|
||||
//笔刷宽度, 单位: 格
|
||||
private int _brushWidth = 0;
|
||||
//笔刷高度, 单位: 格
|
||||
private int _brushHeight = 0;
|
||||
//笔刷偏移, 单位: 格
|
||||
private Vector2I _brushOffset = Vector2I.Zero;
|
||||
/// <summary>
|
||||
/// 笔刷起始x坐标, 单位: 格
|
||||
/// </summary>
|
||||
public int BrushStartX { get; private set; } = 0;
|
||||
/// <summary>
|
||||
/// 笔刷起始y坐标, 单位: 格
|
||||
/// </summary>
|
||||
public int BrushStartY { get; private set; } = 0;
|
||||
/// <summary>
|
||||
/// 笔刷宽度, 单位: 格
|
||||
/// </summary>
|
||||
public int BrushWidth { get; private set; } = 0;
|
||||
/// <summary>
|
||||
/// 笔刷高度, 单位: 格
|
||||
/// </summary>
|
||||
public int BrushHeight { get; private set; } = 0;
|
||||
/// <summary>
|
||||
/// 笔刷偏移, 单位: 格
|
||||
/// </summary>
|
||||
public Vector2I BrushOffset { get; private set; } = Vector2I.Zero;
|
||||
//淡化其它层级
|
||||
private bool _desaltOtherLayer = false;
|
||||
|
||||
|
@ -209,11 +192,6 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
|
||||
_editorTileMap.L_Brush.Instance.Draw += DrawGuides;
|
||||
_eventFactory = EventManager.CreateEventFactory();
|
||||
_eventFactory.AddEventListener(EventEnum.OnSelectDragTool, OnSelectHandTool);
|
||||
_eventFactory.AddEventListener(EventEnum.OnSelectPenTool, OnSelectPenTool);
|
||||
_eventFactory.AddEventListener(EventEnum.OnSelectRectTool, OnSelectRectTool);
|
||||
_eventFactory.AddEventListener(EventEnum.OnSelectEditTool, OnSelectEditTool);
|
||||
_eventFactory.AddEventListener(EventEnum.OnClickCenterTool, OnClickCenterTool);
|
||||
_eventFactory.AddEventListener(EventEnum.OnTileMapDirty, OnEditorDirty);
|
||||
|
||||
RenderingServer.FramePostDraw += OnFramePostDraw;
|
||||
|
@ -239,64 +217,10 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
_editorTileMap.L_Brush.Instance.QueueRedraw();
|
||||
|
||||
var newDelta = (float)delta;
|
||||
_drawFullRect = false;
|
||||
var position = GetLocalMousePosition();
|
||||
//绘制2x2地形
|
||||
if (CurrBrushType == TileMapDrawMode.Terrain && CurrTerrain != null && CurrTerrain.TerrainInfo.TerrainType == 1 && !_isRightPressed)
|
||||
{
|
||||
position -= new Vector2(GameConfig.TileCellSize / 2f, GameConfig.TileCellSize / 2f);
|
||||
}
|
||||
_mouseCellPosition = LocalToMap(position);
|
||||
_mousePosition = new Vector2(
|
||||
_mouseCellPosition.X * GameConfig.TileCellSize,
|
||||
_mouseCellPosition.Y * GameConfig.TileCellSize
|
||||
);
|
||||
|
||||
if (!MapEditorToolsPanel.S_HBoxContainer.Instance.IsMouseInRect()) //不在Ui节点上
|
||||
{
|
||||
//左键绘制
|
||||
if (_isLeftPressed)
|
||||
{
|
||||
if (MouseType == MouseButtonType.Pen) //绘制单格
|
||||
{
|
||||
if (_prevMouseCellPosition != _mouseCellPosition || !_changeFlag) //鼠标位置变过
|
||||
{
|
||||
_changeFlag = true;
|
||||
_prevMouseCellPosition = _mouseCellPosition;
|
||||
//绘制图块
|
||||
SetSingleCell(_mouseCellPosition);
|
||||
}
|
||||
}
|
||||
else if (MouseType == MouseButtonType.Area) //绘制区域
|
||||
{
|
||||
_drawFullRect = true;
|
||||
}
|
||||
else if (MouseType == MouseButtonType.Drag) //拖拽
|
||||
{
|
||||
SetMapPosition(GetGlobalMousePosition() + _moveOffset);
|
||||
}
|
||||
}
|
||||
else if (_isRightPressed) //右键擦除
|
||||
{
|
||||
if (MouseType == MouseButtonType.Pen) //绘制单格
|
||||
{
|
||||
if (_prevMouseCellPosition != _mouseCellPosition || !_changeFlag) //鼠标位置变过
|
||||
{
|
||||
_changeFlag = true;
|
||||
_prevMouseCellPosition = _mouseCellPosition;
|
||||
EraseSingleCell(_mouseCellPosition);
|
||||
}
|
||||
}
|
||||
else if (MouseType == MouseButtonType.Area) //绘制区域
|
||||
{
|
||||
_drawFullRect = true;
|
||||
}
|
||||
else if (MouseType == MouseButtonType.Drag) //拖拽
|
||||
{
|
||||
SetMapPosition(GetGlobalMousePosition() + _moveOffset);
|
||||
}
|
||||
}
|
||||
else if (_isMiddlePressed) //中键移动
|
||||
if (_isMiddlePressed) //中键移动
|
||||
{
|
||||
SetMapPosition(GetGlobalMousePosition() + _moveOffset);
|
||||
}
|
||||
|
@ -352,169 +276,17 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
}
|
||||
}
|
||||
|
||||
//绘制笔刷
|
||||
if (MouseType == MouseButtonType.Pen || MouseType == MouseButtonType.Area)
|
||||
if (MapDrawToolEvent != null)
|
||||
{
|
||||
if (_drawFullRect) //绘制填充矩形
|
||||
{
|
||||
var size = TileSet.TileSize;
|
||||
var cellPos = _mouseStartCellPosition;
|
||||
var temp = size;
|
||||
if (_mouseStartCellPosition.X > _mouseCellPosition.X)
|
||||
{
|
||||
cellPos.X += 1;
|
||||
temp.X -= size.X;
|
||||
MapDrawToolEvent(canvasItem);
|
||||
}
|
||||
if (_mouseStartCellPosition.Y > _mouseCellPosition.Y)
|
||||
{
|
||||
cellPos.Y += 1;
|
||||
temp.Y -= size.Y;
|
||||
}
|
||||
|
||||
var p = cellPos * size;
|
||||
var s = _mousePosition.AsVector2I() - p + temp;
|
||||
|
||||
if (s.X < 0)
|
||||
{
|
||||
p.X += s.X;
|
||||
s.X *= -1;
|
||||
}
|
||||
|
||||
if (s.Y < 0)
|
||||
{
|
||||
p.Y += s.Y;
|
||||
s.Y *= -1;
|
||||
}
|
||||
|
||||
//绘制边框
|
||||
canvasItem.DrawRect(new Rect2(p, s), Colors.White, false, 2f / Scale.X);
|
||||
|
||||
if (CurrLayer.Layer != MapLayer.AutoFloorLayer && (CurrBrushType == TileMapDrawMode.Free || CurrBrushType == TileMapDrawMode.Combination)) //自由绘制 或者 绘制组合
|
||||
{
|
||||
if (_isLeftPressed && _brushWidth > 0 && _brushHeight > 0) //左键绘制
|
||||
{
|
||||
var w = s.X / GameConfig.TileCellSize;
|
||||
var h = s.Y / GameConfig.TileCellSize;
|
||||
for (var i = 0; i < w; i++)
|
||||
{
|
||||
for (var j = 0; j < h; j++)
|
||||
{
|
||||
var x = i % _brushWidth + _brushStartX;
|
||||
var y = j % _brushHeight + _brushStartY;
|
||||
if (CurrBrush.TryGetValue(new Vector2I(x, y), out var v))
|
||||
{
|
||||
var rect = new Rect2(p + (new Vector2I(i, j)) * GameConfig.TileCellSize, GameConfig.TileCellSize, GameConfig.TileCellSize);
|
||||
var srcRect = new Rect2(v * GameConfig.TileCellSize, GameConfig.TileCellSize, GameConfig.TileCellSize);
|
||||
canvasItem.DrawTextureRectRegion(CurrBrushTexture, rect, srcRect, new Color(1, 1, 1, 0.3f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else //绘制单格
|
||||
{
|
||||
if (CurrLayer.Layer == MapLayer.AutoFloorLayer) //选择自动地板层
|
||||
{
|
||||
DrawCellOutline(canvasItem);
|
||||
}
|
||||
else //自定义层
|
||||
{
|
||||
if (CurrBrushType == TileMapDrawMode.Free || CurrBrushType == TileMapDrawMode.Combination) //自由绘制 或者 绘制组合
|
||||
{
|
||||
if (_isRightPressed) //按下了左键擦除
|
||||
{
|
||||
DrawCellOutline(canvasItem);
|
||||
}
|
||||
else //正常绘制
|
||||
{
|
||||
foreach (var item in CurrBrush)
|
||||
{
|
||||
var rect = new Rect2(_mousePosition + (item.Key + _brushOffset) * GameConfig.TileCellSize, GameConfig.TileCellSize, GameConfig.TileCellSize);
|
||||
var srcRect = new Rect2(item.Value * GameConfig.TileCellSize, GameConfig.TileCellSize, GameConfig.TileCellSize);
|
||||
canvasItem.DrawTextureRectRegion(CurrBrushTexture, rect, srcRect, new Color(1, 1, 1, 0.3f));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (CurrBrushType == TileMapDrawMode.Terrain) //绘制地形
|
||||
{
|
||||
if (CurrTerrain == null) //未选择地形
|
||||
{
|
||||
DrawCellOutline(canvasItem);
|
||||
}
|
||||
else if (CurrTerrain.TerrainInfo.TerrainType == 0) //3x3
|
||||
{
|
||||
DrawCellOutline(canvasItem);
|
||||
}
|
||||
else //2x2
|
||||
{
|
||||
DrawCellOutline(canvasItem);
|
||||
if (!_isRightPressed) //没按下左键擦除
|
||||
{
|
||||
DrawCellOutline(canvasItem, new Vector2I(GameConfig.TileCellSize, 0));
|
||||
DrawCellOutline(canvasItem, new Vector2I(0, GameConfig.TileCellSize));
|
||||
DrawCellOutline(canvasItem, new Vector2I(GameConfig.TileCellSize, GameConfig.TileCellSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCellOutline(CanvasItem canvasItem)
|
||||
{
|
||||
canvasItem.DrawRect(new Rect2(_mousePosition, TileSet.TileSize), Colors.White, false, 2f / Scale.X);
|
||||
}
|
||||
|
||||
private void DrawCellOutline(CanvasItem canvasItem, Vector2I offset)
|
||||
{
|
||||
canvasItem.DrawRect(new Rect2(_mousePosition + offset, TileSet.TileSize), Colors.White, false, 2f / Scale.X);
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (@event is InputEventMouseButton mouseButton)
|
||||
{
|
||||
if (mouseButton.ButtonIndex == MouseButton.Left) //左键
|
||||
{
|
||||
if (mouseButton.Pressed) //按下
|
||||
{
|
||||
_moveOffset = Position - GetGlobalMousePosition();
|
||||
_mouseStartCellPosition = LocalToMap(GetLocalMousePosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
_changeFlag = false;
|
||||
if (_drawFullRect) //松开, 提交绘制的矩形区域
|
||||
{
|
||||
SetRectCell(_mouseStartCellPosition, _mouseCellPosition);
|
||||
_drawFullRect = false;
|
||||
}
|
||||
}
|
||||
|
||||
_isLeftPressed = mouseButton.Pressed;
|
||||
}
|
||||
else if (mouseButton.ButtonIndex == MouseButton.Right) //右键
|
||||
{
|
||||
if (mouseButton.Pressed) //按下
|
||||
{
|
||||
_moveOffset = Position - GetGlobalMousePosition();
|
||||
_mouseStartCellPosition = LocalToMap(GetLocalMousePosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
_changeFlag = false;
|
||||
if (_drawFullRect) //松开, 提交擦除的矩形区域
|
||||
{
|
||||
EraseRectCell(_mouseStartCellPosition, _mouseCellPosition);
|
||||
_drawFullRect = false;
|
||||
}
|
||||
}
|
||||
|
||||
_isRightPressed = mouseButton.Pressed;
|
||||
}
|
||||
else if (mouseButton.ButtonIndex == MouseButton.WheelDown)
|
||||
if (mouseButton.ButtonIndex == MouseButton.WheelDown)
|
||||
{
|
||||
//缩小
|
||||
Shrink();
|
||||
|
@ -533,6 +305,11 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (MapInputEvent != null && !MapEditorToolsPanel.S_HBoxContainer.Instance.IsMouseInRect())
|
||||
{
|
||||
MapInputEvent(@event);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -592,11 +369,11 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
yEnd = Mathf.Max(cell.Y, yEnd);
|
||||
}
|
||||
|
||||
_brushStartX = xStart;
|
||||
_brushStartY = yStart;
|
||||
_brushWidth = xEnd - xStart + 1;
|
||||
_brushHeight = yEnd - yStart + 1;
|
||||
_brushOffset = new Vector2I(-(xStart + (xEnd - xStart) / 2), -(yStart + (yEnd - yStart) / 2));
|
||||
BrushStartX = xStart;
|
||||
BrushStartY = yStart;
|
||||
BrushWidth = xEnd - xStart + 1;
|
||||
BrushHeight = yEnd - yStart + 1;
|
||||
BrushOffset = new Vector2I(-(xStart + (xEnd - xStart) / 2), -(yStart + (yEnd - yStart) / 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -812,7 +589,7 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
RunCheckHandler();
|
||||
|
||||
//聚焦 (需要延时一帧调用)
|
||||
this.CallDelayInNode(0, () => OnClickCenterTool(null));
|
||||
this.CallDelayInNode(0, OnFocusClick);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -869,8 +646,10 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
}
|
||||
}
|
||||
|
||||
//绘制单个贴图
|
||||
private void SetSingleCell(Vector2I position)
|
||||
/// <summary>
|
||||
/// 绘制单个贴图
|
||||
/// </summary>
|
||||
public void SetSingleCell(Vector2I position)
|
||||
{
|
||||
if (CurrLayer.Layer == MapLayer.AutoFloorLayer) //选择自动地板层, 那么不管笔刷类型, 通通使用 Main Source 中的 Main Terrain
|
||||
{
|
||||
|
@ -889,7 +668,7 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
{
|
||||
foreach (var item in CurrBrush)
|
||||
{
|
||||
SetCell(CurrLayer.Layer, position + item.Key + _brushOffset, CurrSourceIndex, item.Value);
|
||||
SetCell(CurrLayer.Layer, position + item.Key + BrushOffset, CurrSourceIndex, item.Value);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
@ -928,8 +707,10 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
}
|
||||
}
|
||||
|
||||
//绘制区域贴图
|
||||
private void SetRectCell(Vector2I start, Vector2I end)
|
||||
/// <summary>
|
||||
/// 绘制区域贴图
|
||||
/// </summary>
|
||||
public void SetRectCell(Vector2I start, Vector2I end)
|
||||
{
|
||||
if (start.X > end.X)
|
||||
{
|
||||
|
@ -966,13 +747,18 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
var dirty = false;
|
||||
if (CurrBrushType == TileMapDrawMode.Free || CurrBrushType == TileMapDrawMode.Combination) //自由绘制 或者 组合
|
||||
{
|
||||
if (BrushWidth == 0 || BrushHeight == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dirty = CurrBrush.Count > 0;
|
||||
for (var i = 0; i < width; i++)
|
||||
{
|
||||
for (var j = 0; j < height; j++)
|
||||
{
|
||||
var x = i % _brushWidth + _brushStartX;
|
||||
var y = j % _brushHeight + _brushStartY;
|
||||
var x = i % BrushWidth + BrushStartX;
|
||||
var y = j % BrushHeight + BrushStartY;
|
||||
if (CurrBrush.TryGetValue(new Vector2I(x, y), out var v))
|
||||
{
|
||||
SetCell(CurrLayer.Layer, new Vector2I(start.X + i, start.Y + j), CurrSourceIndex, v);
|
||||
|
@ -1015,8 +801,10 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
}
|
||||
}
|
||||
|
||||
//擦除单个图块
|
||||
private void EraseSingleCell(Vector2I position)
|
||||
/// <summary>
|
||||
/// 擦除单个图块
|
||||
/// </summary>
|
||||
public void EraseSingleCell(Vector2I position)
|
||||
{
|
||||
if (CurrLayer.Layer == MapLayer.AutoFloorLayer) //选择自动地板层, 那么不管笔刷类型, 通通使用 Main Source 中的 Main Terrain
|
||||
{
|
||||
|
@ -1100,8 +888,10 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
}
|
||||
}
|
||||
|
||||
//擦除一个区域内的贴图
|
||||
private void EraseRectCell(Vector2I start, Vector2I end)
|
||||
/// <summary>
|
||||
/// 擦除一个区域内的贴图
|
||||
/// </summary>
|
||||
public void EraseRectCell(Vector2I start, Vector2I end)
|
||||
{
|
||||
if (start.X > end.X)
|
||||
{
|
||||
|
@ -1230,42 +1020,10 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
MapEditorPanel.S_ErrorCellAnimationPlayer.Instance.Stop();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中拖拽功能
|
||||
/// </summary>
|
||||
private void OnSelectHandTool(object arg)
|
||||
{
|
||||
MouseType = MouseButtonType.Drag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中画笔攻击
|
||||
/// </summary>
|
||||
private void OnSelectPenTool(object arg)
|
||||
{
|
||||
MouseType = MouseButtonType.Pen;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中绘制区域功能
|
||||
/// </summary>
|
||||
private void OnSelectRectTool(object arg)
|
||||
{
|
||||
MouseType = MouseButtonType.Area;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选择编辑门区域
|
||||
/// </summary>
|
||||
private void OnSelectEditTool(object arg)
|
||||
{
|
||||
MouseType = MouseButtonType.Edit;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 聚焦
|
||||
/// </summary>
|
||||
private void OnClickCenterTool(object arg)
|
||||
public void OnFocusClick()
|
||||
{
|
||||
var pos = MapEditorPanel.S_SubViewport.Instance.Size / 2;
|
||||
if (CurrRoomSize.X == 0 && CurrRoomSize.Y == 0) //聚焦原点
|
||||
|
@ -1427,6 +1185,10 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
PushLayerDataToList(MapLayer.CustomMiddleLayer2, tileInfo.CustomMiddle2);
|
||||
PushLayerDataToList(MapLayer.CustomTopLayer, tileInfo.CustomTop);
|
||||
|
||||
//---------------------------------------
|
||||
|
||||
MapEditorPanel.S_MapEditorObject.Instance.OnSaveData(tileInfo);
|
||||
|
||||
MapProjectManager.SaveRoomTileInfo(CurrRoomSplit);
|
||||
}
|
||||
|
||||
|
@ -1568,6 +1330,8 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
SetLayerModulate(MapLayer.CustomMiddleLayer2, Colors.White);
|
||||
SetLayerModulate(MapLayer.AutoTopLayer, Colors.White);
|
||||
SetLayerModulate(MapLayer.CustomTopLayer, Colors.White);
|
||||
|
||||
EventManager.EmitEvent(EventEnum.OnSavePreviewImageBegin);
|
||||
}
|
||||
|
||||
private void OnFramePostDraw()
|
||||
|
@ -1614,6 +1378,8 @@ public partial class EditorTileMap : TileMap, IUiNodeScript
|
|||
|
||||
_previewFinish();
|
||||
_hasPreviewImage = false;
|
||||
|
||||
EventManager.EmitEvent(EventEnum.OnSavePreviewImageFinish);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
using System.Collections;
|
||||
using Config;
|
||||
|
||||
namespace UI.MapEditorConfigObject;
|
||||
|
||||
public class ItemCell : UiCell<MapEditorConfigObject.CellButton, ExcelConfig.EditorObject>
|
||||
{
|
||||
public override void OnInit()
|
||||
{
|
||||
CellNode.L_SelectTexture.Instance.Visible = false;
|
||||
}
|
||||
|
||||
public override IEnumerator OnSetDataCoroutine(ExcelConfig.EditorObject data)
|
||||
{
|
||||
CellNode.L_CellName.Instance.Text = data.GetRealName();
|
||||
CellNode.L_PreviewImage.Instance.Texture = data.GetIcon();
|
||||
yield return null;
|
||||
}
|
||||
|
||||
public override void OnSelect()
|
||||
{
|
||||
CellNode.L_SelectTexture.Instance.Visible = true;
|
||||
}
|
||||
|
||||
public override void OnUnSelect()
|
||||
{
|
||||
CellNode.L_SelectTexture.Instance.Visible = false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,262 @@
|
|||
namespace UI.MapEditorConfigObject;
|
||||
|
||||
/// <summary>
|
||||
/// Ui代码, 该类是根据ui场景自动生成的, 请不要手动编辑该类, 以免造成代码丢失
|
||||
/// </summary>
|
||||
public abstract partial class MapEditorConfigObject : UiBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.VBoxContainer"/>, 节点路径: MapEditorConfigObject.VBoxContainer
|
||||
/// </summary>
|
||||
public VBoxContainer L_VBoxContainer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer((MapEditorConfigObjectPanel)this, GetNode<Godot.VBoxContainer>("VBoxContainer"));
|
||||
return _L_VBoxContainer;
|
||||
}
|
||||
}
|
||||
private VBoxContainer _L_VBoxContainer;
|
||||
|
||||
|
||||
public MapEditorConfigObject() : base(nameof(MapEditorConfigObject))
|
||||
{
|
||||
}
|
||||
|
||||
public sealed override void OnInitNestedUi()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.LineEdit"/>, 路径: MapEditorConfigObject.VBoxContainer.HBoxContainer.SearchInput
|
||||
/// </summary>
|
||||
public class SearchInput : UiNode<MapEditorConfigObjectPanel, Godot.LineEdit, SearchInput>
|
||||
{
|
||||
public SearchInput(MapEditorConfigObjectPanel uiPanel, Godot.LineEdit node) : base(uiPanel, node) { }
|
||||
public override SearchInput Clone() => new (UiPanel, (Godot.LineEdit)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.Button"/>, 路径: MapEditorConfigObject.VBoxContainer.HBoxContainer.SearchButton
|
||||
/// </summary>
|
||||
public class SearchButton : UiNode<MapEditorConfigObjectPanel, Godot.Button, SearchButton>
|
||||
{
|
||||
public SearchButton(MapEditorConfigObjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { }
|
||||
public override SearchButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.HBoxContainer"/>, 路径: MapEditorConfigObject.VBoxContainer.HBoxContainer
|
||||
/// </summary>
|
||||
public class HBoxContainer : UiNode<MapEditorConfigObjectPanel, Godot.HBoxContainer, HBoxContainer>
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.LineEdit"/>, 节点路径: MapEditorConfigObject.VBoxContainer.SearchInput
|
||||
/// </summary>
|
||||
public SearchInput L_SearchInput
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_SearchInput == null) _L_SearchInput = new SearchInput(UiPanel, Instance.GetNode<Godot.LineEdit>("SearchInput"));
|
||||
return _L_SearchInput;
|
||||
}
|
||||
}
|
||||
private SearchInput _L_SearchInput;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Button"/>, 节点路径: MapEditorConfigObject.VBoxContainer.SearchButton
|
||||
/// </summary>
|
||||
public SearchButton L_SearchButton
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_SearchButton == null) _L_SearchButton = new SearchButton(UiPanel, Instance.GetNode<Godot.Button>("SearchButton"));
|
||||
return _L_SearchButton;
|
||||
}
|
||||
}
|
||||
private SearchButton _L_SearchButton;
|
||||
|
||||
public HBoxContainer(MapEditorConfigObjectPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
|
||||
public override HBoxContainer Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.TextureRect"/>, 路径: MapEditorConfigObject.VBoxContainer.ScrollContainer.CellButton.PreviewImage
|
||||
/// </summary>
|
||||
public class PreviewImage : UiNode<MapEditorConfigObjectPanel, Godot.TextureRect, PreviewImage>
|
||||
{
|
||||
public PreviewImage(MapEditorConfigObjectPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { }
|
||||
public override PreviewImage Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.Label"/>, 路径: MapEditorConfigObject.VBoxContainer.ScrollContainer.CellButton.CellName
|
||||
/// </summary>
|
||||
public class CellName : UiNode<MapEditorConfigObjectPanel, Godot.Label, CellName>
|
||||
{
|
||||
public CellName(MapEditorConfigObjectPanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
|
||||
public override CellName Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.NinePatchRect"/>, 路径: MapEditorConfigObject.VBoxContainer.ScrollContainer.CellButton.SelectTexture
|
||||
/// </summary>
|
||||
public class SelectTexture : UiNode<MapEditorConfigObjectPanel, Godot.NinePatchRect, SelectTexture>
|
||||
{
|
||||
public SelectTexture(MapEditorConfigObjectPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { }
|
||||
public override SelectTexture Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.Button"/>, 路径: MapEditorConfigObject.VBoxContainer.ScrollContainer.CellButton
|
||||
/// </summary>
|
||||
public class CellButton : UiNode<MapEditorConfigObjectPanel, Godot.Button, CellButton>
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.TextureRect"/>, 节点路径: MapEditorConfigObject.VBoxContainer.ScrollContainer.PreviewImage
|
||||
/// </summary>
|
||||
public PreviewImage L_PreviewImage
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_PreviewImage == null) _L_PreviewImage = new PreviewImage(UiPanel, Instance.GetNode<Godot.TextureRect>("PreviewImage"));
|
||||
return _L_PreviewImage;
|
||||
}
|
||||
}
|
||||
private PreviewImage _L_PreviewImage;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Label"/>, 节点路径: MapEditorConfigObject.VBoxContainer.ScrollContainer.CellName
|
||||
/// </summary>
|
||||
public CellName L_CellName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_CellName == null) _L_CellName = new CellName(UiPanel, Instance.GetNode<Godot.Label>("CellName"));
|
||||
return _L_CellName;
|
||||
}
|
||||
}
|
||||
private CellName _L_CellName;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.NinePatchRect"/>, 节点路径: MapEditorConfigObject.VBoxContainer.ScrollContainer.SelectTexture
|
||||
/// </summary>
|
||||
public SelectTexture L_SelectTexture
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_SelectTexture == null) _L_SelectTexture = new SelectTexture(UiPanel, Instance.GetNode<Godot.NinePatchRect>("SelectTexture"));
|
||||
return _L_SelectTexture;
|
||||
}
|
||||
}
|
||||
private SelectTexture _L_SelectTexture;
|
||||
|
||||
public CellButton(MapEditorConfigObjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { }
|
||||
public override CellButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.ScrollContainer"/>, 路径: MapEditorConfigObject.VBoxContainer.ScrollContainer
|
||||
/// </summary>
|
||||
public class ScrollContainer : UiNode<MapEditorConfigObjectPanel, Godot.ScrollContainer, ScrollContainer>
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Button"/>, 节点路径: MapEditorConfigObject.VBoxContainer.CellButton
|
||||
/// </summary>
|
||||
public CellButton L_CellButton
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_CellButton == null) _L_CellButton = new CellButton(UiPanel, Instance.GetNode<Godot.Button>("CellButton"));
|
||||
return _L_CellButton;
|
||||
}
|
||||
}
|
||||
private CellButton _L_CellButton;
|
||||
|
||||
public ScrollContainer(MapEditorConfigObjectPanel uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { }
|
||||
public override ScrollContainer Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.VBoxContainer"/>, 路径: MapEditorConfigObject.VBoxContainer
|
||||
/// </summary>
|
||||
public class VBoxContainer : UiNode<MapEditorConfigObjectPanel, Godot.VBoxContainer, VBoxContainer>
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.HBoxContainer"/>, 节点路径: MapEditorConfigObject.HBoxContainer
|
||||
/// </summary>
|
||||
public HBoxContainer L_HBoxContainer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer(UiPanel, Instance.GetNode<Godot.HBoxContainer>("HBoxContainer"));
|
||||
return _L_HBoxContainer;
|
||||
}
|
||||
}
|
||||
private HBoxContainer _L_HBoxContainer;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.ScrollContainer"/>, 节点路径: MapEditorConfigObject.ScrollContainer
|
||||
/// </summary>
|
||||
public ScrollContainer L_ScrollContainer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_ScrollContainer == null) _L_ScrollContainer = new ScrollContainer(UiPanel, Instance.GetNode<Godot.ScrollContainer>("ScrollContainer"));
|
||||
return _L_ScrollContainer;
|
||||
}
|
||||
}
|
||||
private ScrollContainer _L_ScrollContainer;
|
||||
|
||||
public VBoxContainer(MapEditorConfigObjectPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { }
|
||||
public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.LineEdit"/>, 节点路径: MapEditorConfigObject.VBoxContainer.HBoxContainer.SearchInput
|
||||
/// </summary>
|
||||
public SearchInput S_SearchInput => L_VBoxContainer.L_HBoxContainer.L_SearchInput;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Button"/>, 节点路径: MapEditorConfigObject.VBoxContainer.HBoxContainer.SearchButton
|
||||
/// </summary>
|
||||
public SearchButton S_SearchButton => L_VBoxContainer.L_HBoxContainer.L_SearchButton;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.HBoxContainer"/>, 节点路径: MapEditorConfigObject.VBoxContainer.HBoxContainer
|
||||
/// </summary>
|
||||
public HBoxContainer S_HBoxContainer => L_VBoxContainer.L_HBoxContainer;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.TextureRect"/>, 节点路径: MapEditorConfigObject.VBoxContainer.ScrollContainer.CellButton.PreviewImage
|
||||
/// </summary>
|
||||
public PreviewImage S_PreviewImage => L_VBoxContainer.L_ScrollContainer.L_CellButton.L_PreviewImage;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Label"/>, 节点路径: MapEditorConfigObject.VBoxContainer.ScrollContainer.CellButton.CellName
|
||||
/// </summary>
|
||||
public CellName S_CellName => L_VBoxContainer.L_ScrollContainer.L_CellButton.L_CellName;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.NinePatchRect"/>, 节点路径: MapEditorConfigObject.VBoxContainer.ScrollContainer.CellButton.SelectTexture
|
||||
/// </summary>
|
||||
public SelectTexture S_SelectTexture => L_VBoxContainer.L_ScrollContainer.L_CellButton.L_SelectTexture;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Button"/>, 节点路径: MapEditorConfigObject.VBoxContainer.ScrollContainer.CellButton
|
||||
/// </summary>
|
||||
public CellButton S_CellButton => L_VBoxContainer.L_ScrollContainer.L_CellButton;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.ScrollContainer"/>, 节点路径: MapEditorConfigObject.VBoxContainer.ScrollContainer
|
||||
/// </summary>
|
||||
public ScrollContainer S_ScrollContainer => L_VBoxContainer.L_ScrollContainer;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.VBoxContainer"/>, 节点路径: MapEditorConfigObject.VBoxContainer
|
||||
/// </summary>
|
||||
public VBoxContainer S_VBoxContainer => L_VBoxContainer;
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
using System.Linq;
|
||||
using Config;
|
||||
using Godot;
|
||||
|
||||
namespace UI.MapEditorConfigObject;
|
||||
|
||||
public partial class MapEditorConfigObjectPanel : MapEditorConfigObject
|
||||
{
|
||||
private UiGrid<CellButton, ExcelConfig.EditorObject> _grid;
|
||||
private bool _initData = false;
|
||||
private long _gridCoroutineId = -1;
|
||||
|
||||
public override void OnCreateUi()
|
||||
{
|
||||
_grid = CreateUiGrid<CellButton, ExcelConfig.EditorObject, ItemCell>(S_CellButton);
|
||||
_grid.SetAutoColumns(true);
|
||||
_grid.SetHorizontalExpand(true);
|
||||
|
||||
//搜索按钮
|
||||
S_SearchButton.Instance.Pressed += OnSearchButtonClicked;
|
||||
}
|
||||
|
||||
public override void OnShowUi()
|
||||
{
|
||||
if (!_initData)
|
||||
{
|
||||
_initData = true;
|
||||
OnSearchButtonClicked();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDestroyUi()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取选中的配置
|
||||
/// </summary>
|
||||
public ExcelConfig.EditorObject GetSelectConfig()
|
||||
{
|
||||
return _grid.SelectData;
|
||||
}
|
||||
|
||||
//搜索按钮点击
|
||||
private void OnSearchButtonClicked()
|
||||
{
|
||||
if (_gridCoroutineId != -1)
|
||||
{
|
||||
StopCoroutine(_gridCoroutineId);
|
||||
}
|
||||
|
||||
var text = S_SearchInput.Instance.Text;
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
_gridCoroutineId = StartCoroutine(_grid.SetDataListCoroutine(ExcelConfig.EditorObject_List));
|
||||
}
|
||||
else
|
||||
{
|
||||
var enumerable = ExcelConfig.EditorObject_List.Where(item => item.GetRealName().Contains(text));
|
||||
_gridCoroutineId = StartCoroutine(_grid.SetDataListCoroutine(enumerable.ToArray()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -4,7 +4,7 @@ using UI.MapEditor;
|
|||
|
||||
namespace UI.MapEditorMapMark;
|
||||
|
||||
public partial class MapEditorMapMarkPanel : MapEditorMapMark
|
||||
public partial class MapEditorMapMarkPanel : MapEditorMapMark, IEditorTab
|
||||
{
|
||||
public enum SelectToolType
|
||||
{
|
||||
|
@ -495,4 +495,17 @@ public partial class MapEditorMapMarkPanel : MapEditorMapMark
|
|||
}
|
||||
S_AutoFillTip.Instance.Visible = false;
|
||||
}
|
||||
|
||||
public void OnSelectTab()
|
||||
{
|
||||
var panel = EditorTileMap.MapEditorPanel;
|
||||
panel.S_LayerPanel.Instance.Visible = false;
|
||||
|
||||
panel.S_MapEditorTools.Instance.SetToolButton(EditorToolEnum.Move, EditorToolEnum.MarkTool, EditorToolEnum.Focus);
|
||||
}
|
||||
|
||||
public void OnUnSelectTab()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ using UI.MapEditor;
|
|||
|
||||
namespace UI.MapEditorMapTile;
|
||||
|
||||
public partial class MapEditorMapTilePanel : MapEditorMapTile
|
||||
public partial class MapEditorMapTilePanel : MapEditorMapTile, IEditorTab
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用的TileSet数据
|
||||
|
@ -129,4 +129,19 @@ public partial class MapEditorMapTilePanel : MapEditorMapTile
|
|||
S_Tab2.Instance.Visible = v2;
|
||||
S_Tab3.Instance.Visible = v3;
|
||||
}
|
||||
|
||||
public void OnSelectTab()
|
||||
{
|
||||
var panel = EditorTileMap.MapEditorPanel;
|
||||
panel.S_LayerPanel.Instance.Visible = true;
|
||||
panel.S_LayerPanel.L_MapEditorMapLayer.Instance.ShowUi();
|
||||
panel.S_LayerPanel.L_MapEditorConfigObject.Instance.HideUi();
|
||||
|
||||
panel.S_MapEditorTools.Instance.SetToolButton(EditorToolEnum.Move, EditorToolEnum.TilePen, EditorToolEnum.TileAreaPen, EditorToolEnum.Focus);
|
||||
}
|
||||
|
||||
public void OnUnSelectTab()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
using System.Collections;
|
||||
using Config;
|
||||
|
||||
namespace UI.MapEditorObject;
|
||||
|
||||
public class ItemCell : UiCell<MapEditorObject.Item, RoomObjectInfo>
|
||||
{
|
||||
public override void OnInit()
|
||||
{
|
||||
CellNode.L_ItemButton.L_Select.Instance.Visible = false;
|
||||
CellNode.L_ItemButton.Instance.Pressed += Click;
|
||||
}
|
||||
|
||||
public override void OnSetData(RoomObjectInfo data)
|
||||
{
|
||||
var config = ExcelConfig.EditorObject_Map[data.Id];
|
||||
CellNode.L_ItemButton.Instance.Text = config.GetRealName();
|
||||
CellNode.L_ItemButton.L_Icon.Instance.Texture = config.GetIcon();
|
||||
}
|
||||
|
||||
public override void OnSelect()
|
||||
{
|
||||
CellNode.L_ItemButton.L_Select.Instance.Visible = true;
|
||||
EventManager.EmitEvent(EventEnum.OnSelectObject, Data);
|
||||
}
|
||||
|
||||
public override void OnUnSelect()
|
||||
{
|
||||
CellNode.L_ItemButton.L_Select.Instance.Visible = false;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick()
|
||||
{
|
||||
CellNode.UiPanel.FoceSelectObject(Data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,370 @@
|
|||
namespace UI.MapEditorObject;
|
||||
|
||||
/// <summary>
|
||||
/// Ui代码, 该类是根据ui场景自动生成的, 请不要手动编辑该类, 以免造成代码丢失
|
||||
/// </summary>
|
||||
public abstract partial class MapEditorObject : UiBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.VBoxContainer"/>, 节点路径: MapEditorObject.VBoxContainer
|
||||
/// </summary>
|
||||
public VBoxContainer L_VBoxContainer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer((MapEditorObjectPanel)this, GetNode<Godot.VBoxContainer>("VBoxContainer"));
|
||||
return _L_VBoxContainer;
|
||||
}
|
||||
}
|
||||
private VBoxContainer _L_VBoxContainer;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Button"/>, 节点路径: MapEditorObject.DynamicDeleteButton
|
||||
/// </summary>
|
||||
public DynamicDeleteButton L_DynamicDeleteButton
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_DynamicDeleteButton == null) _L_DynamicDeleteButton = new DynamicDeleteButton((MapEditorObjectPanel)this, GetNode<Godot.Button>("DynamicDeleteButton"));
|
||||
return _L_DynamicDeleteButton;
|
||||
}
|
||||
}
|
||||
private DynamicDeleteButton _L_DynamicDeleteButton;
|
||||
|
||||
|
||||
public MapEditorObject() : base(nameof(MapEditorObject))
|
||||
{
|
||||
}
|
||||
|
||||
public sealed override void OnInitNestedUi()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.LineEdit"/>, 路径: MapEditorObject.VBoxContainer.HBoxContainer.SearchInput
|
||||
/// </summary>
|
||||
public class SearchInput : UiNode<MapEditorObjectPanel, Godot.LineEdit, SearchInput>
|
||||
{
|
||||
public SearchInput(MapEditorObjectPanel uiPanel, Godot.LineEdit node) : base(uiPanel, node) { }
|
||||
public override SearchInput Clone() => new (UiPanel, (Godot.LineEdit)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.Button"/>, 路径: MapEditorObject.VBoxContainer.HBoxContainer.SearchButton
|
||||
/// </summary>
|
||||
public class SearchButton : UiNode<MapEditorObjectPanel, Godot.Button, SearchButton>
|
||||
{
|
||||
public SearchButton(MapEditorObjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { }
|
||||
public override SearchButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.HBoxContainer"/>, 路径: MapEditorObject.VBoxContainer.HBoxContainer
|
||||
/// </summary>
|
||||
public class HBoxContainer : UiNode<MapEditorObjectPanel, Godot.HBoxContainer, HBoxContainer>
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.LineEdit"/>, 节点路径: MapEditorObject.VBoxContainer.SearchInput
|
||||
/// </summary>
|
||||
public SearchInput L_SearchInput
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_SearchInput == null) _L_SearchInput = new SearchInput(UiPanel, Instance.GetNode<Godot.LineEdit>("SearchInput"));
|
||||
return _L_SearchInput;
|
||||
}
|
||||
}
|
||||
private SearchInput _L_SearchInput;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Button"/>, 节点路径: MapEditorObject.VBoxContainer.SearchButton
|
||||
/// </summary>
|
||||
public SearchButton L_SearchButton
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_SearchButton == null) _L_SearchButton = new SearchButton(UiPanel, Instance.GetNode<Godot.Button>("SearchButton"));
|
||||
return _L_SearchButton;
|
||||
}
|
||||
}
|
||||
private SearchButton _L_SearchButton;
|
||||
|
||||
public HBoxContainer(MapEditorObjectPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
|
||||
public override HBoxContainer Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.Label"/>, 路径: MapEditorObject.VBoxContainer.HBoxContainer2.Label
|
||||
/// </summary>
|
||||
public class Label : UiNode<MapEditorObjectPanel, Godot.Label, Label>
|
||||
{
|
||||
public Label(MapEditorObjectPanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
|
||||
public override Label Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.OptionButton"/>, 路径: MapEditorObject.VBoxContainer.HBoxContainer2.LayerOption
|
||||
/// </summary>
|
||||
public class LayerOption : UiNode<MapEditorObjectPanel, Godot.OptionButton, LayerOption>
|
||||
{
|
||||
public LayerOption(MapEditorObjectPanel uiPanel, Godot.OptionButton node) : base(uiPanel, node) { }
|
||||
public override LayerOption Clone() => new (UiPanel, (Godot.OptionButton)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.HBoxContainer"/>, 路径: MapEditorObject.VBoxContainer.HBoxContainer2
|
||||
/// </summary>
|
||||
public class HBoxContainer2 : UiNode<MapEditorObjectPanel, Godot.HBoxContainer, HBoxContainer2>
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Label"/>, 节点路径: MapEditorObject.VBoxContainer.Label
|
||||
/// </summary>
|
||||
public Label L_Label
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_Label == null) _L_Label = new Label(UiPanel, Instance.GetNode<Godot.Label>("Label"));
|
||||
return _L_Label;
|
||||
}
|
||||
}
|
||||
private Label _L_Label;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.OptionButton"/>, 节点路径: MapEditorObject.VBoxContainer.LayerOption
|
||||
/// </summary>
|
||||
public LayerOption L_LayerOption
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_LayerOption == null) _L_LayerOption = new LayerOption(UiPanel, Instance.GetNode<Godot.OptionButton>("LayerOption"));
|
||||
return _L_LayerOption;
|
||||
}
|
||||
}
|
||||
private LayerOption _L_LayerOption;
|
||||
|
||||
public HBoxContainer2(MapEditorObjectPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
|
||||
public override HBoxContainer2 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.TextureRect"/>, 路径: MapEditorObject.VBoxContainer.ItemRoot.Item.ItemButton.Icon
|
||||
/// </summary>
|
||||
public class Icon : UiNode<MapEditorObjectPanel, Godot.TextureRect, Icon>
|
||||
{
|
||||
public Icon(MapEditorObjectPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { }
|
||||
public override Icon Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.NinePatchRect"/>, 路径: MapEditorObject.VBoxContainer.ItemRoot.Item.ItemButton.Select
|
||||
/// </summary>
|
||||
public class Select : UiNode<MapEditorObjectPanel, Godot.NinePatchRect, Select>
|
||||
{
|
||||
public Select(MapEditorObjectPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { }
|
||||
public override Select Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.Button"/>, 路径: MapEditorObject.VBoxContainer.ItemRoot.Item.ItemButton
|
||||
/// </summary>
|
||||
public class ItemButton : UiNode<MapEditorObjectPanel, Godot.Button, ItemButton>
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.TextureRect"/>, 节点路径: MapEditorObject.VBoxContainer.ItemRoot.Item.Icon
|
||||
/// </summary>
|
||||
public Icon L_Icon
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_Icon == null) _L_Icon = new Icon(UiPanel, Instance.GetNode<Godot.TextureRect>("Icon"));
|
||||
return _L_Icon;
|
||||
}
|
||||
}
|
||||
private Icon _L_Icon;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.NinePatchRect"/>, 节点路径: MapEditorObject.VBoxContainer.ItemRoot.Item.Select
|
||||
/// </summary>
|
||||
public Select L_Select
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_Select == null) _L_Select = new Select(UiPanel, Instance.GetNode<Godot.NinePatchRect>("Select"));
|
||||
return _L_Select;
|
||||
}
|
||||
}
|
||||
private Select _L_Select;
|
||||
|
||||
public ItemButton(MapEditorObjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { }
|
||||
public override ItemButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.HBoxContainer"/>, 路径: MapEditorObject.VBoxContainer.ItemRoot.Item
|
||||
/// </summary>
|
||||
public class Item : UiNode<MapEditorObjectPanel, Godot.HBoxContainer, Item>
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Button"/>, 节点路径: MapEditorObject.VBoxContainer.ItemRoot.ItemButton
|
||||
/// </summary>
|
||||
public ItemButton L_ItemButton
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_ItemButton == null) _L_ItemButton = new ItemButton(UiPanel, Instance.GetNode<Godot.Button>("ItemButton"));
|
||||
return _L_ItemButton;
|
||||
}
|
||||
}
|
||||
private ItemButton _L_ItemButton;
|
||||
|
||||
public Item(MapEditorObjectPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
|
||||
public override Item Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.ScrollContainer"/>, 路径: MapEditorObject.VBoxContainer.ItemRoot
|
||||
/// </summary>
|
||||
public class ItemRoot : UiNode<MapEditorObjectPanel, Godot.ScrollContainer, ItemRoot>
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.HBoxContainer"/>, 节点路径: MapEditorObject.VBoxContainer.Item
|
||||
/// </summary>
|
||||
public Item L_Item
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_Item == null) _L_Item = new Item(UiPanel, Instance.GetNode<Godot.HBoxContainer>("Item"));
|
||||
return _L_Item;
|
||||
}
|
||||
}
|
||||
private Item _L_Item;
|
||||
|
||||
public ItemRoot(MapEditorObjectPanel uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { }
|
||||
public override ItemRoot Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.VBoxContainer"/>, 路径: MapEditorObject.VBoxContainer
|
||||
/// </summary>
|
||||
public class VBoxContainer : UiNode<MapEditorObjectPanel, Godot.VBoxContainer, VBoxContainer>
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.HBoxContainer"/>, 节点路径: MapEditorObject.HBoxContainer
|
||||
/// </summary>
|
||||
public HBoxContainer L_HBoxContainer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer(UiPanel, Instance.GetNode<Godot.HBoxContainer>("HBoxContainer"));
|
||||
return _L_HBoxContainer;
|
||||
}
|
||||
}
|
||||
private HBoxContainer _L_HBoxContainer;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.HBoxContainer"/>, 节点路径: MapEditorObject.HBoxContainer2
|
||||
/// </summary>
|
||||
public HBoxContainer2 L_HBoxContainer2
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_HBoxContainer2 == null) _L_HBoxContainer2 = new HBoxContainer2(UiPanel, Instance.GetNode<Godot.HBoxContainer>("HBoxContainer2"));
|
||||
return _L_HBoxContainer2;
|
||||
}
|
||||
}
|
||||
private HBoxContainer2 _L_HBoxContainer2;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.ScrollContainer"/>, 节点路径: MapEditorObject.ItemRoot
|
||||
/// </summary>
|
||||
public ItemRoot L_ItemRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_ItemRoot == null) _L_ItemRoot = new ItemRoot(UiPanel, Instance.GetNode<Godot.ScrollContainer>("ItemRoot"));
|
||||
return _L_ItemRoot;
|
||||
}
|
||||
}
|
||||
private ItemRoot _L_ItemRoot;
|
||||
|
||||
public VBoxContainer(MapEditorObjectPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { }
|
||||
public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.Button"/>, 路径: MapEditorObject.DynamicDeleteButton
|
||||
/// </summary>
|
||||
public class DynamicDeleteButton : UiNode<MapEditorObjectPanel, Godot.Button, DynamicDeleteButton>
|
||||
{
|
||||
public DynamicDeleteButton(MapEditorObjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { }
|
||||
public override DynamicDeleteButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.LineEdit"/>, 节点路径: MapEditorObject.VBoxContainer.HBoxContainer.SearchInput
|
||||
/// </summary>
|
||||
public SearchInput S_SearchInput => L_VBoxContainer.L_HBoxContainer.L_SearchInput;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Button"/>, 节点路径: MapEditorObject.VBoxContainer.HBoxContainer.SearchButton
|
||||
/// </summary>
|
||||
public SearchButton S_SearchButton => L_VBoxContainer.L_HBoxContainer.L_SearchButton;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.HBoxContainer"/>, 节点路径: MapEditorObject.VBoxContainer.HBoxContainer
|
||||
/// </summary>
|
||||
public HBoxContainer S_HBoxContainer => L_VBoxContainer.L_HBoxContainer;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Label"/>, 节点路径: MapEditorObject.VBoxContainer.HBoxContainer2.Label
|
||||
/// </summary>
|
||||
public Label S_Label => L_VBoxContainer.L_HBoxContainer2.L_Label;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.OptionButton"/>, 节点路径: MapEditorObject.VBoxContainer.HBoxContainer2.LayerOption
|
||||
/// </summary>
|
||||
public LayerOption S_LayerOption => L_VBoxContainer.L_HBoxContainer2.L_LayerOption;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.HBoxContainer"/>, 节点路径: MapEditorObject.VBoxContainer.HBoxContainer2
|
||||
/// </summary>
|
||||
public HBoxContainer2 S_HBoxContainer2 => L_VBoxContainer.L_HBoxContainer2;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.TextureRect"/>, 节点路径: MapEditorObject.VBoxContainer.ItemRoot.Item.ItemButton.Icon
|
||||
/// </summary>
|
||||
public Icon S_Icon => L_VBoxContainer.L_ItemRoot.L_Item.L_ItemButton.L_Icon;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.NinePatchRect"/>, 节点路径: MapEditorObject.VBoxContainer.ItemRoot.Item.ItemButton.Select
|
||||
/// </summary>
|
||||
public Select S_Select => L_VBoxContainer.L_ItemRoot.L_Item.L_ItemButton.L_Select;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Button"/>, 节点路径: MapEditorObject.VBoxContainer.ItemRoot.Item.ItemButton
|
||||
/// </summary>
|
||||
public ItemButton S_ItemButton => L_VBoxContainer.L_ItemRoot.L_Item.L_ItemButton;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.HBoxContainer"/>, 节点路径: MapEditorObject.VBoxContainer.ItemRoot.Item
|
||||
/// </summary>
|
||||
public Item S_Item => L_VBoxContainer.L_ItemRoot.L_Item;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.ScrollContainer"/>, 节点路径: MapEditorObject.VBoxContainer.ItemRoot
|
||||
/// </summary>
|
||||
public ItemRoot S_ItemRoot => L_VBoxContainer.L_ItemRoot;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.VBoxContainer"/>, 节点路径: MapEditorObject.VBoxContainer
|
||||
/// </summary>
|
||||
public VBoxContainer S_VBoxContainer => L_VBoxContainer;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Button"/>, 节点路径: MapEditorObject.DynamicDeleteButton
|
||||
/// </summary>
|
||||
public DynamicDeleteButton S_DynamicDeleteButton => L_DynamicDeleteButton;
|
||||
|
||||
}
|
|
@ -0,0 +1,260 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Config;
|
||||
using Godot;
|
||||
using UI.MapEditor;
|
||||
|
||||
namespace UI.MapEditorObject;
|
||||
|
||||
public partial class MapEditorObjectPanel : MapEditorObject, IEditorTab
|
||||
{
|
||||
/// <summary>
|
||||
/// 编辑器Tile对象
|
||||
/// </summary>
|
||||
public EditorTileMap EditorTileMap { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 临时存储普通层自定义物体数据
|
||||
/// </summary>
|
||||
public readonly List<RoomObjectInfo> NormalLayerObjects = new List<RoomObjectInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// 临时存储Y排序层自定义物体数据
|
||||
/// </summary>
|
||||
public readonly List<RoomObjectInfo> YSortLayerObjects = new List<RoomObjectInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// 当前页签是否选中
|
||||
/// </summary>
|
||||
public bool IsActiveTab { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物体网格
|
||||
/// </summary>
|
||||
public UiGrid<Item, RoomObjectInfo> ObjectGrid { get; private set; }
|
||||
|
||||
public override void OnCreateUi()
|
||||
{
|
||||
var editorPanel = (MapEditorPanel)ParentUi;
|
||||
EditorTileMap = editorPanel.S_TileMap.Instance;
|
||||
|
||||
ObjectGrid = CreateUiGrid<Item, RoomObjectInfo, ItemCell>(S_Item);
|
||||
ObjectGrid.SetHorizontalExpand(true);
|
||||
ObjectGrid.SelectEvent += OnSelectEvent;
|
||||
|
||||
AddEventListener(EventEnum.OnPutObject, OnPutObject);
|
||||
AddEventListener(EventEnum.OnSelectObject, OnSelectObject);
|
||||
|
||||
S_SearchButton.Instance.Pressed += OnSearchClick;
|
||||
S_LayerOption.Instance.ItemSelected += (index) =>
|
||||
{
|
||||
OnChangeObjectLayer(index);
|
||||
OnSearchClick();
|
||||
};
|
||||
|
||||
S_DynamicDeleteButton.Instance.Pressed += OnDelete;
|
||||
}
|
||||
|
||||
public override void OnDestroyUi()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化面板数据
|
||||
/// </summary>
|
||||
public void InitData()
|
||||
{
|
||||
var tileInfo = EditorTileMap.CurrRoomSplit.TileInfo;
|
||||
if (tileInfo.NormalLayerObjects != null)
|
||||
{
|
||||
foreach (var temp in tileInfo.NormalLayerObjects)
|
||||
{
|
||||
if (ExcelConfig.EditorObject_Map.ContainsKey(temp.Id))
|
||||
{
|
||||
NormalLayerObjects.Add(temp.Clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tileInfo.YSortLayerObjects != null)
|
||||
{
|
||||
foreach (var temp in tileInfo.YSortLayerObjects)
|
||||
{
|
||||
if (ExcelConfig.EditorObject_Map.ContainsKey(temp.Id))
|
||||
{
|
||||
YSortLayerObjects.Add(temp.Clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditorTileMap.MapEditorPanel.S_MapEditorTools.Instance.InitCustomObjectData();
|
||||
//刷新数据
|
||||
OnSearchClick();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存配置数据
|
||||
/// </summary>
|
||||
public void OnSaveData(DungeonTileInfo tileInfo)
|
||||
{
|
||||
tileInfo.NormalLayerObjects.Clear();
|
||||
foreach (var normalLayerObject in NormalLayerObjects)
|
||||
{
|
||||
tileInfo.NormalLayerObjects.Add(normalLayerObject.Clone());
|
||||
}
|
||||
tileInfo.YSortLayerObjects.Clear();
|
||||
foreach (var ySortLayerObject in YSortLayerObjects)
|
||||
{
|
||||
tileInfo.YSortLayerObjects.Add(ySortLayerObject.Clone());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 聚焦物体
|
||||
/// </summary>
|
||||
public void FoceSelectObject(RoomObjectInfo info)
|
||||
{
|
||||
EditorTileMap.SetLookPosition(new Vector2(info.X, info.Y));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前选中的物体层
|
||||
/// </summary>
|
||||
public List<RoomObjectInfo> GetCurrentObjectLayer()
|
||||
{
|
||||
return S_LayerOption.Instance.Selected == 0 ? NormalLayerObjects : YSortLayerObjects;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前选中的物体层
|
||||
/// </summary>
|
||||
public RoomLayerEnum GetCurrentObjectLayerEnum()
|
||||
{
|
||||
return S_LayerOption.Instance.Selected == 0 ? RoomLayerEnum.NormalLayer : RoomLayerEnum.YSortLayer;
|
||||
}
|
||||
|
||||
private void OnChangeObjectLayer(long index)
|
||||
{
|
||||
var editorToolsPanel = EditorTileMap.MapEditorPanel.S_MapEditorTools.Instance;
|
||||
var toolsPanel = editorToolsPanel;
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
toolsPanel.CustomNormalRoot.Modulate = Colors.White;
|
||||
toolsPanel.CustomYSortRoot.Modulate = new Color(1, 1, 1, 0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
toolsPanel.CustomNormalRoot.Modulate = new Color(1, 1, 1, 0.5f);
|
||||
toolsPanel.CustomYSortRoot.Modulate = Colors.White;
|
||||
}
|
||||
|
||||
//启用当前层的Area2D物体监视
|
||||
foreach (var custonObjectData in editorToolsPanel.CustomObjecMapping)
|
||||
{
|
||||
var objectData = custonObjectData.Value;
|
||||
objectData.Node.Instance.Monitorable = (long)objectData.Layer == index;
|
||||
}
|
||||
}
|
||||
|
||||
//搜索
|
||||
public void OnSearchClick()
|
||||
{
|
||||
var dataList = GetCurrentObjectLayer();
|
||||
var text = S_SearchInput.Instance.Text;
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
ObjectGrid.SetDataList(dataList);
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = dataList.Where(data => ExcelConfig.EditorObject_Map[data.Id].Name.Contains(text)).ToArray();
|
||||
ObjectGrid.SetDataList(result);
|
||||
}
|
||||
}
|
||||
|
||||
//创建自定义物体
|
||||
private void OnPutObject(object obj)
|
||||
{
|
||||
var temp = (RoomObjectInfo)obj;
|
||||
var layer = GetCurrentObjectLayer();
|
||||
layer.Add(temp);
|
||||
OnSearchClick();
|
||||
}
|
||||
|
||||
private void OnSelectEvent(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
S_DynamicDeleteButton.Instance.Visible = false;
|
||||
S_DynamicDeleteButton.Reparent(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
S_DynamicDeleteButton.Instance.Visible = true;
|
||||
S_DynamicDeleteButton.Reparent(ObjectGrid.GetCell(index).CellNode.Instance);
|
||||
}
|
||||
}
|
||||
|
||||
//删除
|
||||
private void OnDelete()
|
||||
{
|
||||
if (ObjectGrid.SelectIndex < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EditorWindowManager.ShowConfirm("提示", "确定删除该物体吗?", b =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
var layer = GetCurrentObjectLayer();
|
||||
var temp = layer[ObjectGrid.SelectIndex];
|
||||
layer.RemoveAt(ObjectGrid.SelectIndex);
|
||||
|
||||
//派发删除事件
|
||||
EventManager.EmitEvent(EventEnum.OnRemoveObject, temp);
|
||||
|
||||
OnSearchClick();
|
||||
|
||||
//标记数据脏了
|
||||
EventManager.EmitEvent(EventEnum.OnTileMapDirty);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSelectTab()
|
||||
{
|
||||
IsActiveTab = true;
|
||||
var panel = EditorTileMap.MapEditorPanel;
|
||||
|
||||
panel.S_LayerPanel.Instance.Visible = true;
|
||||
panel.S_LayerPanel.L_MapEditorMapLayer.Instance.HideUi();
|
||||
panel.S_LayerPanel.L_MapEditorConfigObject.Instance.ShowUi();
|
||||
|
||||
panel.S_MapEditorTools.Instance.SetToolButton(EditorToolEnum.Move, EditorToolEnum.ObjectPen, EditorToolEnum.ObjectTool, EditorToolEnum.Focus);
|
||||
OnChangeObjectLayer(S_LayerOption.Instance.Selected);
|
||||
}
|
||||
|
||||
public void OnUnSelectTab()
|
||||
{
|
||||
var panel = EditorTileMap.MapEditorPanel;
|
||||
panel.S_MapEditorTools.Instance.CustomNormalRoot.Modulate = Colors.White;
|
||||
panel.S_MapEditorTools.Instance.CustomYSortRoot.Modulate = Colors.White;
|
||||
IsActiveTab = false;
|
||||
}
|
||||
|
||||
private void OnSelectObject(object obj)
|
||||
{
|
||||
var data = (RoomObjectInfo)obj;
|
||||
if (ObjectGrid.SelectData != data)
|
||||
{
|
||||
var uiCell = ObjectGrid.Find(item => item.Data == data);
|
||||
if (uiCell != null)
|
||||
{
|
||||
uiCell.Click();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
using Godot;
|
||||
using UI.MapEditorObject;
|
||||
|
||||
namespace UI.MapEditorTools;
|
||||
|
||||
public partial class CustomObject : Area2D, IUiNodeScript
|
||||
{
|
||||
public RoomObjectInfo Info;
|
||||
public Node2D Node;
|
||||
|
||||
private MapEditorObjectPanel _objectPanel;
|
||||
|
||||
private MapEditorTools.ObjectTemplate _uiNode;
|
||||
private static Rect2 _rect = new Rect2(-GameConfig.TileCellSizeVector2I / 2, GameConfig.TileCellSizeVector2I);
|
||||
|
||||
public void SetUiNode(IUiNode uiNode)
|
||||
{
|
||||
_uiNode = (MapEditorTools.ObjectTemplate) uiNode;
|
||||
_uiNode.L_RectBrush.Instance.Draw += OnDraw;
|
||||
_objectPanel = _uiNode.UiPanel.MapEditorPanel.S_MapEditorObject.Instance;
|
||||
}
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Init(RoomObjectInfo info, Node2D node)
|
||||
{
|
||||
Info = info;
|
||||
Node = node;
|
||||
|
||||
_uiNode.L_Bar.AddChild(node);
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
_uiNode.L_RectBrush.Instance.QueueRedraw();
|
||||
}
|
||||
|
||||
private void OnDraw()
|
||||
{
|
||||
if (_objectPanel.IsActiveTab) //选中页签才能绘制
|
||||
{
|
||||
if (_objectPanel.ObjectGrid.SelectData == Info) //判断是否选中
|
||||
{
|
||||
_uiNode.L_RectBrush.Instance.DrawRect(_rect, Colors.Green, false, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
_uiNode.L_RectBrush.Instance.DrawRect(_rect, Colors.White, false, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -257,11 +257,11 @@ public partial class DoorDragArea : Control
|
|||
bool checkResult;
|
||||
if (DoorAreaInfo == null)
|
||||
{
|
||||
checkResult = MapEditorToolsPanel.EditorMap.Instance.CheckDoorArea(Direction, doorAreaRange.X, doorAreaRange.Y);
|
||||
checkResult = MapEditorToolsPanel.EditorMap.CheckDoorArea(Direction, doorAreaRange.X, doorAreaRange.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
checkResult = MapEditorToolsPanel.EditorMap.Instance.CheckDoorArea(DoorAreaInfo, doorAreaRange.X, doorAreaRange.Y);
|
||||
checkResult = MapEditorToolsPanel.EditorMap.CheckDoorArea(DoorAreaInfo, doorAreaRange.X, doorAreaRange.Y);
|
||||
}
|
||||
if (checkResult)
|
||||
{
|
||||
|
@ -350,11 +350,11 @@ public partial class DoorDragArea : Control
|
|||
bool checkResult;
|
||||
if (DoorAreaInfo == null)
|
||||
{
|
||||
checkResult = MapEditorToolsPanel.EditorMap.Instance.CheckDoorArea(Direction, doorAreaRange.X, doorAreaRange.Y);
|
||||
checkResult = MapEditorToolsPanel.EditorMap.CheckDoorArea(Direction, doorAreaRange.X, doorAreaRange.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
checkResult = MapEditorToolsPanel.EditorMap.Instance.CheckDoorArea(DoorAreaInfo, doorAreaRange.X, doorAreaRange.Y);
|
||||
checkResult = MapEditorToolsPanel.EditorMap.CheckDoorArea(DoorAreaInfo, doorAreaRange.X, doorAreaRange.Y);
|
||||
}
|
||||
if (checkResult)
|
||||
{
|
||||
|
@ -426,7 +426,7 @@ public partial class DoorDragArea : Control
|
|||
|
||||
private void OnMouseEntered()
|
||||
{
|
||||
if (MapEditorToolsPanel.EditorMap.Instance.MouseType != EditorTileMap.MouseButtonType.Edit)
|
||||
if (MapEditorToolsPanel.EditorMap.ActiveToolType != EditorToolEnum.MarkTool)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ public partial class DoorDragArea : Control
|
|||
|
||||
private void OnMouseExited()
|
||||
{
|
||||
if (MapEditorToolsPanel.EditorMap.Instance.MouseType != EditorTileMap.MouseButtonType.Edit)
|
||||
if (MapEditorToolsPanel.EditorMap.ActiveToolType != EditorToolEnum.MarkTool)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public partial class DoorDragButton : TextureButton
|
|||
|
||||
private void OnButtonDown()
|
||||
{
|
||||
if (_mapEditorToolsPanel.EditorMap.Instance.MouseType != EditorTileMap.MouseButtonType.Edit)
|
||||
if (_mapEditorToolsPanel.EditorMap.ActiveToolType != EditorToolEnum.MarkTool)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public partial class DoorDragButton : TextureButton
|
|||
|
||||
private void OnButtonUp()
|
||||
{
|
||||
if (_mapEditorToolsPanel.EditorMap.Instance.MouseType != EditorTileMap.MouseButtonType.Edit)
|
||||
if (_mapEditorToolsPanel.EditorMap.ActiveToolType != EditorToolEnum.MarkTool)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public partial class DoorHoverArea : ColorRect
|
|||
var previewRoot = MapEditorToolsPanel.S_HoverPreviewRoot.Instance;
|
||||
|
||||
//检测是否会与其他门发生碰撞
|
||||
var canCreateDragArea = MapEditorToolsPanel.EditorMap.Instance.CheckDoorArea(Direction, start, start);
|
||||
var canCreateDragArea = MapEditorToolsPanel.EditorMap.CheckDoorArea(Direction, start, start);
|
||||
if (canCreateDragArea)
|
||||
{
|
||||
previewRoot.Visible = true;
|
||||
|
@ -74,7 +74,7 @@ public partial class DoorHoverArea : ColorRect
|
|||
{
|
||||
IsDrag = false;
|
||||
Debug.Log("提交创建: " + direction + ", " + start + ", " + end);
|
||||
_currToolTemplate.Instance.DoorAreaInfo = MapEditorToolsPanel.EditorMap.Instance.CreateDoorArea(direction, start, end);
|
||||
_currToolTemplate.Instance.DoorAreaInfo = MapEditorToolsPanel.EditorMap.CreateDoorArea(direction, start, end);
|
||||
//派发修改数据修改事件
|
||||
EventManager.EmitEvent(EventEnum.OnTileMapDirty);
|
||||
}
|
||||
|
@ -88,13 +88,13 @@ public partial class DoorHoverArea : ColorRect
|
|||
|
||||
private void OnMouseEnter()
|
||||
{
|
||||
if (MapEditorToolsPanel.EditorMap.Instance.MouseType != EditorTileMap.MouseButtonType.Edit)
|
||||
if (MapEditorToolsPanel.EditorMap.ActiveToolType != EditorToolEnum.MarkTool)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MapEditorToolsPanel.ActiveHoverArea == null || !IsDrag)
|
||||
{
|
||||
var roomSize = MapEditorToolsPanel.EditorMap.Instance.CurrRoomSize;
|
||||
var roomSize = MapEditorToolsPanel.EditorMap.CurrRoomSize;
|
||||
//房间大小为0, 不能放置门区域
|
||||
if (roomSize.X == 0 && roomSize.Y == 0)
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ public partial class DoorHoverArea : ColorRect
|
|||
|
||||
private void OnMouseExit()
|
||||
{
|
||||
if (MapEditorToolsPanel.EditorMap.Instance.MouseType != EditorTileMap.MouseButtonType.Edit)
|
||||
if (MapEditorToolsPanel.EditorMap.ActiveToolType != EditorToolEnum.MarkTool)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,19 @@ public abstract partial class MapEditorTools : UiBase
|
|||
}
|
||||
private ToolRoot _L_ToolRoot;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="UI.MapEditorTools.CustomObject"/>, 节点路径: MapEditorTools.ObjectTemplate
|
||||
/// </summary>
|
||||
public ObjectTemplate L_ObjectTemplate
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_ObjectTemplate == null) _L_ObjectTemplate = new ObjectTemplate((MapEditorToolsPanel)this, GetNode<UI.MapEditorTools.CustomObject>("ObjectTemplate"));
|
||||
return _L_ObjectTemplate;
|
||||
}
|
||||
}
|
||||
private ObjectTemplate _L_ObjectTemplate;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.HBoxContainer"/>, 节点路径: MapEditorTools.HBoxContainer
|
||||
/// </summary>
|
||||
|
@ -39,6 +52,7 @@ public abstract partial class MapEditorTools : UiBase
|
|||
public sealed override void OnInitNestedUi()
|
||||
{
|
||||
_ = L_ToolRoot.L_MarkTemplate;
|
||||
_ = L_ObjectTemplate;
|
||||
|
||||
}
|
||||
|
||||
|
@ -381,6 +395,81 @@ public abstract partial class MapEditorTools : UiBase
|
|||
public override ToolRoot Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.CollisionShape2D"/>, 路径: MapEditorTools.ObjectTemplate.CollisionShape2D
|
||||
/// </summary>
|
||||
public class CollisionShape2D : UiNode<MapEditorToolsPanel, Godot.CollisionShape2D, CollisionShape2D>
|
||||
{
|
||||
public CollisionShape2D(MapEditorToolsPanel uiPanel, Godot.CollisionShape2D node) : base(uiPanel, node) { }
|
||||
public override CollisionShape2D Clone() => new (UiPanel, (Godot.CollisionShape2D)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.Node2D"/>, 路径: MapEditorTools.ObjectTemplate.Bar
|
||||
/// </summary>
|
||||
public class Bar : UiNode<MapEditorToolsPanel, Godot.Node2D, Bar>
|
||||
{
|
||||
public Bar(MapEditorToolsPanel uiPanel, Godot.Node2D node) : base(uiPanel, node) { }
|
||||
public override Bar Clone() => new (UiPanel, (Godot.Node2D)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.Node2D"/>, 路径: MapEditorTools.ObjectTemplate.RectBrush
|
||||
/// </summary>
|
||||
public class RectBrush : UiNode<MapEditorToolsPanel, Godot.Node2D, RectBrush>
|
||||
{
|
||||
public RectBrush(MapEditorToolsPanel uiPanel, Godot.Node2D node) : base(uiPanel, node) { }
|
||||
public override RectBrush Clone() => new (UiPanel, (Godot.Node2D)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="UI.MapEditorTools.CustomObject"/>, 路径: MapEditorTools.ObjectTemplate
|
||||
/// </summary>
|
||||
public class ObjectTemplate : UiNode<MapEditorToolsPanel, UI.MapEditorTools.CustomObject, ObjectTemplate>
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.CollisionShape2D"/>, 节点路径: MapEditorTools.CollisionShape2D
|
||||
/// </summary>
|
||||
public CollisionShape2D L_CollisionShape2D
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_CollisionShape2D == null) _L_CollisionShape2D = new CollisionShape2D(UiPanel, Instance.GetNode<Godot.CollisionShape2D>("CollisionShape2D"));
|
||||
return _L_CollisionShape2D;
|
||||
}
|
||||
}
|
||||
private CollisionShape2D _L_CollisionShape2D;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Node2D"/>, 节点路径: MapEditorTools.Bar
|
||||
/// </summary>
|
||||
public Bar L_Bar
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_Bar == null) _L_Bar = new Bar(UiPanel, Instance.GetNode<Godot.Node2D>("Bar"));
|
||||
return _L_Bar;
|
||||
}
|
||||
}
|
||||
private Bar _L_Bar;
|
||||
|
||||
/// <summary>
|
||||
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: <see cref="Godot.Node2D"/>, 节点路径: MapEditorTools.RectBrush
|
||||
/// </summary>
|
||||
public RectBrush L_RectBrush
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_L_RectBrush == null) _L_RectBrush = new RectBrush(UiPanel, Instance.GetNode<Godot.Node2D>("RectBrush"));
|
||||
return _L_RectBrush;
|
||||
}
|
||||
}
|
||||
private RectBrush _L_RectBrush;
|
||||
|
||||
public ObjectTemplate(MapEditorToolsPanel uiPanel, UI.MapEditorTools.CustomObject node) : base(uiPanel, node) { }
|
||||
public override ObjectTemplate Clone() => new (UiPanel, (UI.MapEditorTools.CustomObject)Instance.Duplicate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型: <see cref="Godot.NinePatchRect"/>, 路径: MapEditorTools.HBoxContainer.ToolButton.Select
|
||||
/// </summary>
|
||||
|
@ -515,6 +604,26 @@ public abstract partial class MapEditorTools : UiBase
|
|||
/// </summary>
|
||||
public ToolRoot S_ToolRoot => L_ToolRoot;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.CollisionShape2D"/>, 节点路径: MapEditorTools.ObjectTemplate.CollisionShape2D
|
||||
/// </summary>
|
||||
public CollisionShape2D S_CollisionShape2D => L_ObjectTemplate.L_CollisionShape2D;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Node2D"/>, 节点路径: MapEditorTools.ObjectTemplate.Bar
|
||||
/// </summary>
|
||||
public Bar S_Bar => L_ObjectTemplate.L_Bar;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.Node2D"/>, 节点路径: MapEditorTools.ObjectTemplate.RectBrush
|
||||
/// </summary>
|
||||
public RectBrush S_RectBrush => L_ObjectTemplate.L_RectBrush;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="UI.MapEditorTools.CustomObject"/>, 节点路径: MapEditorTools.ObjectTemplate
|
||||
/// </summary>
|
||||
public ObjectTemplate S_ObjectTemplate => L_ObjectTemplate;
|
||||
|
||||
/// <summary>
|
||||
/// 场景中唯一名称的节点, 节点类型: <see cref="Godot.NinePatchRect"/>, 节点路径: MapEditorTools.HBoxContainer.ToolButton.Select
|
||||
/// </summary>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Config;
|
||||
using Godot;
|
||||
using UI.MapEditor;
|
||||
|
||||
|
@ -7,20 +8,17 @@ namespace UI.MapEditorTools;
|
|||
|
||||
public partial class MapEditorToolsPanel : MapEditorTools
|
||||
{
|
||||
public class ToolBtnData
|
||||
public class CustonObjectData
|
||||
{
|
||||
//是否可以选中
|
||||
public bool CanSelect = false;
|
||||
//工具图标
|
||||
public string Icon;
|
||||
//点击时回调
|
||||
public Action OnClick;
|
||||
public RoomObjectInfo RoomObjectInfo;
|
||||
public ObjectTemplate Node;
|
||||
public RoomLayerEnum Layer;
|
||||
|
||||
public ToolBtnData(bool canSelect, string icon, Action onClick)
|
||||
public CustonObjectData(RoomObjectInfo roomObjectInfo, ObjectTemplate node, RoomLayerEnum layer)
|
||||
{
|
||||
CanSelect = canSelect;
|
||||
Icon = icon;
|
||||
OnClick = onClick;
|
||||
RoomObjectInfo = roomObjectInfo;
|
||||
Node = node;
|
||||
Layer = layer;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,24 +35,52 @@ public partial class MapEditorToolsPanel : MapEditorTools
|
|||
/// <summary>
|
||||
/// 所属编辑器Tile对象
|
||||
/// </summary>
|
||||
public MapEditor.MapEditor.TileMap EditorMap { get; private set; }
|
||||
public EditorTileMap EditorMap { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属编辑器面板对象
|
||||
/// </summary>
|
||||
public MapEditorPanel MapEditorPanel { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否打开弹窗
|
||||
/// </summary>
|
||||
public bool IsOpenPopUps { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前选中的工具
|
||||
/// </summary>
|
||||
public EditorToolEnum ActiveToolType => _toolGrid != null && _toolGrid.SelectData != null ? _toolGrid.SelectData.EditorToolType : EditorToolEnum.None;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义对象普通层根节点
|
||||
/// </summary>
|
||||
public Node2D CustomNormalRoot { get; private set; }
|
||||
/// <summary>
|
||||
/// 自定义对象YSort层根节点
|
||||
/// </summary>
|
||||
public Node2D CustomYSortRoot { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义物体映射字典, 负责存储所有自定义物体
|
||||
/// </summary>
|
||||
public Dictionary<RoomObjectInfo, CustonObjectData> CustomObjecMapping { get; } = new Dictionary<RoomObjectInfo, CustonObjectData>();
|
||||
|
||||
private List<DoorToolTemplate> _doorTools = new List<DoorToolTemplate>();
|
||||
private UiGrid<ToolButton, ToolBtnData> _toolGrid;
|
||||
private Dictionary<EditorToolEnum, EditorToolBase> _toolMapping = new Dictionary<EditorToolEnum, EditorToolBase>();
|
||||
private UiGrid<ToolButton, EditorToolBase> _toolGrid;
|
||||
//当前预设的所有标记
|
||||
private Dictionary<MarkInfo, MarkTemplate> _currMarkToolsMap = new Dictionary<MarkInfo, MarkTemplate>();
|
||||
private EventFactory _eventFactory;
|
||||
private int _editToolIndex;
|
||||
|
||||
//丢失的物体id
|
||||
private HashSet<string> _missingSet = new HashSet<string>();
|
||||
|
||||
private Color _tempColor1, _tempColor2;
|
||||
|
||||
public override void OnCreateUi()
|
||||
{
|
||||
var mapEditorPanel = (MapEditorPanel)ParentUi;
|
||||
EditorMap = mapEditorPanel.S_TileMap;
|
||||
MapEditorPanel = (MapEditorPanel)ParentUi;
|
||||
EditorMap = MapEditorPanel.S_TileMap.Instance;
|
||||
|
||||
S_N_HoverArea.Instance.Init(this, DoorDirection.N);
|
||||
S_S_HoverArea.Instance.Init(this, DoorDirection.S);
|
||||
|
@ -63,59 +89,87 @@ public partial class MapEditorToolsPanel : MapEditorTools
|
|||
S_ToolRoot.Instance.RemoveChild(S_DoorToolTemplate.Instance);
|
||||
S_MarkTemplate.Instance.Visible = false;
|
||||
|
||||
_toolGrid = new UiGrid<ToolButton, ToolBtnData>(S_ToolButton, typeof(ToolButtonCell));
|
||||
_toolGrid.SetColumns(10);
|
||||
//拖拽按钮
|
||||
_toolGrid.Add(new ToolBtnData(true, ResourcePath.resource_sprite_ui_commonIcon_DragTool_png, () =>
|
||||
{
|
||||
EventManager.EmitEvent(EventEnum.OnSelectDragTool);
|
||||
}));
|
||||
//画笔按钮
|
||||
_toolGrid.Add(new ToolBtnData(true, ResourcePath.resource_sprite_ui_commonIcon_PenTool_png, () =>
|
||||
{
|
||||
EventManager.EmitEvent(EventEnum.OnSelectPenTool);
|
||||
}));
|
||||
//绘制区域按钮
|
||||
_toolGrid.Add(new ToolBtnData(true, ResourcePath.resource_sprite_ui_commonIcon_AreaTool_png, () =>
|
||||
{
|
||||
EventManager.EmitEvent(EventEnum.OnSelectRectTool);
|
||||
}));
|
||||
//编辑工具按钮
|
||||
_toolGrid.Add(new ToolBtnData(true, ResourcePath.resource_sprite_ui_commonIcon_DoorTool_png, () =>
|
||||
{
|
||||
EventManager.EmitEvent(EventEnum.OnSelectEditTool);
|
||||
mapEditorPanel.S_MapEditorMapLayer.Instance.SetLayerVisible(MapLayer.MarkLayer, true);
|
||||
}));
|
||||
_editToolIndex = _toolGrid.Count - 1;
|
||||
//聚焦按钮
|
||||
_toolGrid.Add(new ToolBtnData(false, ResourcePath.resource_sprite_ui_commonIcon_CenterTool_png, () =>
|
||||
{
|
||||
EventManager.EmitEvent(EventEnum.OnClickCenterTool);
|
||||
}));
|
||||
_toolGrid.SelectIndex = 1;
|
||||
S_ObjectTemplate.Instance.Visible = false;
|
||||
|
||||
_eventFactory = EventManager.CreateEventFactory();
|
||||
_eventFactory.AddEventListener(EventEnum.OnSelectWave, OnSelectWaveTool);
|
||||
_eventFactory.AddEventListener(EventEnum.OnCreateMark, OnCreateMarkTool);
|
||||
_eventFactory.AddEventListener(EventEnum.OnSelectMark, OnSelectMarkTool);
|
||||
_eventFactory.AddEventListener(EventEnum.OnDeleteMark, OnDeleteMarkTool);
|
||||
_eventFactory.AddEventListener(EventEnum.OnSetMarkVisible, OnSetMarkVisible);
|
||||
_eventFactory.AddEventListener(EventEnum.OnEditMark, OnEditMarkTool);
|
||||
_eventFactory.AddEventListener(EventEnum.OnSelectPreinstall, RefreshMark);
|
||||
//工具栏
|
||||
AddToolMapping(new EditorMove(EditorMap));
|
||||
AddToolMapping(new EditorTilePen(EditorMap));
|
||||
AddToolMapping(new EditorTileAreaPen(EditorMap));
|
||||
AddToolMapping(new EditorMarkTool(EditorMap));
|
||||
AddToolMapping(new EditorFocus(EditorMap));
|
||||
AddToolMapping(new EditorObjectPen(EditorMap));
|
||||
AddToolMapping(new EditorObjectTool(EditorMap));
|
||||
|
||||
//工具栏网格
|
||||
_toolGrid = new UiGrid<ToolButton, EditorToolBase>(S_ToolButton, typeof(ToolButtonCell));
|
||||
_toolGrid.SetColumns(15);
|
||||
|
||||
CustomNormalRoot = new Node2D();
|
||||
CustomNormalRoot.ZIndex = -1;
|
||||
EditorMap.AddChild(CustomNormalRoot);
|
||||
CustomYSortRoot = new Node2D();
|
||||
EditorMap.AddChild(CustomYSortRoot);
|
||||
|
||||
//标记相关
|
||||
AddEventListener(EventEnum.OnSelectWave, OnSelectWaveTool);
|
||||
AddEventListener(EventEnum.OnCreateMark, OnCreateMarkTool);
|
||||
AddEventListener(EventEnum.OnSelectMark, OnSelectMarkTool);
|
||||
AddEventListener(EventEnum.OnDeleteMark, OnDeleteMarkTool);
|
||||
AddEventListener(EventEnum.OnSetMarkVisible, OnSetMarkVisible);
|
||||
AddEventListener(EventEnum.OnEditMark, OnEditMarkTool);
|
||||
AddEventListener(EventEnum.OnSelectPreinstall, RefreshMark);
|
||||
|
||||
//自定义物体相关
|
||||
AddEventListener(EventEnum.OnPutObject, OnPutObject);
|
||||
AddEventListener(EventEnum.OnRemoveObject, OnRemoveObject);
|
||||
AddEventListener(EventEnum.OnSelectObject, OnSelectObject);
|
||||
|
||||
//保存预览图相关
|
||||
AddEventListener(EventEnum.OnSavePreviewImageBegin, OnSavePreviewImageBegin);
|
||||
AddEventListener(EventEnum.OnSavePreviewImageFinish, OnSavePreviewImageFinish);
|
||||
}
|
||||
|
||||
public override void OnDestroyUi()
|
||||
{
|
||||
_eventFactory.RemoveAllEventListener();
|
||||
_eventFactory = null;
|
||||
S_DoorToolTemplate.Instance.QueueFree();
|
||||
_toolGrid.Destroy();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化面板数据
|
||||
/// </summary>
|
||||
public void InitCustomObjectData()
|
||||
{
|
||||
var objectPanel = MapEditorPanel.S_MapEditorObject.Instance;
|
||||
foreach (var objectInfo in objectPanel.NormalLayerObjects)
|
||||
{
|
||||
OnCreateObject(objectInfo, RoomLayerEnum.NormalLayer);
|
||||
}
|
||||
|
||||
foreach (var objectInfo in objectPanel.YSortLayerObjects)
|
||||
{
|
||||
OnCreateObject(objectInfo, RoomLayerEnum.YSortLayer);
|
||||
}
|
||||
|
||||
if (_missingSet.Count > 0)
|
||||
{
|
||||
var str = "";
|
||||
foreach (var item in _missingSet)
|
||||
{
|
||||
if (str.Length > 0)
|
||||
{
|
||||
str += ",";
|
||||
}
|
||||
str += item;
|
||||
}
|
||||
EditorWindowManager.ShowTips("警告", $"发现存在丢失的自定义物体,id为:{str}");
|
||||
}
|
||||
}
|
||||
|
||||
public override void Process(float delta)
|
||||
{
|
||||
S_HoverPreviewRoot.Instance.Visible = ActiveHoverArea != null && !DoorHoverArea.IsDrag;
|
||||
if (EditorMap.Instance.MouseType == EditorTileMap.MouseButtonType.Edit)
|
||||
if (EditorMap.ActiveToolType == EditorToolEnum.MarkTool)
|
||||
{
|
||||
S_ToolRoot.Instance.Modulate = new Color(1, 1, 1, 1);
|
||||
}
|
||||
|
@ -127,6 +181,134 @@ public partial class MapEditorToolsPanel : MapEditorTools
|
|||
IsOpenPopUps = UiManager.GetUiInstanceCount(UiManager.UiNames.EditorWindow) > 0;
|
||||
}
|
||||
|
||||
private void AddToolMapping(EditorToolBase toolBase)
|
||||
{
|
||||
_toolMapping.Add(toolBase.EditorToolType, toolBase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置当前选择的工具
|
||||
/// </summary>
|
||||
public void SetActiviteTool(EditorToolEnum toolEnum)
|
||||
{
|
||||
if (IsDestroyed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_toolGrid == null)
|
||||
{
|
||||
this.CallDelay(0, () => { _SetActiviteTool(toolEnum); });
|
||||
}
|
||||
else
|
||||
{
|
||||
_SetActiviteTool(toolEnum);
|
||||
}
|
||||
}
|
||||
|
||||
private void _SetActiviteTool(EditorToolEnum toolEnum)
|
||||
{
|
||||
var uiCell = _toolGrid.Find(tool => tool.Data.EditorToolType == toolEnum);
|
||||
if (uiCell != null)
|
||||
{
|
||||
uiCell.Click();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置工具栏按钮
|
||||
/// </summary>
|
||||
public void SetToolButton(params EditorToolEnum[] toolEnum)
|
||||
{
|
||||
if (IsDestroyed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_toolGrid == null)
|
||||
{
|
||||
this.CallDelay(0, () => { _SetToolButton(toolEnum); });
|
||||
}
|
||||
else
|
||||
{
|
||||
_SetToolButton(toolEnum);
|
||||
}
|
||||
}
|
||||
|
||||
public void _SetToolButton(params EditorToolEnum[] toolEnum)
|
||||
{
|
||||
_toolGrid.RemoveAll();
|
||||
foreach (var editorToolEnum in toolEnum)
|
||||
{
|
||||
if (_toolMapping.TryGetValue(editorToolEnum, out var tool))
|
||||
{
|
||||
_toolGrid.Add(tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//放置自定义物体
|
||||
private void OnPutObject(object obj)
|
||||
{
|
||||
var info = (RoomObjectInfo)obj;
|
||||
var layerType = MapEditorPanel.S_MapEditorObject.Instance.GetCurrentObjectLayerEnum();
|
||||
OnCreateObject(info, layerType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除物体
|
||||
/// </summary>
|
||||
private void OnRemoveObject(object obj)
|
||||
{
|
||||
var info = (RoomObjectInfo)obj;
|
||||
if (CustomObjecMapping.TryGetValue(info, out var data))
|
||||
{
|
||||
CustomObjecMapping.Remove(info);
|
||||
data.Node.QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选择物体
|
||||
/// </summary>
|
||||
private void OnSelectObject(object obj)
|
||||
{
|
||||
SetActiviteTool(EditorToolEnum.ObjectTool);
|
||||
}
|
||||
|
||||
//创建自定义物体
|
||||
private void OnCreateObject(RoomObjectInfo info, RoomLayerEnum layerType)
|
||||
{
|
||||
if (ExcelConfig.EditorObject_Map.TryGetValue(info.Id, out var config))
|
||||
{
|
||||
var node = ResourceManager.LoadEditorObject(config);
|
||||
|
||||
var template = S_ObjectTemplate.Clone();
|
||||
template.Instance.Visible = true;
|
||||
template.Instance.Position = new Vector2(info.X, info.Y);
|
||||
template.Instance.Init(info, node);
|
||||
template.Instance.Monitorable = (int)layerType == MapEditorPanel.S_MapEditorObject.Instance.S_LayerOption.Instance.Selected;
|
||||
|
||||
switch (layerType)
|
||||
{
|
||||
case RoomLayerEnum.NormalLayer:
|
||||
CustomNormalRoot.AddChild(template.Instance);
|
||||
CustomObjecMapping.Add(info, new CustonObjectData(info, template, RoomLayerEnum.NormalLayer));
|
||||
break;
|
||||
case RoomLayerEnum.YSortLayer:
|
||||
CustomYSortRoot.AddChild(template.Instance);
|
||||
CustomObjecMapping.Add(info, new CustonObjectData(info, template, RoomLayerEnum.YSortLayer));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"创建CustomObject没有找到物体配置: {info.Id}!");
|
||||
_missingSet.Add(info.Id);
|
||||
}
|
||||
}
|
||||
|
||||
//刷新标记
|
||||
private void RefreshMark(object arg)
|
||||
{
|
||||
|
@ -155,10 +337,7 @@ public partial class MapEditorToolsPanel : MapEditorTools
|
|||
private void OnSelectWaveTool(object arg)
|
||||
{
|
||||
//选中编辑工具
|
||||
if (_toolGrid.SelectIndex != _editToolIndex)
|
||||
{
|
||||
_toolGrid.Click(_editToolIndex);
|
||||
}
|
||||
SetActiviteTool(EditorToolEnum.MarkTool);
|
||||
|
||||
var selectIndex = EditorTileMapManager.SelectWaveIndex;
|
||||
var waveList = EditorTileMapManager.SelectPreinstall.WaveList;
|
||||
|
@ -202,10 +381,7 @@ public partial class MapEditorToolsPanel : MapEditorTools
|
|||
private void OnSelectMarkTool(object arg)
|
||||
{
|
||||
//选中编辑工具
|
||||
if (_toolGrid.SelectIndex != _editToolIndex)
|
||||
{
|
||||
_toolGrid.Click(_editToolIndex);
|
||||
}
|
||||
SetActiviteTool(EditorToolEnum.MarkTool);
|
||||
|
||||
if (arg is MarkInfo markInfo)
|
||||
{
|
||||
|
@ -378,7 +554,7 @@ public partial class MapEditorToolsPanel : MapEditorTools
|
|||
_doorTools.Remove(toolInstance);
|
||||
if (toolInstance.Instance.DoorAreaInfo != null)
|
||||
{
|
||||
EditorMap.Instance.RemoveDoorArea(toolInstance.Instance.DoorAreaInfo);
|
||||
EditorMap.RemoveDoorArea(toolInstance.Instance.DoorAreaInfo);
|
||||
}
|
||||
toolInstance.Instance.QueueFree();
|
||||
//派发修改数据修改事件
|
||||
|
@ -537,4 +713,29 @@ public partial class MapEditorToolsPanel : MapEditorTools
|
|||
_doorTools.Add(doorTool);
|
||||
return doorTool;
|
||||
}
|
||||
|
||||
private void OnSavePreviewImageBegin(object obj)
|
||||
{
|
||||
foreach (var custonObjectData in CustomObjecMapping)
|
||||
{
|
||||
custonObjectData.Value.Node.L_RectBrush.Instance.Visible = false;
|
||||
}
|
||||
|
||||
_tempColor1 = CustomNormalRoot.Modulate;
|
||||
_tempColor2 = CustomYSortRoot.Modulate;
|
||||
|
||||
CustomNormalRoot.Modulate = Colors.White;
|
||||
CustomYSortRoot.Modulate = Colors.White;
|
||||
}
|
||||
|
||||
private void OnSavePreviewImageFinish(object obj)
|
||||
{
|
||||
foreach (var custonObjectData in CustomObjecMapping)
|
||||
{
|
||||
custonObjectData.Value.Node.L_RectBrush.Instance.Visible = true;
|
||||
}
|
||||
|
||||
CustomNormalRoot.Modulate = _tempColor1;
|
||||
CustomYSortRoot.Modulate = _tempColor2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ public partial class MarkAreaTool : Node2D
|
|||
|
||||
var flag = false;
|
||||
//必须要选中
|
||||
if (_toolRoot.UiPanel.EditorMap.Instance.MouseType == EditorTileMap.MouseButtonType.Edit)
|
||||
if (_toolRoot.UiPanel.EditorMap.ActiveToolType == EditorToolEnum.MarkTool)
|
||||
{
|
||||
var mousePosition = GetLocalMousePosition();
|
||||
//判断鼠标是否在点上
|
||||
|
|
|
@ -71,7 +71,7 @@ public partial class MarkTool : TextureRect, IUiNodeScript
|
|||
var activeMark = _toolNode.UiPanel.ActiveMark;
|
||||
if ((activeMark == null || (!activeMark.IsDrag && !activeMark.MarkAreaTool.IsDrag)) &&
|
||||
!MarkAreaTool.IsDrag && Input.IsMouseButtonPressed(MouseButton.Left) &&
|
||||
_toolNode.UiPanel.EditorMap.Instance.MouseType == EditorTileMap.MouseButtonType.Edit)
|
||||
_toolNode.UiPanel.EditorMap.ActiveToolType == EditorToolEnum.MarkTool)
|
||||
{
|
||||
_isDown = true;
|
||||
if (_toolNode.UiPanel.ActiveMark != this)
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
namespace UI.MapEditorTools;
|
||||
|
||||
public class ToolButtonCell : UiCell<MapEditorTools.ToolButton, MapEditorToolsPanel.ToolBtnData>
|
||||
public class ToolButtonCell : UiCell<MapEditorTools.ToolButton, EditorToolBase>
|
||||
{
|
||||
public override void OnInit()
|
||||
{
|
||||
CellNode.L_Select.Instance.Visible = false;
|
||||
}
|
||||
|
||||
public override void OnSetData(MapEditorToolsPanel.ToolBtnData data)
|
||||
public override void OnSetData(EditorToolBase data)
|
||||
{
|
||||
CellNode.Instance.TextureNormal = ResourceManager.LoadTexture2D(data.Icon);
|
||||
CellNode.Instance.TooltipText = data.TipText;
|
||||
}
|
||||
|
||||
public override void Process(float delta)
|
||||
{
|
||||
if (Grid.SelectIndex == Index)
|
||||
{
|
||||
Data.Process(delta);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanSelect()
|
||||
|
@ -20,11 +29,17 @@ public class ToolButtonCell : UiCell<MapEditorTools.ToolButton, MapEditorToolsPa
|
|||
public override void OnSelect()
|
||||
{
|
||||
CellNode.L_Select.Instance.Visible = true;
|
||||
Data.EditorTileMap.MapInputEvent += Data.OnMapInputEvent;
|
||||
Data.EditorTileMap.MapDrawToolEvent += Data.OnMapDrawTool;
|
||||
Data.OnSetSelected(true);
|
||||
}
|
||||
|
||||
public override void OnUnSelect()
|
||||
{
|
||||
CellNode.L_Select.Instance.Visible = false;
|
||||
Data.EditorTileMap.MapInputEvent -= Data.OnMapInputEvent;
|
||||
Data.EditorTileMap.MapDrawToolEvent -= Data.OnMapDrawTool;
|
||||
Data.OnSetSelected(false);
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
|
|
Loading…
Reference in New Issue
Block a user