diff --git a/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs b/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs
index d3eb128..9d39372 100644
--- a/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs
+++ b/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs
@@ -160,7 +160,7 @@
RoomPreinstallInfo preinstallInfo;
if (EditorPlayManager.IsPlay && roomInfo.RoomType == GameApplication.Instance.DungeonManager.CurrConfig.DesignatedType) //编辑器模式, 指定预设
{
- preinstallInfo = EditorManager.SelectPreinstall;
+ preinstallInfo = EditorTileMapManager.SelectPreinstall;
}
else //普通模式
{
diff --git a/DungeonShooting_Godot/src/framework/map/room/RoomErrorType.cs b/DungeonShooting_Godot/src/framework/map/room/RoomErrorType.cs
new file mode 100644
index 0000000..510c27b
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/map/room/RoomErrorType.cs
@@ -0,0 +1,27 @@
+
+///
+/// 房间错误类型
+///
+public enum RoomErrorType
+{
+ ///
+ /// 没有错误
+ ///
+ None = 0,
+ ///
+ /// 空房间
+ ///
+ Empty = 1,
+ ///
+ /// 地图绘制错误
+ ///
+ TileError = 2,
+ ///
+ /// 门区域绘制错误
+ ///
+ DoorAreaError = 3,
+ ///
+ /// 没有预设
+ ///
+ NoPreinstallError = 4
+}
\ 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
deleted file mode 100644
index fe428b0..0000000
--- a/DungeonShooting_Godot/src/framework/map/serialize/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/serialize/DungeonRoomGroup.cs b/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomGroup.cs
deleted file mode 100644
index 142ca79..0000000
--- a/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomGroup.cs
+++ /dev/null
@@ -1,207 +0,0 @@
-
-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 bool RemoveRoom(DungeonRoomSplit roomSplit)
- {
- if (BattleList.Remove(roomSplit))
- {
- return true;
- }
- if (InletList.Remove(roomSplit))
- {
- return true;
- }
- if (OutletList.Remove(roomSplit))
- {
- return true;
- }
- if (BossList.Remove(roomSplit))
- {
- return true;
- }
- if (RewardList.Remove(roomSplit))
- {
- return true;
- }
- if (ShopList.Remove(roomSplit))
- {
- return true;
- }
- if (EventList.Remove(roomSplit))
- {
- return true;
- }
-
- return false;
- }
-
- ///
- /// 初始化权重处理
- ///
- 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)
- {
- Debug.LogError("未调用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
deleted file mode 100644
index 05e0dbe..0000000
--- a/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomInfo.cs
+++ /dev/null
@@ -1,92 +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;
-
- 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, 0, ((int)Size.X - 4) * GameConfig.TileCellSize));
- _completionDoorArea.Add(new DoorAreaInfo(DoorDirection.S, 0, ((int)Size.X - 4) * GameConfig.TileCellSize));
- _completionDoorArea.Add(new DoorAreaInfo(DoorDirection.W, 0, ((int)Size.Y - 5) * GameConfig.TileCellSize));
- _completionDoorArea.Add(new DoorAreaInfo(DoorDirection.E, 0, ((int)Size.Y - 5) * GameConfig.TileCellSize));
- }
- }
-
- return _completionDoorArea;
- }
-
- ///
- /// 清除门区域配置数据, 再次调用 GetCompletionDoorArea() 会重新计算 DoorAreaInfo 数据
- ///
- public void ClearCompletionDoorArea()
- {
- if (_completionDoorArea != null)
- {
- _completionDoorArea.Clear();
- _completionDoorArea = null;
- }
- }
-}
\ 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
deleted file mode 100644
index bc44b94..0000000
--- a/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomSplit.cs
+++ /dev/null
@@ -1,203 +0,0 @@
-
-using System.Collections.Generic;
-using System.IO;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-using Godot;
-
-///
-/// 房间配置文件相关信息, 将会在 RoomConfig.json 中汇总
-///
-public class DungeonRoomSplit
-{
- ///
- /// 房间异常类型
- ///
- [JsonInclude]
- public RoomErrorType ErrorType;
-
- ///
- /// 该房间的文件夹路径
- ///
- [JsonInclude]
- public string Path;
-
- ///
- /// 房间配置路径
- ///
- [JsonIgnore]
- public string RoomPath => Path + "/RoomInfo.json";
-
- ///
- /// 房间地块配置数据
- ///
- [JsonIgnore]
- public string TilePath => Path + "/TileInfo.json";
-
- ///
- /// 房间预设配置数据
- ///
- [JsonIgnore]
- public string PreinstallPath => Path + "/Preinstall.json";
-
- ///
- /// 预览图路径
- ///
- [JsonIgnore]
- public string PreviewPath => Path + "/Preview.png";
-
- ///
- /// 房间配置数据, 第一次获取会在资源中加载数据
- ///
- [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;
-
- ///
- /// 预览图
- ///
- [JsonIgnore]
- public Texture2D PreviewImage
- {
- get
- {
- if (_previewImage == null)
- {
- ReloadPreviewImage();
- }
-
- return _previewImage;
- }
- set
- {
- if (_previewImage != null)
- {
- _previewImage.Dispose();
- }
-
- _previewImage = value;
- }
- }
-
- private Texture2D _previewImage;
-
- ///
- /// 重新加载房间数据
- ///
- public void ReloadRoomInfo()
- {
- var asText = ResourceManager.LoadText("res://" + RoomPath);
- _roomInfo = JsonSerializer.Deserialize(asText);
- }
-
- ///
- /// 重新加载房间地块配置数据
- ///
- public void ReloadTileInfo()
- {
- var asText = ResourceManager.LoadText("res://" + TilePath);
- _tileInfo = JsonSerializer.Deserialize(asText);
- }
-
- ///
- /// 重新加载房间预设数据
- ///
- public void ReloadPreinstall()
- {
- var asText = ResourceManager.LoadText("res://" + PreinstallPath);
- _preinstall = JsonSerializer.Deserialize>(asText);
- }
-
- ///
- /// 重新加载预览图片
- ///
- public void ReloadPreviewImage()
- {
- if (_previewImage != null)
- {
- _previewImage.Dispose();
- }
-
- if (File.Exists(PreviewPath))
- {
- var bytes = File.ReadAllBytes(PreviewPath);
-
- var image = Image.Create(GameConfig.PreviewImageSize, GameConfig.PreviewImageSize, false, Image.Format.Rgb8);
- image.LoadPngFromBuffer(bytes);
- _previewImage = ImageTexture.CreateFromImage(image);
- }
- }
-
- public override bool Equals(object obj)
- {
- if (obj == null)
- {
- return false;
- }
-
- if (obj is DungeonRoomSplit roomSplit)
- {
- return roomSplit.Path == Path;
- }
-
- return this == obj;
- }
-
- public override int GetHashCode()
- {
- return Path.GetHashCode();
- }
-}
\ 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
deleted file mode 100644
index 53508b7..0000000
--- a/DungeonShooting_Godot/src/framework/map/serialize/DungeonTileInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-
-using System.Collections.Generic;
-using System.Text.Json.Serialization;
-using Godot;
-
-public class DungeonTileInfo
-{
- ///
- /// 导航顶点数据
- ///
- [JsonInclude]
- public List NavigationVertices;
-
- ///
- /// 导航多边形数据
- ///
- [JsonInclude]
- public List NavigationPolygon;
-
- ///
- /// 底层数据, 五个一组, 分别为: 地图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
deleted file mode 100644
index 41bdd08..0000000
--- a/DungeonShooting_Godot/src/framework/map/serialize/MarkInfo.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-
-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
deleted file mode 100644
index 6e38c93..0000000
--- a/DungeonShooting_Godot/src/framework/map/serialize/MarkInfoItem.cs
+++ /dev/null
@@ -1,45 +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;
-
- ///
- /// 物体初始海拔高度
- ///
- [JsonInclude]
- public int Altitude;
-
- ///
- /// 物体初始纵轴速度
- ///
- [JsonInclude]
- public float VerticalSpeed;
-
- ///
- /// 所属标记类型
- ///
- [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
deleted file mode 100644
index 460e2b2..0000000
--- a/DungeonShooting_Godot/src/framework/map/serialize/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/serialize/RoomErrorType.cs b/DungeonShooting_Godot/src/framework/map/serialize/RoomErrorType.cs
deleted file mode 100644
index 510c27b..0000000
--- a/DungeonShooting_Godot/src/framework/map/serialize/RoomErrorType.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-
-///
-/// 房间错误类型
-///
-public enum RoomErrorType
-{
- ///
- /// 没有错误
- ///
- None = 0,
- ///
- /// 空房间
- ///
- Empty = 1,
- ///
- /// 地图绘制错误
- ///
- TileError = 2,
- ///
- /// 门区域绘制错误
- ///
- DoorAreaError = 3,
- ///
- /// 没有预设
- ///
- NoPreinstallError = 4
-}
\ 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
deleted file mode 100644
index 7f35576..0000000
--- a/DungeonShooting_Godot/src/framework/map/serialize/RoomPreinstallInfo.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-
-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 InitWaveList()
- {
- WaveList = new List>
- {
- new List()
- };
- }
-
- ///
- /// 初始化特殊标记
- ///
- public void InitSpecialMark(DungeonRoomType roomType)
- {
- if (roomType == DungeonRoomType.Inlet) //初始房间
- {
- var preloading = WaveList[0];
- //玩家标记
- var markInfo = new MarkInfo();
- markInfo.Position = new SerializeVector2();
- markInfo.Size = new SerializeVector2();
- markInfo.SpecialMarkType = SpecialMarkType.BirthPoint;
- markInfo.MarkList = new List();
- preloading.Add(markInfo);
- }
- }
-}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/map/serialize/room/DoorAreaInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/room/DoorAreaInfo.cs
new file mode 100644
index 0000000..fe428b0
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/map/serialize/room/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/room/DungeonRoomGroup.cs b/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonRoomGroup.cs
new file mode 100644
index 0000000..142ca79
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonRoomGroup.cs
@@ -0,0 +1,207 @@
+
+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 bool RemoveRoom(DungeonRoomSplit roomSplit)
+ {
+ if (BattleList.Remove(roomSplit))
+ {
+ return true;
+ }
+ if (InletList.Remove(roomSplit))
+ {
+ return true;
+ }
+ if (OutletList.Remove(roomSplit))
+ {
+ return true;
+ }
+ if (BossList.Remove(roomSplit))
+ {
+ return true;
+ }
+ if (RewardList.Remove(roomSplit))
+ {
+ return true;
+ }
+ if (ShopList.Remove(roomSplit))
+ {
+ return true;
+ }
+ if (EventList.Remove(roomSplit))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ ///
+ /// 初始化权重处理
+ ///
+ 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)
+ {
+ Debug.LogError("未调用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/room/DungeonRoomInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonRoomInfo.cs
new file mode 100644
index 0000000..05e0dbe
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonRoomInfo.cs
@@ -0,0 +1,92 @@
+
+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, 0, ((int)Size.X - 4) * GameConfig.TileCellSize));
+ _completionDoorArea.Add(new DoorAreaInfo(DoorDirection.S, 0, ((int)Size.X - 4) * GameConfig.TileCellSize));
+ _completionDoorArea.Add(new DoorAreaInfo(DoorDirection.W, 0, ((int)Size.Y - 5) * GameConfig.TileCellSize));
+ _completionDoorArea.Add(new DoorAreaInfo(DoorDirection.E, 0, ((int)Size.Y - 5) * GameConfig.TileCellSize));
+ }
+ }
+
+ return _completionDoorArea;
+ }
+
+ ///
+ /// 清除门区域配置数据, 再次调用 GetCompletionDoorArea() 会重新计算 DoorAreaInfo 数据
+ ///
+ public void ClearCompletionDoorArea()
+ {
+ if (_completionDoorArea != null)
+ {
+ _completionDoorArea.Clear();
+ _completionDoorArea = null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonRoomSplit.cs b/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonRoomSplit.cs
new file mode 100644
index 0000000..bc44b94
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonRoomSplit.cs
@@ -0,0 +1,203 @@
+
+using System.Collections.Generic;
+using System.IO;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using Godot;
+
+///
+/// 房间配置文件相关信息, 将会在 RoomConfig.json 中汇总
+///
+public class DungeonRoomSplit
+{
+ ///
+ /// 房间异常类型
+ ///
+ [JsonInclude]
+ public RoomErrorType ErrorType;
+
+ ///
+ /// 该房间的文件夹路径
+ ///
+ [JsonInclude]
+ public string Path;
+
+ ///
+ /// 房间配置路径
+ ///
+ [JsonIgnore]
+ public string RoomPath => Path + "/RoomInfo.json";
+
+ ///
+ /// 房间地块配置数据
+ ///
+ [JsonIgnore]
+ public string TilePath => Path + "/TileInfo.json";
+
+ ///
+ /// 房间预设配置数据
+ ///
+ [JsonIgnore]
+ public string PreinstallPath => Path + "/Preinstall.json";
+
+ ///
+ /// 预览图路径
+ ///
+ [JsonIgnore]
+ public string PreviewPath => Path + "/Preview.png";
+
+ ///
+ /// 房间配置数据, 第一次获取会在资源中加载数据
+ ///
+ [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;
+
+ ///
+ /// 预览图
+ ///
+ [JsonIgnore]
+ public Texture2D PreviewImage
+ {
+ get
+ {
+ if (_previewImage == null)
+ {
+ ReloadPreviewImage();
+ }
+
+ return _previewImage;
+ }
+ set
+ {
+ if (_previewImage != null)
+ {
+ _previewImage.Dispose();
+ }
+
+ _previewImage = value;
+ }
+ }
+
+ private Texture2D _previewImage;
+
+ ///
+ /// 重新加载房间数据
+ ///
+ public void ReloadRoomInfo()
+ {
+ var asText = ResourceManager.LoadText("res://" + RoomPath);
+ _roomInfo = JsonSerializer.Deserialize(asText);
+ }
+
+ ///
+ /// 重新加载房间地块配置数据
+ ///
+ public void ReloadTileInfo()
+ {
+ var asText = ResourceManager.LoadText("res://" + TilePath);
+ _tileInfo = JsonSerializer.Deserialize(asText);
+ }
+
+ ///
+ /// 重新加载房间预设数据
+ ///
+ public void ReloadPreinstall()
+ {
+ var asText = ResourceManager.LoadText("res://" + PreinstallPath);
+ _preinstall = JsonSerializer.Deserialize>(asText);
+ }
+
+ ///
+ /// 重新加载预览图片
+ ///
+ public void ReloadPreviewImage()
+ {
+ if (_previewImage != null)
+ {
+ _previewImage.Dispose();
+ }
+
+ if (File.Exists(PreviewPath))
+ {
+ var bytes = File.ReadAllBytes(PreviewPath);
+
+ var image = Image.Create(GameConfig.PreviewImageSize, GameConfig.PreviewImageSize, false, Image.Format.Rgb8);
+ image.LoadPngFromBuffer(bytes);
+ _previewImage = ImageTexture.CreateFromImage(image);
+ }
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+
+ if (obj is DungeonRoomSplit roomSplit)
+ {
+ return roomSplit.Path == Path;
+ }
+
+ return this == obj;
+ }
+
+ public override int GetHashCode()
+ {
+ return Path.GetHashCode();
+ }
+}
\ 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
new file mode 100644
index 0000000..53508b7
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/map/serialize/room/DungeonTileInfo.cs
@@ -0,0 +1,37 @@
+
+using System.Collections.Generic;
+using System.Text.Json.Serialization;
+using Godot;
+
+public class DungeonTileInfo
+{
+ ///
+ /// 导航顶点数据
+ ///
+ [JsonInclude]
+ public List NavigationVertices;
+
+ ///
+ /// 导航多边形数据
+ ///
+ [JsonInclude]
+ public List NavigationPolygon;
+
+ ///
+ /// 底层数据, 五个一组, 分别为: 地图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/room/MarkInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/room/MarkInfo.cs
new file mode 100644
index 0000000..41bdd08
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/map/serialize/room/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/room/MarkInfoItem.cs b/DungeonShooting_Godot/src/framework/map/serialize/room/MarkInfoItem.cs
new file mode 100644
index 0000000..6e38c93
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/map/serialize/room/MarkInfoItem.cs
@@ -0,0 +1,45 @@
+
+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;
+
+ ///
+ /// 物体初始海拔高度
+ ///
+ [JsonInclude]
+ public int Altitude;
+
+ ///
+ /// 物体初始纵轴速度
+ ///
+ [JsonInclude]
+ public float VerticalSpeed;
+
+ ///
+ /// 所属标记类型
+ ///
+ [JsonIgnore]
+ public SpecialMarkType SpecialMarkType = SpecialMarkType.Normal;
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/map/serialize/room/NavigationPolygonData.cs b/DungeonShooting_Godot/src/framework/map/serialize/room/NavigationPolygonData.cs
new file mode 100644
index 0000000..460e2b2
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/map/serialize/room/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/room/RoomPreinstallInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/room/RoomPreinstallInfo.cs
new file mode 100644
index 0000000..7f35576
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/map/serialize/room/RoomPreinstallInfo.cs
@@ -0,0 +1,62 @@
+
+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 InitWaveList()
+ {
+ WaveList = new List>
+ {
+ new List()
+ };
+ }
+
+ ///
+ /// 初始化特殊标记
+ ///
+ public void InitSpecialMark(DungeonRoomType roomType)
+ {
+ if (roomType == DungeonRoomType.Inlet) //初始房间
+ {
+ var preloading = WaveList[0];
+ //玩家标记
+ var markInfo = new MarkInfo();
+ markInfo.Position = new SerializeVector2();
+ markInfo.Size = new SerializeVector2();
+ markInfo.SpecialMarkType = SpecialMarkType.BirthPoint;
+ markInfo.MarkList = new List();
+ preloading.Add(markInfo);
+ }
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileCombinationInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileCombinationInfo.cs
new file mode 100644
index 0000000..ae1f83e
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileCombinationInfo.cs
@@ -0,0 +1,29 @@
+
+using System.Text.Json.Serialization;
+
+///
+/// 组合图块数据
+///
+public class TileCombinationInfo
+{
+ ///
+ /// 组合唯一Id
+ ///
+ [JsonInclude]
+ public string Id;
+ ///
+ /// 组合名称
+ ///
+ [JsonInclude]
+ public string Name;
+ ///
+ /// 组合图块数据, 在纹理中的坐标, 单位: 像素
+ ///
+ [JsonInclude]
+ public SerializeVector2[] Cells;
+ ///
+ /// 组合图块数据, 显示位置, 单位: 像素
+ ///
+ [JsonInclude]
+ public SerializeVector2[] Positions;
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileSetInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileSetInfo.cs
new file mode 100644
index 0000000..8719a5f
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileSetInfo.cs
@@ -0,0 +1,44 @@
+
+using System.Collections.Generic;
+using System.Text.Json.Serialization;
+
+///
+/// 图块集数据
+///
+public class TileSetInfo : IClone
+{
+ ///
+ /// 图块集名称
+ ///
+ [JsonInclude]
+ public string Name;
+
+ ///
+ /// 资源集合
+ ///
+ [JsonInclude]
+ public List Sources;
+
+ ///
+ /// 初始化默认数据
+ ///
+ public void InitData()
+ {
+ Sources = new List();
+ }
+
+ public TileSetInfo Clone()
+ {
+ var tileSetInfo = new TileSetInfo();
+ tileSetInfo.Name = Name;
+ if (Sources != null)
+ {
+ tileSetInfo.Sources = new List();
+ foreach (var source in Sources)
+ {
+ tileSetInfo.Sources.Add(source.Clone());
+ }
+ }
+ return tileSetInfo;
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileSetSourceInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileSetSourceInfo.cs
new file mode 100644
index 0000000..20d7c7d
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileSetSourceInfo.cs
@@ -0,0 +1,21 @@
+
+using System.Text.Json.Serialization;
+
+///
+/// 图集资源数据
+///
+public class TileSetSourceInfo : IClone
+{
+ ///
+ /// 资源名称
+ ///
+ [JsonInclude]
+ public string Name;
+
+ public TileSetSourceInfo Clone()
+ {
+ var tileSetSourceInfo = new TileSetSourceInfo();
+ tileSetSourceInfo.Name = Name;
+ return tileSetSourceInfo;
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/map/tileSet/TileCombinationInfo.cs b/DungeonShooting_Godot/src/framework/map/tileSet/TileCombinationInfo.cs
deleted file mode 100644
index ae1f83e..0000000
--- a/DungeonShooting_Godot/src/framework/map/tileSet/TileCombinationInfo.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-
-using System.Text.Json.Serialization;
-
-///
-/// 组合图块数据
-///
-public class TileCombinationInfo
-{
- ///
- /// 组合唯一Id
- ///
- [JsonInclude]
- public string Id;
- ///
- /// 组合名称
- ///
- [JsonInclude]
- public string Name;
- ///
- /// 组合图块数据, 在纹理中的坐标, 单位: 像素
- ///
- [JsonInclude]
- public SerializeVector2[] Cells;
- ///
- /// 组合图块数据, 显示位置, 单位: 像素
- ///
- [JsonInclude]
- public SerializeVector2[] Positions;
-}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/map/tileSet/TileSetInfo.cs b/DungeonShooting_Godot/src/framework/map/tileSet/TileSetInfo.cs
deleted file mode 100644
index 14ba01b..0000000
--- a/DungeonShooting_Godot/src/framework/map/tileSet/TileSetInfo.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-
-using System.Text.Json.Serialization;
-
-///
-/// 图块集数据
-///
-public class TileSetInfo
-{
- ///
- /// 图块集名称
- ///
- [JsonInclude]
- public string Name;
-}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/event/EventEnum.cs b/DungeonShooting_Godot/src/game/event/EventEnum.cs
index d12df49..f9824af 100644
--- a/DungeonShooting_Godot/src/game/event/EventEnum.cs
+++ b/DungeonShooting_Godot/src/game/event/EventEnum.cs
@@ -149,6 +149,18 @@
OnSetMarkVisible,
///
+ /// 创建TileSet资源, 参数为
+ ///
+ OnCreateTileSetSource,
+ ///
+ /// 选中TileSet资源, 参数为
+ ///
+ OnSelectTileSetSource,
+ ///
+ /// 删除TileSet资源, 参数为
+ ///
+ OnDeleteTileSetSource,
+ ///
/// 设置TileSet纹理, 参数
///
OnSetTileTexture,
diff --git a/DungeonShooting_Godot/src/game/manager/EditorManager.cs b/DungeonShooting_Godot/src/game/manager/EditorManager.cs
deleted file mode 100644
index e6bc977..0000000
--- a/DungeonShooting_Godot/src/game/manager/EditorManager.cs
+++ /dev/null
@@ -1,184 +0,0 @@
-
-using System.Collections.Generic;
-
-public static class EditorManager
-{
- ///
- /// 当前使用的地牢组
- ///
- public static DungeonRoomGroup SelectDungeonGroup { get; private set; }
-
- ///
- /// 当使用的地牢房间
- ///
- public static DungeonRoomSplit SelectRoom { get; private set; }
-
- ///
- /// 当前使用的预设索引
- ///
- public static int SelectPreinstallIndex { get; private set; } = -1;
-
- ///
- /// 当前使用的预设
- ///
- public static RoomPreinstallInfo SelectPreinstall
- {
- get
- {
- if (SelectPreinstallIndex < 0 || SelectPreinstallIndex >= SelectRoom.Preinstall.Count)
- {
- return null;
- }
-
- return SelectRoom.Preinstall[SelectPreinstallIndex];
- }
- }
-
- ///
- /// 当前选中的波索引
- ///
- public static int SelectWaveIndex { get; private set; } = -1;
-
- ///
- /// 当前选中的波
- ///
- public static List SelectWave
- {
- get
- {
- var preinstall = SelectPreinstall;
- if (preinstall == null)
- {
- return null;
- }
-
- if (SelectWaveIndex < 0 || SelectWaveIndex > preinstall.WaveList.Count)
- {
- return null;
- }
-
- return preinstall.WaveList[SelectWaveIndex];
- }
- }
-
- ///
- /// 当前选中的标记
- ///
- public static MarkInfo SelectMark { get; private set; }
-
- public static void SetSelectDungeonGroup(DungeonRoomGroup roomGroup)
- {
- if (SelectDungeonGroup != roomGroup)
- {
- SelectDungeonGroup = roomGroup;
- EventManager.EmitEvent(EventEnum.OnSelectGroup, SelectDungeonGroup);
- }
- }
-
- public static void SetSelectRoom(DungeonRoomSplit roomSplit)
- {
- if (!ReferenceEquals(SelectRoom, roomSplit))
- {
- SelectRoom = roomSplit;
- EventManager.EmitEvent(EventEnum.OnSelectRoom, SelectRoom);
- }
- }
-
- ///
- /// 选中预设
- ///
- /// 预设索引
- public static void SetSelectPreinstallIndex(int index)
- {
- if (SelectRoom == null)
- {
- if (SelectPreinstallIndex != -1)
- {
- SelectPreinstallIndex = -1;
- EventManager.EmitEvent(EventEnum.OnSelectPreinstall, SelectPreinstall);
- }
- }
- else if (index < 0 || SelectRoom.Preinstall == null || index >= SelectRoom.Preinstall.Count)
- {
- if (SelectPreinstallIndex != -1)
- {
- SelectPreinstallIndex = -1;
- EventManager.EmitEvent(EventEnum.OnSelectPreinstall, SelectPreinstall);
- }
- }
- else if (SelectPreinstallIndex != index)
- {
- SelectPreinstallIndex = index;
- EventManager.EmitEvent(EventEnum.OnSelectPreinstall, SelectPreinstall);
- }
- }
-
- ///
- /// 选中波数
- ///
- /// 波数索引
- public static void SetSelectWaveIndex(int index)
- {
- if (SelectPreinstall == null)
- {
- if (SelectWaveIndex != -1)
- {
- SelectWaveIndex = -1;
- EventManager.EmitEvent(EventEnum.OnSelectWave, SelectWave);
- }
- }
- else if (SelectWaveIndex != index)
- {
- if (index < 0 || SelectPreinstall.WaveList == null || index >= SelectPreinstall.WaveList.Count)
- {
- if (SelectWaveIndex != -1)
- {
- SelectWaveIndex = -1;
- EventManager.EmitEvent(EventEnum.OnSelectWave, SelectWave);
- }
- }
- else
- {
- if (SelectWaveIndex != index)
- {
- SelectWaveIndex = index;
- EventManager.EmitEvent(EventEnum.OnSelectWave, SelectWave);
- }
- }
- }
- }
-
- ///
- /// 选中某个标记
- ///
- public static void SetSelectMark(MarkInfo markInfo)
- {
- if (SelectMark != markInfo)
- {
- SelectMark = markInfo;
- EventManager.EmitEvent(EventEnum.OnSelectMark, markInfo);
- }
- }
-
- ///
- /// 根据 RoomErrorType 枚举获取房间错误信息
- ///
- public static string GetRoomErrorTypeMessage(RoomErrorType errorType)
- {
- switch (errorType)
- {
- case RoomErrorType.None:
- return "";
- case RoomErrorType.Empty:
- return "房间没有绘制地块";
- case RoomErrorType.TileError:
- return "房间地块存在绘制错误";
- case RoomErrorType.DoorAreaError:
- return "房间至少要有两个不同方向的门区域";
- case RoomErrorType.NoPreinstallError:
- return "房间没有预设";
- }
-
- return null;
- }
-}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/manager/EditorPlayManager.cs b/DungeonShooting_Godot/src/game/manager/EditorPlayManager.cs
index 66c1ab2..376de4a 100644
--- a/DungeonShooting_Godot/src/game/manager/EditorPlayManager.cs
+++ b/DungeonShooting_Godot/src/game/manager/EditorPlayManager.cs
@@ -19,10 +19,10 @@
IsPlay = true;
_config = new DungeonConfig();
- _config.GroupName = EditorManager.SelectDungeonGroup.GroupName;
- _config.DesignatedType = EditorManager.SelectRoom.RoomInfo.RoomType;
+ _config.GroupName = EditorTileMapManager.SelectDungeonGroup.GroupName;
+ _config.DesignatedType = EditorTileMapManager.SelectRoom.RoomInfo.RoomType;
_config.DesignatedRoom = new List();
- _config.DesignatedRoom.Add(EditorManager.SelectRoom);
+ _config.DesignatedRoom.Add(EditorTileMapManager.SelectRoom);
GameApplication.Instance.DungeonManager.EditorPlayDungeon(prevUi, _config);
}
diff --git a/DungeonShooting_Godot/src/game/manager/EditorTileMapManager.cs b/DungeonShooting_Godot/src/game/manager/EditorTileMapManager.cs
new file mode 100644
index 0000000..067c83e
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/manager/EditorTileMapManager.cs
@@ -0,0 +1,184 @@
+
+using System.Collections.Generic;
+
+public static class EditorTileMapManager
+{
+ ///
+ /// 当前使用的地牢组
+ ///
+ public static DungeonRoomGroup SelectDungeonGroup { get; private set; }
+
+ ///
+ /// 当使用的地牢房间
+ ///
+ public static DungeonRoomSplit SelectRoom { get; private set; }
+
+ ///
+ /// 当前使用的预设索引
+ ///
+ public static int SelectPreinstallIndex { get; private set; } = -1;
+
+ ///
+ /// 当前使用的预设
+ ///
+ public static RoomPreinstallInfo SelectPreinstall
+ {
+ get
+ {
+ if (SelectPreinstallIndex < 0 || SelectPreinstallIndex >= SelectRoom.Preinstall.Count)
+ {
+ return null;
+ }
+
+ return SelectRoom.Preinstall[SelectPreinstallIndex];
+ }
+ }
+
+ ///
+ /// 当前选中的波索引
+ ///
+ public static int SelectWaveIndex { get; private set; } = -1;
+
+ ///
+ /// 当前选中的波
+ ///
+ public static List SelectWave
+ {
+ get
+ {
+ var preinstall = SelectPreinstall;
+ if (preinstall == null)
+ {
+ return null;
+ }
+
+ if (SelectWaveIndex < 0 || SelectWaveIndex > preinstall.WaveList.Count)
+ {
+ return null;
+ }
+
+ return preinstall.WaveList[SelectWaveIndex];
+ }
+ }
+
+ ///
+ /// 当前选中的标记
+ ///
+ public static MarkInfo SelectMark { get; private set; }
+
+ public static void SetSelectDungeonGroup(DungeonRoomGroup roomGroup)
+ {
+ if (SelectDungeonGroup != roomGroup)
+ {
+ SelectDungeonGroup = roomGroup;
+ EventManager.EmitEvent(EventEnum.OnSelectGroup, SelectDungeonGroup);
+ }
+ }
+
+ public static void SetSelectRoom(DungeonRoomSplit roomSplit)
+ {
+ if (!ReferenceEquals(SelectRoom, roomSplit))
+ {
+ SelectRoom = roomSplit;
+ EventManager.EmitEvent(EventEnum.OnSelectRoom, SelectRoom);
+ }
+ }
+
+ ///
+ /// 选中预设
+ ///
+ /// 预设索引
+ public static void SetSelectPreinstallIndex(int index)
+ {
+ if (SelectRoom == null)
+ {
+ if (SelectPreinstallIndex != -1)
+ {
+ SelectPreinstallIndex = -1;
+ EventManager.EmitEvent(EventEnum.OnSelectPreinstall, SelectPreinstall);
+ }
+ }
+ else if (index < 0 || SelectRoom.Preinstall == null || index >= SelectRoom.Preinstall.Count)
+ {
+ if (SelectPreinstallIndex != -1)
+ {
+ SelectPreinstallIndex = -1;
+ EventManager.EmitEvent(EventEnum.OnSelectPreinstall, SelectPreinstall);
+ }
+ }
+ else if (SelectPreinstallIndex != index)
+ {
+ SelectPreinstallIndex = index;
+ EventManager.EmitEvent(EventEnum.OnSelectPreinstall, SelectPreinstall);
+ }
+ }
+
+ ///
+ /// 选中波数
+ ///
+ /// 波数索引
+ public static void SetSelectWaveIndex(int index)
+ {
+ if (SelectPreinstall == null)
+ {
+ if (SelectWaveIndex != -1)
+ {
+ SelectWaveIndex = -1;
+ EventManager.EmitEvent(EventEnum.OnSelectWave, SelectWave);
+ }
+ }
+ else if (SelectWaveIndex != index)
+ {
+ if (index < 0 || SelectPreinstall.WaveList == null || index >= SelectPreinstall.WaveList.Count)
+ {
+ if (SelectWaveIndex != -1)
+ {
+ SelectWaveIndex = -1;
+ EventManager.EmitEvent(EventEnum.OnSelectWave, SelectWave);
+ }
+ }
+ else
+ {
+ if (SelectWaveIndex != index)
+ {
+ SelectWaveIndex = index;
+ EventManager.EmitEvent(EventEnum.OnSelectWave, SelectWave);
+ }
+ }
+ }
+ }
+
+ ///
+ /// 选中某个标记
+ ///
+ public static void SetSelectMark(MarkInfo markInfo)
+ {
+ if (SelectMark != markInfo)
+ {
+ SelectMark = markInfo;
+ EventManager.EmitEvent(EventEnum.OnSelectMark, markInfo);
+ }
+ }
+
+ ///
+ /// 根据 RoomErrorType 枚举获取房间错误信息
+ ///
+ public static string GetRoomErrorTypeMessage(RoomErrorType errorType)
+ {
+ switch (errorType)
+ {
+ case RoomErrorType.None:
+ return "";
+ case RoomErrorType.Empty:
+ return "房间没有绘制地块";
+ case RoomErrorType.TileError:
+ return "房间地块存在绘制错误";
+ case RoomErrorType.DoorAreaError:
+ return "房间至少要有两个不同方向的门区域";
+ case RoomErrorType.NoPreinstallError:
+ return "房间没有预设";
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
index bde0a5d..de3e1db 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
@@ -50,11 +50,11 @@
public override void OnDestroyUi()
{
//清除选中的标记
- EditorManager.SetSelectMark(null);
+ EditorTileMapManager.SetSelectMark(null);
//清除选中的波
- EditorManager.SetSelectWaveIndex(-1);
+ EditorTileMapManager.SetSelectWaveIndex(-1);
//清除选中的预设
- EditorManager.SetSelectPreinstallIndex(-1);
+ EditorTileMapManager.SetSelectPreinstallIndex(-1);
}
//点击播放按钮
@@ -65,13 +65,13 @@
//有错误数据
if (check.HasError)
{
- EditorWindowManager.ShowTips("提示", EditorManager.GetRoomErrorTypeMessage(check.ErrorType) + ",不能运行房间!");
+ EditorWindowManager.ShowTips("提示", EditorTileMapManager.GetRoomErrorTypeMessage(check.ErrorType) + ",不能运行房间!");
return;
}
//保存数据
S_TileMap.Instance.TriggerSave(RoomErrorType.None, () =>
{
- var groupName = EditorManager.SelectDungeonGroup.GroupName;
+ var groupName = EditorTileMapManager.SelectDungeonGroup.GroupName;
var result = DungeonManager.CheckDungeon(groupName);
if (result.HasError)
{
@@ -126,7 +126,7 @@
//有错误的数据
if (check.HasError)
{
- EditorWindowManager.ShowConfirm("提示", EditorManager.GetRoomErrorTypeMessage(check.ErrorType) + ",如果现在保存并退出,运行游戏将不会刷出该房间!\n是否仍要保存?", (v) =>
+ EditorWindowManager.ShowConfirm("提示", EditorTileMapManager.GetRoomErrorTypeMessage(check.ErrorType) + ",如果现在保存并退出,运行游戏将不会刷出该房间!\n是否仍要保存?", (v) =>
{
if (v)
{
@@ -155,7 +155,7 @@
var check = CheckError();
if (check.HasError) //有错误
{
- EditorWindowManager.ShowConfirm("提示", EditorManager.GetRoomErrorTypeMessage(check.ErrorType) + ",如果现在保存并退出,运行游戏将不会刷出该房间!\n是否仍要保存?", (v) =>
+ EditorWindowManager.ShowConfirm("提示", EditorTileMapManager.GetRoomErrorTypeMessage(check.ErrorType) + ",如果现在保存并退出,运行游戏将不会刷出该房间!\n是否仍要保存?", (v) =>
{
if (v)
{
@@ -193,7 +193,7 @@
var check = CheckError();
if (check.HasError) //有错误
{
- EditorWindowManager.ShowConfirm("提示", EditorManager.GetRoomErrorTypeMessage(check.ErrorType) + ",如果不解决错误就退出,运行游戏将不会刷出该房间!\n是否仍要退出?", (v) =>
+ EditorWindowManager.ShowConfirm("提示", EditorTileMapManager.GetRoomErrorTypeMessage(check.ErrorType) + ",如果不解决错误就退出,运行游戏将不会刷出该房间!\n是否仍要退出?", (v) =>
{
if (v)
{
@@ -245,7 +245,7 @@
}
}
- if (EditorManager.SelectRoom.Preinstall == null || EditorManager.SelectRoom.Preinstall.Count == 0)
+ if (EditorTileMapManager.SelectRoom.Preinstall == null || EditorTileMapManager.SelectRoom.Preinstall.Count == 0)
{
return new CheckResult(true, RoomErrorType.NoPreinstallError);
}
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs
index 73d6084..c4928ca 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs
@@ -66,10 +66,10 @@
public void OnClickHandler()
{
- EditorManager.SetSelectWaveIndex(Data.ParentCell.Index);
+ EditorTileMapManager.SetSelectWaveIndex(Data.ParentCell.Index);
CellNode.UiPanel.SetSelectCell(this, CellNode.Instance, MapEditorMapMarkPanel.SelectToolType.Mark);
//选中标记
- EditorManager.SetSelectMark(Data.MarkInfo);
+ EditorTileMapManager.SetSelectMark(Data.MarkInfo);
//双击判定
if (_prevClickTime2 >= 0)
@@ -99,7 +99,7 @@
{
CellNode.L_MarkButton.L_Select.Instance.Visible = true;
//选中标记
- EditorManager.SetSelectMark(Data.MarkInfo);
+ EditorTileMapManager.SetSelectMark(Data.MarkInfo);
}
public override void OnUnSelect()
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs
index f7f1866..c441c4b 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs
@@ -159,10 +159,10 @@
public void OnClickHandler()
{
- EditorManager.SetSelectWaveIndex(Index);
+ EditorTileMapManager.SetSelectWaveIndex(Index);
CellNode.UiPanel.SetSelectCell(this, CellNode.L_WaveContainer.Instance, MapEditorMapMarkPanel.SelectToolType.Wave);
//清除选中的标记
- EditorManager.SetSelectMark(null);
+ EditorTileMapManager.SetSelectMark(null);
}
public override void OnSelect()
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs
index 4bd798e..9cab651 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs
@@ -127,7 +127,7 @@
public RoomPreinstallInfo GetSelectPreinstall()
{
var index = S_PreinstallOption.Instance.Selected;
- var preinstall = EditorManager.SelectRoom.Preinstall;
+ var preinstall = EditorTileMapManager.SelectRoom.Preinstall;
if (index >= preinstall.Count)
{
return null;
@@ -140,7 +140,7 @@
///
public void RefreshPreinstallSelect(int index = -1)
{
- var preinstall = EditorManager.SelectRoom.Preinstall;
+ var preinstall = EditorTileMapManager.SelectRoom.Preinstall;
var optionButton = S_PreinstallOption.Instance;
var selectIndex = index < 0 ? (preinstall.Count > 0 ? 0 : -1) : index;
optionButton.Clear();
@@ -167,10 +167,10 @@
//清除选中项
RemoveSelectCell();
//记录选中波数
- EditorManager.SetSelectWaveIndex(-1);
+ EditorTileMapManager.SetSelectWaveIndex(-1);
//记录选中的预设
- EditorManager.SetSelectPreinstallIndex((int)index);
- var preinstall = EditorManager.SelectRoom.Preinstall;
+ EditorTileMapManager.SetSelectPreinstallIndex((int)index);
+ var preinstall = EditorTileMapManager.SelectRoom.Preinstall;
if (index >= 0 && index <= preinstall.Count)
{
_grid.SetDataList(preinstall[(int)index].WaveList.ToArray());
@@ -266,8 +266,8 @@
///
public void OnAddPreinstall()
{
- var roomInfoRoomType = EditorManager.SelectRoom.RoomInfo.RoomType;
- var roomSplitPreinstall = EditorManager.SelectRoom.Preinstall;
+ var roomInfoRoomType = EditorTileMapManager.SelectRoom.RoomInfo.RoomType;
+ var roomSplitPreinstall = EditorTileMapManager.SelectRoom.Preinstall;
EditorWindowManager.ShowCreatePreinstall(roomInfoRoomType, roomSplitPreinstall, preinstall =>
{
//创建逻辑
@@ -283,8 +283,8 @@
///
public void OnEditPreinstall()
{
- var roomInfoRoomType = EditorManager.SelectRoom.RoomInfo.RoomType;
- var roomSplitPreinstall = EditorManager.SelectRoom.Preinstall;
+ var roomInfoRoomType = EditorTileMapManager.SelectRoom.RoomInfo.RoomType;
+ var roomSplitPreinstall = EditorTileMapManager.SelectRoom.Preinstall;
var selectPreinstall = GetSelectPreinstall();
EditorWindowManager.ShowEditPreinstall(roomInfoRoomType, roomSplitPreinstall, selectPreinstall, preinstall =>
{
@@ -301,7 +301,7 @@
///
public void OnDeletePreinstall()
{
- var index = EditorManager.SelectPreinstallIndex;
+ var index = EditorTileMapManager.SelectPreinstallIndex;
if (index < 0)
{
return;
@@ -312,11 +312,11 @@
if (v)
{
//先把选中项置为-1
- EditorManager.SetSelectPreinstallIndex(-1);
+ EditorTileMapManager.SetSelectPreinstallIndex(-1);
//移除预设数据
- EditorManager.SelectRoom.Preinstall.RemoveAt(index);
+ EditorTileMapManager.SelectRoom.Preinstall.RemoveAt(index);
//刷新选项
- RefreshPreinstallSelect(EditorManager.SelectRoom.Preinstall.Count - 1);
+ RefreshPreinstallSelect(EditorTileMapManager.SelectRoom.Preinstall.Count - 1);
//派发数据修改事件
EventManager.EmitEvent(EventEnum.OnEditorDirty);
}
@@ -335,7 +335,7 @@
return;
}
- var preinstall = EditorManager.SelectRoom.Preinstall;
+ var preinstall = EditorTileMapManager.SelectRoom.Preinstall;
if (index >= preinstall.Count)
{
EditorWindowManager.ShowTips("警告", "未知预设选项!");
@@ -377,7 +377,7 @@
///
public void OnDeleteWave()
{
- var index = EditorManager.SelectWaveIndex;
+ var index = EditorTileMapManager.SelectWaveIndex;
if (index < 0)
{
return;
@@ -405,7 +405,7 @@
//移除数据
selectPreinstall.WaveList.RemoveAt(index);
_grid.RemoveByIndex(index);
- EditorManager.SetSelectWaveIndex(-1);
+ EditorTileMapManager.SetSelectWaveIndex(-1);
//派发数据修改事件
EventManager.EmitEvent(EventEnum.OnEditorDirty);
}
@@ -443,7 +443,7 @@
{
if (SelectCell is EditorMarkCell markCell)
{
- var index = EditorManager.SelectWaveIndex;
+ var index = EditorTileMapManager.SelectWaveIndex;
if (index < 0)
{
return;
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs
index 8950509..a49962a 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs
@@ -94,7 +94,7 @@
///
public void SelectGroup(DungeonRoomGroup group)
{
- EditorManager.SetSelectDungeonGroup(group);
+ EditorTileMapManager.SetSelectDungeonGroup(group);
OnSearchRoomButtonClick();
}
@@ -143,14 +143,14 @@
//搜索房间按钮点击
private void OnSearchRoomButtonClick()
{
- if (EditorManager.SelectDungeonGroup != null)
+ if (EditorTileMapManager.SelectDungeonGroup != null)
{
//输入文本
var text = S_RoomSearchInput.Instance.Text;
//房间类型
var roomType = S_RoomTypeButton.Instance.GetSelectedId();
- IEnumerable result = EditorManager.SelectDungeonGroup.GetAllRoomList();
+ IEnumerable result = EditorTileMapManager.SelectDungeonGroup.GetAllRoomList();
//名称搜索
if (!string.IsNullOrEmpty(text))
@@ -192,7 +192,7 @@
//创建地牢房间按钮点击
private void OnCreateRoomClick()
{
- var groupName = EditorManager.SelectDungeonGroup != null ? EditorManager.SelectDungeonGroup.GroupName : null;
+ var groupName = EditorTileMapManager.SelectDungeonGroup != null ? EditorTileMapManager.SelectDungeonGroup.GroupName : null;
EditorWindowManager.ShowCreateRoom(groupName, Mathf.Max(S_RoomTypeButton.Instance.Selected - 1, 0), CreateRoom);
}
@@ -231,7 +231,7 @@
if (result)
{
//删除房间
- if (MapProjectManager.DeleteRoom(EditorManager.SelectDungeonGroup, selectRoom))
+ if (MapProjectManager.DeleteRoom(EditorTileMapManager.SelectDungeonGroup, selectRoom))
{
MapProjectManager.SaveGroupMap();
OnSearchRoomButtonClick();
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs
index 9d82d5a..878061a 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs
@@ -28,7 +28,7 @@
else
{
CellNode.L_ErrorTexture.Instance.Visible = true;
- tipText += "\n错误: " + EditorManager.GetRoomErrorTypeMessage(data.ErrorType);
+ tipText += "\n错误: " + EditorTileMapManager.GetRoomErrorTypeMessage(data.ErrorType);
}
if (!string.IsNullOrEmpty(data.RoomInfo.Remark))
@@ -51,7 +51,7 @@
public override void OnSelect()
{
- EditorManager.SetSelectRoom(Data);
+ EditorTileMapManager.SetSelectRoom(Data);
CellNode.L_SelectTexture.Instance.Visible = true;
}
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs
index 511c8ac..40d595e 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs
@@ -136,7 +136,7 @@
}
_currMarkToolsMap.Clear();
//添加新的数据
- var selectPreinstall = EditorManager.SelectPreinstall;
+ var selectPreinstall = EditorTileMapManager.SelectPreinstall;
if (selectPreinstall != null)
{
foreach (var markInfos in selectPreinstall.WaveList)
@@ -158,8 +158,8 @@
_toolGrid.Click(_editToolIndex);
}
- var selectIndex = EditorManager.SelectWaveIndex;
- var waveList = EditorManager.SelectPreinstall.WaveList;
+ var selectIndex = EditorTileMapManager.SelectWaveIndex;
+ var waveList = EditorTileMapManager.SelectPreinstall.WaveList;
for (var i = 0; i < waveList.Count; i++)
{
var wave = waveList[i];
@@ -325,11 +325,11 @@
if (markTool != null) //选中当前
{
ActiveMark.OnSelect();
- EditorManager.SetSelectMark(markTool.MarkInfo);
+ EditorTileMapManager.SetSelectMark(markTool.MarkInfo);
}
else
{
- EditorManager.SetSelectMark(null);
+ EditorTileMapManager.SetSelectMark(null);
}
}
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs
index 05b28e9..130ed17 100644
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs
@@ -5,6 +5,12 @@
public partial class TileSetEditorPanel : TileSetEditor
{
///
+ /// 编辑使用的 tileSetInfo 数据
+ ///
+ public TileSetInfo TileSetInfo { get; private set; }
+ public TileSetInfo OriginTileSetInfo { get; private set; }
+
+ ///
/// 是否初始化过纹理
///
public bool InitTexture { get; private set; }
@@ -89,7 +95,9 @@
///
public void InitData(TileSetInfo tileSetInfo)
{
- S_Title.Instance.Text = "正在编辑:" + tileSetInfo.Name;
+ OriginTileSetInfo = tileSetInfo;
+ TileSetInfo = tileSetInfo.Clone();
+ S_Title.Instance.Text = "正在编辑:" + TileSetInfo.Name;
//SetTextureData(Image.LoadFromFile("resource/tileSprite/map1/16x16 dungeon ii wall reconfig v04 spritesheet.png"));
//TabGrid.SelectIndex = 0;
@@ -170,6 +178,7 @@
{
EditorWindowManager.ShowInput("创建资源", "资源名称:", null, (value, isClose) =>
{
+ EventManager.EmitEvent(EventEnum.OnCreateTileSetSource);
var optionButton = S_OptionButton.Instance;
optionButton.AddItem(value);
optionButton.Selected = optionButton.ItemCount - 1;
@@ -179,6 +188,6 @@
private void OnOptionChange(long index)
{
-
+ EventManager.EmitEvent(EventEnum.OnSelectTileSetSource);
}
}
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorProject/TileSetEditorProjectPanel.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorProject/TileSetEditorProjectPanel.cs
index ccf7444..beca290 100644
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditorProject/TileSetEditorProjectPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorProject/TileSetEditorProjectPanel.cs
@@ -19,10 +19,11 @@
_grid.SetAutoColumns(true);
_grid.SetCellOffset(new Vector2I(10, 10));
_grid.SetHorizontalExpand(true);
- _grid.Add(new TileSetInfo()
- {
- Name = "测试数据"
- });
+
+ var tileSetInfo = new TileSetInfo();
+ tileSetInfo.InitData();
+ tileSetInfo.Name = "测试数据";
+ _grid.Add(tileSetInfo);
}
public override void OnDestroyUi()