diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx index 02923b0..665ce59 100644 --- a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/Sound.xlsx b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx index 1c12e9e..536a847 100644 --- a/DungeonShooting_Godot/excel/excelFile/Sound.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx index 88d2d71..877be50 100644 --- a/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx Binary files differ diff --git a/DungeonShooting_Godot/resource/config/ActivityObject.json b/DungeonShooting_Godot/resource/config/ActivityObject.json index 7f8ce7c..85aa85b 100644 --- a/DungeonShooting_Godot/resource/config/ActivityObject.json +++ b/DungeonShooting_Godot/resource/config/ActivityObject.json @@ -2,11 +2,11 @@ { "Id": "role0001", "Type": 3, - "Name": "", + "Name": "\u73A9\u5BB6", "Intro": "\u73A9\u5BB6", "Details": "", "Prefab": "res://prefab/role/Role0001.tscn", - "Icon": "", + "Icon": "res://resource/sprite/role/role0001/Role0001_Icon.png", "ShowInMapEditor": false }, { diff --git a/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json b/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json index a26cac1..0d0481c 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json @@ -9,10 +9,16 @@ "PreinstallPath": "resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json" }, { - "Ready": true, + "Ready": false, "RoomPath": "resource/map/tileMaps/TestGroup1/battle/Room2/Room2_roomInfo.json", "TilePath": "resource/map/tileMaps/TestGroup1/battle/Room2/Room2_tileInfo.json", "PreinstallPath": "resource/map/tileMaps/TestGroup1/battle/Room2/Room2_preinstall.json" + }, + { + "Ready": false, + "RoomPath": "resource/map/tileMaps/TestGroup1/battle/Room3/Room3_roomInfo.json", + "TilePath": "resource/map/tileMaps/TestGroup1/battle/Room3/Room3_tileInfo.json", + "PreinstallPath": "resource/map/tileMaps/TestGroup1/battle/Room3/Room3_preinstall.json" } ], "InletList": [ @@ -25,7 +31,7 @@ ], "OutletList": [ { - "Ready": true, + "Ready": false, "RoomPath": "resource/map/tileMaps/TestGroup1/outlet/End1/End1_roomInfo.json", "TilePath": "resource/map/tileMaps/TestGroup1/outlet/End1/End1_tileInfo.json", "PreinstallPath": "resource/map/tileMaps/TestGroup1/outlet/End1/End1_preinstall.json" diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json index 6b7b9ae..3afe649 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json @@ -1 +1 @@ -[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":20,"Y":-32},"Size":{"X":92,"Y":134},"DelayTime":0,"MarkList":[{"Id":"weapon0006","Weight":100,"Attr":{"CurrAmmon":"20","ResidueAmmo":"300"}}]}],[{"Position":{"X":61,"Y":34},"Size":{"X":86,"Y":72},"DelayTime":0,"MarkList":[{"Id":"weapon0007","Weight":100,"Attr":{"CurrAmmon":"60","ResidueAmmo":"300"}}]}]]},{"Name":"test2","Weight":150,"Remark":"","WaveList":[[{"Position":{"X":65,"Y":32},"Size":{"X":75,"Y":37},"DelayTime":0,"MarkList":[{"Id":"weapon0002","Weight":100,"Attr":{"CurrAmmon":"7","ResidueAmmo":"70"}}]}]]}] \ No newline at end of file +[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":23,"Y":-36},"Size":{"X":16,"Y":120},"DelayTime":0,"MarkList":[{"Id":"weapon0006","Weight":100,"Attr":{"CurrAmmon":"20","ResidueAmmo":"300"}}]}],[{"Position":{"X":61,"Y":34},"Size":{"X":86,"Y":72},"DelayTime":0,"MarkList":[{"Id":"weapon0007","Weight":100,"Attr":{"CurrAmmon":"60","ResidueAmmo":"300"}}]}]]},{"Name":"test2","Weight":150,"Remark":"","WaveList":[[{"Position":{"X":65,"Y":32},"Size":{"X":75,"Y":37},"DelayTime":0,"MarkList":[{"Id":"weapon0002","Weight":100,"Attr":{"CurrAmmon":"7","ResidueAmmo":"70"}}]}]]}] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_roomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_roomInfo.json index 428ba80..22d425f 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_roomInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_roomInfo.json @@ -1 +1 @@ -{"Position":{"X":-6,"Y":-12},"Size":{"X":15,"Y":21},"DoorAreaInfos":[{"Direction":0,"Start":144,"End":304},{"Direction":1,"Start":0,"End":256},{"Direction":3,"Start":0,"End":208},{"Direction":0,"Start":0,"End":80}],"GroupName":"TestGroup1","RoomType":0,"RoomName":"Room1","Weight":100,"Remark":""} \ No newline at end of file +{"Position":{"X":-6,"Y":-13},"Size":{"X":15,"Y":22},"DoorAreaInfos":[{"Direction":0,"Start":160,"End":256},{"Direction":1,"Start":16,"End":272},{"Direction":3,"Start":48,"End":176},{"Direction":0,"Start":16,"End":96}],"GroupName":"TestGroup1","RoomType":0,"RoomName":"Room1","Weight":100,"Remark":""} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json index f0924e5..0fb7acb 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json @@ -1 +1 @@ -{"NavigationList":[{"Type":0,"Points":[-72,-168,120,-168,120,-96,56,-96,56,-80,40,-80,40,-8,104,-8,104,-56,120,-56,120,64,72,64,72,104,120,104,120,128,24,128,24,104,56,104,56,64,8,64,8,0,-56,0,-56,80,-72,80]},{"Type":1,"Points":[-40,-144,24,-144,24,-104,-40,-104]},{"Type":1,"Points":[-56,-64,8,-64,8,-24,-56,-24]}],"Floor":[7,3,0,0,8,7,2,0,0,8,7,1,0,0,8,7,0,0,0,8,7,-1,0,0,8,7,-2,0,0,8,7,-3,0,0,8,7,-4,0,0,8,7,6,0,0,8,7,7,0,0,8,7,-11,0,0,8,7,-10,0,0,8,7,-9,0,0,8,7,-8,0,0,8,7,-7,0,0,8,6,-10,0,0,8,6,-9,0,0,8,6,-8,0,0,8,6,3,0,0,8,6,2,0,0,8,6,1,0,0,8,6,0,0,0,8,6,-1,0,0,8,6,-2,0,0,8,6,-3,0,0,8,6,-4,0,0,8,6,-7,0,0,8,6,6,0,0,8,6,7,0,0,8,6,-11,0,0,8,5,-10,0,0,8,5,-9,0,0,8,5,-7,0,0,8,5,-8,0,0,8,5,3,0,0,8,5,2,0,0,8,5,1,0,0,8,5,0,0,0,8,5,-1,0,0,8,5,6,0,0,8,5,7,0,0,8,5,-11,0,0,8,4,-9,0,0,8,4,-10,0,0,8,4,-8,0,0,8,4,-7,0,0,8,4,3,0,0,8,4,2,0,0,8,4,1,0,0,8,4,0,0,0,8,4,-1,0,0,8,4,6,0,0,8,4,7,0,0,8,4,5,0,0,8,4,4,0,0,8,4,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0,3,3,-1,3,0,3,3,-1,4,0,11,2,0,-9,0,3,2,0,4,0,2,2,0,5,0,3,4,0,6,0,3,3,0,7,0,3,3,0,8,0,11,2,1,4,0,2,2,1,8,0,2,2,2,4,0,3,2,2,8,0,2,2,3,-5,0,1,2,3,-4,0,1,3,3,-3,0,1,3,3,8,0,2,2,4,-6,0,1,2,4,-5,0,13,2,4,8,0,2,2,5,-6,0,2,2,5,-5,0,3,4,5,-4,0,3,3,5,-3,0,3,3,5,4,0,1,2,5,8,0,2,2,6,-6,0,2,2,6,4,0,2,2,6,8,0,2,2,7,-6,0,2,2,7,4,0,2,2,7,8,0,2,2,8,-12,0,1,4,8,-11,0,1,3,8,-10,0,1,3,8,-9,0,1,3,8,-8,0,1,3,8,-7,0,1,3,8,-6,0,13,2,8,-5,0,1,4,8,-4,0,1,3,8,-3,0,1,3,8,-2,0,1,3,8,-1,0,1,3,8,0,0,1,3,8,1,0,1,3,8,2,0,1,3,8,3,0,1,3,8,4,0,13,2,8,5,0,1,4,8,6,0,1,3,8,7,0,1,3,8,8,0,13,2]} \ No newline at end of file +{"NavigationList":[{"Type":0,"Points":[-24,-184,88,-184,88,-168,120,-168,120,-96,56,-96,56,-64,40,-64,40,-8,104,-8,104,-56,120,-56,120,64,72,64,72,104,120,104,120,128,24,128,24,104,56,104,56,64,8,64,8,0,-56,0,-56,80,-72,80,-72,-168,-24,-168]},{"Type":1,"Points":[-8,-160,72,-160,72,-120,40,-120,40,-104,-40,-104,-40,-144,-8,-144]},{"Type":1,"Points":[-56,-64,8,-64,8,-24,-56,-24]}],"Floor":[-5,4,0,0,8,-5,-11,0,0,8,-5,-5,0,0,8,-5,-4,0,0,8,-5,-3,0,0,8,-5,-2,0,0,8,-5,-1,0,0,8,-5,0,0,0,8,-5,1,0,0,8,-5,2,0,0,8,-5,3,0,0,8,-5,-6,0,0,8,-5,-7,0,0,8,-5,-8,0,0,8,-5,-9,0,0,8,-5,-10,0,0,8,-4,-11,0,0,8,-4,-5,0,0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,1,3,8,7,0,1,3,8,8,0,13,2]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room2/Room2_tileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room2/Room2_tileInfo.json index b66e671..a7c4dec 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room2/Room2_tileInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room2/Room2_tileInfo.json @@ -1 +1 @@ -{"NavigationList":[{"Type":0,"Points":[-168,-104,136,-104,136,128,-168,128]},{"Type":1,"Points":[-120,-48,-24,-48,-24,8,-120,8]},{"Type":1,"Points":[-8,48,104,48,104,104,-8,104]}],"Floor":[-11,-7,0,0,8,-11,-6,0,0,8,-11,-5,0,0,8,-11,-4,0,0,8,-11,-3,0,0,8,-11,-2,0,0,8,-11,-1,0,0,8,-11,0,0,0,8,-11,1,0,0,8,-11,2,0,0,8,-11,3,0,0,8,-11,4,0,0,8,-11,5,0,0,8,-11,6,0,0,8,-11,7,0,0,8,-10,-7,0,0,8,-10,-6,0,0,8,-10,-5,0,0,8,-10,-4,0,0,8,-10,-3,0,0,8,-10,-2,0,0,8,-10,-1,0,0,8,-10,0,0,0,8,-10,1,0,0,8,-10,2,0,0,8,-10,3,0,0,8,-10,4,0,0,8,-10,5,0,0,8,-10,6,0,0,8,-10,7,0,0,8,-9,-7,0,0,8,-9,-6,0,0,8,-9,-5,0,0,8,-9,-4,0,0,8,-9,-3,0,0,8,-9,-2,0,0,8,-9,-1,0,0,8,-9,0,0,0,8,-9,1,0,0,8,-9,2,0,0,8,-9,3,0,0,8,-9,4,0,0,8,-9,5,0,0,8,-9,6,0,0,8,-9,7,0,0,8,-8,-7,0,0,8,-8,-6,0,0,8,-8,-5,0,0,8,-8,-4,0,0,8,-8,-3,0,0,8,-8,-2,0,0,8,-8,-1,0,0,8,-8,0,0,0,8,-8,1,0,0,8,-8,2,0,0,8,-8,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-6,-3,0,2,2,-6,8,0,2,2,-5,-3,0,2,2,-5,8,0,2,2,-4,-3,0,3,2,-4,-2,0,3,3,-4,8,0,2,2,-3,8,0,2,2,-2,8,0,2,2,-1,8,0,2,2,0,8,0,2,2,1,3,0,1,2,1,4,0,1,3,1,8,0,2,2,2,3,0,2,2,2,8,0,2,2,3,3,0,2,2,3,8,0,2,2,4,3,0,2,2,4,8,0,2,2,5,3,0,3,2,5,4,0,3,3,5,8,0,2,2,6,8,0,2,2,7,8,0,2,2,8,8,0,2,2,9,-8,0,1,4,9,-7,0,1,3,9,-6,0,1,3,9,-5,0,1,3,9,-4,0,1,3,9,-3,0,1,3,9,-2,0,1,3,9,-1,0,1,3,9,0,0,1,3,9,1,0,1,3,9,2,0,1,3,9,3,0,1,3,9,4,0,1,3,9,5,0,1,3,9,6,0,1,3,9,7,0,1,3,9,8,0,13,2]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_preinstall.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_preinstall.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_roomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_roomInfo.json new file mode 100644 index 0000000..00f5b5f --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_roomInfo.json @@ -0,0 +1 @@ +{"Position":{"X":0,"Y":0},"Size":{"X":0,"Y":0},"DoorAreaInfos":[],"GroupName":"TestGroup1","RoomType":0,"RoomName":"Room3","Weight":100,"Remark":""} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_tileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_tileInfo.json new file mode 100644 index 0000000..6949537 --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_tileInfo.json @@ -0,0 +1 @@ +{"NavigationList":[],"Floor":[],"Middle":[],"Top":[]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_preinstall.json index 0637a08..cfb7f0f 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_preinstall.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_preinstall.json @@ -1 +1 @@ -[] \ No newline at end of file +[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":128,"Y":113},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]}]]}] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_roomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_roomInfo.json index 7fcc776..aff30bf 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_roomInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_roomInfo.json @@ -1 +1 @@ -{"Position":{"X":-3,"Y":-4},"Size":{"X":10,"Y":10},"DoorAreaInfos":[{"Direction":3,"Start":0,"End":128},{"Direction":0,"Start":0,"End":128},{"Direction":2,"Start":0,"End":128},{"Direction":1,"Start":0,"End":128}],"GroupName":"TestGroup1","RoomType":1,"RoomName":"Start1","Weight":100,"Remark":""} \ No newline at end of file +{"Position":{"X":1,"Y":2},"Size":{"X":15,"Y":10},"DoorAreaInfos":[],"GroupName":"TestGroup1","RoomType":1,"RoomName":"Start1","Weight":100,"Remark":""} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_tileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_tileInfo.json index bfb8380..2b8c008 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_tileInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_tileInfo.json @@ -1 +1 @@ -{"NavigationList":[{"Type":0,"Points":[-24,-40,88,-40,88,80,-24,80]}],"Floor":[5,4,0,0,8,5,3,0,0,8,5,2,0,0,8,5,1,0,0,8,5,0,0,0,8,5,-1,0,0,8,5,-2,0,0,8,5,-3,0,0,8,4,4,0,0,8,4,3,0,0,8,4,2,0,0,8,4,1,0,0,8,4,0,0,0,8,4,-1,0,0,8,4,-2,0,0,8,4,-3,0,0,8,3,4,0,0,8,3,3,0,0,8,3,2,0,0,8,3,1,0,0,8,3,0,0,0,8,3,-1,0,0,8,3,-2,0,0,8,3,-3,0,0,8,2,4,0,0,8,2,3,0,0,8,2,2,0,0,8,2,1,0,0,8,2,0,0,0,8,2,-1,0,0,8,2,-2,0,0,8,2,-3,0,0,8,1,4,0,0,8,1,3,0,0,8,1,2,0,0,8,1,1,0,0,8,1,0,0,0,8,1,-1,0,0,8,1,-2,0,0,8,1,-3,0,0,8,0,4,0,0,8,0,3,0,0,8,0,2,0,0,8,0,1,0,0,8,0,0,0,0,8,0,-1,0,0,8,0,-2,0,0,8,0,-3,0,0,8,-1,4,0,0,8,-1,3,0,0,8,-1,2,0,0,8,-1,1,0,0,8,-1,0,0,0,8,-1,-1,0,0,8,-1,-2,0,0,8,-1,-3,0,0,8,-2,4,0,0,8,-2,3,0,0,8,-2,2,0,0,8,-2,1,0,0,8,-2,0,0,0,8,-2,-1,0,0,8,-2,-2,0,0,8,-2,-3,0,0,8],"Middle":[-2,-4,0,2,7,-1,-4,0,2,7,0,-4,0,2,7,1,-4,0,2,7,2,-4,0,2,7,3,-4,0,2,7,4,-4,0,2,7,5,-4,0,2,7],"Top":[-3,-4,0,3,4,-3,-3,0,3,3,-3,-2,0,3,3,-3,-1,0,3,3,-3,0,0,3,3,-3,1,0,3,3,-3,2,0,3,3,-3,3,0,3,3,-3,4,0,3,3,-3,5,0,11,2,-2,5,0,2,2,-1,5,0,2,2,0,5,0,2,2,1,5,0,2,2,2,5,0,2,2,3,5,0,2,2,4,5,0,2,2,5,5,0,2,2,6,-4,0,1,4,6,-3,0,1,3,6,-2,0,1,3,6,-1,0,1,3,6,0,0,1,3,6,1,0,1,3,6,2,0,1,3,6,3,0,1,3,6,4,0,1,3,6,5,0,13,2]} \ No newline at end of file +{"NavigationList":[{"Type":0,"Points":[40,56,232,56,232,176,40,176]}],"Floor":[14,10,0,0,8,14,9,0,0,8,14,8,0,0,8,14,7,0,0,8,14,6,0,0,8,14,5,0,0,8,14,4,0,0,8,14,3,0,0,8,13,10,0,0,8,13,9,0,0,8,13,8,0,0,8,13,7,0,0,8,13,6,0,0,8,13,5,0,0,8,13,4,0,0,8,13,3,0,0,8,12,10,0,0,8,12,9,0,0,8,12,8,0,0,8,12,7,0,0,8,12,6,0,0,8,12,5,0,0,8,12,4,0,0,8,12,3,0,0,8,11,10,0,0,8,11,9,0,0,8,11,8,0,0,8,11,7,0,0,8,11,6,0,0,8,11,5,0,0,8,11,4,0,0,8,11,3,0,0,8,10,10,0,0,8,10,9,0,0,8,10,8,0,0,8,10,7,0,0,8,10,6,0,0,8,10,5,0,0,8,10,4,0,0,8,10,3,0,0,8,9,10,0,0,8,9,9,0,0,8,9,8,0,0,8,9,7,0,0,8,9,6,0,0,8,9,5,0,0,8,9,4,0,0,8,9,3,0,0,8,8,10,0,0,8,8,9,0,0,8,8,8,0,0,8,8,7,0,0,8,8,6,0,0,8,8,5,0,0,8,8,4,0,0,8,8,3,0,0,8,7,10,0,0,8,7,9,0,0,8,7,8,0,0,8,7,7,0,0,8,7,6,0,0,8,7,5,0,0,8,7,4,0,0,8,7,3,0,0,8,6,10,0,0,8,6,9,0,0,8,6,8,0,0,8,6,7,0,0,8,6,6,0,0,8,6,5,0,0,8,6,4,0,0,8,6,3,0,0,8,5,10,0,0,8,5,9,0,0,8,5,8,0,0,8,5,7,0,0,8,5,6,0,0,8,5,5,0,0,8,5,4,0,0,8,5,3,0,0,8,4,10,0,0,8,4,9,0,0,8,4,8,0,0,8,4,7,0,0,8,4,6,0,0,8,4,5,0,0,8,4,4,0,0,8,4,3,0,0,8,3,10,0,0,8,3,9,0,0,8,3,8,0,0,8,3,7,0,0,8,3,6,0,0,8,3,5,0,0,8,3,4,0,0,8,3,3,0,0,8,2,10,0,0,8,2,9,0,0,8,2,8,0,0,8,2,7,0,0,8,2,6,0,0,8,2,5,0,0,8,2,4,0,0,8,2,3,0,0,8],"Middle":[2,2,0,2,7,3,2,0,2,7,4,2,0,2,7,5,2,0,2,7,6,2,0,2,7,7,2,0,2,7,8,2,0,2,7,9,2,0,2,7,10,2,0,2,7,11,2,0,2,7,12,2,0,2,7,13,2,0,2,7,14,2,0,2,7],"Top":[1,2,0,3,4,1,3,0,3,3,1,4,0,3,3,1,5,0,3,3,1,6,0,3,3,1,7,0,3,3,1,8,0,3,3,1,9,0,3,3,1,10,0,3,3,1,11,0,11,2,2,11,0,2,2,3,11,0,2,2,4,11,0,2,2,5,11,0,2,2,6,11,0,2,2,7,11,0,2,2,8,11,0,2,2,9,11,0,2,2,10,11,0,2,2,11,11,0,2,2,12,11,0,2,2,13,11,0,2,2,14,11,0,2,2,15,2,0,1,4,15,3,0,1,3,15,4,0,1,3,15,5,0,1,3,15,6,0,1,3,15,7,0,1,3,15,8,0,1,3,15,9,0,1,3,15,10,0,1,3,15,11,0,13,2]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/outlet/End1/End1_tileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/outlet/End1/End1_tileInfo.json index 34d5dc3..3f92b0e 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/outlet/End1/End1_tileInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/outlet/End1/End1_tileInfo.json @@ -1 +1 @@ -{"NavigationList":[{"Type":0,"Points":[-56,-72,104,-72,104,64,-56,64]}],"Floor":[6,3,0,0,8,6,2,0,0,8,6,1,0,0,8,6,0,0,0,8,6,-1,0,0,8,6,-2,0,0,8,6,-3,0,0,8,6,-4,0,0,8,6,-5,0,0,8,5,3,0,0,8,5,2,0,0,8,5,1,0,0,8,5,0,0,0,8,5,-1,0,0,8,5,-2,0,0,8,5,-3,0,0,8,5,-4,0,0,8,5,-5,0,0,8,4,3,0,0,8,4,2,0,0,8,4,1,0,0,8,4,0,0,0,8,4,-1,0,0,8,4,-2,0,0,8,4,-3,0,0,8,4,-4,0,0,8,4,-5,0,0,8,3,3,0,0,8,3,2,0,0,8,3,1,0,0,8,3,0,0,0,8,3,-1,0,0,8,3,-2,0,0,8,3,-3,0,0,8,3,-4,0,0,8,3,-5,0,0,8,2,3,0,0,8,2,2,0,0,8,2,1,0,0,8,2,0,0,0,8,2,-1,0,0,8,2,-2,0,0,8,2,-3,0,0,8,2,-4,0,0,8,2,-5,0,0,8,1,3,0,0,8,1,2,0,0,8,1,1,0,0,8,1,0,0,0,8,1,-1,0,0,8,1,-2,0,0,8,1,-3,0,0,8,1,-4,0,0,8,1,-5,0,0,8,0,3,0,0,8,0,2,0,0,8,0,1,0,0,8,0,0,0,0,8,0,-1,0,0,8,0,-2,0,0,8,0,-3,0,0,8,0,-4,0,0,8,0,-5,0,0,8,-1,3,0,0,8,-1,2,0,0,8,-1,1,0,0,8,-1,0,0,0,8,-1,-1,0,0,8,-1,-2,0,0,8,-1,-3,0,0,8,-1,-4,0,0,8,-1,-5,0,0,8,-2,3,0,0,8,-2,2,0,0,8,-2,1,0,0,8,-2,0,0,0,8,-2,-1,0,0,8,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3,-5,-4,0,3,3,-5,-3,0,3,3,-5,-2,0,3,3,-5,-1,0,3,3,-5,0,0,3,3,-5,1,0,3,3,-5,2,0,3,3,-5,3,0,3,3,-5,4,0,11,2,-4,4,0,2,2,-3,4,0,2,2,-2,4,0,2,2,-1,4,0,2,2,0,4,0,2,2,1,4,0,2,2,2,4,0,2,2,3,4,0,2,2,4,4,0,2,2,5,4,0,2,2,6,4,0,2,2,7,-6,0,1,4,7,-5,0,1,3,7,-4,0,1,3,7,-3,0,1,3,7,-2,0,1,3,7,-1,0,1,3,7,0,0,1,3,7,1,0,1,3,7,2,0,1,3,7,3,0,1,3,7,4,0,13,2]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0001/Enemy0001_Icon.png b/DungeonShooting_Godot/resource/sprite/role/enemy0001/Enemy0001_Icon.png index 13ad67c..1276ee6 100644 --- a/DungeonShooting_Godot/resource/sprite/role/enemy0001/Enemy0001_Icon.png +++ b/DungeonShooting_Godot/resource/sprite/role/enemy0001/Enemy0001_Icon.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/role/role0001/Role0001.png b/DungeonShooting_Godot/resource/sprite/role/role0001/Role0001.png new file mode 100644 index 0000000..7f15453 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/role/role0001/Role0001.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/role/role0001/Role0001.png.import b/DungeonShooting_Godot/resource/sprite/role/role0001/Role0001.png.import new file mode 100644 index 0000000..eec1f3f --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/role/role0001/Role0001.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bhwhhg2dfsr26" +path="res://.godot/imported/Role0001.png-6999fc593f104cd54766f96578820516.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/role/role0001/Role0001.png" +dest_files=["res://.godot/imported/Role0001.png-6999fc593f104cd54766f96578820516.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/role/role0001/Role0001_Icon.png b/DungeonShooting_Godot/resource/sprite/role/role0001/Role0001_Icon.png new file mode 100644 index 0000000..2ae1072 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/role/role0001/Role0001_Icon.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/role/role0001/Role0001_Icon.png.import b/DungeonShooting_Godot/resource/sprite/role/role0001/Role0001_Icon.png.import new file mode 100644 index 0000000..9f21658 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/role/role0001/Role0001_Icon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://xo2xd4057wpa" +path="res://.godot/imported/Role0001_Icon.png-f31dfd180821eef50ddc4827aa6658ec.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/role/role0001/Role0001_Icon.png" +dest_files=["res://.godot/imported/Role0001_Icon.png-f31dfd180821eef50ddc4827aa6658ec.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/role/role2.png b/DungeonShooting_Godot/resource/sprite/role/role2.png deleted file mode 100644 index 7f15453..0000000 --- a/DungeonShooting_Godot/resource/sprite/role/role2.png +++ /dev/null Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/role/role2.png.import b/DungeonShooting_Godot/resource/sprite/role/role2.png.import deleted file mode 100644 index 8c0e537..0000000 --- a/DungeonShooting_Godot/resource/sprite/role/role2.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://bhwhhg2dfsr26" -path="res://.godot/imported/role2.png-2684720cd846f0db30590472914d73a4.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://resource/sprite/role/role2.png" -dest_files=["res://.godot/imported/role2.png-2684720cd846f0db30590472914d73a4.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/spriteFrames/role/Role0001.tres b/DungeonShooting_Godot/resource/spriteFrames/role/Role0001.tres index c813ce3..51d0ef0 100644 --- a/DungeonShooting_Godot/resource/spriteFrames/role/Role0001.tres +++ b/DungeonShooting_Godot/resource/spriteFrames/role/Role0001.tres @@ -1,57 +1,57 @@ [gd_resource type="SpriteFrames" load_steps=15 format=3 uid="uid://n11thtali6es"] -[ext_resource type="Texture2D" uid="uid://bhwhhg2dfsr26" path="res://resource/sprite/role/role2.png" id="1_n8j7s"] +[ext_resource type="Texture2D" uid="uid://bhwhhg2dfsr26" path="res://resource/sprite/role/role0001/Role0001.png" id="1_frpf2"] [sub_resource type="AtlasTexture" id="AtlasTexture_tmewn"] -atlas = ExtResource("1_n8j7s") +atlas = ExtResource("1_frpf2") region = Rect2(0, 0, 16, 24) [sub_resource type="AtlasTexture" id="AtlasTexture_dvg4a"] -atlas = ExtResource("1_n8j7s") +atlas = ExtResource("1_frpf2") region = Rect2(0, 24, 16, 24) [sub_resource type="AtlasTexture" id="AtlasTexture_kvuct"] -atlas = ExtResource("1_n8j7s") +atlas = ExtResource("1_frpf2") region = Rect2(16, 24, 16, 24) [sub_resource type="AtlasTexture" id="AtlasTexture_5op76"] -atlas = ExtResource("1_n8j7s") +atlas = ExtResource("1_frpf2") region = Rect2(32, 24, 16, 24) [sub_resource type="AtlasTexture" id="AtlasTexture_helyc"] -atlas = ExtResource("1_n8j7s") +atlas = ExtResource("1_frpf2") region = Rect2(48, 24, 16, 24) [sub_resource type="AtlasTexture" id="AtlasTexture_67mn8"] -atlas = ExtResource("1_n8j7s") +atlas = ExtResource("1_frpf2") region = Rect2(48, 48, 16, 24) [sub_resource type="AtlasTexture" id="AtlasTexture_jeywq"] -atlas = ExtResource("1_n8j7s") +atlas = ExtResource("1_frpf2") region = Rect2(32, 48, 16, 24) [sub_resource type="AtlasTexture" id="AtlasTexture_oycx8"] -atlas = ExtResource("1_n8j7s") +atlas = ExtResource("1_frpf2") region = Rect2(16, 48, 16, 24) [sub_resource type="AtlasTexture" id="AtlasTexture_tjg1t"] -atlas = ExtResource("1_n8j7s") +atlas = ExtResource("1_frpf2") region = Rect2(0, 48, 16, 24) [sub_resource type="AtlasTexture" id="AtlasTexture_2ltxw"] -atlas = ExtResource("1_n8j7s") +atlas = ExtResource("1_frpf2") region = Rect2(0, 48, 16, 24) [sub_resource type="AtlasTexture" id="AtlasTexture_x1va1"] -atlas = ExtResource("1_n8j7s") +atlas = ExtResource("1_frpf2") region = Rect2(16, 48, 16, 24) [sub_resource type="AtlasTexture" id="AtlasTexture_ic2p5"] -atlas = ExtResource("1_n8j7s") +atlas = ExtResource("1_frpf2") region = Rect2(32, 48, 16, 24) [sub_resource type="AtlasTexture" id="AtlasTexture_j3hdu"] -atlas = ExtResource("1_n8j7s") +atlas = ExtResource("1_frpf2") region = Rect2(48, 48, 16, 24) [resource] diff --git a/DungeonShooting_Godot/scene/Main.tscn b/DungeonShooting_Godot/scene/Main.tscn index d31de2b..b034a25 100644 --- a/DungeonShooting_Godot/scene/Main.tscn +++ b/DungeonShooting_Godot/scene/Main.tscn @@ -26,7 +26,6 @@ SubViewportContainer = NodePath("ViewCanvas/SubViewportContainer") SceneRoot = NodePath("ViewCanvas/SubViewportContainer/SubViewport/SceneRoot") GlobalNodeRoot = NodePath("GlobalNodeRoot") -Debug = true metadata/_edit_vertical_guides_ = [] [node name="ViewCanvas" type="CanvasLayer" parent="."] diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs index 38650e0..a94b145 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs @@ -11,7 +11,7 @@ public static class Ids { /// - /// 名称:
+ /// 名称: 玩家
/// 简介: 玩家 ///
public const string Id_role0001 = "role0001"; diff --git a/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs b/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs index 0559237..c85d8e5 100644 --- a/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs +++ b/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs @@ -16,12 +16,12 @@ /// /// 起始房间 /// - public RoomInfo StartRoom { get; private set; } + public RoomInfo StartRoomInfo { get; private set; } /// /// 结束房间 /// - public RoomInfo EndRoom { get; private set; } + public RoomInfo EndRoomInfo { get; private set; } /// /// boss房间 @@ -90,8 +90,7 @@ // //没有合适的门 // NoProperDoor, } - -#if TOOLS + /// /// 用于调试, 设置生成器只能生成哪些房间 /// @@ -99,7 +98,6 @@ { _designatedRoom = new List(list); } -#endif public DungeonGenerator(DungeonConfig config) { @@ -134,7 +132,7 @@ /// public void EachRoom(Action cb) { - EachRoom(StartRoom, cb); + EachRoom(StartRoomInfo, cb); } private void EachRoom(RoomInfo roomInfo, Action cb) @@ -156,68 +154,68 @@ /// public void Generate() { - if (StartRoom != null) return; + if (StartRoomInfo != null) return; CalcNextRoomType(null); //用于排除上一级房间 var excludePrevRoom = new List(); //上一个房间 - RoomInfo prevRoom = null; + RoomInfo prevRoomInfo = null; var chainTryCount = 0; var chainMaxTryCount = 3; //如果房间数量不够, 就一直生成 - while (_count < _config.RoomCount || EndRoom == null) + while (_count < _config.RoomCount || EndRoomInfo == null) { var nextRoomType = GetNextRoomType(); //上一个房间 - RoomInfo tempPrevRoom; + RoomInfo tempPrevRoomInfo; if (nextRoomType == DungeonRoomType.Inlet) { - tempPrevRoom = null; + tempPrevRoomInfo = null; } else if (nextRoomType == DungeonRoomType.Boss) { - tempPrevRoom = FindMaxLayerRoom(excludePrevRoom); + tempPrevRoomInfo = FindMaxLayerRoom(excludePrevRoom); } else if (nextRoomType == DungeonRoomType.Outlet) { - tempPrevRoom = prevRoom; + tempPrevRoomInfo = prevRoomInfo; } else if (nextRoomType == DungeonRoomType.Battle) { if (chainTryCount < chainMaxTryCount) { - if (prevRoom != null && prevRoom.Layer > 6) //层数太高, 下一个房间生成在低层级 + if (prevRoomInfo != null && prevRoomInfo.Layer > 6) //层数太高, 下一个房间生成在低层级 { - tempPrevRoom = RoundRoomLessThanLayer(3); + tempPrevRoomInfo = RoundRoomLessThanLayer(3); } else { - tempPrevRoom = prevRoom; + tempPrevRoomInfo = prevRoomInfo; } } else { - tempPrevRoom = Random.RandomChoose(RoomInfos); + tempPrevRoomInfo = Random.RandomChoose(RoomInfos); } } else { - tempPrevRoom = Random.RandomChoose(RoomInfos); + tempPrevRoomInfo = Random.RandomChoose(RoomInfos); } //生成下一个房间 - var errorCode = GenerateRoom(tempPrevRoom, nextRoomType, out var nextRoom); + var errorCode = GenerateRoom(tempPrevRoomInfo, nextRoomType, out var nextRoom); if (errorCode == GenerateRoomErrorCode.NoError) //生成成功 { _failCount = 0; RoomInfos.Add(nextRoom); if (nextRoomType == DungeonRoomType.Inlet) { - StartRoom = nextRoom; + StartRoomInfo = nextRoom; } else if (nextRoomType == DungeonRoomType.Boss) //boss房间 { @@ -226,22 +224,22 @@ } else if (nextRoomType == DungeonRoomType.Outlet) { - EndRoom = nextRoom; + EndRoomInfo = nextRoom; } else if (nextRoomType == DungeonRoomType.Battle) { chainTryCount = 0; chainMaxTryCount = Random.RandomRangeInt(1, 3); } - prevRoom = nextRoom; - CalcNextRoomType(prevRoom); + prevRoomInfo = nextRoom; + CalcNextRoomType(prevRoomInfo); } else //生成失败 { if (nextRoomType == DungeonRoomType.Boss) { //生成boss房间成功 - excludePrevRoom.Add(tempPrevRoom); + excludePrevRoom.Add(tempPrevRoomInfo); if (excludePrevRoom.Count >= RoomInfos.Count) { //全都没找到合适的, 那就再来一遍 @@ -251,13 +249,13 @@ else if (nextRoomType == DungeonRoomType.Outlet) { //生成结束房间失败, 那么只能回滚boss房间 - if (prevRoom != null) + if (prevRoomInfo != null) { - var bossPrev = prevRoom.Prev; - BossRoom.Remove(prevRoom); - RollbackRoom(prevRoom); + var bossPrev = prevRoomInfo.Prev; + BossRoom.Remove(prevRoomInfo); + RollbackRoom(prevRoomInfo); CalcNextRoomType(bossPrev); - prevRoom = null; + prevRoomInfo = null; } } else if (nextRoomType == DungeonRoomType.Battle) @@ -284,7 +282,7 @@ } //生成房间 - private GenerateRoomErrorCode GenerateRoom(RoomInfo prevRoomInfo, DungeonRoomType roomType, out RoomInfo resultRoom) + private GenerateRoomErrorCode GenerateRoom(RoomInfo prevRoomInfo, DungeonRoomType roomType, out RoomInfo resultRoomInfo) { // if (_count >= _config.RoomCount) // { @@ -382,7 +380,7 @@ room.GetVerticalStart() < -_rangeY || room.GetVerticalEnd() > _rangeY) { //超出区域, 直接跳出尝试的循环, 返回 null - resultRoom = null; + resultRoomInfo = null; return GenerateRoomErrorCode.OutArea; } } @@ -411,7 +409,7 @@ //尝试次数用光了, 还没有找到合适的位置 if (tryCount >= maxTryCount) { - resultRoom = null; + resultRoomInfo = null; return GenerateRoomErrorCode.NoSuitableLocation; } } @@ -432,7 +430,7 @@ { prevRoomInfo.Next.Add(room); } - resultRoom = room; + resultRoomInfo = room; return GenerateRoomErrorCode.NoError; } @@ -554,24 +552,24 @@ /// /// 找两个房间的门 /// - private bool ConnectDoor(RoomInfo room, RoomInfo nextRoom) + private bool ConnectDoor(RoomInfo roomInfo, RoomInfo nextRoomInfo) { //门描述 var roomDoor = new RoomDoorInfo(); var nextRoomDoor = new RoomDoorInfo(); - roomDoor.RoomInfo = room; - nextRoomDoor.RoomInfo = nextRoom; - roomDoor.ConnectRoom = nextRoom; + roomDoor.RoomInfo = roomInfo; + nextRoomDoor.RoomInfo = nextRoomInfo; + roomDoor.ConnectRoom = nextRoomInfo; roomDoor.ConnectDoor = nextRoomDoor; - nextRoomDoor.ConnectRoom = room; + nextRoomDoor.ConnectRoom = roomInfo; nextRoomDoor.ConnectDoor = roomDoor; //先寻找直通门 if (Random.RandomBoolean()) { //直行通道, 优先横轴 - if (TryConnectHorizontalDoor(room, roomDoor, nextRoom, nextRoomDoor) - || TryConnectVerticalDoor(room, roomDoor, nextRoom, nextRoomDoor)) + if (TryConnectHorizontalDoor(roomInfo, roomDoor, nextRoomInfo, nextRoomDoor) + || TryConnectVerticalDoor(roomInfo, roomDoor, nextRoomInfo, nextRoomDoor)) { return true; } @@ -579,30 +577,30 @@ else { //直行通道, 优先纵轴 - if (TryConnectVerticalDoor(room, roomDoor, nextRoom, nextRoomDoor) - || TryConnectHorizontalDoor(room, roomDoor, nextRoom, nextRoomDoor)) + if (TryConnectVerticalDoor(roomInfo, roomDoor, nextRoomInfo, nextRoomDoor) + || TryConnectHorizontalDoor(roomInfo, roomDoor, nextRoomInfo, nextRoomDoor)) { return true; } } //包含拐角的通道 - return TryConnectCrossDoor(room, roomDoor, nextRoom, nextRoomDoor); + return TryConnectCrossDoor(roomInfo, roomDoor, nextRoomInfo, nextRoomDoor); } /// /// 尝试寻找横轴方向上两个房间的连通的门, 只查找直线通道, 返回是否找到 /// - private bool TryConnectHorizontalDoor(RoomInfo room, RoomDoorInfo roomDoor, RoomInfo nextRoom, RoomDoorInfo nextRoomDoor) + private bool TryConnectHorizontalDoor(RoomInfo roomInfo, RoomDoorInfo roomDoor, RoomInfo nextRoomInfo, RoomDoorInfo nextRoomDoor) { - var overlapX = Mathf.Min(room.GetHorizontalEnd(), nextRoom.GetHorizontalEnd()) - - Mathf.Max(room.GetHorizontalStart(), nextRoom.GetHorizontalStart()); + var overlapX = Mathf.Min(roomInfo.GetHorizontalEnd(), nextRoomInfo.GetHorizontalEnd()) - + Mathf.Max(roomInfo.GetHorizontalStart(), nextRoomInfo.GetHorizontalStart()); //这种情况下x轴有重叠 if (overlapX >= 6) { //找到重叠区域 - var rangeList = FindPassage(room, nextRoom, - room.GetVerticalStart() < nextRoom.GetVerticalStart() ? DoorDirection.S : DoorDirection.N); + var rangeList = FindPassage(roomInfo, nextRoomInfo, + roomInfo.GetVerticalStart() < nextRoomInfo.GetVerticalStart() ? DoorDirection.S : DoorDirection.N); while (rangeList.Count > 0) { @@ -610,19 +608,19 @@ var range = Random.RandomChooseAndRemove(rangeList); var x = Random.RandomRangeInt(range.X, range.Y); - if (room.GetVerticalStart() < nextRoom.GetVerticalStart()) //room在上, nextRoom在下 + if (roomInfo.GetVerticalStart() < nextRoomInfo.GetVerticalStart()) //room在上, nextRoom在下 { roomDoor.Direction = DoorDirection.S; nextRoomDoor.Direction = DoorDirection.N; - roomDoor.OriginPosition = new Vector2I(x, room.GetVerticalEnd()); - nextRoomDoor.OriginPosition = new Vector2I(x, nextRoom.GetVerticalStart()); + roomDoor.OriginPosition = new Vector2I(x, roomInfo.GetVerticalEnd()); + nextRoomDoor.OriginPosition = new Vector2I(x, nextRoomInfo.GetVerticalStart()); } else //room在下, nextRoom在上 { roomDoor.Direction = DoorDirection.N; nextRoomDoor.Direction = DoorDirection.S; - roomDoor.OriginPosition = new Vector2I(x, room.GetVerticalStart()); - nextRoomDoor.OriginPosition = new Vector2I(x, nextRoom.GetVerticalEnd()); + roomDoor.OriginPosition = new Vector2I(x, roomInfo.GetVerticalStart()); + nextRoomDoor.OriginPosition = new Vector2I(x, nextRoomInfo.GetVerticalEnd()); } //判断门之间的通道是否有物体碰到 @@ -633,8 +631,8 @@ } //没有撞到物体 - room.Doors.Add(roomDoor); - nextRoom.Doors.Add(nextRoomDoor); + roomInfo.Doors.Add(roomDoor); + nextRoomInfo.Doors.Add(nextRoomDoor); return true; } } @@ -645,16 +643,16 @@ /// /// 尝试寻找纵轴方向上两个房间的连通的门, 只查找直线通道, 返回是否找到 /// - private bool TryConnectVerticalDoor(RoomInfo room, RoomDoorInfo roomDoor, RoomInfo nextRoom, RoomDoorInfo nextRoomDoor) + private bool TryConnectVerticalDoor(RoomInfo roomInfo, RoomDoorInfo roomDoor, RoomInfo nextRoomInfo, RoomDoorInfo nextRoomDoor) { - var overlapY = Mathf.Min(room.GetVerticalEnd(), nextRoom.GetVerticalEnd()) - - Mathf.Max(room.GetVerticalStart(), nextRoom.GetVerticalStart()); + var overlapY = Mathf.Min(roomInfo.GetVerticalEnd(), nextRoomInfo.GetVerticalEnd()) - + Mathf.Max(roomInfo.GetVerticalStart(), nextRoomInfo.GetVerticalStart()); //这种情况下y轴有重叠 if (overlapY >= 6) { //找到重叠区域 - var rangeList = FindPassage(room, nextRoom, - room.GetHorizontalStart() < nextRoom.GetHorizontalStart() ? DoorDirection.E : DoorDirection.W); + var rangeList = FindPassage(roomInfo, nextRoomInfo, + roomInfo.GetHorizontalStart() < nextRoomInfo.GetHorizontalStart() ? DoorDirection.E : DoorDirection.W); while (rangeList.Count > 0) { @@ -662,19 +660,19 @@ var range = Random.RandomChooseAndRemove(rangeList); var y = Random.RandomRangeInt(range.X, range.Y); - if (room.GetHorizontalStart() < nextRoom.GetHorizontalStart()) //room在左, nextRoom在右 + if (roomInfo.GetHorizontalStart() < nextRoomInfo.GetHorizontalStart()) //room在左, nextRoom在右 { roomDoor.Direction = DoorDirection.E; nextRoomDoor.Direction = DoorDirection.W; - roomDoor.OriginPosition = new Vector2I(room.GetHorizontalEnd(), y); - nextRoomDoor.OriginPosition = new Vector2I(nextRoom.GetHorizontalStart(), y); + roomDoor.OriginPosition = new Vector2I(roomInfo.GetHorizontalEnd(), y); + nextRoomDoor.OriginPosition = new Vector2I(nextRoomInfo.GetHorizontalStart(), y); } else //room在右, nextRoom在左 { roomDoor.Direction = DoorDirection.W; nextRoomDoor.Direction = DoorDirection.E; - roomDoor.OriginPosition = new Vector2I(room.GetHorizontalStart(), y); - nextRoomDoor.OriginPosition = new Vector2I(nextRoom.GetHorizontalEnd(), y); + roomDoor.OriginPosition = new Vector2I(roomInfo.GetHorizontalStart(), y); + nextRoomDoor.OriginPosition = new Vector2I(nextRoomInfo.GetHorizontalEnd(), y); } //判断门之间的通道是否有物体碰到 @@ -685,8 +683,8 @@ } //没有撞到物体 - room.Doors.Add(roomDoor); - nextRoom.Doors.Add(nextRoomDoor); + roomInfo.Doors.Add(roomDoor); + nextRoomInfo.Doors.Add(nextRoomDoor); return true; } } @@ -697,27 +695,27 @@ /// /// 尝试寻找包含拐角的两个房间的连通的门, 返回是否找到 /// - private bool TryConnectCrossDoor(RoomInfo room, RoomDoorInfo roomDoor, RoomInfo nextRoom, RoomDoorInfo nextRoomDoor) + private bool TryConnectCrossDoor(RoomInfo roomInfo, RoomDoorInfo roomDoor, RoomInfo nextRoomInfo, RoomDoorInfo nextRoomDoor) { //焦点 Vector2I cross = default; - if (room.GetHorizontalStart() > nextRoom.GetHorizontalStart()) + if (roomInfo.GetHorizontalStart() > nextRoomInfo.GetHorizontalStart()) { - if (room.GetVerticalStart() > nextRoom.GetVerticalStart()) + if (roomInfo.GetVerticalStart() > nextRoomInfo.GetVerticalStart()) { if (Random.RandomBoolean()) //↑ //→ { - if (!TryConnect_NE_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross) && - !TryConnect_WS_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross)) + if (!TryConnect_NE_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross) && + !TryConnect_WS_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross)) { return false; } } else //← //↓ { - if (!TryConnect_WS_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross) && - !TryConnect_NE_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross)) + if (!TryConnect_WS_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross) && + !TryConnect_NE_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross)) { return false; } @@ -727,16 +725,16 @@ { if (Random.RandomBoolean()) //↓ //→ { - if (!TryConnect_SE_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross) && - !TryConnect_WN_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross)) + if (!TryConnect_SE_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross) && + !TryConnect_WN_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross)) { return false; } } else //← //↑ { - if (!TryConnect_WN_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross) && - !TryConnect_SE_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross)) + if (!TryConnect_WN_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross) && + !TryConnect_SE_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross)) { return false; } @@ -745,20 +743,20 @@ } else { - if (room.GetVerticalStart() > nextRoom.GetVerticalStart()) //→ //↓ + if (roomInfo.GetVerticalStart() > nextRoomInfo.GetVerticalStart()) //→ //↓ { if (Random.RandomBoolean()) { - if (!TryConnect_ES_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross) && - !TryConnect_NW_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross)) + if (!TryConnect_ES_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross) && + !TryConnect_NW_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross)) { return false; } } else //↑ //← { - if (!TryConnect_NW_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross) && - !TryConnect_ES_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross)) + if (!TryConnect_NW_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross) && + !TryConnect_ES_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross)) { return false; } @@ -768,16 +766,16 @@ { if (Random.RandomBoolean()) //→ //↑ { - if (!TryConnect_EN_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross) && - !TryConnect_SW_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross)) + if (!TryConnect_EN_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross) && + !TryConnect_SW_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross)) { return false; } } else //↓ //← { - if (!TryConnect_SW_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross) && - !TryConnect_EN_Door(room, nextRoom, roomDoor, nextRoomDoor, ref cross)) + if (!TryConnect_SW_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross) && + !TryConnect_EN_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross)) { return false; } @@ -797,24 +795,24 @@ nextRoomDoor.HasCross = true; nextRoomDoor.Cross = cross; - room.Doors.Add(roomDoor); - nextRoom.Doors.Add(nextRoomDoor); + roomInfo.Doors.Add(roomDoor); + nextRoomInfo.Doors.Add(nextRoomDoor); return true; } - private bool FindCrossPassage(RoomInfo room, RoomInfo nextRoom, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor,ref int offset1, ref int offset2) + private bool FindCrossPassage(RoomInfo roomInfo, RoomInfo nextRoomInfo, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor,ref int offset1, ref int offset2) { - var room1 = room.RoomSplit.RoomInfo; - var room2 = nextRoom.RoomSplit.RoomInfo; + var room1 = roomInfo.RoomSplit.RoomInfo; + var room2 = nextRoomInfo.RoomSplit.RoomInfo; int? temp1 = null; int? temp2 = null; - foreach (var areaInfo1 in room1.DoorAreaInfos) + foreach (var areaInfo1 in room1.GetCompletionDoorArea()) { if (areaInfo1.Direction == roomDoor.Direction) { - FindCrossPassage_Area(areaInfo1, room, nextRoom, ref temp1); + FindCrossPassage_Area(areaInfo1, roomInfo, nextRoomInfo, ref temp1); } } @@ -823,11 +821,11 @@ return false; } - foreach (var areaInfo2 in room2.DoorAreaInfos) + foreach (var areaInfo2 in room2.GetCompletionDoorArea()) { if (areaInfo2.Direction == nextRoomDoor.Direction) { - FindCrossPassage_Area(areaInfo2, nextRoom, room, ref temp2); + FindCrossPassage_Area(areaInfo2, nextRoomInfo, roomInfo, ref temp2); } } @@ -931,26 +929,26 @@ } } - private bool TryConnect_NE_Door(RoomInfo room, RoomInfo nextRoom, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) + private bool TryConnect_NE_Door(RoomInfo roomInfo, RoomInfo nextRoomInfo, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) { var offset1 = 0; var offset2 = 0; roomDoor.Direction = DoorDirection.N; //↑ nextRoomDoor.Direction = DoorDirection.E; //→ - if (!FindCrossPassage(room, nextRoom, roomDoor, nextRoomDoor, ref offset1, ref offset2)) + if (!FindCrossPassage(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref offset1, ref offset2)) { return false; } - roomDoor.OriginPosition = new Vector2I(room.GetHorizontalStart() + offset1, room.GetVerticalStart()); - nextRoomDoor.OriginPosition = new Vector2I(nextRoom.GetHorizontalEnd(), - nextRoom.GetVerticalStart() + offset2); + roomDoor.OriginPosition = new Vector2I(roomInfo.GetHorizontalStart() + offset1, roomInfo.GetVerticalStart()); + nextRoomDoor.OriginPosition = new Vector2I(nextRoomInfo.GetHorizontalEnd(), + nextRoomInfo.GetVerticalStart() + offset2); cross = new Vector2I(roomDoor.OriginPosition.X, nextRoomDoor.OriginPosition.Y); return true; } - private bool TryConnect_WS_Door(RoomInfo room, RoomInfo nextRoom, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) + private bool TryConnect_WS_Door(RoomInfo roomInfo, RoomInfo nextRoomInfo, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) { //ok var offset1 = 0; @@ -958,128 +956,128 @@ roomDoor.Direction = DoorDirection.W; //← nextRoomDoor.Direction = DoorDirection.S; //↓ - if (!FindCrossPassage(room, nextRoom, roomDoor, nextRoomDoor, ref offset1, ref offset2)) + if (!FindCrossPassage(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref offset1, ref offset2)) { return false; } - roomDoor.OriginPosition = new Vector2I(room.GetHorizontalStart(), room.GetVerticalStart() + offset1); - nextRoomDoor.OriginPosition = new Vector2I(nextRoom.GetHorizontalStart() + offset2, nextRoom.GetVerticalEnd()); + roomDoor.OriginPosition = new Vector2I(roomInfo.GetHorizontalStart(), roomInfo.GetVerticalStart() + offset1); + nextRoomDoor.OriginPosition = new Vector2I(nextRoomInfo.GetHorizontalStart() + offset2, nextRoomInfo.GetVerticalEnd()); cross = new Vector2I(nextRoomDoor.OriginPosition.X, roomDoor.OriginPosition.Y); return true; } - private bool TryConnect_SE_Door(RoomInfo room, RoomInfo nextRoom, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) + private bool TryConnect_SE_Door(RoomInfo roomInfo, RoomInfo nextRoomInfo, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) { var offset1 = 0; var offset2 = 0; roomDoor.Direction = DoorDirection.S; //↓ nextRoomDoor.Direction = DoorDirection.E; //→ - if (!FindCrossPassage(room, nextRoom, roomDoor, nextRoomDoor, ref offset1, ref offset2)) + if (!FindCrossPassage(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref offset1, ref offset2)) { return false; } - roomDoor.OriginPosition = new Vector2I(room.GetHorizontalStart() + offset1, room.GetVerticalEnd()); - nextRoomDoor.OriginPosition = new Vector2I(nextRoom.GetHorizontalEnd(), - nextRoom.GetVerticalStart() + offset2); + roomDoor.OriginPosition = new Vector2I(roomInfo.GetHorizontalStart() + offset1, roomInfo.GetVerticalEnd()); + nextRoomDoor.OriginPosition = new Vector2I(nextRoomInfo.GetHorizontalEnd(), + nextRoomInfo.GetVerticalStart() + offset2); cross = new Vector2I(roomDoor.OriginPosition.X, nextRoomDoor.OriginPosition.Y); return true; } - private bool TryConnect_WN_Door(RoomInfo room, RoomInfo nextRoom, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) + private bool TryConnect_WN_Door(RoomInfo roomInfo, RoomInfo nextRoomInfo, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) { var offset1 = 0; var offset2 = 0; roomDoor.Direction = DoorDirection.W; //← nextRoomDoor.Direction = DoorDirection.N; //↑ - if (!FindCrossPassage(room, nextRoom, roomDoor, nextRoomDoor, ref offset1, ref offset2)) + if (!FindCrossPassage(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref offset1, ref offset2)) { return false; } roomDoor.OriginPosition = - new Vector2I(room.GetHorizontalStart(), room.GetVerticalStart() + offset1); // - nextRoomDoor.OriginPosition = new Vector2I(nextRoom.GetHorizontalStart() + offset2, - nextRoom.GetVerticalStart()); + new Vector2I(roomInfo.GetHorizontalStart(), roomInfo.GetVerticalStart() + offset1); // + nextRoomDoor.OriginPosition = new Vector2I(nextRoomInfo.GetHorizontalStart() + offset2, + nextRoomInfo.GetVerticalStart()); cross = new Vector2I(nextRoomDoor.OriginPosition.X, roomDoor.OriginPosition.Y); return true; } - private bool TryConnect_ES_Door(RoomInfo room, RoomInfo nextRoom, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) + private bool TryConnect_ES_Door(RoomInfo roomInfo, RoomInfo nextRoomInfo, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) { var offset1 = 0; var offset2 = 0; roomDoor.Direction = DoorDirection.E; //→ nextRoomDoor.Direction = DoorDirection.S; //↓ - if (!FindCrossPassage(room, nextRoom, roomDoor, nextRoomDoor, ref offset1, ref offset2)) + if (!FindCrossPassage(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref offset1, ref offset2)) { return false; } - roomDoor.OriginPosition = new Vector2I(room.GetHorizontalEnd(), room.GetVerticalStart() + offset1); - nextRoomDoor.OriginPosition = new Vector2I(nextRoom.GetHorizontalStart() + offset2, - nextRoom.GetVerticalEnd()); + roomDoor.OriginPosition = new Vector2I(roomInfo.GetHorizontalEnd(), roomInfo.GetVerticalStart() + offset1); + nextRoomDoor.OriginPosition = new Vector2I(nextRoomInfo.GetHorizontalStart() + offset2, + nextRoomInfo.GetVerticalEnd()); cross = new Vector2I(nextRoomDoor.OriginPosition.X, roomDoor.OriginPosition.Y); return true; } - private bool TryConnect_NW_Door(RoomInfo room, RoomInfo nextRoom, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) + private bool TryConnect_NW_Door(RoomInfo roomInfo, RoomInfo nextRoomInfo, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) { var offset1 = 0; var offset2 = 0; roomDoor.Direction = DoorDirection.N; //↑ nextRoomDoor.Direction = DoorDirection.W; //← - if (!FindCrossPassage(room, nextRoom, roomDoor, nextRoomDoor, ref offset1, ref offset2)) + if (!FindCrossPassage(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref offset1, ref offset2)) { return false; } - roomDoor.OriginPosition = new Vector2I(room.GetHorizontalStart() + offset1, room.GetVerticalStart()); - nextRoomDoor.OriginPosition = new Vector2I(nextRoom.GetHorizontalStart(), - nextRoom.GetVerticalStart() + offset2); + roomDoor.OriginPosition = new Vector2I(roomInfo.GetHorizontalStart() + offset1, roomInfo.GetVerticalStart()); + nextRoomDoor.OriginPosition = new Vector2I(nextRoomInfo.GetHorizontalStart(), + nextRoomInfo.GetVerticalStart() + offset2); cross = new Vector2I(roomDoor.OriginPosition.X, nextRoomDoor.OriginPosition.Y); return true; } - private bool TryConnect_EN_Door(RoomInfo room, RoomInfo nextRoom, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) + private bool TryConnect_EN_Door(RoomInfo roomInfo, RoomInfo nextRoomInfo, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) { var offset1 = 0; var offset2 = 0; roomDoor.Direction = DoorDirection.E; //→ nextRoomDoor.Direction = DoorDirection.N; //↑ - if (!FindCrossPassage(room, nextRoom, roomDoor, nextRoomDoor, ref offset1, ref offset2)) + if (!FindCrossPassage(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref offset1, ref offset2)) { return false; } - roomDoor.OriginPosition = new Vector2I(room.GetHorizontalEnd(), - room.GetVerticalStart() + offset1); - nextRoomDoor.OriginPosition = new Vector2I(nextRoom.GetHorizontalStart() + offset2, nextRoom.GetVerticalStart()); + roomDoor.OriginPosition = new Vector2I(roomInfo.GetHorizontalEnd(), + roomInfo.GetVerticalStart() + offset1); + nextRoomDoor.OriginPosition = new Vector2I(nextRoomInfo.GetHorizontalStart() + offset2, nextRoomInfo.GetVerticalStart()); cross = new Vector2I(nextRoomDoor.OriginPosition.X, roomDoor.OriginPosition.Y); return true; } - private bool TryConnect_SW_Door(RoomInfo room, RoomInfo nextRoom, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) + private bool TryConnect_SW_Door(RoomInfo roomInfo, RoomInfo nextRoomInfo, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor, ref Vector2I cross) { var offset1 = 0; var offset2 = 0; roomDoor.Direction = DoorDirection.S; //↓ nextRoomDoor.Direction = DoorDirection.W; //← - if (!FindCrossPassage(room, nextRoom, roomDoor, nextRoomDoor, ref offset1, ref offset2)) + if (!FindCrossPassage(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref offset1, ref offset2)) { return false; } - roomDoor.OriginPosition = new Vector2I(room.GetHorizontalStart() + offset1, - room.GetVerticalEnd()); - nextRoomDoor.OriginPosition = new Vector2I(nextRoom.GetHorizontalStart(), nextRoom.GetVerticalStart() + offset2); + roomDoor.OriginPosition = new Vector2I(roomInfo.GetHorizontalStart() + offset1, + roomInfo.GetVerticalEnd()); + nextRoomDoor.OriginPosition = new Vector2I(nextRoomInfo.GetHorizontalStart(), nextRoomInfo.GetVerticalStart() + offset2); cross = new Vector2I(roomDoor.OriginPosition.X, nextRoomDoor.OriginPosition.Y); return true; } @@ -1087,25 +1085,25 @@ /// /// 查找房间的连接通道, 函数返回是否找到对应的门, 通过 result 返回 x/y 轴坐标 /// - /// 第一个房间 - /// 第二个房间 + /// 第一个房间 + /// 第二个房间 /// 第一个房间连接方向 - private List FindPassage(RoomInfo room, RoomInfo nextRoom, DoorDirection direction) + private List FindPassage(RoomInfo roomInfo, RoomInfo nextRoomInfo, DoorDirection direction) { - var room1 = room.RoomSplit.RoomInfo; - var room2 = nextRoom.RoomSplit.RoomInfo; + var room1 = roomInfo.RoomSplit.RoomInfo; + var room2 = nextRoomInfo.RoomSplit.RoomInfo; //用于存储符合生成条件的区域 var rangeList = new List(); - foreach (var doorAreaInfo1 in room1.DoorAreaInfos) + foreach (var doorAreaInfo1 in room1.GetCompletionDoorArea()) { if (doorAreaInfo1.Direction == direction) { //第二个门的方向 var direction2 = GetReverseDirection(direction); - foreach (var doorAreaInfo2 in room2.DoorAreaInfos) + foreach (var doorAreaInfo2 in room2.GetCompletionDoorArea()) { if (doorAreaInfo2.Direction == direction2) { @@ -1113,15 +1111,15 @@ if (direction == DoorDirection.E || direction == DoorDirection.W) //第二个门向← 或者 第二个门向→ { range = CalcOverlapRange( - room.GetVerticalStart() * GameConfig.TileCellSize + doorAreaInfo1.Start, room.GetVerticalStart() * GameConfig.TileCellSize + doorAreaInfo1.End, - nextRoom.GetVerticalStart() * GameConfig.TileCellSize + doorAreaInfo2.Start, nextRoom.GetVerticalStart() * GameConfig.TileCellSize + doorAreaInfo2.End + roomInfo.GetVerticalStart() * GameConfig.TileCellSize + doorAreaInfo1.Start, roomInfo.GetVerticalStart() * GameConfig.TileCellSize + doorAreaInfo1.End, + nextRoomInfo.GetVerticalStart() * GameConfig.TileCellSize + doorAreaInfo2.Start, nextRoomInfo.GetVerticalStart() * GameConfig.TileCellSize + doorAreaInfo2.End ); } else //第二个门向↑ 或者 第二个门向↓ { range = CalcOverlapRange( - room.GetHorizontalStart() * GameConfig.TileCellSize + doorAreaInfo1.Start, room.GetHorizontalStart() * GameConfig.TileCellSize + doorAreaInfo1.End, - nextRoom.GetHorizontalStart() * GameConfig.TileCellSize + doorAreaInfo2.Start, nextRoom.GetHorizontalStart() * GameConfig.TileCellSize + doorAreaInfo2.End + roomInfo.GetHorizontalStart() * GameConfig.TileCellSize + doorAreaInfo1.Start, roomInfo.GetHorizontalStart() * GameConfig.TileCellSize + doorAreaInfo1.End, + nextRoomInfo.GetHorizontalStart() * GameConfig.TileCellSize + doorAreaInfo2.Start, nextRoomInfo.GetHorizontalStart() * GameConfig.TileCellSize + doorAreaInfo2.End ); } //交集范围够生成门 diff --git a/DungeonShooting_Godot/src/framework/map/DungeonRoomTemplate.cs b/DungeonShooting_Godot/src/framework/map/DungeonRoomTemplate.cs deleted file mode 100644 index 456324b..0000000 --- a/DungeonShooting_Godot/src/framework/map/DungeonRoomTemplate.cs +++ /dev/null @@ -1,942 +0,0 @@ -/* -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text.Json; -using Generator; -using Godot; - -[Tool] -public partial class DungeonRoomTemplate : TileMap -{ - /// - /// 是否启用编辑模式 - /// - [Export] - public bool EnableEdit = false; - - /// - /// 房间权重, 值越大, 生成地牢是越容易出现该房间 - /// - [Export(PropertyHint.Range, "1, 500")] - public int Weight - { - get => _weight; - set - { - _weight = value; - _changeWeight = true; - _changeWeightTimer = 0; - } - } - private int _weight = DefaultWeight; - private bool _changeWeight = false; - private float _changeWeightTimer = 0; - -#if TOOLS - //是否悬停在线上 - private bool _hover = false; - - //悬停点 - private Vector2 _hoverPoint1; - private Vector2 _hoverPoint2; - private DoorDirection _hoverDirection; - private bool _canPut = false; - - //选中点 - private bool _hasActivePoint = false; - //选中左/右点 - private byte _activePointType = 0; - private DoorAreaInfo _activeArea = null; - - //拖拽 - private bool _isDrag = false; - private float _startDragValue; - private Vector2 _startDragPositionValue; - private bool _dragHasCollision = false; - - private bool _mouseDown = false; - - //房间配置 - private DungeonRoomInfo _dungeonRoomInfo; - private Rect2 _prevRect; - - //是否能是否按下 - private bool _clickSave = false; - - private DungeonTileMap _dungeonTileMap; - 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._dungeonRoomInfo != null && RoomTemplate._dungeonRoomInfo.DoorAreaInfos != null) - { - var color2 = new Color(0, 1, 0, 0.8f); - //绘制已经存在的 - foreach (var doorAreaInfo in RoomTemplate._dungeonRoomInfo.DoorAreaInfos) - { - 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._dungeonTileMap != null) - { - var result = RoomTemplate._dungeonTileMap.GetGenerateNavigationResult(); - if (result != null) - { - if (result.Success) - { - var polygonData = RoomTemplate._dungeonTileMap.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()) - { - return; - } - EnableEdit = false; - } - - public override void _Process(double delta) - { - if (!Engine.IsEditorHint()) - { - return; - } - - if (TileSet == null) - { - return; - } - - if (_dungeonTileMap == null) - { - _dungeonTileMap = new DungeonTileMap(this); - _dungeonTileMap.SetFloorAtlasCoords(new List() { new Vector2I(0, 8) }); - OnTileChanged(); - var callable = new Callable(this, nameof(OnTileChanged)); - if (!IsConnected("changed", callable)) - { - Connect("changed", callable); - } - } - - if (_tileDrawHandler == null) - { - _tileDrawHandler = GetNodeOrNull("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) - { - _calcTileNavTimer -= (float)delta; - //重新计算导航 - if (_calcTileNavTimer <= 0) - { - _dungeonTileMap.GenerateNavigationPolygon(0); - } - } - - //加载配置 - var initConfigs = false; - if (_dungeonRoomInfo == null) - { - initConfigs = true; - - var path = SceneFilePath; - if (!string.IsNullOrEmpty(path)) - { - var start = GameConfig.RoomTileDir.Length + 6; - var name = path.Substring(start, path.Length - start - 5); - ReadConfig(CalcTileRange(this), name); - } - - } - - //按键检测 - var isClick = false; - if (Input.IsMouseButtonPressed(MouseButton.Left)) - { - if (!_mouseDown) - { - _mouseDown = true; - isClick = true; - } - } - else if (_mouseDown) - { - _mouseDown = false; - isClick = false; - } - - if (Input.IsMouseButtonPressed(MouseButton.Middle)) //中键移除门 - { - if (EnableEdit && _activeArea != null) - { - RemoveDoorArea(_activeArea); - _hasActivePoint = false; - _activeArea = null; - } - } - else if (TileSet != null) //编辑操作 - { - var mapRect = CalcTileRange(this); - var mousePosition = GetLocalMousePosition(); - - if (mapRect != _prevRect) - { - if (!initConfigs) - { - OnMapRectChange(); - } - } - - _prevRect = mapRect; - - if (EnableEdit) - { - var tileSize = TileSet.TileSize; - if (_isDrag) //拖拽中 - { - if (_activeArea != null) - { - //拖拽节点操作 - if (_activeArea.Direction == DoorDirection.N || _activeArea.Direction == DoorDirection.S) - { - if (_activePointType == 0) - { - var mouseOffset = Approach(mousePosition.X, tileSize.X); - _activeArea.StartPosition = new Vector2(mouseOffset, _activeArea.StartPosition.Y); - _activeArea.Start = mouseOffset - mapRect.Position.X; - _dragHasCollision = _activeArea.StartPosition.X <= mapRect.Position.X || - _activeArea.StartPosition.X + 3 * tileSize.X >= - _activeArea.EndPosition.X || - CheckDoorCollision(_activeArea.Direction, _activeArea); - } - else - { - var mouseOffset = Approach(mousePosition.X, tileSize.X); - _activeArea.EndPosition = new Vector2(mouseOffset, _activeArea.EndPosition.Y); - _activeArea.End = mouseOffset - mapRect.Position.X; - _dragHasCollision = _activeArea.EndPosition.X >= mapRect.Position.X + mapRect.Size.X || - _activeArea.EndPosition.X - 3 * tileSize.X <= - _activeArea.StartPosition.X || - CheckDoorCollision(_activeArea.Direction, _activeArea); - } - } - else - { - if (_activePointType == 0) - { - var mouseOffset = Approach(mousePosition.Y, tileSize.Y); - _activeArea.StartPosition = new Vector2(_activeArea.StartPosition.X, mouseOffset); - _activeArea.Start = mouseOffset - mapRect.Position.Y; - _dragHasCollision = _activeArea.StartPosition.Y <= mapRect.Position.Y || - _activeArea.StartPosition.Y + 3 * tileSize.Y >= - _activeArea.EndPosition.Y || - CheckDoorCollision(_activeArea.Direction, _activeArea); - } - else - { - var mouseOffset = Approach(mousePosition.Y, tileSize.Y); - _activeArea.EndPosition = new Vector2(_activeArea.EndPosition.X, mouseOffset); - _activeArea.End = mouseOffset - mapRect.Position.Y; - _dragHasCollision = _activeArea.EndPosition.Y >= mapRect.Position.Y + mapRect.Size.Y || - _activeArea.EndPosition.Y - 3 * tileSize.Y <= - _activeArea.StartPosition.Y || - CheckDoorCollision(_activeArea.Direction, _activeArea); - } - } - } - } - else - { - if (Mathf.Abs(mousePosition.Y - mapRect.Position.Y) <= 8 && mousePosition.X >= mapRect.Position.X && - mousePosition.X <= mapRect.Position.X + mapRect.Size.X) //上 - { - _hover = true; - _hoverDirection = DoorDirection.N; - var mouseOffset = Approach(mousePosition.X, tileSize.X); - _hoverPoint1 = new Vector2(mouseOffset - tileSize.X * 2, mapRect.Position.Y); - _hoverPoint2 = new Vector2(_hoverPoint1.X + tileSize.X * 4, _hoverPoint1.Y); - - //判断是否能放下新的门 - if (_hoverPoint1.X <= mapRect.Position.X || - _hoverPoint2.X >= mapRect.Position.X + mapRect.Size.X || - CheckDoorCollision()) - { - _canPut = false; - FindHoverPoint(mouseOffset); - } - else - { - _canPut = true; - _hasActivePoint = false; - _activeArea = null; - } - } - else if (Mathf.Abs(mousePosition.X - mapRect.Position.X) <= 8 && - mousePosition.Y >= mapRect.Position.Y && - mousePosition.Y <= mapRect.Position.Y + mapRect.Size.Y) //左 - { - _hover = true; - _hoverDirection = DoorDirection.W; - var mouseOffset = Approach(mousePosition.Y, tileSize.Y); - _hoverPoint1 = new Vector2(mapRect.Position.X, mouseOffset - tileSize.Y * 2); - _hoverPoint2 = new Vector2(_hoverPoint1.X, _hoverPoint1.Y + tileSize.X * 4); - - //判断是否能放下新的门 - if (_hoverPoint1.Y <= mapRect.Position.Y || - _hoverPoint2.Y >= mapRect.Position.Y + mapRect.Size.Y || - CheckDoorCollision()) - { - _canPut = false; - FindHoverPoint(mouseOffset); - } - else - { - _canPut = true; - _hasActivePoint = false; - _activeArea = null; - } - } - else if (Mathf.Abs(mousePosition.Y - (mapRect.Position.Y + mapRect.Size.Y)) <= 8 && - mousePosition.X >= mapRect.Position.X && - mousePosition.X <= mapRect.Position.X + mapRect.Size.X) //下 - { - _hover = true; - _hoverDirection = DoorDirection.S; - var mouseOffset = Approach(mousePosition.X, tileSize.X); - _hoverPoint1 = new Vector2(mouseOffset - tileSize.X * 2, - mapRect.Position.Y + mapRect.Size.Y); - _hoverPoint2 = new Vector2(_hoverPoint1.X + tileSize.X * 4, _hoverPoint1.Y); - - //判断是否能放下新的门 - if (_hoverPoint1.X <= mapRect.Position.X || - _hoverPoint2.X >= mapRect.Position.X + mapRect.Size.X || - CheckDoorCollision()) - { - _canPut = false; - FindHoverPoint(mouseOffset); - } - else - { - _canPut = true; - _hasActivePoint = false; - _activeArea = null; - } - } - else if (Mathf.Abs(mousePosition.X - (mapRect.Position.X + mapRect.Size.X)) <= 8 && - mousePosition.Y >= mapRect.Position.Y && - mousePosition.Y <= mapRect.Position.Y + mapRect.Size.Y) //右 - { - _hover = true; - _hoverDirection = DoorDirection.E; - var mouseOffset = Approach(mousePosition.Y, tileSize.Y); - _hoverPoint1 = new Vector2(mapRect.Position.X + mapRect.Size.X, - mouseOffset - tileSize.Y * 2); - _hoverPoint2 = new Vector2(_hoverPoint1.X, _hoverPoint1.Y + tileSize.X * 4); - - //判断是否能放下新的门 - if (_hoverPoint1.Y <= mapRect.Position.Y || - _hoverPoint2.Y >= mapRect.Position.Y + mapRect.Size.Y || - CheckDoorCollision()) - { - _canPut = false; - FindHoverPoint(mouseOffset); - } - else - { - _canPut = true; - _hasActivePoint = false; - _activeArea = null; - } - } - else - { - ClearState(); - } - } - - if (isClick && _canPut) //判断是否可以创建新的点 - { - CreateDoorArea(mapRect); - } - else if (_mouseDown && !_isDrag) //拖拽节点 - { - _isDrag = true; - _dragHasCollision = false; - if (_activeArea != null) - { - if (_activePointType == 0) - { - _startDragValue = _activeArea.Start; - _startDragPositionValue = _activeArea.StartPosition; - } - else - { - _startDragValue = _activeArea.End; - _startDragPositionValue = _activeArea.EndPosition; - } - } - } - else if (!_mouseDown && _isDrag) //松开拖拽的点 - { - _isDrag = false; - if (_activeArea != null) //提交拖拽结果 - { - if (_dragHasCollision) - { - if (_activePointType == 0) - { - _activeArea.Start = _startDragValue; - _activeArea.StartPosition = _startDragPositionValue; - } - else - { - _activeArea.End = _startDragValue; - _activeArea.EndPosition = _startDragPositionValue; - } - } - - //OnDoorAreaChange(); - } - - _dragHasCollision = false; - } - } - else - { - ClearState(); - } - - _tileDrawHandler.QueueRedraw(); - } - else - { - ClearState(); - } - - //按下 ctrl + s 保存 - if (Input.IsKeyPressed(Key.Ctrl) && Input.IsKeyPressed(Key.S)) - { - if (!_clickSave) - { - TriggerSave(); - } - _clickSave = true; - - // if (_canSave) - // { - // _canSave = false; - // TriggerSave(); - // } - } - else - { - _clickSave = false; - } - - //权重发生改变 - if (_changeWeight) - { - _changeWeightTimer += (float)delta; - if (_changeWeightTimer > 1) - { - _changeWeightTimer = 0; - _changeWeight = false; - //权重改变, 保存数据 - TriggerSave(); - } - } - } - - private void ClearState() - { - _hover = false; - _canPut = false; - _hasActivePoint = false; - _activeArea = null; - } - - private void OnTileChanged() - { - _calcTileNavTimer = 1f; - } - - //创建门 - private void CreateDoorArea(Rect2 mapRect) - { - var doorAreaInfo = new DoorAreaInfo(); - doorAreaInfo.Direction = _hoverDirection; - doorAreaInfo.StartPosition = _hoverPoint1; - doorAreaInfo.EndPosition = _hoverPoint2; - switch (_hoverDirection) - { - case DoorDirection.E: - case DoorDirection.W: - doorAreaInfo.Start = _hoverPoint1.Y - mapRect.Position.Y; - doorAreaInfo.End = _hoverPoint2.Y - mapRect.Position.Y; - break; - case DoorDirection.N: - case DoorDirection.S: - doorAreaInfo.Start = _hoverPoint1.X - mapRect.Position.X; - doorAreaInfo.End = _hoverPoint2.X - mapRect.Position.X; - break; - } - - _dungeonRoomInfo.DoorAreaInfos.Add(doorAreaInfo); - //OnDoorAreaChange(); - } - - //移除门 - private void RemoveDoorArea(DoorAreaInfo doorAreaInfo) - { - _dungeonRoomInfo.DoorAreaInfos.Remove(doorAreaInfo); - //OnDoorAreaChange(); - } - - //检查门是否有碰撞 - private bool CheckDoorCollision() - { - foreach (var doorAreaInfo in _dungeonRoomInfo.DoorAreaInfos) - { - if (doorAreaInfo.Direction == _hoverDirection) - { - switch (_hoverDirection) - { - case DoorDirection.E: - case DoorDirection.W: - if (CheckValueCollision(doorAreaInfo.StartPosition.Y, doorAreaInfo.EndPosition.Y, _hoverPoint1.Y, _hoverPoint2.Y)) - { - return true; - } - break; - case DoorDirection.S: - case DoorDirection.N: - if (CheckValueCollision(doorAreaInfo.StartPosition.X, doorAreaInfo.EndPosition.X, _hoverPoint1.X, _hoverPoint2.X)) - { - return true; - } - break; - } - } - } - - return false; - } - - //检查门是否有碰撞 - private bool CheckDoorCollision(DoorDirection direction, DoorAreaInfo info) - { - foreach (var doorAreaInfo in _dungeonRoomInfo.DoorAreaInfos) - { - if (doorAreaInfo.Direction == direction && info != doorAreaInfo && - CheckValueCollision(doorAreaInfo.Start, doorAreaInfo.End, info.Start, info.End)) - { - return true; - } - } - - return false; - } - - private bool CheckValueCollision(float o1, float o2, float h1, float h2) - { - var size = TileSet.TileSize.X; - return !(h2 < o1 - 3 * size || o2 + 3 * size < h1); - } - - private void FindHoverPoint(float mouseOffset) - { - if (_isDrag) - { - return; - } - - //检测是否有碰撞的点 - var flag = false; - foreach (var doorAreaInfo in _dungeonRoomInfo.DoorAreaInfos) - { - if (doorAreaInfo.Direction == _hoverDirection) - { - if (_hoverDirection == DoorDirection.N || _hoverDirection == DoorDirection.S) - { - if (Math.Abs(doorAreaInfo.StartPosition.X - mouseOffset) < 0.0001f) - { - _hasActivePoint = true; - _activePointType = 0; - _activeArea = doorAreaInfo; - flag = true; - break; - } - else if (Math.Abs(doorAreaInfo.EndPosition.X - mouseOffset) < 0.0001f) - { - _hasActivePoint = true; - _activePointType = 1; - _activeArea = doorAreaInfo; - flag = true; - break; - } - } - else - { - if (Math.Abs(doorAreaInfo.StartPosition.Y - mouseOffset) < 0.0001f) - { - _hasActivePoint = true; - _activePointType = 0; - _activeArea = doorAreaInfo; - flag = true; - break; - } - else if (Math.Abs(doorAreaInfo.EndPosition.Y - mouseOffset) < 0.0001f) - { - _hasActivePoint = true; - _activePointType = 1; - _activeArea = doorAreaInfo; - flag = true; - break; - } - } - } - } - - if (!flag) - { - _hasActivePoint = false; - _activeArea = null; - } - } - - private float Approach(float value, float period) - { - var temp = value % period; - if (Mathf.Abs(temp) >= period / 2) - { - return ((int)(value / period) + (value >= 0 ? 1 : -1)) * period; - } - - return (int)(value / period) * period; - } - - //地图大小改变 - private void OnMapRectChange() - { - _dungeonRoomInfo.DoorAreaInfos.Clear(); - _canPut = false; - _hasActivePoint = false; - _activeArea = null; - //OnDoorAreaChange(); - } - - // //区域数据修改 - // private void OnDoorAreaChange() - // { - // _canSave = true; - // } - - //触发保存操作 - private void TriggerSave() - { - //如果没有找到对应的场景文件,则不保存 - var path = _dungeonRoomInfo.GroupName + "/" + DungeonManager.DungeonRoomTypeToString(_dungeonRoomInfo.RoomType) + "/" + _dungeonRoomInfo.FileName; - if (!File.Exists(GameConfig.RoomTileDir + path + ".tscn")) - { - return; - } - //计算导航网格 - _dungeonTileMap.GenerateNavigationPolygon(0); - var rect = GetUsedRect(); - DungeonRoomInfo.SaveConfig(_dungeonRoomInfo.DoorAreaInfos, rect.Position, rect.Size, - _dungeonRoomInfo.GroupName, _dungeonRoomInfo.RoomType, Name, Weight); - } - - /// - /// 计算tile所占区域 - /// - /// - public static Rect2 CalcTileRange(TileMap tileMap) - { - var usedRect = tileMap.GetUsedRect(); - var pos = usedRect.Position * tileMap.TileSet.TileSize; - var size = usedRect.Size * tileMap.TileSet.TileSize; - return new Rect2(tileMap.ToLocal(pos), size); - } - - /// - /// 读取房间配置 - /// - private void ReadConfig(Rect2 mapRect, string name) - { - var path = GameConfig.RoomTileDataDir + name + ".json"; - - if (File.Exists(path)) - { - var text = File.ReadAllText(path); - try - { - _dungeonRoomInfo = DeserializeDungeonRoomInfo(text); - - //填充 StartPosition 和 EndPosition 数据 - foreach (var doorAreaInfo in _dungeonRoomInfo.DoorAreaInfos) - { - doorAreaInfo.CalcPosition(mapRect.Position, mapRect.Size); - } - - Weight = _dungeonRoomInfo.Weight; - } - catch (Exception e) - { - GD.PrintErr($"加载房间数据'{path}'发生异常: " + e); - } - } - } - - /// - /// 反序列化 DungeonRoomInfo - /// - public static DungeonRoomInfo DeserializeDungeonRoomInfo(string text) - { - // 下面这句代码在 Godot4.0_rc2的编辑器模式下, 重载脚本会导致编辑器一直报错!, 所以暂时先用下面的方法 - //var roomInfo = JsonSerializer.Deserialize(text); - - var obj = Json.ParseString(text).AsGodotDictionary(); - var roomInfo = new DungeonRoomInfo(); - if (obj.ContainsKey("Position")) - { - var position = obj["Position"].AsGodotDictionary(); - roomInfo.Position = new SerializeVector2(position["X"].AsInt32(), position["Y"].AsInt32()); - } - - if (obj.ContainsKey("Size")) - { - var size = obj["Size"].AsGodotDictionary(); - roomInfo.Size = new SerializeVector2(size["X"].AsInt32(), size["Y"].AsInt32()); - } - - if (obj.ContainsKey("RoomType")) - { - var roomType = obj["RoomType"].AsInt32(); - roomInfo.RoomType = (DungeonRoomType)roomType; - } - - if (obj.ContainsKey("GroupName")) - { - roomInfo.GroupName = obj["GroupName"].AsString(); - } - - if (obj.ContainsKey("FileName")) - { - roomInfo.FileName = obj["FileName"].AsString(); - } - - if (obj.ContainsKey("Weight")) - { - roomInfo.Weight = obj["Weight"].AsInt32(); - } - - if (obj.ContainsKey("DoorAreaInfos")) - { - var doorAreaInfos = obj["DoorAreaInfos"].AsGodotArray(); - roomInfo.DoorAreaInfos = new List(); - foreach (var item in doorAreaInfos) - { - var temp = item.AsGodotDictionary(); - var doorInfo = new DoorAreaInfo(); - doorInfo.Direction = (DoorDirection)temp["Direction"].AsInt32(); - doorInfo.Start = temp["Start"].AsInt32(); - doorInfo.End = temp["End"].AsInt32(); - roomInfo.DoorAreaInfos.Add(doorInfo); - } - } - - return roomInfo; - } -#endif - - /// - /// 获取所有标记数据 - /// - public ActivityMark[] GetMarks() - { - var list = new List(); - foreach (var child in GetChildren()) - { - EachAndGetMarks(child, list); - } - - return list.ToArray(); - } - - private void EachAndGetMarks(Node node, List list) - { - if (node is ActivityMark mark) - { - list.Add(mark); - } - foreach (var child in node.GetChildren()) - { - EachAndGetMarks(child, list); - } - } -} -*/ \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs b/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs index bc9133e..1e7bbba 100644 --- a/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs +++ b/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs @@ -34,10 +34,10 @@ /// /// 根据 startRoom 和 config 数据自动填充 tileMap 参数中的地图数据 /// - public void AutoFillRoomTile(AutoTileConfig config, RoomInfo startRoom, SeedRandom random) + public void AutoFillRoomTile(AutoTileConfig config, RoomInfo startRoomInfo, SeedRandom random) { _connectNavigationItemList.Clear(); - _AutoFillRoomTile(config, startRoom, random); + _AutoFillRoomTile(config, startRoomInfo, random); } private void _AutoFillRoomTile(AutoTileConfig config, RoomInfo roomInfo, SeedRandom random) @@ -75,6 +75,7 @@ //var rectSize = roomInfo.RoomSplit.RoomInfo.Size; var rectPos = roomInfo.RoomSplit.RoomInfo.Position.AsVector2I(); //var offset = roomInfo.GetOffsetPosition() / GameConfig.TileCellSizeVector2I; + //填充tile操作 var tileInfo = roomInfo.RoomSplit.TileInfo; for (var i = 0; i < tileInfo.Floor.Count; i += 5) @@ -108,7 +109,9 @@ _tileRoot.SetCell(GameConfig.TopMapLayer, pos, sourceId, new Vector2I(atlasCoordsX, atlasCoordsY)); } - GD.PrintErr("初始化流程得改"); + //初始化标记 + //roomInfo.RoomSplit.Preinstall. + //roomInfo.RoomSplit.TileInfo. // var template = ResourceManager.Load(roomInfo.RoomSplit.ScenePath); // var tileInstance = template.Instantiate(); @@ -681,7 +684,7 @@ _generateNavigationResult = new GenerateNavigationResult(true); } - catch (NavigationPointInterleavingException e) + catch (NavigationPointException e) { _usePoints.Clear(); _polygonDataList.Clear(); @@ -876,7 +879,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); + throw new NavigationPointException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } case 1: //下 { @@ -934,7 +937,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); + throw new NavigationPointException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } case 2: //左 { @@ -994,7 +997,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); + throw new NavigationPointException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } case 3: //上 { @@ -1052,7 +1055,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); + throw new NavigationPointException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } } } @@ -1136,7 +1139,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); + throw new NavigationPointException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } case 1: //下 { @@ -1194,7 +1197,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); + throw new NavigationPointException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } case 2: //左 { @@ -1251,7 +1254,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); + throw new NavigationPointException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } case 3: //上 { @@ -1309,7 +1312,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); + throw new NavigationPointException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } } } @@ -1320,7 +1323,7 @@ { if (_usePoints.Contains(pos)) { - throw new NavigationPointInterleavingException(pos, "生成导航多边形发生错误! 点: " + pos + "发生交错!"); + throw new NavigationPointException(pos, "生成导航多边形发生错误! 点: " + pos + "发生交错!"); } _usePoints.Add(pos); diff --git a/DungeonShooting_Godot/src/framework/map/GenerateNavigationResult.cs b/DungeonShooting_Godot/src/framework/map/GenerateNavigationResult.cs index 9a6001c..1fb2a71 100644 --- a/DungeonShooting_Godot/src/framework/map/GenerateNavigationResult.cs +++ b/DungeonShooting_Godot/src/framework/map/GenerateNavigationResult.cs @@ -4,7 +4,7 @@ /// public class GenerateNavigationResult { - public GenerateNavigationResult(bool success, NavigationPointInterleavingException exception = null) + public GenerateNavigationResult(bool success, NavigationPointException exception = null) { Success = success; Exception = exception; @@ -18,5 +18,5 @@ /// /// 异常信息 /// - public NavigationPointInterleavingException Exception; + public NavigationPointException Exception; } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/NavigationPointException.cs b/DungeonShooting_Godot/src/framework/map/NavigationPointException.cs new file mode 100644 index 0000000..d48bc69 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/NavigationPointException.cs @@ -0,0 +1,19 @@ + +using System; +using Godot; + +/// +/// 导航点交错异常 +/// +public class NavigationPointException : Exception +{ + /// + /// 交错点 + /// + public Vector2I Point { get; } + + public NavigationPointException(Vector2I point, string message): base(message) + { + Point = point; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/NavigationPointInterleavingException.cs b/DungeonShooting_Godot/src/framework/map/NavigationPointInterleavingException.cs deleted file mode 100644 index f4f7e9e..0000000 --- a/DungeonShooting_Godot/src/framework/map/NavigationPointInterleavingException.cs +++ /dev/null @@ -1,19 +0,0 @@ - -using System; -using Godot; - -/// -/// 导航点交错异常 -/// -public class NavigationPointInterleavingException : Exception -{ - /// - /// 交错点 - /// - public Vector2I Point { get; } - - public NavigationPointInterleavingException(Vector2I point, string message): base(message) - { - Point = point; - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/RoomDoorInfo.cs b/DungeonShooting_Godot/src/framework/map/RoomDoorInfo.cs deleted file mode 100644 index 6e029fa..0000000 --- a/DungeonShooting_Godot/src/framework/map/RoomDoorInfo.cs +++ /dev/null @@ -1,64 +0,0 @@ - -using Godot; - -/// -/// 房间的门 -/// -public class RoomDoorInfo -{ - /// - /// 所在墙面方向 - /// - public DoorDirection Direction; - - /// - /// 所在的房间 - /// - public RoomInfo RoomInfo; - - /// - /// 连接的门 - /// - public RoomDoorInfo ConnectDoor; - - /// - /// 连接的房间 - /// - public RoomInfo ConnectRoom; - - /// - /// 原点坐标, 单位: 格 - /// - public Vector2I OriginPosition; - - /// - /// 与下一道门是否有交叉点 - /// - public bool HasCross; - - /// - /// 与下一道门的交叉点, 单位: 格 - /// - public Vector2I Cross; - - /// - /// 占位导航网格 - /// - public DoorNavigationInfo Navigation; - - /// - /// 门实例 - /// - public RoomDoor Door; - - /// - /// 世界坐标下的原点坐标, 单位: 像素 - /// - public Vector2I GetWorldOriginPosition() - { - return new Vector2I( - OriginPosition.X * GameConfig.TileCellSize, - OriginPosition.Y * GameConfig.TileCellSize - ); - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/RoomInfo.cs b/DungeonShooting_Godot/src/framework/map/RoomInfo.cs deleted file mode 100644 index 70f37e4..0000000 --- a/DungeonShooting_Godot/src/framework/map/RoomInfo.cs +++ /dev/null @@ -1,299 +0,0 @@ - -using System.Collections.Generic; -using Godot; - -/// -/// 房间的数据描述 -/// -public class RoomInfo : IDestroy -{ - public RoomInfo(int id, DungeonRoomType type, DungeonRoomSplit roomSplit) - { - Id = id; - RoomType = type; - RoomSplit = roomSplit; - } - - /// - /// 房间 id - /// - public int Id; - - /// - /// 房间类型 - /// - public DungeonRoomType RoomType; - - /// - /// 层级, 也就是离初始房间间隔多少个房间 - /// - public int Layer; - - /// - /// 生成该房间使用的配置数据 - /// - public DungeonRoomSplit RoomSplit; - - /// - /// 房间大小, 单位: 格 - /// - public Vector2I Size; - - /// - /// 房间位置, 单位: 格 - /// - public Vector2I Position; - - /// - /// 门 - /// - public List Doors = new List(); - - /// - /// 连接该房间的过道占用区域信息 - /// - public List AisleArea = new List(); - - /// - /// 下一个房间 - /// - public List Next = new List(); - - /// - /// 上一个房间 - /// - public RoomInfo Prev; - - /// - /// 物体生成标记 - /// - public List ActivityMarks = new List(); - - /// - /// 当前房间归属区域 - /// - public AffiliationArea AffiliationArea; - - /// - /// 静态精灵绘制画布 - /// - public RoomStaticImageCanvas StaticImageCanvas; - - /// - /// 是否处于闭关状态, 也就是房间门没有主动打开 - /// - public bool IsSeclusion { get; private set; } = false; - - public bool IsDestroyed { get; private set; } - - private bool _beReady = false; - private bool _waveStart = false; - private int _currWaveIndex = 0; - private int _currWaveNumber = 0; - private List _currActivityMarks = new List(); - - /// - /// 获取房间的全局坐标, 单位: 像素 - /// - public Vector2I GetWorldPosition() - { - return new Vector2I( - Position.X * GameConfig.TileCellSize, - Position.Y * GameConfig.TileCellSize - ); - } - - /// - /// 获取房间左上角的 Tile 距离全局坐标原点的偏移, 单位: 像素 - /// - /// - public Vector2I GetOffsetPosition() - { - return RoomSplit.RoomInfo.Position.AsVector2I() * GameConfig.TileCellSize; - } - - /// - /// 获取房间横轴结束位置, 单位: 格 - /// - public int GetHorizontalEnd() - { - return Position.X + Size.X; - } - - /// - /// 获取房间纵轴结束位置, 单位: 格 - /// - public int GetVerticalEnd() - { - return Position.Y + Size.Y; - } - - /// - /// 获取房间横轴开始位置, 单位: 格 - /// - public int GetHorizontalStart() - { - return Position.X; - } - - /// - /// 获取房间纵轴开始位置, 单位: 格 - /// - public int GetVerticalStart() - { - return Position.Y; - } - - /// - /// 获取房间宽度, 单位: 像素 - /// - public int GetWidth() - { - return Size.X * GameConfig.TileCellSize; - } - - - /// - /// 获取房间高度, 单位: 像素 - /// - public int GetHeight() - { - return Size.Y * GameConfig.TileCellSize; - } - - public void Destroy() - { - if (IsDestroyed) - { - return; - } - - IsDestroyed = true; - foreach (var nextRoom in Next) - { - nextRoom.Destroy(); - } - Next.Clear(); - foreach (var activityMark in ActivityMarks) - { - activityMark.QueueFree(); - } - ActivityMarks.Clear(); - - if (StaticImageCanvas != null) - { - StaticImageCanvas.Destroy(); - } - } - - /// - /// 房间准备好了, 准备刷敌人, 并且关闭所有门, - /// 当清完每一波刷新的敌人后即可开门 - /// - public void BeReady() - { - //没有标记, 啥都不要做 - if (ActivityMarks.Count == 0) - { - _beReady = true; - IsSeclusion = false; - return; - } - IsSeclusion = true; - _waveStart = false; - - if (!_beReady) - { - _beReady = true; - //按照 WaveNumber 排序 - ActivityMarks.Sort((x, y) => - { - return x.WaveNumber - y.WaveNumber; - }); - } - - //不是初始房间才能关门 - if (RoomSplit.RoomInfo.RoomType != DungeonRoomType.Inlet) - { - //关门 - foreach (var doorInfo in Doors) - { - doorInfo.Door.CloseDoor(); - } - } - - //执行第一波生成 - NextWave(); - } - - /// - /// 当前房间所有敌人都被清除了 - /// - public void OnClearRoom() - { - if (_currWaveIndex >= ActivityMarks.Count) //所有 mark 都走完了 - { - IsSeclusion = false; - _currActivityMarks.Clear(); - //开门 - if (RoomSplit.RoomInfo.RoomType != DungeonRoomType.Inlet) - { - foreach (var doorInfo in Doors) - { - doorInfo.Door.OpenDoor(); - } - } - } - else //执行下一波 - { - NextWave(); - } - } - - /// - /// 返回当前这一波所有的标记的 Doing 函数是否执行完成 - /// - public bool IsCurrWaveOver() - { - for (var i = 0; i < _currActivityMarks.Count; i++) - { - if (!_currActivityMarks[i].IsOver()) - { - return false; - } - } - - return true; - } - - /// - /// 执行下一轮标记 - /// - private void NextWave() - { - if (!_waveStart) - { - _waveStart = true; - _currWaveIndex = 0; - _currWaveNumber = ActivityMarks[0].WaveNumber; - } - GD.Print("执行下一波, 当前: " + _currWaveNumber); - - _currActivityMarks.Clear(); - //根据标记生成对象 - for (; _currWaveIndex < ActivityMarks.Count; _currWaveIndex++) - { - var mark = ActivityMarks[_currWaveIndex]; - if (mark.WaveNumber != _currWaveNumber) //当前这波已经执行完成了 - { - _currWaveNumber = mark.WaveNumber; - break; - } - else //生成操作 - { - mark.BeReady(this); - _currActivityMarks.Add(mark); - } - } - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/data/DoorAreaInfo.cs b/DungeonShooting_Godot/src/framework/map/data/DoorAreaInfo.cs deleted file mode 100644 index fe428b0..0000000 --- a/DungeonShooting_Godot/src/framework/map/data/DoorAreaInfo.cs +++ /dev/null @@ -1,82 +0,0 @@ - -using System.Text.Json.Serialization; -using Godot; - -/// -/// 用于描述门生成区域 -/// -public class DoorAreaInfo : IClone -{ - /// - /// 门方向 - /// - [JsonInclude] - public DoorDirection Direction; - /// - /// 起始位置, 相对 tilemap 的横/纵轴原点, 单位: 像素 - /// - [JsonInclude] - public int Start = 0; - /// - /// 结束位置, 相对 tilemap 的横/纵轴原点, 单位: 像素 - /// - [JsonInclude] - public int End = 16; - - /// - /// 起始点坐标, 该坐标为模板场景的世界坐标, 单位: 像素, 不参与序列化与反序列化 - /// - public Vector2I StartPosition; - /// - /// 结束点坐标, 该坐标为模板场景的世界坐标, 单位: 像素, 不参与序列化与反序列化 - /// - public Vector2I EndPosition; - - public DoorAreaInfo() - { - } - - public DoorAreaInfo(DoorDirection direction, int start, int end) - { - Direction = direction; - Start = start; - End = end; - } - - /// - /// 自动计算 startPosition 和 endPosition - /// - public void CalcPosition(Vector2I rootPosition, Vector2I rootSize) - { - switch (Direction) - { - case DoorDirection.E: - StartPosition = new Vector2I(rootPosition.X, rootPosition.Y + Start); - EndPosition = new Vector2I(rootPosition.X, rootPosition.Y + End); - break; - case DoorDirection.W: - StartPosition = new Vector2I(rootPosition.X + rootSize.X, rootPosition.Y + Start); - EndPosition = new Vector2I(rootPosition.X + rootSize.X, rootPosition.Y + End); - break; - case DoorDirection.S: - StartPosition = new Vector2I(rootPosition.X + Start, rootPosition.Y + rootSize.Y); - EndPosition = new Vector2I(rootPosition.X + End, rootPosition.Y + rootSize.Y); - break; - case DoorDirection.N: - StartPosition = new Vector2I(rootPosition.X + Start, rootPosition.Y); - EndPosition = new Vector2I(rootPosition.X + End, rootPosition.Y); - break; - } - } - - public DoorAreaInfo Clone() - { - var data = new DoorAreaInfo(); - data.Start = Start; - data.End = End; - data.Direction = Direction; - return data; - } - - -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/data/DungeonRoomGroup.cs b/DungeonShooting_Godot/src/framework/map/data/DungeonRoomGroup.cs deleted file mode 100644 index 76c12e2..0000000 --- a/DungeonShooting_Godot/src/framework/map/data/DungeonRoomGroup.cs +++ /dev/null @@ -1,156 +0,0 @@ - -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; -using Godot; - -/// -/// 房间组数据 -/// -public class DungeonRoomGroup -{ - /// - /// 组名称 - /// - [JsonInclude] - public string GroupName; - - /// - /// 普通战斗房间, 进入该房间时会关上门, 并刷出若干波敌人, 消灭所有敌人后开门 - /// - [JsonInclude] - public List BattleList = new List(); - - /// - /// 起始房间, 由上一层地牢的结束房间进入该房间, 每层包含一个起始房间 - /// - [JsonInclude] - public List InletList = new List(); - - /// - /// 结束房间, 进入另一层地牢, 每层只是包含一个结束房间 - /// - [JsonInclude] - public List OutletList = new List(); - - /// - /// boss战房间, 进入房间时会关上没, 刷出boss, 消灭boss后开门 - /// - [JsonInclude] - public List BossList = new List(); - - /// - /// 奖励房间, 给予玩家武器或者道具奖励的房间 - /// - [JsonInclude] - public List RewardList = new List(); - - /// - /// 商店, 玩家买卖道具装备的房间 - /// - [JsonInclude] - public List ShopList = new List(); - - /// - /// 事件房间, 触发剧情或者解锁NPC的房间 - /// - [JsonInclude] - public List EventList = new List(); - - /// - /// 组包住 - /// - [JsonInclude] - public string Remark; - - private bool _init = false; - private Dictionary _weightRandomMap; - - /// - /// 获取所有房间数据 - /// - public List GetAllRoomList() - { - var list = new List(); - list.AddRange(BattleList); - list.AddRange(InletList); - list.AddRange(OutletList); - list.AddRange(BossList); - list.AddRange(ShopList); - list.AddRange(RewardList); - list.AddRange(ShopList); - list.AddRange(EventList); - return list; - } - - /// - /// 获取指定类型房间集合 - /// - public List GetRoomList(DungeonRoomType roomType) - { - switch (roomType) - { - case DungeonRoomType.Battle: return BattleList; - case DungeonRoomType.Inlet: return InletList; - case DungeonRoomType.Outlet: return OutletList; - case DungeonRoomType.Boss: return BossList; - case DungeonRoomType.Reward: return RewardList; - case DungeonRoomType.Shop: return ShopList; - case DungeonRoomType.Event: return EventList; - } - - return null; - } - - /// - /// 初始化权重处理 - /// - public void InitWeight(SeedRandom random) - { - if (_init) - { - return; - } - - _init = true; - _weightRandomMap = new Dictionary(); - - foreach (var roomType in Enum.GetValues()) - { - InitAdRewardWeight(roomType, random); - } - } - - private void InitAdRewardWeight(DungeonRoomType roomType, SeedRandom random) - { - var dungeonRoomSplits = GetRoomList(roomType); - var weightRandom = new WeightRandom(random); - _weightRandomMap.Add(roomType, weightRandom); - - var list = new List(); - foreach (var roomSplit in dungeonRoomSplits) - { - list.Add(roomSplit.RoomInfo.Weight); - } - weightRandom.InitAdRewardWeight(list.ToArray()); - } - - /// - /// 根据房间类型和权重获取随机房间 - /// - public DungeonRoomSplit GetRandomRoom(DungeonRoomType roomType) - { - if (!_init) - { - GD.PrintErr("未调用DungeonRoomGroup.InitWeight()来初始化权重!"); - return null; - } - - if (_weightRandomMap.TryGetValue(roomType, out var weightRandom)) - { - return GetRoomList(roomType)[weightRandom.GetRandomIndex()]; - } - - return null; - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/data/DungeonRoomInfo.cs b/DungeonShooting_Godot/src/framework/map/data/DungeonRoomInfo.cs deleted file mode 100644 index b9f23c9..0000000 --- a/DungeonShooting_Godot/src/framework/map/data/DungeonRoomInfo.cs +++ /dev/null @@ -1,57 +0,0 @@ - -using System.Collections.Generic; -using System.Text.Json.Serialization; - -/// -/// 房间配置数据 -/// -public class DungeonRoomInfo -{ - /// - /// 房间位置, 在tile坐标系中的位置, 单位: 格 - /// - [JsonInclude] - public SerializeVector2 Position; - - /// - /// 房间大小, 在tile坐标系中占用的格子, 单位: 格 - /// - [JsonInclude] - public SerializeVector2 Size; - - /// - /// 房间连通门 - /// - [JsonInclude] - public List DoorAreaInfos; - - /// - /// 当前房间所属分组的名称 - /// - [JsonInclude] - public string GroupName; - - /// - /// 房间类型 - /// - [JsonInclude] - public DungeonRoomType RoomType = DungeonRoomType.Battle; - - /// - /// 房间名称 - /// - [JsonInclude] - public string RoomName; - - /// - /// 房间权重, 值越大, 生成地牢是越容易出现该房间 - /// - [JsonInclude] - public int Weight = ResourceManager.DefaultWeight; - - /// - /// 房间备注 - /// - [JsonInclude] - public string Remark; -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/data/DungeonRoomSplit.cs b/DungeonShooting_Godot/src/framework/map/data/DungeonRoomSplit.cs deleted file mode 100644 index 7c71d23..0000000 --- a/DungeonShooting_Godot/src/framework/map/data/DungeonRoomSplit.cs +++ /dev/null @@ -1,132 +0,0 @@ - -using System.Collections.Generic; -using System.Text.Json; -using System.Text.Json.Serialization; - -/// -/// 房间配置文件相关信息, 将会在 RoomConfig.json 中汇总 -/// -public class DungeonRoomSplit -{ - /// - /// 当前房间是否绘制完成, 也就是是否可用 - /// - [JsonInclude] - public bool Ready; - - /// - /// 房间配置路径 - /// - [JsonInclude] - public string RoomPath; - - /// - /// 房间地块配置数据 - /// - [JsonInclude] - public string TilePath; - - /// - /// 房间预设配置数据 - /// - [JsonInclude] - public string PreinstallPath; - - /// - /// 房间配置数据, 第一次获取会在资源中加载数据 - /// - [JsonIgnore] - public DungeonRoomInfo RoomInfo - { - get - { - if (_roomInfo == null && RoomPath != null) - { - ReloadRoomInfo(); - } - - return _roomInfo; - } - set => _roomInfo = value; - } - - private DungeonRoomInfo _roomInfo; - - /// - /// 房间地块配置数据 - /// - [JsonIgnore] - public DungeonTileInfo TileInfo - { - get - { - if (_tileInfo == null && TilePath != null) - { - ReloadTileInfo(); - } - - return _tileInfo; - } - set => _tileInfo = value; - } - - private DungeonTileInfo _tileInfo; - - /// - /// 房间预设数据 - /// - [JsonIgnore] - public List Preinstall - { - get - { - if (_preinstall == null && PreinstallPath != null) - { - ReloadPreinstall(); - } - - return _preinstall; - } - set => _preinstall = value; - } - - private List _preinstall; - - - /// - /// 重新加载房间数据 - /// - public void ReloadRoomInfo() - { - var asText = ResourceManager.LoadText(RoomPath); - _roomInfo = JsonSerializer.Deserialize(asText); - - // //需要处理 DoorAreaInfos 长度为 0 的房间, 并为其配置默认值 - // var areaInfos = _roomInfo.DoorAreaInfos; - // if (areaInfos.Count == 0) - // { - // areaInfos.Add(new DoorAreaInfo(DoorDirection.N, GameConfig.TileCellSize, (_roomInfo.Size.X - 1) * GameConfig.TileCellSize)); - // areaInfos.Add(new DoorAreaInfo(DoorDirection.S, GameConfig.TileCellSize, (_roomInfo.Size.X - 1) * GameConfig.TileCellSize)); - // areaInfos.Add(new DoorAreaInfo(DoorDirection.W, GameConfig.TileCellSize, (_roomInfo.Size.Y - 1) * GameConfig.TileCellSize)); - // areaInfos.Add(new DoorAreaInfo(DoorDirection.E, GameConfig.TileCellSize, (_roomInfo.Size.Y - 1) * GameConfig.TileCellSize)); - // } - } - - /// - /// 重新加载房间地块配置数据 - /// - public void ReloadTileInfo() - { - var asText = ResourceManager.LoadText(TilePath); - _tileInfo = JsonSerializer.Deserialize(asText); - } - - /// - /// 重新加载房间预设数据 - /// - public void ReloadPreinstall() - { - var asText = ResourceManager.LoadText(PreinstallPath); - _preinstall = JsonSerializer.Deserialize>(asText); - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/data/DungeonTileInfo.cs b/DungeonShooting_Godot/src/framework/map/data/DungeonTileInfo.cs deleted file mode 100644 index c4003b4..0000000 --- a/DungeonShooting_Godot/src/framework/map/data/DungeonTileInfo.cs +++ /dev/null @@ -1,30 +0,0 @@ - -using System.Collections.Generic; -using System.Text.Json.Serialization; - -public class DungeonTileInfo -{ - /// - /// 导航数据 - /// - [JsonInclude] - public List NavigationList; - - /// - /// 底层数据, 五个一组, 分别为: 地图x坐标, 地图y坐标, 资源id, 图集x坐标, 图集y坐标 - /// - [JsonInclude] - public List Floor; - - /// - /// 中层数据, 五个一组, 分别为: 地图x坐标, 地图y坐标, 资源id, 图集x坐标, 图集y坐标 - /// - [JsonInclude] - public List Middle; - - /// - /// 顶层数据, 五个一组, 分别为: 地图x坐标, 地图y坐标, 资源id, 图集x坐标, 图集y坐标 - /// - [JsonInclude] - public List Top; -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/data/MarkInfo.cs b/DungeonShooting_Godot/src/framework/map/data/MarkInfo.cs deleted file mode 100644 index 610f639..0000000 --- a/DungeonShooting_Godot/src/framework/map/data/MarkInfo.cs +++ /dev/null @@ -1,44 +0,0 @@ - -using System.Collections.Generic; -using System.Text.Json.Serialization; - -/// -/// 标记数据 -/// -public class MarkInfo -{ - /// - /// 所在坐标 - /// - [JsonInclude] - public SerializeVector2 Position; - - /// - /// 区域大小 - /// - [JsonInclude] - public SerializeVector2 Size; - - /// - /// 延时时间 - /// - [JsonInclude] - public float DelayTime; - - /// - /// 标记列表数据 - /// - [JsonInclude] - public List MarkList; - - /// - /// 从指定 MarkInfo 克隆数据, 浅拷贝 - /// - public void CloneFrom(MarkInfo mark) - { - Position = mark.Position; - Size = mark.Size; - DelayTime = mark.DelayTime; - MarkList = mark.MarkList; - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/data/MarkInfoItem.cs b/DungeonShooting_Godot/src/framework/map/data/MarkInfoItem.cs deleted file mode 100644 index f41d764..0000000 --- a/DungeonShooting_Godot/src/framework/map/data/MarkInfoItem.cs +++ /dev/null @@ -1,27 +0,0 @@ - -using System.Collections.Generic; -using System.Text.Json.Serialization; - -/// -/// 标记项数据 -/// -public class MarkInfoItem -{ - /// - /// 物体Id - /// - [JsonInclude] - public string Id; - - /// - /// 权重 - /// - [JsonInclude] - public int Weight; - - /// - /// 额外属性 - /// - [JsonInclude] - public Dictionary Attr; -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/data/NavigationPolygonData.cs b/DungeonShooting_Godot/src/framework/map/data/NavigationPolygonData.cs deleted file mode 100644 index bc142da..0000000 --- a/DungeonShooting_Godot/src/framework/map/data/NavigationPolygonData.cs +++ /dev/null @@ -1,81 +0,0 @@ - -using System.Collections.Generic; -using System.Text.Json.Serialization; -using Godot; - -public enum NavigationPolygonType -{ - /// - /// 外轮廓 - /// - Out, - /// - /// 内轮廓 - /// - In, -} - -/// -/// 描述导航多边形数据 -/// -public class NavigationPolygonData -{ - /// - /// 导航轮廓类型 - /// - [JsonInclude] - public NavigationPolygonType Type; - - /// - /// 多边形的顶点, 两个为一组, 单位: 像素, 需要获取转为 Vector2[] 的值请调用 GetPoints() 函数 - /// - [JsonInclude] - public List Points; - - private Vector2[] _pointVector2Array; - - public NavigationPolygonData() - { - } - - public NavigationPolygonData(NavigationPolygonType type) - { - Type = type; - } - - /// - /// 读取所有的坐标点 - /// - public Vector2[] GetPoints() - { - if (_pointVector2Array == null) - { - if (Points == null) - { - return null; - } - - _pointVector2Array = new Vector2[Points.Count / 2]; - for (var i = 0; i < Points.Count; i += 2) - { - _pointVector2Array[i / 2] = new Vector2(Points[i], Points[i + 1]); - } - } - - return _pointVector2Array; - } - - /// - /// 设置所有的坐标点 - /// - public void SetPoints(Vector2[] array) - { - _pointVector2Array = array; - Points = new List(); - foreach (var pos in array) - { - Points.Add(pos.X); - Points.Add(pos.Y); - } - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/data/RoomPreinstall.cs b/DungeonShooting_Godot/src/framework/map/data/RoomPreinstall.cs deleted file mode 100644 index 221d999..0000000 --- a/DungeonShooting_Godot/src/framework/map/data/RoomPreinstall.cs +++ /dev/null @@ -1,55 +0,0 @@ - -using System.Collections.Generic; -using System.Text.Json.Serialization; - -/// -/// 房间预设数据 -/// -public class RoomPreinstall -{ - /// - /// 预设名称 - /// - [JsonInclude] - public string Name; - - /// - /// 预设权重 - /// - [JsonInclude] - public int Weight; - - /// - /// 预设备注 - /// - [JsonInclude] - public string Remark; - - /// - /// 波数数据 - /// - [JsonInclude] - public List> WaveList; - - /// - /// 从指定对象浅拷贝数据 - /// - public void CloneFrom(RoomPreinstall preinstall) - { - Name = preinstall.Name; - Weight = preinstall.Weight; - Remark = preinstall.Remark; - WaveList = preinstall.WaveList; - } - - /// - /// 初始化波数据 - /// - public void InitWaveList() - { - WaveList = new List> - { - new List() - }; - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/mark/ActivityMark.cs b/DungeonShooting_Godot/src/framework/map/mark/ActivityMark.cs index 4cd0b62..05a79af 100644 --- a/DungeonShooting_Godot/src/framework/map/mark/ActivityMark.cs +++ b/DungeonShooting_Godot/src/framework/map/mark/ActivityMark.cs @@ -83,7 +83,7 @@ private bool _isOver = true; private float _overTimer = 1; private float _timer = 0; - private RoomInfo _tempRoom; + private RoomInfo _tempRoomInfo; //已经计算好要生成的物体 private Dictionary _currentExpression = new Dictionary(); @@ -143,8 +143,8 @@ _timer += (float)delta; if (_timer >= DelayTime) { - Doing(_tempRoom); - _tempRoom = null; + Doing(_tempRoomInfo); + _tempRoomInfo = null; _isOver = true; } } @@ -171,7 +171,7 @@ else { _timer = 0; - _tempRoom = roomInfo; + _tempRoomInfo = roomInfo; } } diff --git a/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs b/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs new file mode 100644 index 0000000..193b40b --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs @@ -0,0 +1,6 @@ + + +public class RoomPreinstall +{ + +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/preinstall/SpecialMarkType.cs b/DungeonShooting_Godot/src/framework/map/preinstall/SpecialMarkType.cs new file mode 100644 index 0000000..9541c00 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/preinstall/SpecialMarkType.cs @@ -0,0 +1,15 @@ + +/// +/// 特殊标记类型 +/// +public enum SpecialMarkType +{ + /// + /// 正常类型 + /// + Normal, + /// + /// 玩家出生点 + /// + BirthPoint, +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/room/RoomDoorInfo.cs b/DungeonShooting_Godot/src/framework/map/room/RoomDoorInfo.cs new file mode 100644 index 0000000..6e029fa --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/room/RoomDoorInfo.cs @@ -0,0 +1,64 @@ + +using Godot; + +/// +/// 房间的门 +/// +public class RoomDoorInfo +{ + /// + /// 所在墙面方向 + /// + public DoorDirection Direction; + + /// + /// 所在的房间 + /// + public RoomInfo RoomInfo; + + /// + /// 连接的门 + /// + public RoomDoorInfo ConnectDoor; + + /// + /// 连接的房间 + /// + public RoomInfo ConnectRoom; + + /// + /// 原点坐标, 单位: 格 + /// + public Vector2I OriginPosition; + + /// + /// 与下一道门是否有交叉点 + /// + public bool HasCross; + + /// + /// 与下一道门的交叉点, 单位: 格 + /// + public Vector2I Cross; + + /// + /// 占位导航网格 + /// + public DoorNavigationInfo Navigation; + + /// + /// 门实例 + /// + public RoomDoor Door; + + /// + /// 世界坐标下的原点坐标, 单位: 像素 + /// + public Vector2I GetWorldOriginPosition() + { + return new Vector2I( + OriginPosition.X * GameConfig.TileCellSize, + OriginPosition.Y * GameConfig.TileCellSize + ); + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs b/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs new file mode 100644 index 0000000..70f37e4 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs @@ -0,0 +1,299 @@ + +using System.Collections.Generic; +using Godot; + +/// +/// 房间的数据描述 +/// +public class RoomInfo : IDestroy +{ + public RoomInfo(int id, DungeonRoomType type, DungeonRoomSplit roomSplit) + { + Id = id; + RoomType = type; + RoomSplit = roomSplit; + } + + /// + /// 房间 id + /// + public int Id; + + /// + /// 房间类型 + /// + public DungeonRoomType RoomType; + + /// + /// 层级, 也就是离初始房间间隔多少个房间 + /// + public int Layer; + + /// + /// 生成该房间使用的配置数据 + /// + public DungeonRoomSplit RoomSplit; + + /// + /// 房间大小, 单位: 格 + /// + public Vector2I Size; + + /// + /// 房间位置, 单位: 格 + /// + public Vector2I Position; + + /// + /// 门 + /// + public List Doors = new List(); + + /// + /// 连接该房间的过道占用区域信息 + /// + public List AisleArea = new List(); + + /// + /// 下一个房间 + /// + public List Next = new List(); + + /// + /// 上一个房间 + /// + public RoomInfo Prev; + + /// + /// 物体生成标记 + /// + public List ActivityMarks = new List(); + + /// + /// 当前房间归属区域 + /// + public AffiliationArea AffiliationArea; + + /// + /// 静态精灵绘制画布 + /// + public RoomStaticImageCanvas StaticImageCanvas; + + /// + /// 是否处于闭关状态, 也就是房间门没有主动打开 + /// + public bool IsSeclusion { get; private set; } = false; + + public bool IsDestroyed { get; private set; } + + private bool _beReady = false; + private bool _waveStart = false; + private int _currWaveIndex = 0; + private int _currWaveNumber = 0; + private List _currActivityMarks = new List(); + + /// + /// 获取房间的全局坐标, 单位: 像素 + /// + public Vector2I GetWorldPosition() + { + return new Vector2I( + Position.X * GameConfig.TileCellSize, + Position.Y * GameConfig.TileCellSize + ); + } + + /// + /// 获取房间左上角的 Tile 距离全局坐标原点的偏移, 单位: 像素 + /// + /// + public Vector2I GetOffsetPosition() + { + return RoomSplit.RoomInfo.Position.AsVector2I() * GameConfig.TileCellSize; + } + + /// + /// 获取房间横轴结束位置, 单位: 格 + /// + public int GetHorizontalEnd() + { + return Position.X + Size.X; + } + + /// + /// 获取房间纵轴结束位置, 单位: 格 + /// + public int GetVerticalEnd() + { + return Position.Y + Size.Y; + } + + /// + /// 获取房间横轴开始位置, 单位: 格 + /// + public int GetHorizontalStart() + { + return Position.X; + } + + /// + /// 获取房间纵轴开始位置, 单位: 格 + /// + public int GetVerticalStart() + { + return Position.Y; + } + + /// + /// 获取房间宽度, 单位: 像素 + /// + public int GetWidth() + { + return Size.X * GameConfig.TileCellSize; + } + + + /// + /// 获取房间高度, 单位: 像素 + /// + public int GetHeight() + { + return Size.Y * GameConfig.TileCellSize; + } + + public void Destroy() + { + if (IsDestroyed) + { + return; + } + + IsDestroyed = true; + foreach (var nextRoom in Next) + { + nextRoom.Destroy(); + } + Next.Clear(); + foreach (var activityMark in ActivityMarks) + { + activityMark.QueueFree(); + } + ActivityMarks.Clear(); + + if (StaticImageCanvas != null) + { + StaticImageCanvas.Destroy(); + } + } + + /// + /// 房间准备好了, 准备刷敌人, 并且关闭所有门, + /// 当清完每一波刷新的敌人后即可开门 + /// + public void BeReady() + { + //没有标记, 啥都不要做 + if (ActivityMarks.Count == 0) + { + _beReady = true; + IsSeclusion = false; + return; + } + IsSeclusion = true; + _waveStart = false; + + if (!_beReady) + { + _beReady = true; + //按照 WaveNumber 排序 + ActivityMarks.Sort((x, y) => + { + return x.WaveNumber - y.WaveNumber; + }); + } + + //不是初始房间才能关门 + if (RoomSplit.RoomInfo.RoomType != DungeonRoomType.Inlet) + { + //关门 + foreach (var doorInfo in Doors) + { + doorInfo.Door.CloseDoor(); + } + } + + //执行第一波生成 + NextWave(); + } + + /// + /// 当前房间所有敌人都被清除了 + /// + public void OnClearRoom() + { + if (_currWaveIndex >= ActivityMarks.Count) //所有 mark 都走完了 + { + IsSeclusion = false; + _currActivityMarks.Clear(); + //开门 + if (RoomSplit.RoomInfo.RoomType != DungeonRoomType.Inlet) + { + foreach (var doorInfo in Doors) + { + doorInfo.Door.OpenDoor(); + } + } + } + else //执行下一波 + { + NextWave(); + } + } + + /// + /// 返回当前这一波所有的标记的 Doing 函数是否执行完成 + /// + public bool IsCurrWaveOver() + { + for (var i = 0; i < _currActivityMarks.Count; i++) + { + if (!_currActivityMarks[i].IsOver()) + { + return false; + } + } + + return true; + } + + /// + /// 执行下一轮标记 + /// + private void NextWave() + { + if (!_waveStart) + { + _waveStart = true; + _currWaveIndex = 0; + _currWaveNumber = ActivityMarks[0].WaveNumber; + } + GD.Print("执行下一波, 当前: " + _currWaveNumber); + + _currActivityMarks.Clear(); + //根据标记生成对象 + for (; _currWaveIndex < ActivityMarks.Count; _currWaveIndex++) + { + var mark = ActivityMarks[_currWaveIndex]; + if (mark.WaveNumber != _currWaveNumber) //当前这波已经执行完成了 + { + _currWaveNumber = mark.WaveNumber; + break; + } + else //生成操作 + { + mark.BeReady(this); + _currActivityMarks.Add(mark); + } + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/serialize/DoorAreaInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/DoorAreaInfo.cs new file mode 100644 index 0000000..fe428b0 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/serialize/DoorAreaInfo.cs @@ -0,0 +1,82 @@ + +using System.Text.Json.Serialization; +using Godot; + +/// +/// 用于描述门生成区域 +/// +public class DoorAreaInfo : IClone +{ + /// + /// 门方向 + /// + [JsonInclude] + public DoorDirection Direction; + /// + /// 起始位置, 相对 tilemap 的横/纵轴原点, 单位: 像素 + /// + [JsonInclude] + public int Start = 0; + /// + /// 结束位置, 相对 tilemap 的横/纵轴原点, 单位: 像素 + /// + [JsonInclude] + public int End = 16; + + /// + /// 起始点坐标, 该坐标为模板场景的世界坐标, 单位: 像素, 不参与序列化与反序列化 + /// + public Vector2I StartPosition; + /// + /// 结束点坐标, 该坐标为模板场景的世界坐标, 单位: 像素, 不参与序列化与反序列化 + /// + public Vector2I EndPosition; + + public DoorAreaInfo() + { + } + + public DoorAreaInfo(DoorDirection direction, int start, int end) + { + Direction = direction; + Start = start; + End = end; + } + + /// + /// 自动计算 startPosition 和 endPosition + /// + public void CalcPosition(Vector2I rootPosition, Vector2I rootSize) + { + switch (Direction) + { + case DoorDirection.E: + StartPosition = new Vector2I(rootPosition.X, rootPosition.Y + Start); + EndPosition = new Vector2I(rootPosition.X, rootPosition.Y + End); + break; + case DoorDirection.W: + StartPosition = new Vector2I(rootPosition.X + rootSize.X, rootPosition.Y + Start); + EndPosition = new Vector2I(rootPosition.X + rootSize.X, rootPosition.Y + End); + break; + case DoorDirection.S: + StartPosition = new Vector2I(rootPosition.X + Start, rootPosition.Y + rootSize.Y); + EndPosition = new Vector2I(rootPosition.X + End, rootPosition.Y + rootSize.Y); + break; + case DoorDirection.N: + StartPosition = new Vector2I(rootPosition.X + Start, rootPosition.Y); + EndPosition = new Vector2I(rootPosition.X + End, rootPosition.Y); + break; + } + } + + public DoorAreaInfo Clone() + { + var data = new DoorAreaInfo(); + data.Start = Start; + data.End = End; + data.Direction = Direction; + return data; + } + + +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomGroup.cs b/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomGroup.cs new file mode 100644 index 0000000..85c6774 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomGroup.cs @@ -0,0 +1,170 @@ + +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; +using Godot; + +/// +/// 房间组数据 +/// +public class DungeonRoomGroup : IClone +{ + /// + /// 组名称 + /// + [JsonInclude] + public string GroupName; + + /// + /// 普通战斗房间, 进入该房间时会关上门, 并刷出若干波敌人, 消灭所有敌人后开门 + /// + [JsonInclude] + public List BattleList = new List(); + + /// + /// 起始房间, 由上一层地牢的结束房间进入该房间, 每层包含一个起始房间 + /// + [JsonInclude] + public List InletList = new List(); + + /// + /// 结束房间, 进入另一层地牢, 每层只是包含一个结束房间 + /// + [JsonInclude] + public List OutletList = new List(); + + /// + /// boss战房间, 进入房间时会关上没, 刷出boss, 消灭boss后开门 + /// + [JsonInclude] + public List BossList = new List(); + + /// + /// 奖励房间, 给予玩家武器或者道具奖励的房间 + /// + [JsonInclude] + public List RewardList = new List(); + + /// + /// 商店, 玩家买卖道具装备的房间 + /// + [JsonInclude] + public List ShopList = new List(); + + /// + /// 事件房间, 触发剧情或者解锁NPC的房间 + /// + [JsonInclude] + public List EventList = new List(); + + /// + /// 组包住 + /// + [JsonInclude] + public string Remark; + + private bool _init = false; + private Dictionary _weightRandomMap; + private List _readyBattleList; + + /// + /// 获取所有房间数据 + /// + public List GetAllRoomList() + { + var list = new List(); + list.AddRange(BattleList); + list.AddRange(InletList); + list.AddRange(OutletList); + list.AddRange(BossList); + list.AddRange(ShopList); + list.AddRange(RewardList); + list.AddRange(EventList); + return list; + } + + /// + /// 获取指定类型房间集合 + /// + public List GetRoomList(DungeonRoomType roomType) + { + switch (roomType) + { + case DungeonRoomType.Battle: return BattleList; + case DungeonRoomType.Inlet: return InletList; + case DungeonRoomType.Outlet: return OutletList; + case DungeonRoomType.Boss: return BossList; + case DungeonRoomType.Reward: return RewardList; + case DungeonRoomType.Shop: return ShopList; + case DungeonRoomType.Event: return EventList; + } + + return null; + } + + /// + /// 初始化权重处理 + /// + public void InitWeight(SeedRandom random) + { + if (_init) + { + return; + } + + _init = true; + _weightRandomMap = new Dictionary(); + + foreach (var roomType in Enum.GetValues()) + { + InitAdRewardWeight(roomType, random); + } + } + + private void InitAdRewardWeight(DungeonRoomType roomType, SeedRandom random) + { + var dungeonRoomSplits = GetRoomList(roomType); + var weightRandom = new WeightRandom(random); + _weightRandomMap.Add(roomType, weightRandom); + + var list = new List(); + foreach (var roomSplit in dungeonRoomSplits) + { + list.Add(roomSplit.RoomInfo.Weight); + } + weightRandom.InitAdRewardWeight(list.ToArray()); + } + + /// + /// 根据房间类型和权重获取随机房间 + /// + public DungeonRoomSplit GetRandomRoom(DungeonRoomType roomType) + { + if (!_init) + { + GD.PrintErr("未调用DungeonRoomGroup.InitWeight()来初始化权重!"); + return null; + } + + if (_weightRandomMap.TryGetValue(roomType, out var weightRandom)) + { + return GetRoomList(roomType)[weightRandom.GetRandomIndex()]; + } + + return null; + } + + public DungeonRoomGroup Clone() + { + var inst = new DungeonRoomGroup(); + inst.GroupName = GroupName; + inst.BattleList.AddRange(BattleList); + inst.InletList.AddRange(InletList); + inst.OutletList.AddRange(OutletList); + inst.BossList.AddRange(BossList); + inst.ShopList.AddRange(ShopList); + inst.RewardList.AddRange(RewardList); + inst.EventList.AddRange(EventList); + return inst; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomInfo.cs new file mode 100644 index 0000000..c8923b4 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomInfo.cs @@ -0,0 +1,80 @@ + +using System.Collections.Generic; +using System.Text.Json.Serialization; + +/// +/// 房间配置数据 +/// +public class DungeonRoomInfo +{ + /// + /// 房间位置, 在tile坐标系中的位置, 单位: 格 + /// + [JsonInclude] + public SerializeVector2 Position; + + /// + /// 房间大小, 在tile坐标系中占用的格子, 单位: 格 + /// + [JsonInclude] + public SerializeVector2 Size; + + /// + /// 房间连通门 + /// + [JsonInclude] + public List DoorAreaInfos; + + /// + /// 当前房间所属分组的名称 + /// + [JsonInclude] + public string GroupName; + + /// + /// 房间类型 + /// + [JsonInclude] + public DungeonRoomType RoomType = DungeonRoomType.Battle; + + /// + /// 房间名称 + /// + [JsonInclude] + public string RoomName; + + /// + /// 房间权重, 值越大, 生成地牢是越容易出现该房间 + /// + [JsonInclude] + public int Weight = ResourceManager.DefaultWeight; + + /// + /// 房间备注 + /// + [JsonInclude] + public string Remark; + + private List _completionDoorArea; + + /// + /// 获取门区域配置数据, 如果该函数会自动填充未配置的数据 + /// + public List GetCompletionDoorArea() + { + if (_completionDoorArea == null) + { + //需要处理 DoorAreaInfos 长度为 0 的房间, 并为其配置默认值 + _completionDoorArea = new List(DoorAreaInfos); + if (_completionDoorArea.Count == 0) + { + _completionDoorArea.Add(new DoorAreaInfo(DoorDirection.N, GameConfig.TileCellSize, ((int)Size.X - 1) * GameConfig.TileCellSize)); + _completionDoorArea.Add(new DoorAreaInfo(DoorDirection.S, GameConfig.TileCellSize, ((int)Size.X - 1) * GameConfig.TileCellSize)); + _completionDoorArea.Add(new DoorAreaInfo(DoorDirection.W, GameConfig.TileCellSize, ((int)Size.Y - 1) * GameConfig.TileCellSize)); + _completionDoorArea.Add(new DoorAreaInfo(DoorDirection.E, GameConfig.TileCellSize, ((int)Size.Y - 1) * GameConfig.TileCellSize)); + } + } + + return _completionDoorArea; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomSplit.cs b/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomSplit.cs new file mode 100644 index 0000000..8a94f94 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomSplit.cs @@ -0,0 +1,122 @@ + +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; + +/// +/// 房间配置文件相关信息, 将会在 RoomConfig.json 中汇总 +/// +public class DungeonRoomSplit +{ + /// + /// 当前房间是否绘制完成, 也就是是否可用, 条件: 房间绘制没有异常, 预设数量大于 0 + /// + [JsonInclude] + public bool Ready; + + /// + /// 房间配置路径 + /// + [JsonInclude] + public string RoomPath; + + /// + /// 房间地块配置数据 + /// + [JsonInclude] + public string TilePath; + + /// + /// 房间预设配置数据 + /// + [JsonInclude] + public string PreinstallPath; + + /// + /// 房间配置数据, 第一次获取会在资源中加载数据 + /// + [JsonIgnore] + public DungeonRoomInfo RoomInfo + { + get + { + if (_roomInfo == null && RoomPath != null) + { + ReloadRoomInfo(); + } + + return _roomInfo; + } + set => _roomInfo = value; + } + + private DungeonRoomInfo _roomInfo; + + /// + /// 房间地块配置数据 + /// + [JsonIgnore] + public DungeonTileInfo TileInfo + { + get + { + if (_tileInfo == null && TilePath != null) + { + ReloadTileInfo(); + } + + return _tileInfo; + } + set => _tileInfo = value; + } + + private DungeonTileInfo _tileInfo; + + /// + /// 房间预设数据 + /// + [JsonIgnore] + public List Preinstall + { + get + { + if (_preinstall == null && PreinstallPath != null) + { + ReloadPreinstall(); + } + + return _preinstall; + } + set => _preinstall = value; + } + + private List _preinstall; + + + /// + /// 重新加载房间数据 + /// + public void ReloadRoomInfo() + { + var asText = ResourceManager.LoadText(RoomPath); + _roomInfo = JsonSerializer.Deserialize(asText); + } + + /// + /// 重新加载房间地块配置数据 + /// + public void ReloadTileInfo() + { + var asText = ResourceManager.LoadText(TilePath); + _tileInfo = JsonSerializer.Deserialize(asText); + } + + /// + /// 重新加载房间预设数据 + /// + public void ReloadPreinstall() + { + var asText = ResourceManager.LoadText(PreinstallPath); + _preinstall = JsonSerializer.Deserialize>(asText); + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/serialize/DungeonTileInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/DungeonTileInfo.cs new file mode 100644 index 0000000..c4003b4 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/serialize/DungeonTileInfo.cs @@ -0,0 +1,30 @@ + +using System.Collections.Generic; +using System.Text.Json.Serialization; + +public class DungeonTileInfo +{ + /// + /// 导航数据 + /// + [JsonInclude] + public List NavigationList; + + /// + /// 底层数据, 五个一组, 分别为: 地图x坐标, 地图y坐标, 资源id, 图集x坐标, 图集y坐标 + /// + [JsonInclude] + public List Floor; + + /// + /// 中层数据, 五个一组, 分别为: 地图x坐标, 地图y坐标, 资源id, 图集x坐标, 图集y坐标 + /// + [JsonInclude] + public List Middle; + + /// + /// 顶层数据, 五个一组, 分别为: 地图x坐标, 地图y坐标, 资源id, 图集x坐标, 图集y坐标 + /// + [JsonInclude] + public List Top; +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/serialize/MarkInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/MarkInfo.cs new file mode 100644 index 0000000..56d82bb --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/serialize/MarkInfo.cs @@ -0,0 +1,50 @@ + +using System.Collections.Generic; +using System.Text.Json.Serialization; + +/// +/// 标记数据 +/// +public class MarkInfo +{ + /// + /// 所在坐标 + /// + [JsonInclude] + public SerializeVector2 Position; + + /// + /// 区域大小 + /// + [JsonInclude] + public SerializeVector2 Size; + + /// + /// 特殊标记类型 + /// + [JsonInclude] + public SpecialMarkType SpecialMarkType = SpecialMarkType.Normal; + + /// + /// 延时时间 + /// + [JsonInclude] + public float DelayTime; + + /// + /// 标记列表数据 + /// + [JsonInclude] + public List MarkList; + + /// + /// 从指定 MarkInfo 克隆数据, 浅拷贝 + /// + public void CloneFrom(MarkInfo mark) + { + Position = mark.Position; + Size = mark.Size; + DelayTime = mark.DelayTime; + MarkList = mark.MarkList; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/serialize/MarkInfoItem.cs b/DungeonShooting_Godot/src/framework/map/serialize/MarkInfoItem.cs new file mode 100644 index 0000000..60a46c2 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/serialize/MarkInfoItem.cs @@ -0,0 +1,33 @@ + +using System.Collections.Generic; +using System.Text.Json.Serialization; + +/// +/// 标记项数据 +/// +public class MarkInfoItem +{ + /// + /// 物体Id + /// + [JsonInclude] + public string Id; + + /// + /// 权重 + /// + [JsonInclude] + public int Weight; + + /// + /// 额外属性 + /// + [JsonInclude] + public Dictionary Attr; + + /// + /// 所属标记类型 + /// + [JsonIgnore] + public SpecialMarkType SpecialMarkType = SpecialMarkType.Normal; +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/serialize/NavigationPolygonData.cs b/DungeonShooting_Godot/src/framework/map/serialize/NavigationPolygonData.cs new file mode 100644 index 0000000..bc142da --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/serialize/NavigationPolygonData.cs @@ -0,0 +1,81 @@ + +using System.Collections.Generic; +using System.Text.Json.Serialization; +using Godot; + +public enum NavigationPolygonType +{ + /// + /// 外轮廓 + /// + Out, + /// + /// 内轮廓 + /// + In, +} + +/// +/// 描述导航多边形数据 +/// +public class NavigationPolygonData +{ + /// + /// 导航轮廓类型 + /// + [JsonInclude] + public NavigationPolygonType Type; + + /// + /// 多边形的顶点, 两个为一组, 单位: 像素, 需要获取转为 Vector2[] 的值请调用 GetPoints() 函数 + /// + [JsonInclude] + public List Points; + + private Vector2[] _pointVector2Array; + + public NavigationPolygonData() + { + } + + public NavigationPolygonData(NavigationPolygonType type) + { + Type = type; + } + + /// + /// 读取所有的坐标点 + /// + public Vector2[] GetPoints() + { + if (_pointVector2Array == null) + { + if (Points == null) + { + return null; + } + + _pointVector2Array = new Vector2[Points.Count / 2]; + for (var i = 0; i < Points.Count; i += 2) + { + _pointVector2Array[i / 2] = new Vector2(Points[i], Points[i + 1]); + } + } + + return _pointVector2Array; + } + + /// + /// 设置所有的坐标点 + /// + public void SetPoints(Vector2[] array) + { + _pointVector2Array = array; + Points = new List(); + foreach (var pos in array) + { + Points.Add(pos.X); + Points.Add(pos.Y); + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/serialize/RoomPreinstallInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/RoomPreinstallInfo.cs new file mode 100644 index 0000000..ad68616 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/serialize/RoomPreinstallInfo.cs @@ -0,0 +1,55 @@ + +using System.Collections.Generic; +using System.Text.Json.Serialization; + +/// +/// 房间预设数据 +/// +public class RoomPreinstallInfo +{ + /// + /// 预设名称 + /// + [JsonInclude] + public string Name; + + /// + /// 预设权重 + /// + [JsonInclude] + public int Weight; + + /// + /// 预设备注 + /// + [JsonInclude] + public string Remark; + + /// + /// 波数数据 + /// + [JsonInclude] + public List> WaveList; + + /// + /// 从指定对象浅拷贝数据 + /// + public void CloneFrom(RoomPreinstallInfo preinstallInfo) + { + Name = preinstallInfo.Name; + Weight = preinstallInfo.Weight; + Remark = preinstallInfo.Remark; + WaveList = preinstallInfo.WaveList; + } + + /// + /// 初始化波数据 + /// + public void InitWaveList() + { + WaveList = new List> + { + new List() + }; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/GameApplication.cs b/DungeonShooting_Godot/src/game/GameApplication.cs index a4f50ce..693694c 100644 --- a/DungeonShooting_Godot/src/game/GameApplication.cs +++ b/DungeonShooting_Godot/src/game/GameApplication.cs @@ -207,26 +207,48 @@ ProxyCoroutineHandler.ProxyStopAllCoroutine(ref _coroutineList); } + public void SetRoomConfig(Dictionary roomConfig) + { + RoomConfig = roomConfig; + InitReadyRoom(); + } + //初始化房间配置 private void InitRoomConfig() { //加载房间配置信息 - var asText = ResourceManager.LoadText("res://resource/map/tileMaps/GroupConfig.json"); + var asText = ResourceManager.LoadText("res://resource/map/tileMaps/" + GameConfig.RoomGroupConfigFile); RoomConfig = JsonSerializer.Deserialize>(asText); - //初始化RoomConfigMap - //RoomConfigMap = new Dictionary(); - //加载流程更改 - // foreach (var dungeonRoomGroup in RoomConfig) - // { - // foreach (var dungeonRoomType in Enum.GetValues()) - // { - // foreach (var dungeonRoomSplit in dungeonRoomGroup.Value.GetRoomList(dungeonRoomType)) - // { - // RoomConfigMap.Add(dungeonRoomSplit.ScenePath, dungeonRoomSplit); - // } - // } - // } + InitReadyRoom(); + } + + //初始化房间数据 + private void InitReadyRoom() + { + foreach (var dungeonRoomGroup in RoomConfig) + { + RemoveUnreadyRooms(dungeonRoomGroup.Value.BattleList); + RemoveUnreadyRooms(dungeonRoomGroup.Value.InletList); + RemoveUnreadyRooms(dungeonRoomGroup.Value.OutletList); + RemoveUnreadyRooms(dungeonRoomGroup.Value.BossList); + RemoveUnreadyRooms(dungeonRoomGroup.Value.ShopList); + RemoveUnreadyRooms(dungeonRoomGroup.Value.RewardList); + RemoveUnreadyRooms(dungeonRoomGroup.Value.EventList); + } + } + + //移除未准备好的房间 + private void RemoveUnreadyRooms(List roomInfos) + { + for (var i = 0; i < roomInfos.Count; i++) + { + if (!roomInfos[i].Ready) + { + roomInfos.RemoveAt(i); + i--; + } + } } //窗体大小改变 diff --git a/DungeonShooting_Godot/src/game/activity/role/Player.cs b/DungeonShooting_Godot/src/game/activity/role/Player.cs index 565dc02..a34bf2b 100644 --- a/DungeonShooting_Godot/src/game/activity/role/Player.cs +++ b/DungeonShooting_Godot/src/game/activity/role/Player.cs @@ -41,7 +41,8 @@ RoleState.MoveSpeed = 500; CollisionLayer = 0; CollisionMask = 0; - GameCamera.Main.Zoom = new Vector2(0.5f, 0.5f); + GameCamera.Main.Zoom = new Vector2(.75f, 0.75f); + //GameCamera.Main.Zoom = new Vector2(0.5f, 0.5f); } protected override void Process(float delta) @@ -117,6 +118,8 @@ if (Input.IsKeyPressed(Key.P)) { + //Hurt(1000, 0); + Hp = 0; Hurt(1000, 0); } } diff --git a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs index bfba87a..7d6f655 100644 --- a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs +++ b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs @@ -175,14 +175,16 @@ /// /// 打开创建房间预设弹窗 /// + /// 当前房间的类型 /// 当前房间已经包含的所有预设列表 /// 创建成功时的回调 - public static void ShowCreatePreinstall(List list, Action onCreatePreinstall) + public static void ShowCreatePreinstall(DungeonRoomType roomType, List list, Action onCreatePreinstall) { var window = UiManager.Open_EditorWindow(); window.SetWindowTitle("创建房间预设"); window.SetWindowSize(new Vector2I(700, 600)); var body = window.OpenBody(UiManager.UiName.MapEditorCreatePreinstall); + body.InitData(roomType); window.SetButtonList( new EditorWindowPanel.ButtonData("确定", () => { @@ -203,16 +205,17 @@ /// /// 打开编辑房间预设弹窗 /// + /// 当前房间的类型 /// 当前房间已经包含的所有预设列表 - /// 需要编辑的预设数据 + /// 需要编辑的预设数据 /// 保存时的回调 - public static void ShowEditPreinstall(List list, RoomPreinstall preinstall, Action onSavePreinstall) + public static void ShowEditPreinstall(DungeonRoomType roomType, List list, RoomPreinstallInfo preinstallInfo, Action onSavePreinstall) { var window = UiManager.Open_EditorWindow(); window.SetWindowTitle("创建房间预设"); window.SetWindowSize(new Vector2I(700, 600)); var body = window.OpenBody(UiManager.UiName.MapEditorCreatePreinstall); - body.InitData(preinstall); + body.InitData(roomType, preinstallInfo); window.SetButtonList( new EditorWindowPanel.ButtonData("确定", () => { diff --git a/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs b/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs index d60d569..b2494cb 100644 --- a/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs +++ b/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs @@ -201,5 +201,13 @@ options.WriteIndented = true; var jsonText = JsonSerializer.Serialize(GroupMap, options); File.WriteAllText(configFile, jsonText); + + //更新GameApplication中的房间数据 + var dic = new Dictionary(); + foreach (var dungeonRoomGroup in GroupMap) + { + dic.Add(dungeonRoomGroup.Key, dungeonRoomGroup.Value.Clone()); + } + GameApplication.Instance.SetRoomConfig(dic); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs index b4891c1..f393378 100644 --- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs +++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs @@ -14,12 +14,12 @@ /// /// 起始房间 /// - public RoomInfo StartRoom => _dungeonGenerator?.StartRoom; + public RoomInfo StartRoomInfo => _dungeonGenerator?.StartRoomInfo; /// /// 当前玩家所在的房间 /// - public RoomInfo ActiveRoom => Player.Current?.AffiliationArea?.RoomInfo; + public RoomInfo ActiveRoomInfo => Player.Current?.AffiliationArea?.RoomInfo; /// /// 当前玩家所在的区域 @@ -111,7 +111,7 @@ //填充地牢 _autoTileConfig = new AutoTileConfig(); _dungeonTileMap = new DungeonTileMap(_world.TileRoot); - _dungeonTileMap.AutoFillRoomTile(_autoTileConfig, _dungeonGenerator.StartRoom, _dungeonGenerator.Random); + _dungeonTileMap.AutoFillRoomTile(_autoTileConfig, _dungeonGenerator.StartRoomInfo, _dungeonGenerator.Random); yield return 0; //生成寻路网格, 这一步操作只生成过道的导航 @@ -135,7 +135,7 @@ //SoundManager.PlayMusic(ResourcePath.resource_sound_bgm_Intro_ogg, -17f); //初始房间创建玩家标记 - var playerBirthMark = StartRoom.ActivityMarks.FirstOrDefault(mark => mark.Type == ActivityType.Player); + var playerBirthMark = StartRoomInfo.ActivityMarks.FirstOrDefault(mark => mark.Type == ActivityType.Player); //创建玩家 var player = ActivityObject.Create(ActivityObject.Ids.Id_role0001); if (playerBirthMark != null) @@ -167,6 +167,7 @@ EventManager.EmitEvent(EventEnum.OnEnterDungeon); IsInDungeon = true; + QueueRedraw(); yield return 0; //关闭 loading UI UiManager.Destroy_Loading(); @@ -197,8 +198,9 @@ _world = null; GameApplication.Instance.DestroyWorld(); yield return new WaitForFixedProcess(10); + QueueRedraw(); //鼠标还原 - GameApplication.Instance.Cursor.SetGuiMode(false); + GameApplication.Instance.Cursor.SetGuiMode(true); //派发退出地牢事件 EventManager.EmitEvent(EventEnum.OnExitDungeon); yield return 0; @@ -439,7 +441,7 @@ /// private void OnCheckEnemy() { - var activeRoom = ActiveRoom; + var activeRoom = ActiveRoomInfo; if (activeRoom != null)// && //activeRoom.IsSeclusion) { if (activeRoom.IsSeclusion) //房间处于关上状态 @@ -509,24 +511,24 @@ } //绘制房间区域, debug 用 - private void DrawRoomInfo(RoomInfo room) + private void DrawRoomInfo(RoomInfo roomInfo) { var cellSize = _world.TileRoot.CellQuadrantSize; - var pos1 = (room.Position + room.Size / 2) * cellSize; + var pos1 = (roomInfo.Position + roomInfo.Size / 2) * cellSize; //绘制下一个房间 - foreach (var nextRoom in room.Next) + foreach (var nextRoom in roomInfo.Next) { var pos2 = (nextRoom.Position + nextRoom.Size / 2) * cellSize; DrawLine(pos1, pos2, Colors.Red); DrawRoomInfo(nextRoom); } - DrawString(ResourceManager.DefaultFont16Px, pos1 - new Vector2I(0, 10), "Id: " + room.Id.ToString()); - DrawString(ResourceManager.DefaultFont16Px, pos1 + new Vector2I(0, 10), "Layer: " + room.Layer.ToString()); + DrawString(ResourceManager.DefaultFont16Px, pos1 - new Vector2I(0, 10), "Id: " + roomInfo.Id.ToString()); + DrawString(ResourceManager.DefaultFont16Px, pos1 + new Vector2I(0, 10), "Layer: " + roomInfo.Layer.ToString()); //绘制门 - foreach (var roomDoor in room.Doors) + foreach (var roomDoor in roomInfo.Doors) { var originPos = roomDoor.OriginPosition * cellSize; switch (roomDoor.Direction) @@ -554,7 +556,7 @@ } //绘制房间区域 - DrawRect(new Rect2(room.Position * cellSize, room.Size * cellSize), Colors.Blue, false); + DrawRect(new Rect2(roomInfo.Position * cellSize, roomInfo.Size * cellSize), Colors.Blue, false); if (roomDoor.HasCross && roomDoor.RoomInfo.Id < roomDoor.ConnectRoom.Id) { diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs index 80a007d..eeb6c40 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs @@ -173,7 +173,7 @@ /// /// 当前选中的预设 /// - public RoomPreinstall SelectPreinstall + public RoomPreinstallInfo SelectPreinstallInfo { get { @@ -191,6 +191,11 @@ /// public MarkTool SelectMark => MapEditorToolsPanel.ActiveMark; + /// + /// 当前的房间大小 + /// + public Vector2I RoomSize => _roomSize; + //变动过的数据 //地图位置, 单位: 格 @@ -490,7 +495,8 @@ public void TriggerSave() { GD.Print("保存地牢房间数据..."); - RoomSplit.Ready = !HasError; + //是否准备好 + RoomSplit.Ready = !HasError && RoomSplit.Preinstall != null && RoomSplit.Preinstall.Count > 0; SaveRoomInfoConfig(); SaveTileInfoConfig(); SavePreinstallConfig(); diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs index cbcf66d..4548f98 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs @@ -72,7 +72,23 @@ S_DelayContainer.Instance.Visible = true; S_DelayInput.Instance.Value = data.DelayTime; } - _grid.SetDataList(data.MarkList.ToArray()); + + if (_markInfo.SpecialMarkType == SpecialMarkType.BirthPoint) //出生标记 + { + var markInfoItem = new MarkInfoItem(); + markInfoItem.Id = ActivityObject.Ids.Id_role0001; + markInfoItem.SpecialMarkType = _markInfo.SpecialMarkType; + _grid.Add(markInfoItem); + //隐藏选项 + S_AddMark.Instance.Visible = false; + S_DelayContainer.Instance.Visible = false; + } + else //普通标记 + { + _grid.SetDataList(data.MarkList.ToArray()); + S_AddMark.Instance.Visible = true; + S_DelayContainer.Instance.Visible = true; + } } /// @@ -100,13 +116,29 @@ data.Position = new SerializeVector2((float)S_PosX.Instance.Value, (float)S_PosY.Instance.Value); data.Size = new SerializeVector2((float)S_SizeX.Instance.Value, (float)S_SizeY.Instance.Value); - //标记物体数据 - var gridCount = _grid.Count; - for (var i = 0; i < gridCount; i++) + if (_markInfo != null) { - var uiCell = (MarkObjectCell)_grid.GetCell(i); - var markInfoItem = uiCell.GetMarkInfoItem(); - data.MarkList.Add(markInfoItem); + data.SpecialMarkType = _markInfo.SpecialMarkType; + } + else + { + data.SpecialMarkType = SpecialMarkType.Normal; + } + + //标记物体数据 + if (data.SpecialMarkType == SpecialMarkType.BirthPoint) //出生标记 + { + + } + else //普通标记 + { + var gridCount = _grid.Count; + for (var i = 0; i < gridCount; i++) + { + var uiCell = (MarkObjectCell)_grid.GetCell(i); + var markInfoItem = uiCell.GetMarkInfoItem(); + data.MarkList.Add(markInfoItem); + } } return data; diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs index 457b82f..3ad5565 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs @@ -48,6 +48,15 @@ CreateExpandPanel(_activityObject, data); } } + + if (data.SpecialMarkType == SpecialMarkType.BirthPoint) //出生标记 + { + CellNode.L_VBoxContainer.L_HBoxContainer.L_CenterContainer.L_DeleteButton.Instance.Visible = false; + } + else //普通标记 + { + CellNode.L_VBoxContainer.L_HBoxContainer.L_CenterContainer.L_DeleteButton.Instance.Visible = true; + } } public override void OnDisable() diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstallPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstallPanel.cs index d4194fb..d8ac5b8 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstallPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstallPanel.cs @@ -6,27 +6,35 @@ public partial class MapEditorCreatePreinstallPanel : MapEditorCreatePreinstall { - private RoomPreinstall _roomPreinstall; + private RoomPreinstallInfo _roomPreinstallInfo; + private DungeonRoomType _roomType; + + /// + /// 初始化房间预设数据, 用于创建预设 + /// + public void InitData(DungeonRoomType roomType) + { + _roomType = roomType; + } /// /// 初始化房间预设数据, 用于编辑预设 /// - public void InitData(RoomPreinstall preinstall) + public void InitData(DungeonRoomType roomType, RoomPreinstallInfo preinstallInfo) { - _roomPreinstall = preinstall; - S_PreinstallNameInput.Instance.Text = preinstall.Name; - S_WeightInput.Instance.Value = preinstall.Weight; - S_RemarkInput.Instance.Text = preinstall.Remark; + InitData(roomType); + _roomPreinstallInfo = preinstallInfo; + S_PreinstallNameInput.Instance.Text = preinstallInfo.Name; + S_WeightInput.Instance.Value = preinstallInfo.Weight; + S_RemarkInput.Instance.Text = preinstallInfo.Remark; } - + /// /// 填完数据后创建数据进行验证并创建数据对象, 如果验证失败, 则返回null /// - /// - /// - public RoomPreinstall GetRoomPreinstall(List roomPreinstalls) + public RoomPreinstallInfo GetRoomPreinstall(List roomPreinstalls) { - var data = new RoomPreinstall(); + var data = new RoomPreinstallInfo(); data.Name = S_PreinstallNameInput.Instance.Text; //检查名称是否合规 if (string.IsNullOrEmpty(data.Name)) @@ -35,7 +43,7 @@ return null; } - var index = roomPreinstalls.FindIndex(preinstall => preinstall.Name == data.Name && preinstall != _roomPreinstall); + var index = roomPreinstalls.FindIndex(preinstall => preinstall.Name == data.Name && preinstall != _roomPreinstallInfo); if (index >= 0) { EditorWindowManager.ShowTips("错误", "当前房间已经存在预设名称'" + data.Name + "', 请使用其他名称!"); @@ -44,16 +52,33 @@ data.Remark = S_RemarkInput.Instance.Text; data.Weight = (int)S_WeightInput.Instance.Value; - if (_roomPreinstall != null) //编辑数据 + if (_roomPreinstallInfo != null) //编辑数据 { - data.WaveList = _roomPreinstall.WaveList; + data.WaveList = _roomPreinstallInfo.WaveList; } else //创建数据 { //预加载波 data.InitWaveList(); + CreateSpecialMark(data.WaveList); } return data; } + + //创建特殊标记 + private void CreateSpecialMark(List> dataWaveList) + { + if (_roomType == DungeonRoomType.Inlet) //初始房间 + { + var preloading = dataWaveList[0]; + //玩家标记 + var markInfo = new MarkInfo(); + markInfo.Position = new SerializeVector2(); + markInfo.Size = new SerializeVector2(); + markInfo.SpecialMarkType = SpecialMarkType.BirthPoint; + markInfo.MarkList = new List(); + preloading.Add(markInfo); + } + } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateRoom/MapEditorCreateRoomPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateRoom/MapEditorCreateRoomPanel.cs index ac87b22..04be262 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateRoom/MapEditorCreateRoomPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateRoom/MapEditorCreateRoomPanel.cs @@ -117,7 +117,7 @@ roomSplit.TileInfo = tileInfo; roomSplit.PreinstallPath = dirPath + "/" + MapProjectManager.GetRoomPreinstallConfigName(roomInfo.RoomName); - roomSplit.Preinstall = new List(); + roomSplit.Preinstall = new List(); return roomSplit; } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs index 7e70305..4a19ce5 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs @@ -31,7 +31,14 @@ } else { - text += "空"; + if (data.MarkInfo.SpecialMarkType == SpecialMarkType.BirthPoint) + { + text = "出生标记"; + } + else + { + text += "空"; + } } //延时时间 diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs index b1b444c..56379e0 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs @@ -131,7 +131,7 @@ /// /// 获取当前选中的预设 /// - public RoomPreinstall GetSelectPreinstall() + public RoomPreinstallInfo GetSelectPreinstall() { var index = S_PreinstallOption.Instance.Selected; var preinstall = EditorTileMap.RoomSplit.Preinstall; @@ -206,16 +206,27 @@ return; } - if (toolType == SelectToolType.Wave) //不需要显示编辑波数按钮 + if (toolType == SelectToolType.Wave) { + //不需要显示编辑波数按钮 S_DynamicTool.L_EditButton.Instance.Visible = false; //预加载波不能删除 S_DynamicTool.L_DeleteButton.Instance.Visible = uiCell.Index != 0; } else //显示编辑按钮 { - S_DynamicTool.L_EditButton.Instance.Visible = true; - S_DynamicTool.L_DeleteButton.Instance.Visible = true; + var markCell = (EditorMarkCell)uiCell; + var markType = markCell.Data.MarkInfo.SpecialMarkType; + if (markType == SpecialMarkType.BirthPoint) //某些特殊标记不能删除 + { + S_DynamicTool.L_EditButton.Instance.Visible = true; + S_DynamicTool.L_DeleteButton.Instance.Visible = false; + } + else //普通标记 + { + S_DynamicTool.L_EditButton.Instance.Visible = true; + S_DynamicTool.L_DeleteButton.Instance.Visible = true; + } } //显示工具 @@ -261,8 +272,9 @@ /// public void OnAddPreinstall() { + var roomInfoRoomType = EditorTileMap.RoomSplit.RoomInfo.RoomType; var roomSplitPreinstall = EditorTileMap.RoomSplit.Preinstall; - EditorWindowManager.ShowCreatePreinstall(roomSplitPreinstall, preinstall => + EditorWindowManager.ShowCreatePreinstall(roomInfoRoomType, roomSplitPreinstall, preinstall => { //创建逻辑 roomSplitPreinstall.Add(preinstall); @@ -277,9 +289,10 @@ /// public void OnEditPreinstall() { + var roomInfoRoomType = EditorTileMap.RoomSplit.RoomInfo.RoomType; var roomSplitPreinstall = EditorTileMap.RoomSplit.Preinstall; var selectPreinstall = GetSelectPreinstall(); - EditorWindowManager.ShowEditPreinstall(roomSplitPreinstall, selectPreinstall, preinstall => + EditorWindowManager.ShowEditPreinstall(roomInfoRoomType, roomSplitPreinstall, selectPreinstall, preinstall => { //修改逻辑 selectPreinstall.CloneFrom(preinstall); diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs index 591fc21..0489882 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs @@ -94,6 +94,18 @@ } if (MapEditorToolsPanel.ActiveHoverArea == null || !IsDrag) { + var roomSize = MapEditorToolsPanel.EditorMap.Instance.RoomSize; + //房间大小为0, 不能放置门区域 + if (roomSize.X == 0 && roomSize.Y == 0) + { + return; + } + //正在拖拽标记, 不能放置门区域 + var activeMark = MapEditorToolsPanel.ActiveMark; + if (activeMark != null && (activeMark.IsDrag || activeMark.MarkAreaTool.IsDrag)) + { + return; + } _mouseHover = true; MapEditorToolsPanel.SetActiveHoverArea(this); } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs index f4abecd..85b79ee 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs @@ -142,7 +142,7 @@ } _currMarkToolsMap.Clear(); //添加新的数据 - var selectPreinstall = EditorMap.Instance.SelectPreinstall; + var selectPreinstall = EditorMap.Instance.SelectPreinstallInfo; if (selectPreinstall != null) { foreach (var markInfos in selectPreinstall.WaveList) @@ -159,7 +159,7 @@ private void OnSelectWaveTool(object arg) { var selectIndex = (int)arg; - var waveList = EditorMap.Instance.SelectPreinstall.WaveList; + var waveList = EditorMap.Instance.SelectPreinstallInfo.WaveList; for (var i = 0; i < waveList.Count; i++) { var wave = waveList[i]; diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkAreaTool.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkAreaTool.cs index 25022ac..1d6d223 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkAreaTool.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkAreaTool.cs @@ -49,10 +49,12 @@ public override void _Process(double delta) { - if (!Visible || _markInfo == null || _toolRoot.UiPanel.IsOpenPopUps || !_toolRoot.UiPanel.S_ToolRoot.Instance.Visible) + if (!Visible || _markInfo == null || _toolRoot.UiPanel.IsOpenPopUps || + !_toolRoot.UiPanel.S_ToolRoot.Instance.Visible || DoorHoverArea.IsDrag) { return; } + _showCornerBlock = _markInfo.Size.X >= 4 && _markInfo.Size.Y >= 4; var globalMousePosition = GetGlobalMousePosition(); diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs index 271ee4f..b95df0a 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs @@ -12,17 +12,21 @@ /// 绑定的数据 /// public MarkInfo MarkInfo { get; private set; } - + /// /// 是否拖拽中 /// public bool IsDrag { get; private set; } + /// + /// 标记区域 + /// + public MarkAreaTool MarkAreaTool { get; private set; } + private bool _enter; private MapEditorTools.MarkTemplate _toolNode; private bool _isDown; private Vector2 _offset; - private MarkAreaTool _markAreaToolUp; private Vector2 _startPos; public void SetUiNode(IUiNode uiNode) @@ -31,10 +35,10 @@ _toolNode.Instance.MouseEntered += OnMouseEntered; _toolNode.Instance.MouseExited += OnMouseExited; - _markAreaToolUp = new MarkAreaTool(); - _markAreaToolUp.Position = Size / 2; - _markAreaToolUp.Visible = false; - AddChild(_markAreaToolUp); + MarkAreaTool = new MarkAreaTool(); + MarkAreaTool.Position = Size / 2; + MarkAreaTool.Visible = false; + AddChild(MarkAreaTool); } public void OnDestroy() @@ -43,12 +47,12 @@ public override void _Process(double delta) { - if (_toolNode != null && MarkInfo != null && _toolNode.UiPanel.S_ToolRoot.Instance.Visible) + if (_toolNode != null && MarkInfo != null && _toolNode.UiPanel.S_ToolRoot.Instance.Visible && !DoorHoverArea.IsDrag) { if (_isDown) { //松开鼠标或者在拖拽区域 - if (!Input.IsMouseButtonPressed(MouseButton.Left) || _markAreaToolUp.IsDrag) + if (!Input.IsMouseButtonPressed(MouseButton.Left) || MarkAreaTool.IsDrag) { _isDown = false; IsDrag = false; @@ -65,8 +69,8 @@ { //判断是否可以选中 var activeMark = _toolNode.UiPanel.ActiveMark; - if ((activeMark == null || (!activeMark.IsDrag && !activeMark._markAreaToolUp.IsDrag)) && - !_markAreaToolUp.IsDrag && Input.IsMouseButtonPressed(MouseButton.Left) && + if ((activeMark == null || (!activeMark.IsDrag && !activeMark.MarkAreaTool.IsDrag)) && + !MarkAreaTool.IsDrag && Input.IsMouseButtonPressed(MouseButton.Left) && _toolNode.UiPanel.EditorMap.Instance.MouseType == EditorTileMap.MouseButtonType.Edit) { _isDown = true; @@ -94,11 +98,11 @@ //只有选中物体才会显示拖拽区域 if (_toolNode.UiPanel.ActiveMark == this) { - _markAreaToolUp.Visible = true; + MarkAreaTool.Visible = true; } else { - _markAreaToolUp.Visible = false; + MarkAreaTool.Visible = false; } QueueRedraw(); } @@ -112,7 +116,7 @@ MarkInfo = markInfo; Position = markInfo.Position.AsVector2() - (Size / 2).Ceil(); _startPos = GlobalPosition; - _markAreaToolUp.InitData(_toolNode.UiPanel.S_ToolRoot, this); + MarkAreaTool.InitData(_toolNode.UiPanel.S_ToolRoot, this); } private void OnMouseEntered() @@ -127,7 +131,7 @@ public override void _Draw() { - if (MarkInfo != null && !_markAreaToolUp.Visible) + if (MarkInfo != null && !MarkAreaTool.Visible) { var size = new Vector2(MarkInfo.Size.X + 2, MarkInfo.Size.Y + 2); DrawRect(new Rect2(-size / 2 + Size / 2, size.X, size.Y), new Color(1, 1, 1, 0.7f), false, 1);