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 0d1b78c..48728ce 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]} \ 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 514959a..6763cbc 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]} \ 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 f4a21e1..7c8ea78 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]} \ 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 new file mode 100644 index 0000000..43752c7 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/serialize/room/CustomLayerInfo.cs @@ -0,0 +1,26 @@ + +using System.Collections.Generic; +using System.Text.Json.Serialization; + +/// +/// 自定义层数据 +/// +public class CustomLayerInfo +{ + /// + /// 层名称 + /// + [JsonInclude] + public string Name; + + /// + /// 数据五个一组, 分别为: 地图x坐标, 地图y坐标, 资源id, 图集x坐标, 图集y坐标 + /// + [JsonInclude] + public List Data; + + public void InitData() + { + Data = new List(); + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonTileInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonTileInfo.cs index 4d05822..0b16f8b 100644 --- a/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonTileInfo.cs +++ b/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonTileInfo.cs @@ -35,7 +35,11 @@ [JsonInclude] public List Top; - //自定义层, 数据五个一组, 分别为: 地图x坐标, 地图y坐标, 资源id, 图集x坐标, 图集y坐标 + /// + /// 自定义层 + /// + [JsonInclude] + public Dictionary CustomLayers; public void InitData() { @@ -44,5 +48,6 @@ Floor = new List(); Middle = new List(); Top = new List(); + CustomLayers = new Dictionary(); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/data/TileMapLayerData.cs b/DungeonShooting_Godot/src/game/data/TileMapLayerData.cs new file mode 100644 index 0000000..ed479f1 --- /dev/null +++ b/DungeonShooting_Godot/src/game/data/TileMapLayerData.cs @@ -0,0 +1,41 @@ + +public class TileMapLayerData +{ + /// + /// 显示文本 + /// + public string Title; + /// + /// Map层级 + /// + public int Layer; + /// + /// 是否锁定 + /// + public bool IsLock; + /// + /// 是否可以删除 + /// + public bool CanDelete; + /// + /// 自定义层数据 + /// + public CustomLayerInfo CustomLayerInfo; + + public TileMapLayerData(string title, int layer, bool isLock) + { + Title = title; + Layer = layer; + IsLock = isLock; + CanDelete = false; + } + + public TileMapLayerData(string title, int layer, CustomLayerInfo customLayerInfo) + { + Title = title; + Layer = layer; + IsLock = false; + CanDelete = true; + CustomLayerInfo = customLayerInfo; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs index de043ba..53574e5 100644 --- a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs +++ b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs @@ -752,6 +752,47 @@ }) ); } + + public static void ShowCreateCustomLayer(DungeonTileInfo dungeonTileInfo, Action onCreate, UiBase parentUi = null) + { + var window = CreateWindowInstance(parentUi); + window.SetWindowTitle("创建Layer"); + window.SetWindowSize(new Vector2I(600, 350)); + var body = window.OpenBody(UiManager.UiNames.EditorForm); + + //第一项 + var item1 = new FormItemData("名称", new LineEdit() + { + PlaceholderText = "请输入名称" + }); + //第二项 + var item2 = new FormItemData("索引", new SpinBox() + { + Value = 5, + Step = 1 + }); + + body.AddItem(item1); + body.AddItem(item2); + window.SetButtonList( + new EditorWindowPanel.ButtonData("确定", () => + { + var text = item1.UiNode.Text; + if (string.IsNullOrEmpty(text)) + { + ShowTips("错误", $"名称不允许为空!"); + return; + } + + // window.CloseWindow(); + // onCreate(terrainInfo); + }), + new EditorWindowPanel.ButtonData("取消", () => + { + window.CloseWindow(); + }) + ); + } private static EditorWindowPanel CreateWindowInstance(UiBase parentUi = null) { diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs index 41b351d..a5d950e 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs @@ -2,7 +2,7 @@ namespace UI.MapEditorMapLayer; -public class LayerButtonCell : UiCell +public class LayerButtonCell : UiCell { private bool _visible; @@ -12,7 +12,7 @@ CellNode.L_SelectTexture.Instance.Visible = false; } - public override void OnSetData(MapEditorMapLayerPanel.LayerButtonData data) + public override void OnSetData(TileMapLayerData data) { if (data.IsLock) { diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/MapEditorMapLayerPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/MapEditorMapLayerPanel.cs index 2645af5..190525a 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/MapEditorMapLayerPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/MapEditorMapLayerPanel.cs @@ -5,41 +5,24 @@ public partial class MapEditorMapLayerPanel : MapEditorMapLayer { - public class LayerButtonData - { - /// - /// 显示文本 - /// - public string Title; - /// - /// 是否锁定 - /// - public bool IsLock; - /// - /// Map层级 - /// - public int Layer; - - public LayerButtonData(string title, bool isLock, int layer) - { - Title = title; - IsLock = isLock; - Layer = layer; - } - } - - private UiGrid _grid; + private UiGrid _grid; public override void OnCreateUi() { - _grid = new UiGrid(S_LayerButton, typeof(LayerButtonCell)); + //var mapEditorMapTilePanel = ((MapEditorPanel)ParentUi).S_MapEditorMapTile.Instance; + + S_AddButton.Instance.Pressed += OnAddClick; + S_EditButton.Instance.Pressed += OnEditClick; + S_DeleteButton.Instance.Pressed += OnDeleteClick; + + _grid = new UiGrid(S_LayerButton, typeof(LayerButtonCell)); _grid.SetCellOffset(new Vector2I(0, 2)); _grid.SetHorizontalExpand(true); - _grid.Add(new LayerButtonData("地板", false, EditorTileMap.AutoFloorLayer)); - _grid.Add(new LayerButtonData("侧方墙壁", true, EditorTileMap.AutoMiddleLayer)); - _grid.Add(new LayerButtonData("顶部墙壁", true, EditorTileMap.AutoTopLayer)); - _grid.Add(new LayerButtonData("标记数据层", false, EditorTileMap.MarkLayer)); + _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.SelectIndex = 0; } @@ -48,4 +31,21 @@ _grid.Destroy(); } + private void OnAddClick() + { + EditorWindowManager.ShowCreateCustomLayer(null, info => + { + + }); + } + + private void OnEditClick() + { + + } + + private void OnDeleteClick() + { + + } }