修复在编辑器中 DungeonRoomTemplate 绘制层级的bug
This commit is contained in:
parent
b808d93bb9
commit
38b5d31134
|
@ -117,7 +117,7 @@ public partial class YourActivity : ActivityObject
|
|||
[RegisterActivity(ActivityIdPrefix.Enemy + "0001", ResourcePath.prefab_role_Enemy_tscn)]
|
||||
```
|
||||
|
||||
#### 实例化`ActivityObject`
|
||||
##### 实例化`ActivityObject`
|
||||
可通过`ActivityObject.Create(id)`创建物体, 这个`id`可以结合`ActivityIdPrefix`, 那么创建敌人最终可以这样写
|
||||
```csharp
|
||||
var enemy = ActivityObject.Create<Enemy>(ActivityIdPrefix.Enemy + "0001");
|
||||
|
@ -138,6 +138,6 @@ public virtual void CustomHandler(ActivityObject instance)
|
|||
例子: 注册武器, [RegisterWeapon.cs](../DungeonShooting_Godot/src/game/item/weapon/RegisterWeapon.cs)
|
||||
由于创建武器必须指定武器属性数据, 那么原来的`[RegisterActivity()]`就不适用了, `RegisterWeapon`重写了构造函数, 改变了初始化参数, 并且重写`CustomHandler()`, 对`ActivityInstance`进行初始化属性操作
|
||||
|
||||
|
||||
### 3.2.5.`ActivityObject`常用功能
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DocumentationFile></DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="src\game\ui\editorTools" />
|
||||
|
|
|
@ -14,5 +14,9 @@
|
|||
{
|
||||
"ScenePath": "res://resource/map/tileMaps/Room4.tscn",
|
||||
"ConfigPath": "res://resource/map/tiledata/Room4.json"
|
||||
},
|
||||
{
|
||||
"ScenePath": "res://resource/map/tileMaps/Room5.tscn",
|
||||
"ConfigPath": "res://resource/map/tiledata/Room5.json"
|
||||
}
|
||||
]
|
File diff suppressed because one or more lines are too long
11
DungeonShooting_Godot/resource/map/tileMaps/Room5.tscn
Normal file
11
DungeonShooting_Godot/resource/map/tileMaps/Room5.tscn
Normal file
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://ctbfg0p66xirw"]
|
||||
|
||||
[ext_resource type="TileSet" uid="uid://b00g22o1cqhe8" path="res://resource/map/tileset/TileSet1.tres" id="1_mx0vc"]
|
||||
[ext_resource type="Script" path="res://src/framework/map/DungeonRoomTemplate.cs" id="dungeonRoomTemplate"]
|
||||
|
||||
[node name="Room5" type="TileMap"]
|
||||
tile_set = ExtResource("1_mx0vc")
|
||||
format = 2
|
||||
layer_0/tile_data = PackedInt32Array(0, 0, 8, 1, 0, 8, 65537, 0, 8, 65536, 0, 8, 131071, 0, 8, -65535, 0, 8, 131073, 0, 8, 131072, 0, 8, 196607, 0, 8, -65534, 0, 8, 65538, 0, 8, 2, 0, 8, 65539, 0, 8, 3, 0, 8, -65533, 0, 8, 4, 0, 8, 65540, 0, 8, -65532, 0, 8, 131076, 0, 8, 196609, 0, 8, 196608, 0, 8, 262143, 0, 8, 196612, 0, 8, 262148, 0, 8, 262147, 0, 8, 262146, 0, 8, 262145, 0, 8, 262144, 0, 8, 327679, 0, 8, 65541, 0, 8, 131077, 0, 8, 5, 0, 8, 65542, 0, 8, 131078, 0, 8, 65543, 0, 8, 131079, 0, 8, 7, 131072, 7, 196613, 0, 8, 262149, 0, 8, 327685, 0, 8, 327684, 0, 8, 327683, 0, 8, 262150, 0, 8, 196614, 0, 8, 262151, 0, 8, 196615, 0, 8, 327682, 0, 8, 327681, 0, 8, 327680, 0, 8, 131074, 65536, 2, 196610, 65536, 7, 196611, 196608, 7, 131075, 196608, 2, 196606, 0, 8, 131070, 0, 8, 65534, 131072, 7, 262142, 0, 8, 393218, 0, 8, 393217, 0, 8, 393219, 0, 8, 393220, 0, 8, 393222, 851968, 2, 327678, 0, 8, 393214, 131072, 2, 196605, 196608, 3, 131069, 196608, 3, 65533, 196608, 4, 262141, 196608, 3, 327677, 196608, 3, 393213, 720896, 2, -131071, 0, 8, -131070, 0, 8, -131069, 0, 8, -131068, 0, 8, 65544, 65536, 3, 131080, 65536, 3, 8, 65536, 4, 196616, 65536, 3, 262152, 65536, 3, 327688, 851968, 2, 458756, 0, 8, 458755, 0, 8, 458754, 0, 8, 458753, 0, 8, -196607, 131072, 7, -196606, 131072, 7, -196605, 131072, 7, -196604, 131072, 7, -196603, 65536, 4, 524289, 131072, 2, 524290, 131072, 2, 524291, 131072, 2, 524292, 131072, 2, 524293, 851968, 2, 65535, 196608, 7, -1, 196608, 4, -65536, 196608, 7, -131072, 196608, 3, -196608, 196608, 4, -131067, 65536, 3, -65531, 65536, 7, 6, 65536, 7, -65530, 65536, 4, 393221, 65536, 2, 458757, 65536, 3, 393216, 196608, 2, 458751, 720896, 2, 393215, 196608, 2, 524288, 720896, 2, 458752, 196608, 3, 327686, 65536, 2, 327687, 131072, 2)
|
||||
script = ExtResource("dungeonRoomTemplate")
|
||||
EnableEdit = true
|
|
@ -25,7 +25,7 @@
|
|||
},
|
||||
{
|
||||
"Direction": 0,
|
||||
"Start": 80,
|
||||
"Start": 96,
|
||||
"End": 288
|
||||
},
|
||||
{
|
||||
|
|
140
DungeonShooting_Godot/resource/map/tiledata/Room5.json
Normal file
140
DungeonShooting_Godot/resource/map/tiledata/Room5.json
Normal file
|
@ -0,0 +1,140 @@
|
|||
{
|
||||
"Position": {
|
||||
"X": -3,
|
||||
"Y": -3
|
||||
},
|
||||
"Size": {
|
||||
"X": 12,
|
||||
"Y": 12
|
||||
},
|
||||
"DoorAreaInfos": [
|
||||
{
|
||||
"Direction": 3,
|
||||
"Start": 64,
|
||||
"End": 128
|
||||
},
|
||||
{
|
||||
"Direction": 0,
|
||||
"Start": 64,
|
||||
"End": 128
|
||||
},
|
||||
{
|
||||
"Direction": 2,
|
||||
"Start": 64,
|
||||
"End": 128
|
||||
},
|
||||
{
|
||||
"Direction": 1,
|
||||
"Start": 64,
|
||||
"End": 128
|
||||
}
|
||||
],
|
||||
"NavigationList": [
|
||||
{
|
||||
"Type": 0,
|
||||
"Points": [
|
||||
{
|
||||
"X": 24,
|
||||
"Y": -24
|
||||
},
|
||||
{
|
||||
"X": 72,
|
||||
"Y": -24
|
||||
},
|
||||
{
|
||||
"X": 72,
|
||||
"Y": 8
|
||||
},
|
||||
{
|
||||
"X": 88,
|
||||
"Y": 8
|
||||
},
|
||||
{
|
||||
"X": 88,
|
||||
"Y": 24
|
||||
},
|
||||
{
|
||||
"X": 120,
|
||||
"Y": 24
|
||||
},
|
||||
{
|
||||
"X": 120,
|
||||
"Y": 72
|
||||
},
|
||||
{
|
||||
"X": 88,
|
||||
"Y": 72
|
||||
},
|
||||
{
|
||||
"X": 88,
|
||||
"Y": 88
|
||||
},
|
||||
{
|
||||
"X": 72,
|
||||
"Y": 88
|
||||
},
|
||||
{
|
||||
"X": 72,
|
||||
"Y": 120
|
||||
},
|
||||
{
|
||||
"X": 24,
|
||||
"Y": 120
|
||||
},
|
||||
{
|
||||
"X": 24,
|
||||
"Y": 88
|
||||
},
|
||||
{
|
||||
"X": 8,
|
||||
"Y": 88
|
||||
},
|
||||
{
|
||||
"X": 8,
|
||||
"Y": 72
|
||||
},
|
||||
{
|
||||
"X": -24,
|
||||
"Y": 72
|
||||
},
|
||||
{
|
||||
"X": -24,
|
||||
"Y": 24
|
||||
},
|
||||
{
|
||||
"X": 8,
|
||||
"Y": 24
|
||||
},
|
||||
{
|
||||
"X": 8,
|
||||
"Y": 8
|
||||
},
|
||||
{
|
||||
"X": 24,
|
||||
"Y": 8
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Type": 1,
|
||||
"Points": [
|
||||
{
|
||||
"X": 24,
|
||||
"Y": 24
|
||||
},
|
||||
{
|
||||
"X": 72,
|
||||
"Y": 24
|
||||
},
|
||||
{
|
||||
"X": 72,
|
||||
"Y": 72
|
||||
},
|
||||
{
|
||||
"X": 24,
|
||||
"Y": 72
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -352,7 +352,7 @@ bg_color = Color(0.260588, 0.156863, 0.724706, 0.8)
|
|||
|
||||
[sub_resource type="ImageTexture" id="58"]
|
||||
|
||||
[sub_resource type="Image" id="Image_syism"]
|
||||
[sub_resource type="Image" id="Image_i7t0l"]
|
||||
data = {
|
||||
"data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 1, 255, 255, 255, 39, 255, 255, 255, 67, 255, 255, 255, 67, 255, 255, 255, 39, 255, 255, 255, 1, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 39, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 39, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 66, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 66, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 66, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 66, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 39, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 39, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 1, 255, 255, 255, 39, 255, 255, 255, 67, 255, 255, 255, 67, 255, 255, 255, 39, 255, 255, 255, 1, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
"format": "RGBA8",
|
||||
|
@ -362,7 +362,7 @@ data = {
|
|||
}
|
||||
|
||||
[sub_resource type="ImageTexture" id="60"]
|
||||
image = SubResource("Image_syism")
|
||||
image = SubResource("Image_i7t0l")
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="61"]
|
||||
content_margin_left = 2.0
|
||||
|
@ -372,7 +372,7 @@ content_margin_bottom = 2.0
|
|||
texture = SubResource("60")
|
||||
region_rect = Rect2(0, 0, 12, 12)
|
||||
|
||||
[sub_resource type="Image" id="Image_opr8o"]
|
||||
[sub_resource type="Image" id="Image_pnn4e"]
|
||||
data = {
|
||||
"data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 247, 247, 247, 0, 248, 248, 248, 0, 248, 248, 248, 0, 247, 247, 247, 0, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 191, 191, 191, 4, 247, 247, 247, 98, 248, 248, 248, 167, 248, 248, 248, 167, 247, 247, 247, 98, 191, 191, 191, 4, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, 247, 247, 0, 247, 247, 247, 97, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 247, 247, 247, 97, 247, 247, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 248, 248, 0, 248, 248, 248, 164, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 164, 248, 248, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 248, 248, 0, 248, 248, 248, 164, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 164, 248, 248, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, 247, 247, 0, 247, 247, 247, 97, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 247, 247, 247, 97, 247, 247, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 191, 191, 191, 4, 247, 247, 247, 98, 248, 248, 248, 167, 248, 248, 248, 167, 247, 247, 247, 98, 191, 191, 191, 4, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 247, 247, 247, 0, 248, 248, 248, 0, 248, 248, 248, 0, 247, 247, 247, 0, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
"format": "RGBA8",
|
||||
|
@ -382,7 +382,7 @@ data = {
|
|||
}
|
||||
|
||||
[sub_resource type="ImageTexture" id="63"]
|
||||
image = SubResource("Image_opr8o")
|
||||
image = SubResource("Image_pnn4e")
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="64"]
|
||||
content_margin_left = 2.0
|
||||
|
@ -392,7 +392,7 @@ content_margin_bottom = 2.0
|
|||
texture = SubResource("63")
|
||||
region_rect = Rect2(0, 0, 12, 12)
|
||||
|
||||
[sub_resource type="Image" id="Image_kcn7n"]
|
||||
[sub_resource type="Image" id="Image_1qsai"]
|
||||
data = {
|
||||
"data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 127, 127, 127, 4, 173, 173, 173, 97, 173, 173, 173, 166, 173, 173, 173, 166, 173, 173, 173, 97, 127, 127, 127, 4, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 172, 172, 0, 172, 172, 172, 96, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 172, 172, 172, 96, 172, 172, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 173, 173, 173, 0, 173, 173, 173, 163, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 163, 173, 173, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 173, 173, 173, 0, 173, 173, 173, 163, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 163, 173, 173, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 172, 172, 0, 172, 172, 172, 96, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 172, 172, 172, 96, 172, 172, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 127, 127, 127, 4, 173, 173, 173, 97, 173, 173, 173, 166, 173, 173, 173, 166, 173, 173, 173, 97, 127, 127, 127, 4, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
"format": "RGBA8",
|
||||
|
@ -402,7 +402,7 @@ data = {
|
|||
}
|
||||
|
||||
[sub_resource type="ImageTexture" id="66"]
|
||||
image = SubResource("Image_kcn7n")
|
||||
image = SubResource("Image_1qsai")
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="67"]
|
||||
content_margin_left = 2.0
|
||||
|
@ -412,7 +412,7 @@ content_margin_bottom = 2.0
|
|||
texture = SubResource("66")
|
||||
region_rect = Rect2(0, 0, 12, 12)
|
||||
|
||||
[sub_resource type="Image" id="Image_agsbk"]
|
||||
[sub_resource type="Image" id="Image_hrr01"]
|
||||
data = {
|
||||
"data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 4, 255, 255, 255, 16, 255, 255, 255, 16, 255, 255, 255, 4, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 16, 255, 255, 255, 21, 255, 255, 255, 21, 255, 255, 255, 16, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 16, 255, 255, 255, 21, 255, 255, 255, 21, 255, 255, 255, 16, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 4, 255, 255, 255, 16, 255, 255, 255, 16, 255, 255, 255, 4, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
"format": "RGBA8",
|
||||
|
@ -422,7 +422,7 @@ data = {
|
|||
}
|
||||
|
||||
[sub_resource type="ImageTexture" id="69"]
|
||||
image = SubResource("Image_agsbk")
|
||||
image = SubResource("Image_hrr01")
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="70"]
|
||||
content_margin_left = 0.0
|
||||
|
@ -446,7 +446,7 @@ content_margin_top = 4.0
|
|||
content_margin_right = 4.0
|
||||
content_margin_bottom = 4.0
|
||||
|
||||
[sub_resource type="Image" id="Image_4781k"]
|
||||
[sub_resource type="Image" id="Image_ooxyq"]
|
||||
data = {
|
||||
"data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 228, 255, 255, 255, 188, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 228, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 18, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 187, 255, 255, 255, 17, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 187, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 18, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 17, 255, 255, 255, 17, 255, 255, 255, 186, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 190, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 185, 255, 255, 255, 229, 255, 255, 255, 189, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 191, 255, 255, 255, 229, 255, 255, 255, 229, 255, 255, 255, 190, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 187, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 187, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 18, 255, 255, 255, 19, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 186, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 185, 255, 255, 255, 229, 255, 255, 255, 189, 255, 255, 255, 19, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 189, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 229, 255, 255, 255, 190, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 190, 255, 255, 255, 229, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 77, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 77, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
"format": "RGBA8",
|
||||
|
@ -456,7 +456,7 @@ data = {
|
|||
}
|
||||
|
||||
[sub_resource type="ImageTexture" id="56"]
|
||||
image = SubResource("Image_4781k")
|
||||
image = SubResource("Image_ooxyq")
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="57"]
|
||||
content_margin_left = 6.0
|
||||
|
|
|
@ -35,10 +35,8 @@ material = SubResource("2")
|
|||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 580.0
|
||||
offset_top = 4.0
|
||||
offset_right = -860.0
|
||||
offset_bottom = -806.0
|
||||
offset_right = -1440.0
|
||||
offset_bottom = -810.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
scale = Vector2(4, 4)
|
||||
|
|
|
@ -110,7 +110,7 @@ public static class Utils
|
|||
/// <summary>
|
||||
/// 使用定的 canvasItem 绘制导航区域, 注意, 该函数只能在 draw 函数中调用
|
||||
/// </summary>
|
||||
public static void DrawNavigationPolygon(CanvasItem canvasItem, NavigationPolygonData[] polygonData)
|
||||
public static void DrawNavigationPolygon(CanvasItem canvasItem, NavigationPolygonData[] polygonData, int width = 1)
|
||||
{
|
||||
for (var i = 0; i < polygonData.Length; i++)
|
||||
{
|
||||
|
@ -121,11 +121,11 @@ public static class Utils
|
|||
array.Add(array[0]);
|
||||
if (item.Type == NavigationPolygonType.In)
|
||||
{
|
||||
canvasItem.DrawPolyline(array.ToArray(), Colors.Yellow);
|
||||
canvasItem.DrawPolyline(array.ToArray(), Colors.Yellow, width);
|
||||
}
|
||||
else
|
||||
{
|
||||
canvasItem.DrawPolyline(array.ToArray(), Colors.Red);
|
||||
canvasItem.DrawPolyline(array.ToArray(), Colors.Red, width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,7 @@ public partial class DungeonRoomTemplate : TileMap
|
|||
//选中左/右点
|
||||
private byte _activePointType = 0;
|
||||
private DoorAreaInfo _activeArea = null;
|
||||
|
||||
|
||||
|
||||
//拖拽
|
||||
private bool _isDrag = false;
|
||||
private float _startDragValue;
|
||||
|
@ -49,10 +48,175 @@ public partial class DungeonRoomTemplate : TileMap
|
|||
private bool _clickSave = false;
|
||||
|
||||
private DungeonTile _dungeonTile;
|
||||
private TileDrawHandler _tileDrawHandler;
|
||||
|
||||
//计算导航的计时器
|
||||
private float _calcTileNavTimer = 0;
|
||||
|
||||
private partial class TileDrawHandler : Node2D
|
||||
{
|
||||
public DungeonRoomTemplate RoomTemplate;
|
||||
|
||||
public override void _Draw()
|
||||
{
|
||||
if (!Engine.IsEditorHint() || RoomTemplate == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (RoomTemplate.TileSet != null)
|
||||
{
|
||||
//绘制地图轮廓
|
||||
var mapRange = CalcTileRange(RoomTemplate);
|
||||
mapRange.Position -= new Vector2(2, 2);
|
||||
mapRange.Size += new Vector2(4, 4);
|
||||
DrawRect(mapRange, RoomTemplate._hover ? Colors.Green : new Color(0.03137255F, 0.59607846F, 0.03137255F), false, 2);
|
||||
|
||||
//绘制悬停
|
||||
if (RoomTemplate._hover && !RoomTemplate._isDrag)
|
||||
{
|
||||
if (!RoomTemplate._hasActivePoint) //这里判断是否悬停在拖动点上
|
||||
{
|
||||
var color = RoomTemplate._canPut ? new Color(0, 1, 0, 0.2f) : new Color(1, 0, 0, 0.2f);
|
||||
switch (RoomTemplate._hoverDirection)
|
||||
{
|
||||
case DoorDirection.E:
|
||||
DrawRect(
|
||||
new Rect2(new Vector2(RoomTemplate._hoverPoint1.X + 2, RoomTemplate._hoverPoint1.Y), 30,
|
||||
RoomTemplate._hoverPoint2.Y - RoomTemplate._hoverPoint1.Y), color);
|
||||
DrawCircle(new Vector2(RoomTemplate._hoverPoint1.X + 2, RoomTemplate._hoverPoint1.Y), 5, color);
|
||||
DrawCircle(new Vector2(RoomTemplate._hoverPoint2.X + 2, RoomTemplate._hoverPoint2.Y), 5, color);
|
||||
break;
|
||||
case DoorDirection.W:
|
||||
DrawRect(
|
||||
new Rect2(new Vector2(RoomTemplate._hoverPoint1.X - 2 - 30, RoomTemplate._hoverPoint1.Y), 30,
|
||||
RoomTemplate._hoverPoint2.Y - RoomTemplate._hoverPoint1.Y), color);
|
||||
DrawCircle(new Vector2(RoomTemplate._hoverPoint1.X - 2, RoomTemplate._hoverPoint1.Y), 5, color);
|
||||
DrawCircle(new Vector2(RoomTemplate._hoverPoint2.X - 2, RoomTemplate._hoverPoint2.Y), 5, color);
|
||||
break;
|
||||
case DoorDirection.S:
|
||||
DrawRect(
|
||||
new Rect2(new Vector2(RoomTemplate._hoverPoint1.X, RoomTemplate._hoverPoint1.Y + 2),
|
||||
RoomTemplate._hoverPoint2.X - RoomTemplate._hoverPoint1.X, 30), color);
|
||||
DrawCircle(new Vector2(RoomTemplate._hoverPoint1.X, RoomTemplate._hoverPoint1.Y + 2), 5, color);
|
||||
DrawCircle(new Vector2(RoomTemplate._hoverPoint2.X, RoomTemplate._hoverPoint2.Y + 2), 5, color);
|
||||
break;
|
||||
case DoorDirection.N:
|
||||
DrawRect(
|
||||
new Rect2(new Vector2(RoomTemplate._hoverPoint1.X, RoomTemplate._hoverPoint1.Y - 30 - 2),
|
||||
RoomTemplate._hoverPoint2.X - RoomTemplate._hoverPoint1.X, 30), color);
|
||||
DrawCircle(new Vector2(RoomTemplate._hoverPoint1.X, RoomTemplate._hoverPoint1.Y - 2), 5, color);
|
||||
DrawCircle(new Vector2(RoomTemplate._hoverPoint2.X, RoomTemplate._hoverPoint2.Y - 2), 5, color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//绘制区域
|
||||
if (RoomTemplate._doorConfigs != null)
|
||||
{
|
||||
var color2 = new Color(0, 1, 0, 0.8f);
|
||||
//绘制已经存在的
|
||||
foreach (var doorAreaInfo in RoomTemplate._doorConfigs)
|
||||
{
|
||||
var flag = RoomTemplate._hasActivePoint && RoomTemplate._activeArea == doorAreaInfo;
|
||||
var color3 = (flag && RoomTemplate._activePointType == 0)
|
||||
? (RoomTemplate._isDrag
|
||||
? (RoomTemplate._dragHasCollision
|
||||
? new Color(1, 0, 0, 0.8f)
|
||||
: new Color(0.2F, 0.4117647F, 0.8392157F, 0.8f))
|
||||
: new Color(1, 1, 1, 0.8f))
|
||||
: color2;
|
||||
var color4 = (flag && RoomTemplate._activePointType == 1)
|
||||
? (RoomTemplate._isDrag
|
||||
? (RoomTemplate._dragHasCollision
|
||||
? new Color(1, 0, 0, 0.8f)
|
||||
: new Color(0.2F, 0.4117647F, 0.8392157F, 0.8f))
|
||||
: new Color(1, 1, 1, 0.8f))
|
||||
: color2;
|
||||
switch (doorAreaInfo.Direction)
|
||||
{
|
||||
case DoorDirection.E:
|
||||
DrawRect(
|
||||
new Rect2(
|
||||
new Vector2(mapRange.Position.X + mapRange.Size.X,
|
||||
mapRange.Position.Y + doorAreaInfo.Start + 2), 30,
|
||||
doorAreaInfo.End - doorAreaInfo.Start), color2);
|
||||
DrawCircle(
|
||||
new Vector2(mapRange.Position.X + mapRange.Size.X,
|
||||
mapRange.Position.Y + doorAreaInfo.Start + 2), 5, color3);
|
||||
DrawCircle(
|
||||
new Vector2(mapRange.Position.X + mapRange.Size.X,
|
||||
mapRange.Position.Y + doorAreaInfo.End + 2),
|
||||
5, color4);
|
||||
break;
|
||||
case DoorDirection.W:
|
||||
DrawRect(
|
||||
new Rect2(
|
||||
new Vector2(mapRange.Position.X - 30, mapRange.Position.Y + doorAreaInfo.Start + 2),
|
||||
30, doorAreaInfo.End - doorAreaInfo.Start), color2);
|
||||
DrawCircle(new Vector2(mapRange.Position.X, mapRange.Position.Y + doorAreaInfo.Start + 2),
|
||||
5,
|
||||
color3);
|
||||
DrawCircle(new Vector2(mapRange.Position.X, mapRange.Position.Y + doorAreaInfo.End + 2), 5,
|
||||
color4);
|
||||
break;
|
||||
case DoorDirection.S:
|
||||
DrawRect(
|
||||
new Rect2(
|
||||
new Vector2(mapRange.Position.X + doorAreaInfo.Start + 2,
|
||||
mapRange.Position.Y + mapRange.Size.Y), doorAreaInfo.End - doorAreaInfo.Start,
|
||||
30),
|
||||
color2);
|
||||
DrawCircle(
|
||||
new Vector2(mapRange.Position.X + doorAreaInfo.Start + 2,
|
||||
mapRange.Position.Y + mapRange.Size.Y), 5, color3);
|
||||
DrawCircle(
|
||||
new Vector2(mapRange.Position.X + doorAreaInfo.End + 2,
|
||||
mapRange.Position.Y + mapRange.Size.Y),
|
||||
5, color4);
|
||||
break;
|
||||
case DoorDirection.N:
|
||||
DrawRect(
|
||||
new Rect2(
|
||||
new Vector2(mapRange.Position.X + doorAreaInfo.Start + 2, mapRange.Position.Y - 30),
|
||||
doorAreaInfo.End - doorAreaInfo.Start, 30), color2);
|
||||
DrawCircle(new Vector2(mapRange.Position.X + doorAreaInfo.Start + 2, mapRange.Position.Y),
|
||||
5,
|
||||
color3);
|
||||
DrawCircle(new Vector2(mapRange.Position.X + doorAreaInfo.End + 2, mapRange.Position.Y), 5,
|
||||
color4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//绘制导航, 现在有点问题, 绘制的内容会被自身的 tile 所挡住
|
||||
if (RoomTemplate._dungeonTile != null)
|
||||
{
|
||||
var result = RoomTemplate._dungeonTile.GetGenerateNavigationResult();
|
||||
if (result != null)
|
||||
{
|
||||
if (result.Success)
|
||||
{
|
||||
var polygonData = RoomTemplate._dungeonTile.GetPolygonData();
|
||||
Utils.DrawNavigationPolygon(this, polygonData, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
var color = new Color(1, 0, 0, 0.5f);
|
||||
var tileCellSize = GameConfig.TileCellSize;
|
||||
var point = (result.Exception.Point + new Vector2(0.5f, 0.5f)) * tileCellSize;
|
||||
DrawCircle(point, 4, color);
|
||||
DrawLine(point + new Vector2(-tileCellSize / 2f, -tileCellSize / 2f), point + new Vector2(tileCellSize / 2f, tileCellSize / 2f), color, 2);
|
||||
DrawLine(point + new Vector2(-tileCellSize / 2f, tileCellSize / 2f), point + new Vector2(tileCellSize / 2f, -tileCellSize / 2f), color, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
if (!Engine.IsEditorHint())
|
||||
|
@ -85,6 +249,23 @@ public partial class DungeonRoomTemplate : TileMap
|
|||
Connect("changed", callable);
|
||||
}
|
||||
}
|
||||
|
||||
if (_tileDrawHandler == null)
|
||||
{
|
||||
_tileDrawHandler = GetNodeOrNull<TileDrawHandler>("TileDrawHandler");
|
||||
if (_tileDrawHandler == null)
|
||||
{
|
||||
_tileDrawHandler = new TileDrawHandler();
|
||||
_tileDrawHandler.RoomTemplate = this;
|
||||
_tileDrawHandler.Name = "TileDrawHandler";
|
||||
_tileDrawHandler.ZIndex = 100;
|
||||
AddChild(_tileDrawHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
_tileDrawHandler.RoomTemplate = this;
|
||||
}
|
||||
}
|
||||
|
||||
//导航计算
|
||||
if (_calcTileNavTimer > 0)
|
||||
|
@ -362,7 +543,7 @@ public partial class DungeonRoomTemplate : TileMap
|
|||
ClearState();
|
||||
}
|
||||
|
||||
QueueRedraw();
|
||||
_tileDrawHandler.QueueRedraw();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -384,160 +565,7 @@ public partial class DungeonRoomTemplate : TileMap
|
|||
_clickSave = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Draw()
|
||||
{
|
||||
if (!Engine.IsEditorHint())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (TileSet != null)
|
||||
{
|
||||
//绘制地图轮廓
|
||||
var mapRange = CalcTileRange(this);
|
||||
mapRange.Position -= new Vector2(2, 2);
|
||||
mapRange.Size += new Vector2(4, 4);
|
||||
DrawRect(mapRange, _hover ? Colors.Green : new Color(0.03137255F, 0.59607846F, 0.03137255F), false, 2);
|
||||
|
||||
//绘制悬停
|
||||
if (_hover && !_isDrag)
|
||||
{
|
||||
if (!_hasActivePoint) //这里判断是否悬停在拖动点上
|
||||
{
|
||||
var color = _canPut ? new Color(0, 1, 0, 0.2f) : new Color(1, 0, 0, 0.2f);
|
||||
switch (_hoverDirection)
|
||||
{
|
||||
case DoorDirection.E:
|
||||
DrawRect(
|
||||
new Rect2(new Vector2(_hoverPoint1.X + 2, _hoverPoint1.Y), 30,
|
||||
_hoverPoint2.Y - _hoverPoint1.Y), color);
|
||||
DrawCircle(new Vector2(_hoverPoint1.X + 2, _hoverPoint1.Y), 5, color);
|
||||
DrawCircle(new Vector2(_hoverPoint2.X + 2, _hoverPoint2.Y), 5, color);
|
||||
break;
|
||||
case DoorDirection.W:
|
||||
DrawRect(
|
||||
new Rect2(new Vector2(_hoverPoint1.X - 2 - 30, _hoverPoint1.Y), 30,
|
||||
_hoverPoint2.Y - _hoverPoint1.Y), color);
|
||||
DrawCircle(new Vector2(_hoverPoint1.X - 2, _hoverPoint1.Y), 5, color);
|
||||
DrawCircle(new Vector2(_hoverPoint2.X - 2, _hoverPoint2.Y), 5, color);
|
||||
break;
|
||||
case DoorDirection.S:
|
||||
DrawRect(
|
||||
new Rect2(new Vector2(_hoverPoint1.X, _hoverPoint1.Y + 2),
|
||||
_hoverPoint2.X - _hoverPoint1.X, 30), color);
|
||||
DrawCircle(new Vector2(_hoverPoint1.X, _hoverPoint1.Y + 2), 5, color);
|
||||
DrawCircle(new Vector2(_hoverPoint2.X, _hoverPoint2.Y + 2), 5, color);
|
||||
break;
|
||||
case DoorDirection.N:
|
||||
DrawRect(
|
||||
new Rect2(new Vector2(_hoverPoint1.X, _hoverPoint1.Y - 30 - 2),
|
||||
_hoverPoint2.X - _hoverPoint1.X, 30), color);
|
||||
DrawCircle(new Vector2(_hoverPoint1.X, _hoverPoint1.Y - 2), 5, color);
|
||||
DrawCircle(new Vector2(_hoverPoint2.X, _hoverPoint2.Y - 2), 5, color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//绘制区域
|
||||
if (_doorConfigs != null)
|
||||
{
|
||||
var color2 = new Color(0, 1, 0, 0.8f);
|
||||
//绘制已经存在的
|
||||
foreach (var doorAreaInfo in _doorConfigs)
|
||||
{
|
||||
var flag = _hasActivePoint && _activeArea == doorAreaInfo;
|
||||
var color3 = (flag && _activePointType == 0)
|
||||
? (_isDrag
|
||||
? (_dragHasCollision
|
||||
? new Color(1, 0, 0, 0.8f)
|
||||
: new Color(0.2F, 0.4117647F, 0.8392157F, 0.8f))
|
||||
: new Color(1, 1, 1, 0.8f))
|
||||
: color2;
|
||||
var color4 = (flag && _activePointType == 1)
|
||||
? (_isDrag
|
||||
? (_dragHasCollision
|
||||
? new Color(1, 0, 0, 0.8f)
|
||||
: new Color(0.2F, 0.4117647F, 0.8392157F, 0.8f))
|
||||
: new Color(1, 1, 1, 0.8f))
|
||||
: color2;
|
||||
switch (doorAreaInfo.Direction)
|
||||
{
|
||||
case DoorDirection.E:
|
||||
DrawRect(
|
||||
new Rect2(
|
||||
new Vector2(mapRange.Position.X + mapRange.Size.X,
|
||||
mapRange.Position.Y + doorAreaInfo.Start + 2), 30,
|
||||
doorAreaInfo.End - doorAreaInfo.Start), color2);
|
||||
DrawCircle(
|
||||
new Vector2(mapRange.Position.X + mapRange.Size.X,
|
||||
mapRange.Position.Y + doorAreaInfo.Start + 2), 5, color3);
|
||||
DrawCircle(
|
||||
new Vector2(mapRange.Position.X + mapRange.Size.X,
|
||||
mapRange.Position.Y + doorAreaInfo.End + 2),
|
||||
5, color4);
|
||||
break;
|
||||
case DoorDirection.W:
|
||||
DrawRect(
|
||||
new Rect2(
|
||||
new Vector2(mapRange.Position.X - 30, mapRange.Position.Y + doorAreaInfo.Start + 2),
|
||||
30, doorAreaInfo.End - doorAreaInfo.Start), color2);
|
||||
DrawCircle(new Vector2(mapRange.Position.X, mapRange.Position.Y + doorAreaInfo.Start + 2),
|
||||
5,
|
||||
color3);
|
||||
DrawCircle(new Vector2(mapRange.Position.X, mapRange.Position.Y + doorAreaInfo.End + 2), 5,
|
||||
color4);
|
||||
break;
|
||||
case DoorDirection.S:
|
||||
DrawRect(
|
||||
new Rect2(
|
||||
new Vector2(mapRange.Position.X + doorAreaInfo.Start + 2,
|
||||
mapRange.Position.Y + mapRange.Size.Y), doorAreaInfo.End - doorAreaInfo.Start,
|
||||
30),
|
||||
color2);
|
||||
DrawCircle(
|
||||
new Vector2(mapRange.Position.X + doorAreaInfo.Start + 2,
|
||||
mapRange.Position.Y + mapRange.Size.Y), 5, color3);
|
||||
DrawCircle(
|
||||
new Vector2(mapRange.Position.X + doorAreaInfo.End + 2,
|
||||
mapRange.Position.Y + mapRange.Size.Y),
|
||||
5, color4);
|
||||
break;
|
||||
case DoorDirection.N:
|
||||
DrawRect(
|
||||
new Rect2(
|
||||
new Vector2(mapRange.Position.X + doorAreaInfo.Start + 2, mapRange.Position.Y - 30),
|
||||
doorAreaInfo.End - doorAreaInfo.Start, 30), color2);
|
||||
DrawCircle(new Vector2(mapRange.Position.X + doorAreaInfo.Start + 2, mapRange.Position.Y),
|
||||
5,
|
||||
color3);
|
||||
DrawCircle(new Vector2(mapRange.Position.X + doorAreaInfo.End + 2, mapRange.Position.Y), 5,
|
||||
color4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//绘制导航, 现在有点问题, 绘制的内容会被自身的 tile 所挡住
|
||||
if (_dungeonTile != null)
|
||||
{
|
||||
var result = _dungeonTile.GetGenerateNavigationResult();
|
||||
if (result != null)
|
||||
{
|
||||
if (result.Success)
|
||||
{
|
||||
var polygonData = _dungeonTile.GetPolygonData();
|
||||
Utils.DrawNavigationPolygon(this, polygonData);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawCircle(result.Exception.Point * GameConfig.TileCellSize, 10, Colors.Red);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ClearState()
|
||||
{
|
||||
_hover = false;
|
||||
|
|
|
@ -843,7 +843,7 @@ public class DungeonTile
|
|||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!");
|
||||
}
|
||||
case 1: //下
|
||||
{
|
||||
|
@ -897,7 +897,7 @@ public class DungeonTile
|
|||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!");
|
||||
}
|
||||
case 2: //左
|
||||
{
|
||||
|
@ -951,7 +951,7 @@ public class DungeonTile
|
|||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!");
|
||||
}
|
||||
case 3: //上
|
||||
{
|
||||
|
@ -1005,7 +1005,7 @@ public class DungeonTile
|
|||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1082,7 +1082,7 @@ public class DungeonTile
|
|||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!");
|
||||
}
|
||||
case 1: //下
|
||||
{
|
||||
|
@ -1136,7 +1136,7 @@ public class DungeonTile
|
|||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!");
|
||||
}
|
||||
case 2: //左
|
||||
{
|
||||
|
@ -1190,7 +1190,7 @@ public class DungeonTile
|
|||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!");
|
||||
}
|
||||
case 3: //上
|
||||
{
|
||||
|
@ -1244,7 +1244,7 @@ public class DungeonTile
|
|||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user