diff --git a/DungeonShooting_Godot/resource/map/RoomConfig.json b/DungeonShooting_Godot/resource/map/RoomConfig.json index 93e722f..63ff048 100644 --- a/DungeonShooting_Godot/resource/map/RoomConfig.json +++ b/DungeonShooting_Godot/resource/map/RoomConfig.json @@ -7,6 +7,10 @@ "ConfigPath": "res://resource/map/tiledata/testGroup/battle/Room1.json" }, { + "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room2.tscn", + "ConfigPath": "res://resource/map/tiledata/testGroup/battle/Room2.json" + }, + { "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room3.tscn", "ConfigPath": "res://resource/map/tiledata/testGroup/battle/Room3.json" }, diff --git a/DungeonShooting_Godot/resource/map/tileMaps/testGroup/battle/Room2.tscn b/DungeonShooting_Godot/resource/map/tileMaps/testGroup/battle/Room2.tscn new file mode 100644 index 0000000..7a06fff --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileMaps/testGroup/battle/Room2.tscn @@ -0,0 +1,66 @@ +[gd_scene load_steps=5 format=3 uid="uid://bual5tyxahj1u"] + +[ext_resource type="TileSet" uid="uid://b00g22o1cqhe8" path="res://resource/map/tileset/TileSet1.tres" id="1_u22xh"] +[ext_resource type="Script" path="res://src/framework/map/mark/EnemyMark.cs" id="3_tgvyr"] +[ext_resource type="Script" path="res://src/framework/map/mark/WeaponMark.cs" id="4_x0odx"] +[ext_resource type="Script" path="res://src/framework/map/DungeonRoomTemplate.cs" id="dungeonRoomTemplate"] + +[node name="Room2" type="TileMap"] +tile_set = ExtResource("1_u22xh") +format = 2 +layer_0/tile_data = PackedInt32Array(589840, 0, 8, 524304, 0, 8, 458768, 0, 8, 393232, 0, 8, 327696, 0, 8, 262160, 0, 8, 196624, 0, 8, 131088, 0, 8, 65552, 0, 8, 16, 0, 8, -65520, 0, 8, -131056, 0, 8, 589839, 0, 8, 524303, 0, 8, 458767, 0, 8, 393231, 0, 8, 327695, 0, 8, 262159, 0, 8, 196623, 0, 8, 131087, 0, 8, 65551, 0, 8, 15, 0, 8, -65521, 0, 8, -131057, 0, 8, 589838, 0, 8, 524302, 0, 8, 458766, 0, 8, 393230, 0, 8, 327694, 0, 8, 262158, 0, 8, 196622, 0, 8, 131086, 0, 8, 65550, 0, 8, 14, 0, 8, -65522, 0, 8, -131058, 0, 8, 589837, 0, 8, 524301, 0, 8, 458765, 0, 8, 393229, 0, 8, 327693, 0, 8, 262157, 0, 8, 196621, 0, 8, 131085, 0, 8, 65549, 0, 8, 13, 0, 8, -65523, 0, 8, -131059, 0, 8, 589836, 0, 8, 524300, 0, 8, 458764, 0, 8, 393228, 0, 8, 589835, 0, 8, 524299, 0, 8, 458763, 0, 8, 393227, 0, 8, 589834, 0, 8, 524298, 0, 8, 458762, 0, 8, 393226, 0, 8, 589833, 0, 8, 524297, 0, 8, 458761, 0, 8, 393225, 0, 8, 589832, 0, 8, 524296, 0, 8, 458760, 0, 8, 393224, 0, 8, 327688, 0, 8, 262152, 0, 8, 196616, 0, 8, 131080, 0, 8, 65544, 0, 8, 8, 0, 8, -65528, 0, 8, -131064, 0, 8, 589831, 0, 8, 524295, 0, 8, 458759, 0, 8, 393223, 0, 8, 327687, 0, 8, 262151, 0, 8, 196615, 0, 8, 131079, 0, 8, 65543, 0, 8, 7, 0, 8, -65529, 0, 8, -131065, 0, 8, 589830, 0, 8, 524294, 0, 8, 458758, 0, 8, 393222, 0, 8, 327686, 0, 8, 262150, 0, 8, 196614, 0, 8, 131078, 0, 8, 65542, 0, 8, 6, 0, 8, -65530, 0, 8, -131066, 0, 8, 589829, 0, 8, 524293, 0, 8, 458757, 0, 8, 393221, 0, 8, 327685, 0, 8, 262149, 0, 8, 196613, 0, 8, 131077, 0, 8, 65541, 0, 8, 5, 0, 8, -65531, 0, 8, -131067, 0, 8, 589828, 0, 8, 524292, 0, 8, 458756, 0, 8, 393220, 0, 8, 327684, 0, 8, 262148, 0, 8, 196612, 0, 8, 131076, 0, 8, 65540, 0, 8, 4, 0, 8, -65532, 0, 8, -131068, 0, 8, 131075, 0, 8, 65539, 0, 8, 3, 0, 8, -65533, 0, 8, -131069, 0, 8, 131074, 0, 8, 65538, 0, 8, 2, 0, 8, -65534, 0, 8, -131070, 0, 8, 131073, 0, 8, 65537, 0, 8, 1, 0, 8, -65535, 0, 8, -131071, 0, 8, 131072, 0, 8, 65536, 0, 8, 0, 0, 8, -65536, 0, 8, -131072, 0, 8, 655359, 0, 8, 589823, 0, 8, 524287, 0, 8, 458751, 0, 8, 393215, 0, 8, 327679, 0, 8, 262143, 0, 8, 196607, 0, 8, 131071, 0, 8, 65535, 0, 8, -1, 0, 8, -65537, 0, 8, 655358, 0, 8, 589822, 0, 8, 524286, 0, 8, 458750, 0, 8, 393214, 0, 8, 327678, 0, 8, 262142, 0, 8, 196606, 0, 8, 131070, 0, 8, 65534, 0, 8, -2, 0, 8, -65538, 0, 8, 655357, 0, 8, 589821, 0, 8, 524285, 0, 8, 458749, 0, 8, 393213, 0, 8, 327677, 0, 8, 262141, 0, 8, 196605, 0, 8, 131069, 0, 8, 65533, 0, 8, -3, 0, 8, -65539, 0, 8, 655356, 0, 8, 589820, 0, 8, 524284, 0, 8, 458748, 0, 8, 393212, 0, 8, 327676, 0, 8, 262140, 0, 8, 196604, 0, 8, 131068, 0, 8, 65532, 0, 8, -4, 0, 8, -65540, 0, 8, -5, 196608, 3, -65541, 196608, 3, -131077, 196608, 4, -131076, 131072, 7, -131075, 131072, 7, 65531, 196608, 3, 131067, 196608, 3, 196603, 196608, 3, 262139, 196608, 3, 327675, 196608, 3, 393211, 196608, 3, 458747, 196608, 3, 524283, 196608, 3, 589819, 196608, 3, 655355, 196608, 3, 720893, 131072, 2, 720892, 131072, 2, 720891, 720896, 2, -131074, 131072, 7, 720894, 131072, 2, -131073, 131072, 7, 720895, 131072, 2, -196608, 131072, 7, -196607, 131072, 7, -196606, 131072, 7, -196605, 131072, 7, -196604, 131072, 7, 655364, 131072, 2, -196603, 131072, 7, 655365, 131072, 2, -196602, 131072, 7, 655366, 131072, 2, -196601, 131072, 7, 655367, 131072, 2, -196600, 131072, 7, 655368, 131072, 2, 655369, 131072, 2, 655370, 131072, 2, 655371, 131072, 2, 655372, 131072, 2, -196595, 131072, 7, 655373, 131072, 2, -196594, 131072, 7, 655374, 131072, 2, -196593, 131072, 7, 655375, 131072, 2, -196592, 131072, 7, 655376, 131072, 2, -131055, 65536, 3, -65519, 65536, 3, -196591, 65536, 4, 17, 65536, 3, 65553, 65536, 3, 131089, 65536, 3, 196625, 65536, 3, 262161, 65536, 3, 327697, 65536, 3, 393233, 65536, 3, 458769, 65536, 3, 524305, 65536, 3, 589841, 65536, 3, 655377, 851968, 2, 327691, 0, 8, 327692, 0, 8, 327690, 0, 8, 327689, 0, 8, 262153, 65536, 7, 262154, 131072, 7, 262155, 131072, 7, 262156, 196608, 7, -131063, 65536, 3, -65527, 65536, 3, -196599, 65536, 4, 9, 65536, 3, 65545, 65536, 3, 131081, 65536, 3, 196617, 65536, 3, -65524, 196608, 3, -131060, 196608, 3, -196596, 196608, 4, 12, 196608, 3, 65548, 196608, 3, 131084, 196608, 3, 196620, 196608, 3, 196608, 65536, 2, 196609, 131072, 2, 196610, 131072, 2, 196611, 196608, 2, 262147, 196608, 3, 327683, 196608, 3, 393219, 196608, 3, 458755, 196608, 3, 524291, 196608, 3, 589827, 196608, 3, 655363, 720896, 2, 262144, 65536, 3, 327680, 65536, 3, 393216, 65536, 3, 458752, 65536, 3, 524288, 65536, 3, 589824, 65536, 3, 655360, 851968, 2) +script = ExtResource("dungeonRoomTemplate") + +[node name="EnemyMark" type="Node2D" parent="."] +position = Vector2(-23, 7) +script = ExtResource("3_tgvyr") +Type = 3 +ItemId = "0001" +Layer = 1 +BirthRect = Vector2i(50, 50) + +[node name="EnemyMark2" type="Node2D" parent="."] +position = Vector2(232, 119) +script = ExtResource("3_tgvyr") +Type = 3 +ItemId = "0001" +Layer = 1 +BirthRect = Vector2i(50, 50) + +[node name="WeaponMark" type="Node2D" parent="."] +position = Vector2(105, 45) +script = ExtResource("4_x0odx") +CurrAmmon = 30 +Type = 4 +ItemId = "0001" +DelayTime = 1.0 +Altitude = 8 + +[node name="WeaponMark2" type="Node2D" parent="."] +position = Vector2(106, 103) +script = ExtResource("4_x0odx") +CurrAmmon = 15 +Type = 4 +ItemId = "0002" +DelayTime = 1.0 +Altitude = 8 + +[node name="EnemyMark3" type="Node2D" parent="."] +position = Vector2(102, 8) +script = ExtResource("3_tgvyr") +Type = 3 +ItemId = "0001" +Layer = 1 +WaveNumber = 2 +DelayTime = 1.0 +BirthRect = Vector2i(50, 50) + +[node name="EnemyMark4" type="Node2D" parent="."] +position = Vector2(103, 121) +script = ExtResource("3_tgvyr") +Type = 3 +ItemId = "0001" +Layer = 1 +WaveNumber = 2 +DelayTime = 2.0 +BirthRect = Vector2i(50, 50) diff --git a/DungeonShooting_Godot/resource/map/tiledata/testGroup/battle/Room2.json b/DungeonShooting_Godot/resource/map/tiledata/testGroup/battle/Room2.json new file mode 100644 index 0000000..ac26334 --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tiledata/testGroup/battle/Room2.json @@ -0,0 +1,100 @@ +{ + "Position": { + "X": -5, + "Y": -3 + }, + "Size": { + "X": 23, + "Y": 14 + }, + "DoorAreaInfos": [ + { + "Direction": 3, + "Start": 16, + "End": 224 + }, + { + "Direction": 3, + "Start": 288, + "End": 352 + }, + { + "Direction": 0, + "Start": 16, + "End": 208 + }, + { + "Direction": 2, + "Start": 144, + "End": 352 + }, + { + "Direction": 2, + "Start": 16, + "End": 80 + }, + { + "Direction": 1, + "Start": 16, + "End": 208 + } + ], + "NavigationList": [ + { + "Type": 0, + "Points": [ + { + "X": -56, + "Y": -24 + }, + { + "X": 136, + "Y": -24 + }, + { + "X": 136, + "Y": 88 + }, + { + "X": 216, + "Y": 88 + }, + { + "X": 216, + "Y": -24 + }, + { + "X": 264, + "Y": -24 + }, + { + "X": 264, + "Y": 152 + }, + { + "X": 72, + "Y": 152 + }, + { + "X": 72, + "Y": 40 + }, + { + "X": -8, + "Y": 40 + }, + { + "X": -8, + "Y": 152 + }, + { + "X": -56, + "Y": 152 + } + ] + } + ], + "GroupName": "testGroup", + "RoomType": 0, + "FileName": "Room2" +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs index 3c92f03..5cf3487 100644 --- a/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs @@ -17,9 +17,10 @@ private Action _onConfirmClose; //存放创建房间中选择组的下拉框数据 - private Dictionary _createRoomGroupValueMap = new Dictionary(); + private Dictionary _createRoomGroupValueMap; + //存放创建房间中选择类型的下拉框数据 - private Dictionary _createRoomTypeValueMap = new Dictionary(); + private Dictionary _createRoomTypeValueMap; public override void OnShowUi() { @@ -38,30 +39,9 @@ L_Confirm.Instance.CloseRequested += OnCanceled; L_Confirm.Instance.Confirmed += OnConfirm; + InitSelectOptions(); + var container = L_ScrollContainer.L_MarginContainer.L_VBoxContainer; - - //创建ui的下拉框数据 - { - var directoryInfo = new DirectoryInfo(GameConfig.RoomTileDir); - var directoryInfoArray = directoryInfo.GetDirectories(); - for (var i = 0; i < directoryInfoArray.Length; i++) - { - var text = directoryInfoArray[i].Name; - container.L_HBoxContainer6.L_RoomGroupSelect.Instance.AddItem(text, i); - _createRoomGroupValueMap.Add(i, text); - } - - var dungeonRoomTypes = Enum.GetValues(); - for (var i = 0; i < dungeonRoomTypes.Length; i++) - { - var typeName = DungeonRoomTemplate.DungeonRoomTypeToString(dungeonRoomTypes[i]); - var text = typeName + " (" + - DungeonRoomTemplate.DungeonRoomTypeToDescribeString(dungeonRoomTypes[i]) + ")"; - container.L_HBoxContainer6.L_RoomTypeSelect.Instance.AddItem(text, i); - _createRoomTypeValueMap.Add(i, typeName); - } - } - //重新生成 ResourcePath container.L_HBoxContainer.L_Button.Instance.Pressed += GenerateResourcePath; //重新打包房间配置 @@ -95,6 +75,44 @@ container.L_HBoxContainer6.L_Button.Instance.Pressed -= GenerateDungeonRoom; } + public override void Process(float delta) + { + if (_createRoomGroupValueMap == null || _createRoomTypeValueMap == null) + { + InitSelectOptions(); + } + } + + //创建ui的下拉框数据 + private void InitSelectOptions() + { + _createRoomGroupValueMap = new Dictionary(); + _createRoomTypeValueMap = new Dictionary(); + var container = L_ScrollContainer.L_MarginContainer.L_VBoxContainer; + var select1 = container.L_HBoxContainer6.L_RoomGroupSelect.Instance; + select1.Clear(); + var directoryInfo = new DirectoryInfo(GameConfig.RoomTileDir); + var directoryInfoArray = directoryInfo.GetDirectories(); + for (var i = 0; i < directoryInfoArray.Length; i++) + { + var text = directoryInfoArray[i].Name; + select1.AddItem(text, i); + _createRoomGroupValueMap.Add(i, text); + } + + var select2 = container.L_HBoxContainer6.L_RoomTypeSelect.Instance; + select2.Clear(); + var dungeonRoomTypes = Enum.GetValues(); + for (var i = 0; i < dungeonRoomTypes.Length; i++) + { + var typeName = DungeonRoomTemplate.DungeonRoomTypeToString(dungeonRoomTypes[i]); + var text = typeName + " (" + + DungeonRoomTemplate.DungeonRoomTypeToDescribeString(dungeonRoomTypes[i]) + ")"; + select2.AddItem(text, i); + _createRoomTypeValueMap.Add(i, typeName); + } + } + /// /// Tips 关闭信号回调 ///