diff --git a/Assets/Editor/BFOthersTools/BoardEditorTools/BoardEditorWindow.cs b/Assets/Editor/BFOthersTools/BoardEditorTools/BoardEditorWindow.cs index 4e58b6753..f28b0e604 100644 --- a/Assets/Editor/BFOthersTools/BoardEditorTools/BoardEditorWindow.cs +++ b/Assets/Editor/BFOthersTools/BoardEditorTools/BoardEditorWindow.cs @@ -20,11 +20,14 @@ namespace BFEditor // } const string BOARD_EXCEL_KEY = "bf_board_excel_key"; const string BOARD_GRID_TYPE_KEY = "bf_board_grid_type_key"; + const string BOARD_GRID_EDGE_KEY = "bf_board_grid_edge_key"; int gridCount = 49; string battleImgDirectory = "Assets/arts/textures/ui/battle/"; string boardFilepath; string boardGridTypePath; + string boardGridEdgePath; string boardFiledName = "board"; + string boardEdgeFiledName = "grid_edge"; string randomTypeStr = ""; int curIndex = 1; int maxRow = 7; @@ -32,6 +35,9 @@ namespace BFEditor Dictionary boardDict = new Dictionary(); Dictionary outPutBoardDict = new Dictionary(); Dictionary imgDict = new Dictionary(); + Dictionary> boardGridEdgeDict = new Dictionary>(); + Dictionary edgeDict = new Dictionary(); + Dictionary outPutBoardEdgeDict = new Dictionary(); bool loadExcelOver = false; Dictionary elementTypeImgDict = new Dictionary(){ [1] = "red_1", @@ -55,6 +61,12 @@ namespace BFEditor { boardGridTypePath = "选择grid_type配置表路径"; } + + boardGridEdgePath = GetBoardGridEdgePath(); + if (boardGridEdgePath.Equals("")) + { + boardGridEdgePath = "选择grid_edge_type配置表路径"; + } string[] paths = Directory.GetFiles(battleImgDirectory); foreach(var path in paths) { @@ -86,6 +98,16 @@ namespace BFEditor PlayerPrefs.SetString(BOARD_GRID_TYPE_KEY, path); } + string GetBoardGridEdgePath() + { + return PlayerPrefs.GetString(BOARD_GRID_EDGE_KEY, ""); + } + + void SetBoardGridEdgePath(string path) + { + PlayerPrefs.SetString(BOARD_GRID_EDGE_KEY, path); + } + BoardEditorWindow() { this.titleContent = new GUIContent("棋盘编辑器"); @@ -114,6 +136,20 @@ namespace BFEditor } } GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + GUILayout.Label("grid_edge 路径", GUILayout.Width(100)); + GUILayout.Space(10); + GUILayout.TextField(boardGridEdgePath, GUILayout.Width(300)); + if (GUILayout.Button("选择", GUILayout.Width(80))) + { + string openPath = EditorUtility.OpenFilePanel("选择配置表", GetBoardGridEdgePath(), ""); + if (openPath.CompareTo("") != 0) + { + boardGridEdgePath = openPath; + SetBoardGridEdgePath(openPath); + } + } + GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); @@ -357,6 +393,21 @@ namespace BFEditor boardGridTypeDict[key] = dict; } + // 读取grid_edge_type配置表 + BFEditorUtils.RunCommond("python", "load_board.py " + tempPath + " " + boardGridEdgePath, pythonToolPath); + string boardGridEdgeJson = File.ReadAllText(tempPath); + jsonObj = (JObject)JsonConvert.DeserializeObject(boardGridEdgeJson); + foreach (var item in jsonObj) + { + int key = int.Parse(item.Key); + Dictionary dict = new Dictionary(); + foreach (var item2 in (JObject)item.Value) + { + dict[item2.Key] = item2.Value.ToString(); + } + boardGridEdgeDict[key] = dict; + } + // 读取boardFile配置表 BFEditorUtils.RunCommond("python", "load_board.py " + tempPath + " " + boardFilepath, pythonToolPath); string boardFileJson = File.ReadAllText(tempPath); @@ -369,6 +420,12 @@ namespace BFEditor boardDict[key] = copyBoard((JArray)item.Value[boardFiledName]); outPutBoardDict[key] = copyBoard((JArray)item.Value[boardFiledName]); } + if (item.Value[boardEdgeFiledName] != null) + { + int key = int.Parse(item.Key); + edgeDict[key] = copyBoard((JArray)item.Value[boardEdgeFiledName]); + outPutBoardEdgeDict[key] = copyBoard((JArray)item.Value[boardEdgeFiledName]); + } } loadExcelOver = true; @@ -394,7 +451,7 @@ namespace BFEditor void DragBoard() { Texture img; - GUI.DrawTexture(new Rect(0, 150, 702, 702), boardImg); + GUI.DrawTexture(new Rect(0, 200, 702, 702), boardImg); if(!loadExcelOver) { return; @@ -406,7 +463,7 @@ namespace BFEditor return; } - GUILayout.BeginArea(new Rect(0, 150, 702, 702)); + GUILayout.BeginArea(new Rect(0, 200, 702, 702)); GUILayout.BeginVertical(); JArray jo = boardDict[curIndex]; int posIndex = 0; @@ -452,9 +509,37 @@ namespace BFEditor GUILayout.EndHorizontal(); } GUILayout.EndVertical(); + if (edgeDict.ContainsKey(curIndex)) + { + JArray edgeJo = edgeDict[curIndex]; + for (int i = 0; i < edgeJo.Count; i++) + { + JArray gridInfo = (JArray)edgeJo[i]; + if(gridInfo.Count < 3) + { + continue; + } + int posId = (int)gridInfo[0]; + int edgeType = (int)gridInfo[1]; + int dir = (int)gridInfo[2]; + // 绘制类型 + if(boardGridEdgeDict[edgeType].ContainsKey("icon")) + { + string icon = boardGridEdgeDict[edgeType]["icon"]; + if (imgDict.ContainsKey(icon)) + { + int row = posId / 10; + int col = posId % 10; + img = imgDict[icon]; + GUI.DrawTexture(new Rect(startOffset + (col - 1) * textureWidth, startOffset + (row - 1) * textureWidth, 92, 32), img); + } + } + } + } + GUILayout.EndArea(); - GUILayout.BeginArea(new Rect(730, 150, 510 * 7, 550 / 7 * maxRow)); + GUILayout.BeginArea(new Rect(730, 200, 510 * 7, 550 / 7 * maxRow)); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label("棋盘配置信息", GUILayout.Width(100), GUILayout.Height(30)); diff --git a/Assets/Editor/BFOthersTools/OtherToolsMenu.cs b/Assets/Editor/BFOthersTools/OtherToolsMenu.cs index 9c78fb7c0..7859035cb 100644 --- a/Assets/Editor/BFOthersTools/OtherToolsMenu.cs +++ b/Assets/Editor/BFOthersTools/OtherToolsMenu.cs @@ -104,7 +104,7 @@ namespace BFEditor [MenuItem("其他工具/棋盘编辑器", false, 9)] public static void CreateBoardEditorWindow() { - var window = (BoardEditorWindow)EditorWindow.GetWindowWithRect(typeof(BoardEditorWindow), new Rect(Screen.width / 2, Screen.height / 2, 1200, 850), true); + var window = (BoardEditorWindow)EditorWindow.GetWindowWithRect(typeof(BoardEditorWindow), new Rect(Screen.width / 2, Screen.height / 2, 1200, 1000), true); window.Show(); } } diff --git a/Assets/lua/app/config/chapter_dungeon_rune.lua.bytes b/Assets/lua/app/config/chapter_dungeon_rune.lua.bytes index d3e61d8fa..4cf5aaa9c 100644 Binary files a/Assets/lua/app/config/chapter_dungeon_rune.lua.bytes and b/Assets/lua/app/config/chapter_dungeon_rune.lua.bytes differ diff --git a/Assets/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua.bytes b/Assets/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua.bytes index 0e0b218af..46c3869da 100644 Binary files a/Assets/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua.bytes and b/Assets/lua/app/module/battle/controller/battle_controller_dungeon_rune.lua.bytes differ