|
@@ -4,7 +4,9 @@ using System.Collections.Generic;
|
|
|
using UnityEngine;
|
|
using UnityEngine;
|
|
|
using UnityEditor;
|
|
using UnityEditor;
|
|
|
using System.Linq;
|
|
using System.Linq;
|
|
|
-
|
|
|
|
|
|
|
+using cfg;
|
|
|
|
|
+using SimpleJSON;
|
|
|
|
|
+using System.IO;
|
|
|
|
|
|
|
|
public class GameMapEditor : EditorWindow
|
|
public class GameMapEditor : EditorWindow
|
|
|
{
|
|
{
|
|
@@ -120,7 +122,7 @@ public class GameMapEditor : EditorWindow
|
|
|
private static readonly GUIContent GC_LayersHead = new GUIContent("波次");
|
|
private static readonly GUIContent GC_LayersHead = new GUIContent("波次");
|
|
|
private static readonly GUIContent GC_TilesHead = new GUIContent("兵种");
|
|
private static readonly GUIContent GC_TilesHead = new GUIContent("兵种");
|
|
|
private static readonly GUIContent GC_new = new GUIContent("new");
|
|
private static readonly GUIContent GC_new = new GUIContent("new");
|
|
|
- private static readonly GUIContent GC_rename = new GUIContent("ren", "Rename");
|
|
|
|
|
|
|
+ private static readonly GUIContent GC_rename = new GUIContent("rename");
|
|
|
private static readonly GUIContent GC_apply = new GUIContent("apply");
|
|
private static readonly GUIContent GC_apply = new GUIContent("apply");
|
|
|
private static readonly GUIContent GC_clear = new GUIContent("x", "Clear tile selection. Draw empty tiles.");
|
|
private static readonly GUIContent GC_clear = new GUIContent("x", "Clear tile selection. Draw empty tiles.");
|
|
|
private static readonly GUIContent GC_add = new GUIContent("+", "Add");
|
|
private static readonly GUIContent GC_add = new GUIContent("+", "Add");
|
|
@@ -129,8 +131,8 @@ public class GameMapEditor : EditorWindow
|
|
|
private static readonly GUIContent GC_movR = new GUIContent(">", "Move selected");
|
|
private static readonly GUIContent GC_movR = new GUIContent(">", "Move selected");
|
|
|
private static readonly GUIContent GC_BackCol = new GUIContent("BackColor");
|
|
private static readonly GUIContent GC_BackCol = new GUIContent("BackColor");
|
|
|
private static readonly GUIContent GC_GridCol = new GUIContent("GridColor");
|
|
private static readonly GUIContent GC_GridCol = new GUIContent("GridColor");
|
|
|
- private static readonly GUIContent GC_Solid = new GUIContent("Outside is Solid");
|
|
|
|
|
- private static readonly GUIContent GC_AutoSz = new GUIContent("Auto-tile Size");
|
|
|
|
|
|
|
+ //private static readonly GUIContent GC_Solid = new GUIContent("Outside is Solid");
|
|
|
|
|
+ //private static readonly GUIContent GC_AutoSz = new GUIContent("Auto-tile Size");
|
|
|
private static readonly GUIContent GC_EditAuto = new GUIContent("Setup Auto-tile");
|
|
private static readonly GUIContent GC_EditAuto = new GUIContent("Setup Auto-tile");
|
|
|
private static readonly GUIContent GC_Viz = new GUIContent("*", "Toggle layer visblity in editor");
|
|
private static readonly GUIContent GC_Viz = new GUIContent("*", "Toggle layer visblity in editor");
|
|
|
|
|
|
|
@@ -622,16 +624,7 @@ public class GameMapEditor : EditorWindow
|
|
|
r.x = r.xMax - 200f; r.width = 100f; r.height = 15f;
|
|
r.x = r.xMax - 200f; r.width = 100f; r.height = 15f;
|
|
|
if (GUI.Button(r, GC_ExcelReload))
|
|
if (GUI.Button(r, GC_ExcelReload))
|
|
|
{
|
|
{
|
|
|
- List<string> excelWorksheets = ExcelEditor.ReadExcelSheetsInfo(enemyExcelPath);
|
|
|
|
|
- for (int i = 0; i < excelWorksheets.Count; i++)
|
|
|
|
|
- {
|
|
|
|
|
- asset.maps[i].ident = excelWorksheets[i];
|
|
|
|
|
- int.TryParse(ExcelEditor.GetCellData(enemyExcelPath, excelWorksheets[i], "C6"), out int width);
|
|
|
|
|
- int.TryParse(ExcelEditor.GetCellData(enemyExcelPath, excelWorksheets[i], "D6"), out int height);
|
|
|
|
|
- asset.maps[i].Resize(width, height);
|
|
|
|
|
- }
|
|
|
|
|
- mapSize_w = asset.maps[mapIdx].width;
|
|
|
|
|
- mapSize_h = asset.maps[mapIdx].height;
|
|
|
|
|
|
|
+ ReloadExcel(enemyExcelPath);
|
|
|
}
|
|
}
|
|
|
r.x = r.xMax; r.width = 100f; r.height = 15f;
|
|
r.x = r.xMax; r.width = 100f; r.height = 15f;
|
|
|
if (GUI.Button(r, GC_MapSelect))
|
|
if (GUI.Button(r, GC_MapSelect))
|
|
@@ -703,6 +696,44 @@ public class GameMapEditor : EditorWindow
|
|
|
EditorGUILayout.EndVertical();
|
|
EditorGUILayout.EndVertical();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private JSONNode Loader(string fileName)
|
|
|
|
|
+ {
|
|
|
|
|
+ return JSON.Parse(File.ReadAllText("GenerateDatas/json/" + fileName + ".json"));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void ReloadExcel(string path)
|
|
|
|
|
+ {
|
|
|
|
|
+ List<string> excelWorksheets = ExcelEditor.ReadExcelSheetsInfo(path);
|
|
|
|
|
+ Tables allCfgData = new Tables(Loader);
|
|
|
|
|
+ List<SingleCreateEnemyConfig> cfgCreateEnemy = allCfgData.CfgCreateEnemy.DataList;
|
|
|
|
|
+
|
|
|
|
|
+ if (mapIdx >= excelWorksheets.Count)
|
|
|
|
|
+ {
|
|
|
|
|
+ mapsPopup.ChangeMapSelected(excelWorksheets.Count - 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (asset.maps.Count > excelWorksheets.Count)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ for(int i = asset.maps.Count - 1; i>= excelWorksheets.Count; i--)
|
|
|
|
|
+ {
|
|
|
|
|
+ asset.RemoveMapAtIndex(i);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ for (int i = 0; i < excelWorksheets.Count; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (i >= asset.maps.Count)
|
|
|
|
|
+ {
|
|
|
|
|
+ asset.AddMap();
|
|
|
|
|
+ }
|
|
|
|
|
+ asset.maps[i].ident = excelWorksheets[i];
|
|
|
|
|
+ int.TryParse(ExcelEditor.GetCellData(path, excelWorksheets[i], "C6"), out int width);
|
|
|
|
|
+ int.TryParse(ExcelEditor.GetCellData(path, excelWorksheets[i], "D6"), out int height);
|
|
|
|
|
+ asset.maps[i].Resize(width, height);
|
|
|
|
|
+ }
|
|
|
|
|
+ mapsPopup.ChangeContentRect();
|
|
|
|
|
+ mapSize_w = asset.maps[mapIdx].width;
|
|
|
|
|
+ mapSize_h = asset.maps[mapIdx].height;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
private void OnMapSelected(int idx)
|
|
private void OnMapSelected(int idx)
|