diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Test1/battle/Battle1/TileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/Test1/battle/Battle1/TileInfo.json index 48728ce..181ef20 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/Test1/battle/Battle1/TileInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/Test1/battle/Battle1/TileInfo.json @@ -1 +1 @@ -{"NavigationVertices":[{"X":154,"Y":6},{"X":154,"Y":66},{"X":134,"Y":38},{"X":138,"Y":6},{"X":134,"Y":-30},{"X":138,"Y":-58},{"X":90,"Y":-58},{"X":74,"Y":-30},{"X":118,"Y":54},{"X":118,"Y":38},{"X":54,"Y":66},{"X":74,"Y":54},{"X":54,"Y":50},{"X":-10,"Y":50},{"X":-10,"Y":-14},{"X":-26,"Y":-14},{"X":-26,"Y":-74},{"X":90,"Y":-74}],"NavigationPolygon":[[0,1,2,3],[3,2,4,5],[6,5,4,7],[8,9,2,1],[8,1,10,11],[11,10,12,7],[12,13,14,7],[7,14,15,16,17,6]],"Floor":[-1,-1,0,3,3,-1,0,3,3,0,0,3,2,0,0,3,2,-1,0,3,1,-1,0,3,0,-1,0,3,0,0,0,3,-1,0,0,3,1,0,0,3,-1,1,0,3,0,1,0,3,1,1,0,3,2,1,0,3,3,1,0,3,4,1,0,3,4,2,0,3,3,2,0,3,2,2,0,3,1,2,0,3,0,2,0,3,-1,2,0,3,4,0,0,3,4,-1,0,3,4,-2,0,3,3,-2,0,3,2,-2,0,3,1,-2,0,3,0,-2,0,3,-1,-2,0,3,-1,-3,0,3,0,-3,0,3,1,-3,0,3,2,-3,0,3,3,-3,0,3,4,-3,0,3,5,-3,0,3,5,-4,0,3,5,-5,0,3,4,-5,0,3,3,-5,0,3,2,-5,0,3,1,-5,0,3,0,-5,0,3,-1,-5,0,3,-2,-5,0,3,-2,-4,0,3,-1,-4,0,3,0,-4,0,3,1,-4,0,3,2,-4,0,3,3,-4,0,3,4,-4,0,3,6,-4,0,3,7,-4,0,3,8,-4,0,3,8,-3,0,3,8,-2,0,3,7,-3,0,3,6,-3,0,3,8,-1,0,3,8,0,0,3,8,1,0,3,8,2,0,3,7,2,0,3,7,3,0,3,6,3,0,3,5,3,0,3,4,3,0,3,3,3,0,3,8,3,0,3,9,3,0,3,9,2,0,3,-2,-3,0,3,-2,-2,0,3,9,0,0,3,9,1,0,3],"Middle":[-2,-7,63,1,-2,-6,2,2,-1,-7,63,1,-1,-6,2,2,0,-7,63,1,0,-6,2,2,1,-7,63,1,1,-6,2,2,2,-7,63,1,2,-6,2,2,3,-7,63,1,3,-6,2,2,4,-7,63,1,4,-6,2,2,5,-7,63,1,5,-6,2,2,5,1,54,1,5,2,1,2,6,-6,54,1,6,-5,1,2,6,1,27,1,6,2,3,2,7,-6,63,1,7,-5,2,2,7,0,27,1,7,1,3,2,8,-6,63,1,8,-5,2,2,9,-2,54,1,9,-1,1,2],"Top":[-4,-8,511,1,-4,-7,511,1,-4,-6,511,1,-4,-5,511,1,-4,-4,511,1,-4,-3,511,1,-4,-2,511,1,-4,-1,511,1,-4,0,511,1,-3,-8,511,1,-3,-7,255,1,-3,-6,219,1,-3,-5,219,1,-3,-4,219,1,-3,-3,219,1,-3,-2,219,1,-3,-1,507,1,-3,0,511,1,-3,1,511,1,-3,2,511,1,-3,3,511,1,-3,4,511,1,-2,-8,511,1,-2,-1,216,1,-2,0,219,1,-2,1,219,1,-2,2,219,1,-2,3,507,1,-2,4,511,1,-1,-8,511,1,-1,3,504,1,-1,4,511,1,0,-8,511,1,0,3,504,1,0,4,511,1,1,-8,511,1,1,3,504,1,1,4,511,1,1,5,511,1,2,-8,511,1,2,3,216,1,2,4,507,1,2,5,511,1,3,-8,511,1,3,4,504,1,3,5,511,1,4,-8,511,1,4,4,504,1,4,5,511,1,5,-8,511,1,5,-2,432,1,5,-1,438,1,5,0,438,1,5,4,504,1,5,5,511,1,6,-8,511,1,6,-7,447,1,6,-2,504,1,6,-1,511,1,6,0,255,1,6,4,504,1,6,5,511,1,7,-8,511,1,7,-7,511,1,7,-2,216,1,7,-1,219,1,7,4,504,1,7,5,511,1,8,-7,511,1,8,4,504,1,8,5,511,1,9,-7,511,1,9,-6,447,1,9,-5,438,1,9,-4,438,1,9,-3,438,1,9,4,504,1,9,5,511,1,10,-7,511,1,10,-6,511,1,10,-5,511,1,10,-4,511,1,10,-3,511,1,10,-2,447,1,10,-1,438,1,10,0,438,1,10,1,438,1,10,2,438,1,10,3,438,1,10,4,510,1,10,5,511,1,11,-3,511,1,11,-2,511,1,11,-1,511,1,11,0,511,1,11,1,511,1,11,2,511,1,11,3,511,1,11,4,511,1,11,5,511,1],"CustomLayers":{}} \ No newline at end of file +{"NavigationVertices":[{"X":154,"Y":6},{"X":154,"Y":66},{"X":134,"Y":38},{"X":138,"Y":6},{"X":134,"Y":-30},{"X":138,"Y":-58},{"X":90,"Y":-58},{"X":74,"Y":-30},{"X":118,"Y":54},{"X":118,"Y":38},{"X":54,"Y":66},{"X":74,"Y":54},{"X":54,"Y":50},{"X":-10,"Y":50},{"X":-10,"Y":-14},{"X":-26,"Y":-14},{"X":-26,"Y":-74},{"X":90,"Y":-74}],"NavigationPolygon":[[0,1,2,3],[3,2,4,5],[6,5,4,7],[8,9,2,1],[8,1,10,11],[11,10,12,7],[12,13,14,7],[7,14,15,16,17,6]],"Floor":[-1,-1,0,3,3,-1,0,3,3,0,0,3,2,0,0,3,2,-1,0,3,1,-1,0,3,0,-1,0,3,0,0,0,3,-1,0,0,3,1,0,0,3,-1,1,0,3,0,1,0,3,1,1,0,3,2,1,0,3,3,1,0,3,4,1,0,3,4,2,0,3,3,2,0,3,2,2,0,3,1,2,0,3,0,2,0,3,-1,2,0,3,4,0,0,3,4,-1,0,3,4,-2,0,3,3,-2,0,3,2,-2,0,3,1,-2,0,3,0,-2,0,3,-1,-2,0,3,-1,-3,0,3,0,-3,0,3,1,-3,0,3,2,-3,0,3,3,-3,0,3,4,-3,0,3,5,-3,0,3,5,-4,0,3,5,-5,0,3,4,-5,0,3,3,-5,0,3,2,-5,0,3,1,-5,0,3,0,-5,0,3,-1,-5,0,3,-2,-5,0,3,-2,-4,0,3,-1,-4,0,3,0,-4,0,3,1,-4,0,3,2,-4,0,3,3,-4,0,3,4,-4,0,3,6,-4,0,3,7,-4,0,3,8,-4,0,3,8,-3,0,3,8,-2,0,3,7,-3,0,3,6,-3,0,3,8,-1,0,3,8,0,0,3,8,1,0,3,8,2,0,3,7,2,0,3,7,3,0,3,6,3,0,3,5,3,0,3,4,3,0,3,3,3,0,3,8,3,0,3,9,3,0,3,9,2,0,3,-2,-3,0,3,-2,-2,0,3,9,0,0,3,9,1,0,3],"Middle":[-2,-7,63,1,-2,-6,2,2,-1,-7,63,1,-1,-6,2,2,0,-7,63,1,0,-6,2,2,1,-7,63,1,1,-6,2,2,2,-7,63,1,2,-6,2,2,3,-7,63,1,3,-6,2,2,4,-7,63,1,4,-6,2,2,5,-7,63,1,5,-6,2,2,5,1,54,1,5,2,1,2,6,-6,54,1,6,-5,1,2,6,1,27,1,6,2,3,2,7,-6,63,1,7,-5,2,2,7,0,27,1,7,1,3,2,8,-6,63,1,8,-5,2,2,9,-2,54,1,9,-1,1,2],"Top":[-4,-8,511,1,-4,-7,511,1,-4,-6,511,1,-4,-5,511,1,-4,-4,511,1,-4,-3,511,1,-4,-2,511,1,-4,-1,511,1,-4,0,511,1,-3,-8,511,1,-3,-7,255,1,-3,-6,219,1,-3,-5,219,1,-3,-4,219,1,-3,-3,219,1,-3,-2,219,1,-3,-1,507,1,-3,0,511,1,-3,1,511,1,-3,2,511,1,-3,3,511,1,-3,4,511,1,-2,-8,511,1,-2,-1,216,1,-2,0,219,1,-2,1,219,1,-2,2,219,1,-2,3,507,1,-2,4,511,1,-1,-8,511,1,-1,3,504,1,-1,4,511,1,0,-8,511,1,0,3,504,1,0,4,511,1,1,-8,511,1,1,3,504,1,1,4,511,1,1,5,511,1,2,-8,511,1,2,3,216,1,2,4,507,1,2,5,511,1,3,-8,511,1,3,4,504,1,3,5,511,1,4,-8,511,1,4,4,504,1,4,5,511,1,5,-8,511,1,5,-2,432,1,5,-1,438,1,5,0,438,1,5,4,504,1,5,5,511,1,6,-8,511,1,6,-7,447,1,6,-2,504,1,6,-1,511,1,6,0,255,1,6,4,504,1,6,5,511,1,7,-8,511,1,7,-7,511,1,7,-2,216,1,7,-1,219,1,7,4,504,1,7,5,511,1,8,-7,511,1,8,4,504,1,8,5,511,1,9,-7,511,1,9,-6,447,1,9,-5,438,1,9,-4,438,1,9,-3,438,1,9,4,504,1,9,5,511,1,10,-7,511,1,10,-6,511,1,10,-5,511,1,10,-4,511,1,10,-3,511,1,10,-2,447,1,10,-1,438,1,10,0,438,1,10,1,438,1,10,2,438,1,10,3,438,1,10,4,510,1,10,5,511,1,11,-3,511,1,11,-2,511,1,11,-1,511,1,11,0,511,1,11,1,511,1,11,2,511,1,11,3,511,1,11,4,511,1,11,5,511,1],"CustomLayers":[]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/TileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/TileInfo.json index 6763cbc..73fa1b4 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/TileInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/TileInfo.json @@ -1 +1 @@ -{"NavigationVertices":[{"X":58,"Y":34},{"X":-26,"Y":34},{"X":-26,"Y":-42},{"X":58,"Y":-42}],"NavigationPolygon":[[0,1,2,3]],"Floor":[3,-2,0,3,2,-2,0,3,1,-2,0,3,0,-2,0,3,-1,-2,0,3,-2,-2,0,3,-2,-1,0,3,-1,-1,0,3,0,-1,0,3,1,-1,0,3,2,-1,0,3,3,-1,0,3,3,0,0,3,2,0,0,3,1,0,0,3,0,0,0,3,-1,0,0,3,-2,0,0,3,-2,1,0,3,-1,1,0,3,0,1,0,3,1,1,0,3,2,1,0,3,3,1,0,3,3,-3,0,3,2,-3,0,3,1,-3,0,3,0,-3,0,3,-1,-3,0,3,-2,-3,0,3],"Middle":[-2,-5,63,1,-2,-4,2,2,-1,-5,63,1,-1,-4,2,2,0,-5,63,1,0,-4,2,2,1,-5,63,1,1,-4,2,2,2,-5,63,1,2,-4,2,2,3,-5,63,1,3,-4,2,2],"Top":[-4,-6,511,1,-4,-5,511,1,-4,-4,511,1,-4,-3,511,1,-4,-2,511,1,-4,-1,511,1,-4,0,511,1,-4,1,511,1,-4,2,511,1,-4,3,511,1,-3,-6,511,1,-3,-5,255,1,-3,-4,219,1,-3,-3,219,1,-3,-2,219,1,-3,-1,219,1,-3,0,219,1,-3,1,219,1,-3,2,507,1,-3,3,511,1,-2,-6,511,1,-2,2,504,1,-2,3,511,1,-1,-6,511,1,-1,2,504,1,-1,3,511,1,0,-6,511,1,0,2,504,1,0,3,511,1,1,-6,511,1,1,2,504,1,1,3,511,1,2,-6,511,1,2,2,504,1,2,3,511,1,3,-6,511,1,3,2,504,1,3,3,511,1,4,-6,511,1,4,-5,447,1,4,-4,438,1,4,-3,438,1,4,-2,438,1,4,-1,438,1,4,0,438,1,4,1,438,1,4,2,510,1,4,3,511,1,5,-6,511,1,5,-5,511,1,5,-4,511,1,5,-3,511,1,5,-2,511,1,5,-1,511,1,5,0,511,1,5,1,511,1,5,2,511,1,5,3,511,1],"CustomLayers":{}} \ No newline at end of file +{"NavigationVertices":[{"X":58,"Y":34},{"X":-26,"Y":34},{"X":-26,"Y":-42},{"X":58,"Y":-42}],"NavigationPolygon":[[0,1,2,3]],"Floor":[3,-2,0,3,2,-2,0,3,1,-2,0,3,0,-2,0,3,-1,-2,0,3,-2,-2,0,3,-2,-1,0,3,-1,-1,0,3,0,-1,0,3,1,-1,0,3,2,-1,0,3,3,-1,0,3,3,0,0,3,2,0,0,3,1,0,0,3,0,0,0,3,-1,0,0,3,-2,0,0,3,-2,1,0,3,-1,1,0,3,0,1,0,3,1,1,0,3,2,1,0,3,3,1,0,3,3,-3,0,3,2,-3,0,3,1,-3,0,3,0,-3,0,3,-1,-3,0,3,-2,-3,0,3],"Middle":[-2,-5,63,1,-2,-4,2,2,-1,-5,63,1,-1,-4,2,2,0,-5,63,1,0,-4,2,2,1,-5,63,1,1,-4,2,2,2,-5,63,1,2,-4,2,2,3,-5,63,1,3,-4,2,2],"Top":[-4,-6,511,1,-4,-5,511,1,-4,-4,511,1,-4,-3,511,1,-4,-2,511,1,-4,-1,511,1,-4,0,511,1,-4,1,511,1,-4,2,511,1,-4,3,511,1,-3,-6,511,1,-3,-5,255,1,-3,-4,219,1,-3,-3,219,1,-3,-2,219,1,-3,-1,219,1,-3,0,219,1,-3,1,219,1,-3,2,507,1,-3,3,511,1,-2,-6,511,1,-2,2,504,1,-2,3,511,1,-1,-6,511,1,-1,2,504,1,-1,3,511,1,0,-6,511,1,0,2,504,1,0,3,511,1,1,-6,511,1,1,2,504,1,1,3,511,1,2,-6,511,1,2,2,504,1,2,3,511,1,3,-6,511,1,3,2,504,1,3,3,511,1,4,-6,511,1,4,-5,447,1,4,-4,438,1,4,-3,438,1,4,-2,438,1,4,-1,438,1,4,0,438,1,4,1,438,1,4,2,510,1,4,3,511,1,5,-6,511,1,5,-5,511,1,5,-4,511,1,5,-3,511,1,5,-2,511,1,5,-1,511,1,5,0,511,1,5,1,511,1,5,2,511,1,5,3,511,1],"CustomLayers":[]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Test1/outlet/End1/TileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/Test1/outlet/End1/TileInfo.json index 7c8ea78..2187435 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/Test1/outlet/End1/TileInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/Test1/outlet/End1/TileInfo.json @@ -1 +1 @@ -{"NavigationVertices":[{"X":42,"Y":-42},{"X":42,"Y":34},{"X":22,"Y":6},{"X":22,"Y":-30},{"X":-26,"Y":-42},{"X":-6,"Y":-30},{"X":-26,"Y":34},{"X":-6,"Y":6}],"NavigationPolygon":[[0,1,2,3],[4,0,3,5],[2,1,6,7],[7,6,4,5]],"Floor":[-2,-1,0,3,-2,-2,0,3,-1,-2,0,3,1,-2,0,3,1,-1,0,3,2,-1,0,3,-1,-1,0,3,-2,0,0,3,-2,1,0,3,-1,1,0,3,0,1,0,3,1,1,0,3,2,1,0,3,2,0,0,3,1,0,0,3,0,0,0,3,-1,0,0,3,2,-2,0,3,2,-3,0,3,1,-3,0,3,0,-3,0,3,-1,-3,0,3,-2,-3,0,3],"Middle":[-2,-5,63,1,-2,-4,2,2,-1,-5,63,1,-1,-4,2,2,0,-5,63,1,0,-4,2,2,0,-2,16,1,0,-1,0,2,1,-5,63,1,1,-4,2,2,2,-5,63,1,2,-4,2,2],"Top":[-4,-6,511,1,-4,-5,511,1,-4,-4,511,1,-4,-3,511,1,-4,-2,511,1,-4,-1,511,1,-4,0,511,1,-4,1,511,1,-4,2,511,1,-4,3,511,1,-3,-6,511,1,-3,-5,255,1,-3,-4,219,1,-3,-3,219,1,-3,-2,219,1,-3,-1,219,1,-3,0,219,1,-3,1,219,1,-3,2,507,1,-3,3,511,1,-2,-6,511,1,-2,2,504,1,-2,3,511,1,-1,-6,511,1,-1,2,504,1,-1,3,511,1,0,-6,511,1,0,2,504,1,0,3,511,1,1,-6,511,1,1,2,504,1,1,3,511,1,2,-6,511,1,2,2,504,1,2,3,511,1,3,-6,511,1,3,-5,447,1,3,-4,438,1,3,-3,438,1,3,-2,438,1,3,-1,438,1,3,0,438,1,3,1,438,1,3,2,510,1,3,3,511,1,4,-6,511,1,4,-5,511,1,4,-4,511,1,4,-3,511,1,4,-2,511,1,4,-1,511,1,4,0,511,1,4,1,511,1,4,2,511,1,4,3,511,1],"CustomLayers":{}} \ No newline at end of file +{"NavigationVertices":[{"X":42,"Y":-42},{"X":42,"Y":34},{"X":22,"Y":6},{"X":22,"Y":-30},{"X":-26,"Y":-42},{"X":-6,"Y":-30},{"X":-26,"Y":34},{"X":-6,"Y":6}],"NavigationPolygon":[[0,1,2,3],[4,0,3,5],[2,1,6,7],[7,6,4,5]],"Floor":[-2,-1,0,3,-2,-2,0,3,-1,-2,0,3,1,-2,0,3,1,-1,0,3,2,-1,0,3,-1,-1,0,3,-2,0,0,3,-2,1,0,3,-1,1,0,3,0,1,0,3,1,1,0,3,2,1,0,3,2,0,0,3,1,0,0,3,0,0,0,3,-1,0,0,3,2,-2,0,3,2,-3,0,3,1,-3,0,3,0,-3,0,3,-1,-3,0,3,-2,-3,0,3],"Middle":[-2,-5,63,1,-2,-4,2,2,-1,-5,63,1,-1,-4,2,2,0,-5,63,1,0,-4,2,2,0,-2,16,1,0,-1,0,2,1,-5,63,1,1,-4,2,2,2,-5,63,1,2,-4,2,2],"Top":[-4,-6,511,1,-4,-5,511,1,-4,-4,511,1,-4,-3,511,1,-4,-2,511,1,-4,-1,511,1,-4,0,511,1,-4,1,511,1,-4,2,511,1,-4,3,511,1,-3,-6,511,1,-3,-5,255,1,-3,-4,219,1,-3,-3,219,1,-3,-2,219,1,-3,-1,219,1,-3,0,219,1,-3,1,219,1,-3,2,507,1,-3,3,511,1,-2,-6,511,1,-2,2,504,1,-2,3,511,1,-1,-6,511,1,-1,2,504,1,-1,3,511,1,0,-6,511,1,0,2,504,1,0,3,511,1,1,-6,511,1,1,2,504,1,1,3,511,1,2,-6,511,1,2,2,504,1,2,3,511,1,3,-6,511,1,3,-5,447,1,3,-4,438,1,3,-3,438,1,3,-2,438,1,3,-1,438,1,3,0,438,1,3,1,438,1,3,2,510,1,3,3,511,1,4,-6,511,1,4,-5,511,1,4,-4,511,1,4,-3,511,1,4,-2,511,1,4,-1,511,1,4,0,511,1,4,1,511,1,4,2,511,1,4,3,511,1],"CustomLayers":[]} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/serialize/room/CustomLayerInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/room/CustomLayerInfo.cs index 43752c7..28c2b6f 100644 --- a/DungeonShooting_Godot/src/framework/map/serialize/room/CustomLayerInfo.cs +++ b/DungeonShooting_Godot/src/framework/map/serialize/room/CustomLayerInfo.cs @@ -14,6 +14,12 @@ public string Name; /// + /// Z 轴排序 + /// + [JsonInclude] + public int ZIndex; + + /// /// 数据五个一组, 分别为: 地图x坐标, 地图y坐标, 资源id, 图集x坐标, 图集y坐标 /// [JsonInclude] diff --git a/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonTileInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonTileInfo.cs index 0b16f8b..539fc3e 100644 --- a/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonTileInfo.cs +++ b/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonTileInfo.cs @@ -39,7 +39,7 @@ /// 自定义层 /// [JsonInclude] - public Dictionary CustomLayers; + public List CustomLayers; public void InitData() { @@ -48,6 +48,6 @@ Floor = new List(); Middle = new List(); Top = new List(); - CustomLayers = new Dictionary(); + CustomLayers = new List(); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/GameConfig.cs b/DungeonShooting_Godot/src/game/GameConfig.cs index a42e0fe..0155eba 100644 --- a/DungeonShooting_Godot/src/game/GameConfig.cs +++ b/DungeonShooting_Godot/src/game/GameConfig.cs @@ -75,6 +75,23 @@ /// 连接房间的过道的地板层级 /// public const int AisleFloorMapLayer = 3; + /// + /// 标记数据层 + /// + public const int MarkLayer = 9999; + + /// + /// TileMap 地板的 Zindex + /// + public const int FloorMapZIndex = -10; + /// + /// TileMap 中层的 Zindex + /// + public const int MiddleMapZIndex = 0; + /// + /// TileMap 上层的 Zindex + /// + public const int TopMapZindex = 10; /// /// 配置层级的自定义数据名称 diff --git a/DungeonShooting_Godot/src/game/data/TileMapLayerData.cs b/DungeonShooting_Godot/src/game/data/TileMapLayerData.cs index ed479f1..431a40e 100644 --- a/DungeonShooting_Godot/src/game/data/TileMapLayerData.cs +++ b/DungeonShooting_Godot/src/game/data/TileMapLayerData.cs @@ -6,10 +6,14 @@ /// public string Title; /// - /// Map层级 + /// Map 层级索引 /// public int Layer; /// + /// Map 层级 Z 索引 + /// + public int ZIndex; + /// /// 是否锁定 /// public bool IsLock; @@ -22,18 +26,20 @@ /// public CustomLayerInfo CustomLayerInfo; - public TileMapLayerData(string title, int layer, bool isLock) + public TileMapLayerData(string title, int layer, int zIndex, bool isLock) { Title = title; Layer = layer; + ZIndex = zIndex; IsLock = isLock; CanDelete = false; } - public TileMapLayerData(string title, int layer, CustomLayerInfo customLayerInfo) + public TileMapLayerData(int layer, CustomLayerInfo customLayerInfo) { - Title = title; + Title = customLayerInfo.Name; Layer = layer; + ZIndex = customLayerInfo.ZIndex; IsLock = false; CanDelete = true; CustomLayerInfo = customLayerInfo; diff --git a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs index 53574e5..216b4f7 100644 --- a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs +++ b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using Config; using Godot; using UI.EditorColorPicker; @@ -753,11 +754,17 @@ ); } - public static void ShowCreateCustomLayer(DungeonTileInfo dungeonTileInfo, Action onCreate, UiBase parentUi = null) + /// + /// 显示创建 + /// + /// 当前房间所有的层 + /// 创建完成回调 + /// 所属父级Ui + public static void ShowCreateCustomLayer(List customLayerInfos, Action onCreate, UiBase parentUi = null) { var window = CreateWindowInstance(parentUi); window.SetWindowTitle("创建Layer"); - window.SetWindowSize(new Vector2I(600, 350)); + window.SetWindowSize(new Vector2I(400, 350)); var body = window.OpenBody(UiManager.UiNames.EditorForm); //第一项 @@ -766,10 +773,12 @@ PlaceholderText = "请输入名称" }); //第二项 - var item2 = new FormItemData("索引", new SpinBox() + var item2 = new FormItemData("层级", new SpinBox() { Value = 5, - Step = 1 + Step = 1, + MinValue = -100, + MaxValue = 100, }); body.AddItem(item1); @@ -783,9 +792,23 @@ ShowTips("错误", $"名称不允许为空!"); return; } + + foreach (var item in customLayerInfos) + { + if (item.Name == text) + { + ShowTips("错误", $"已经有相同的层名了!"); + return; + } + } + + var terrainInfo = new CustomLayerInfo(); + terrainInfo.InitData(); + terrainInfo.Name = text; + terrainInfo.ZIndex = (int)item2.UiNode.Value; - // window.CloseWindow(); - // onCreate(terrainInfo); + window.CloseWindow(); + onCreate(terrainInfo); }), new EditorWindowPanel.ButtonData("取消", () => { diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs index 44af8af..aa42c49 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs @@ -35,35 +35,6 @@ } /// - /// 自动图块地板层 - /// - public const int AutoFloorLayer = 0; - // /// - // /// 自定义图块地板层 - // /// - // public const int CustomFloorLayer = 1; - /// - /// 自动图块中间层 - /// - public const int AutoMiddleLayer = 1; - // /// - // /// 自定义图块中间层 - // /// - // public const int CustomMiddleLayer = 3; - /// - /// 自动图块顶层 - /// - public const int AutoTopLayer = 2; - // /// - // /// 自定义图块顶层 - // /// - // public const int CustomTopLayer = 5; - /// - /// 标记数据层 - /// - public const int MarkLayer = 999; - - /// /// 所属地图编辑器UI /// public MapEditorPanel MapEditorPanel { get; private set; } @@ -450,7 +421,7 @@ var terrainCell = terrainInfo.GetTerrainCell(index, type); var atlasCoords = terrainInfo.GetPosition(terrainCell); SetCell(layer, pos, sourceId, atlasCoords); - if (layer == AutoFloorLayer) + if (layer == GameConfig.FloorMapLayer) { _autoCellLayerGrid.Set(pos, true); } @@ -510,9 +481,9 @@ InitLayer(); //地块数据 - SetAutoLayerDataFromList(AutoFloorLayer, tileInfo.Floor); - SetAutoLayerDataFromList(AutoMiddleLayer, tileInfo.Middle); - SetAutoLayerDataFromList(AutoTopLayer, tileInfo.Top); + SetAutoLayerDataFromList(GameConfig.FloorMapLayer, tileInfo.Floor); + SetAutoLayerDataFromList(GameConfig.MiddleMapLayer, tileInfo.Middle); + SetAutoLayerDataFromList(GameConfig.TopMapLayer, tileInfo.Top); //如果有图块错误, 则找出错误的点位 if (roomSplit.ErrorType == RoomErrorType.TileError) @@ -573,12 +544,12 @@ //初始化层级数据 // AddLayer(CustomFloorLayer); // SetLayerZIndex(CustomFloorLayer, CustomFloorLayer); - AddLayer(AutoMiddleLayer); - SetLayerZIndex(AutoMiddleLayer, AutoMiddleLayer); + AddLayer(GameConfig.MiddleMapLayer); + SetLayerZIndex(GameConfig.MiddleMapLayer, GameConfig.MiddleMapLayer); // AddLayer(CustomMiddleLayer); // SetLayerZIndex(CustomMiddleLayer, CustomMiddleLayer); - AddLayer(AutoTopLayer); - SetLayerZIndex(AutoTopLayer, AutoTopLayer); + AddLayer(GameConfig.TopMapLayer); + SetLayerZIndex(GameConfig.TopMapLayer, GameConfig.TopMapLayer); // AddLayer(CustomTopLayer); // SetLayerZIndex(CustomTopLayer, CustomTopLayer); } @@ -697,8 +668,8 @@ { _generateTimer = _generateInterval; _isGenerateTerrain = false; - ClearLayer(AutoTopLayer); - ClearLayer(AutoMiddleLayer); + ClearLayer(GameConfig.TopMapLayer); + ClearLayer(GameConfig.MiddleMapLayer); CloseErrorCell(); //标记有修改数据 EventManager.EmitEvent(EventEnum.OnTileMapDirty); @@ -736,7 +707,7 @@ //生成自动图块 (地形) private void GenerateTerrain() { - //ClearLayer(AutoFloorLayer); + //ClearLayer(GameConfig.FloorMapLayer); var list = new List(); var xStart = int.MaxValue; var yStart = int.MaxValue; @@ -830,7 +801,7 @@ } var arr = new Array(list); //绘制自动图块 - SetCellsTerrainConnect(AutoFloorLayer, arr, _terrainSet, _terrain, false); + SetCellsTerrainConnect(GameConfig.FloorMapLayer, arr, _terrainSet, _terrain, false); //擦除临时边界 for (var i = 0; i < temp1.Count; i++) @@ -870,11 +841,11 @@ return false; } - //将自动生成的图块从 AutoFloorLayer 移动到指定图层中 + //将自动生成的图块从 GameConfig.FloorMapLayer 移动到指定图层中 private void MoveTerrainCell() { - ClearLayer(AutoTopLayer); - ClearLayer(AutoMiddleLayer); + ClearLayer(GameConfig.TopMapLayer); + ClearLayer(GameConfig.MiddleMapLayer); var x = CurrRoomPosition.X; var y = CurrRoomPosition.Y; @@ -886,24 +857,24 @@ for (var j = 0; j < h; j++) { var pos = new Vector2I(x + i, y + j); - if (!_autoCellLayerGrid.Contains(pos) && GetCellSourceId(AutoFloorLayer, pos) != -1) + if (!_autoCellLayerGrid.Contains(pos) && GetCellSourceId(GameConfig.FloorMapLayer, pos) != -1) { - var atlasCoords = GetCellAtlasCoords(AutoFloorLayer, pos); + var atlasCoords = GetCellAtlasCoords(GameConfig.FloorMapLayer, pos); var layer = _autoTileConfig.GetLayer(atlasCoords); if (layer == GameConfig.MiddleMapLayer) { - layer = AutoMiddleLayer; + layer = GameConfig.MiddleMapLayer; } else if (layer == GameConfig.TopMapLayer) { - layer = AutoTopLayer; + layer = GameConfig.TopMapLayer; } else { Debug.LogError($"异常图块: {pos}, 这个图块的图集坐标'{atlasCoords}'不属于'MiddleMapLayer'和'TopMapLayer'!"); continue; } - EraseCell(AutoFloorLayer, pos); + EraseCell(GameConfig.FloorMapLayer, pos); SetCell(layer, pos, _sourceId, atlasCoords); } } @@ -944,17 +915,17 @@ private int GetFloorLayer() { - return AutoFloorLayer; + return GameConfig.FloorMapLayer; } private int GetMiddleLayer() { - return AutoMiddleLayer; + return GameConfig.MiddleMapLayer; } private int GetTopLayer() { - return AutoTopLayer; + return GameConfig.TopMapLayer; } /// @@ -1141,9 +1112,9 @@ tileInfo.Middle.Clear(); tileInfo.Top.Clear(); - PushAutoLayerDataToList(AutoFloorLayer, _sourceId, tileInfo.Floor); - PushAutoLayerDataToList(AutoMiddleLayer, _sourceId, tileInfo.Middle); - PushAutoLayerDataToList(AutoTopLayer, _sourceId, tileInfo.Top); + PushAutoLayerDataToList(GameConfig.FloorMapLayer, _sourceId, tileInfo.Floor); + PushAutoLayerDataToList(GameConfig.MiddleMapLayer, _sourceId, tileInfo.Middle); + PushAutoLayerDataToList(GameConfig.TopMapLayer, _sourceId, tileInfo.Top); MapProjectManager.SaveRoomTileInfo(CurrRoomSplit); } @@ -1255,18 +1226,18 @@ //隐藏工具栏 MapEditorToolsPanel.Visible = false; //显示所有层级 - _tempAutoFloorLayer = IsLayerEnabled(AutoFloorLayer); + _tempAutoFloorLayer = IsLayerEnabled(GameConfig.FloorMapLayer); //_tempCustomFloorLayer = IsLayerEnabled(CustomFloorLayer); - _tempAutoMiddleLayer = IsLayerEnabled(AutoMiddleLayer); + _tempAutoMiddleLayer = IsLayerEnabled(GameConfig.MiddleMapLayer); //_tempCustomMiddleLayer = IsLayerEnabled(CustomMiddleLayer); - _tempAutoTopLayer = IsLayerEnabled(AutoTopLayer); + _tempAutoTopLayer = IsLayerEnabled(GameConfig.TopMapLayer); //_tempCustomTopLayer = IsLayerEnabled(CustomTopLayer); - SetLayerEnabled(AutoFloorLayer, true); + SetLayerEnabled(GameConfig.FloorMapLayer, true); //SetLayerEnabled(CustomFloorLayer, true); - SetLayerEnabled(AutoMiddleLayer, true); + SetLayerEnabled(GameConfig.MiddleMapLayer, true); //SetLayerEnabled(CustomMiddleLayer, true); - SetLayerEnabled(AutoTopLayer, true); + SetLayerEnabled(GameConfig.TopMapLayer, true); //SetLayerEnabled(CustomTopLayer, true); } @@ -1286,11 +1257,11 @@ //还原工具栏 MapEditorToolsPanel.Visible = true; //还原层级显示 - SetLayerEnabled(AutoFloorLayer, _tempAutoFloorLayer); + SetLayerEnabled(GameConfig.FloorMapLayer, _tempAutoFloorLayer); //SetLayerEnabled(CustomFloorLayer, _tempCustomFloorLayer); - SetLayerEnabled(AutoMiddleLayer, _tempAutoMiddleLayer); + SetLayerEnabled(GameConfig.MiddleMapLayer, _tempAutoMiddleLayer); //SetLayerEnabled(CustomMiddleLayer, _tempCustomMiddleLayer); - SetLayerEnabled(AutoTopLayer, _tempAutoTopLayer); + SetLayerEnabled(GameConfig.TopMapLayer, _tempAutoTopLayer); //SetLayerEnabled(CustomTopLayer, _tempCustomTopLayer); //保存预览图 diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs index a5d950e..698a4c7 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs @@ -27,7 +27,7 @@ var panel = CellNode.UiPanel.ParentUi as MapEditorPanel; if (panel != null) { - if (Data.Layer == EditorTileMap.MarkLayer) //标记层 + if (Data.Layer == GameConfig.MarkLayer) //标记层 { _visible = true; } @@ -45,7 +45,7 @@ if (panel != null) { _visible = !_visible; - if (Data.Layer == EditorTileMap.MarkLayer) //隐藏标记层 + if (Data.Layer == GameConfig.MarkLayer) //隐藏标记层 { panel.S_MapEditorTools.Instance.S_ToolRoot.Instance.Visible = _visible; } @@ -78,4 +78,14 @@ { CellNode.L_SelectTexture.Instance.Visible = false; } + + public override bool CanSelect() + { + return !Data.IsLock; + } + + public override int OnSort(UiCell other) + { + return Data.ZIndex - other.Data.ZIndex; + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/MapEditorMapLayerPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/MapEditorMapLayerPanel.cs index 190525a..3f0d8ba 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/MapEditorMapLayerPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/MapEditorMapLayerPanel.cs @@ -7,35 +7,37 @@ { private UiGrid _grid; + /// + /// 编辑器Tile对象 + /// + public EditorTileMap EditorTileMap { get; private set; } + public override void OnCreateUi() { - //var mapEditorMapTilePanel = ((MapEditorPanel)ParentUi).S_MapEditorMapTile.Instance; + var editorPanel = (MapEditorPanel)ParentUi; + EditorTileMap = editorPanel.S_TileMap.Instance; S_AddButton.Instance.Pressed += OnAddClick; S_EditButton.Instance.Pressed += OnEditClick; S_DeleteButton.Instance.Pressed += OnDeleteClick; - - _grid = new UiGrid(S_LayerButton, typeof(LayerButtonCell)); + + _grid = CreateUiGrid(S_LayerButton); _grid.SetCellOffset(new Vector2I(0, 2)); _grid.SetHorizontalExpand(true); - _grid.Add(new TileMapLayerData("地板", EditorTileMap.AutoFloorLayer, false)); - _grid.Add(new TileMapLayerData("侧方墙壁", EditorTileMap.AutoMiddleLayer, true)); - _grid.Add(new TileMapLayerData("顶部墙壁", EditorTileMap.AutoTopLayer, true)); - _grid.Add(new TileMapLayerData("标记数据层", EditorTileMap.MarkLayer, false)); + _grid.Add(new TileMapLayerData("地板", GameConfig.FloorMapLayer, GameConfig.FloorMapZIndex, false)); + _grid.Add(new TileMapLayerData("侧方墙壁", GameConfig.MiddleMapLayer, GameConfig.MiddleMapZIndex, true)); + _grid.Add(new TileMapLayerData("顶部墙壁", GameConfig.TopMapLayer, GameConfig.TopMapZindex, true)); + _grid.Add(new TileMapLayerData("标记数据层", GameConfig.MarkLayer, 0, false)); _grid.SelectIndex = 0; } - public override void OnDestroyUi() - { - _grid.Destroy(); - } - private void OnAddClick() { - EditorWindowManager.ShowCreateCustomLayer(null, info => + EditorWindowManager.ShowCreateCustomLayer(EditorTileMap.CurrRoomSplit.TileInfo.CustomLayers, info => { - + _grid.Add(new TileMapLayerData(0, info), true); + _grid.Sort(); }); }