|
|
@@ -6,6 +6,7 @@ using cfg;
|
|
|
using System;
|
|
|
using System.IO;
|
|
|
using OfficeOpenXml;
|
|
|
+using System.Diagnostics;
|
|
|
|
|
|
public class GameMapEdPopup : PopupWindowContent
|
|
|
{
|
|
|
@@ -146,8 +147,8 @@ public class GameMapEdPopup : PopupWindowContent
|
|
|
}
|
|
|
catch (System.InvalidOperationException e)
|
|
|
{
|
|
|
- Debug.LogError($"出怪表未关闭或Sheet名重复,请重试");
|
|
|
- Debug.LogException(e);
|
|
|
+ UnityEngine.Debug.LogError($"出怪表未关闭或Sheet名重复,请重试");
|
|
|
+ UnityEngine.Debug.LogException(e);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
@@ -222,13 +223,7 @@ public class GameMapEdPopup : PopupWindowContent
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
- Debug.Log(gameMap.layers.Length);
|
|
|
- Debug.Log(i);
|
|
|
- Debug.Log(layer.spawnTimes.Count);
|
|
|
- Debug.LogError(j);
|
|
|
- Debug.LogError(spawnTime);
|
|
|
- Debug.LogError(spawnTime.pos);
|
|
|
- Debug.LogException(e);
|
|
|
+ UnityEngine.Debug.LogException(e);
|
|
|
}
|
|
|
|
|
|
if (layer.isTowerWave)
|
|
|
@@ -287,13 +282,49 @@ public class GameMapEdPopup : PopupWindowContent
|
|
|
catch (System.InvalidOperationException e)
|
|
|
{
|
|
|
EditorUtility.DisplayDialog("Error", $"出怪表未关闭或Sheet名重复,请重试", "OK");
|
|
|
- Debug.LogException(e);
|
|
|
+ UnityEngine.Debug.LogException(e);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- Debug.Log($"\"{gameMap.showIdent}\"表保存完毕!");
|
|
|
- Debug.Log("记得运行\"gen_code_json.bat\"更新数据!");
|
|
|
+ UnityEngine.Debug.Log($"\"{gameMap.showIdent}\"表保存完毕!");
|
|
|
+ UnityEngine.Debug.Log("记得运行\"gen_code_json.bat\"更新数据!");
|
|
|
+ RunBat();
|
|
|
+ }
|
|
|
+
|
|
|
+ //运行.bat文件
|
|
|
+ public static void RunBat()
|
|
|
+ {
|
|
|
+
|
|
|
+ string batPath = Application.dataPath + "/../Luban/gen_code_json.bat"; // 示例路径
|
|
|
+
|
|
|
+ // 检查文件是否存在
|
|
|
+ if (!System.IO.File.Exists(batPath))
|
|
|
+ {
|
|
|
+ UnityEngine.Debug.LogError(".bat文件不存在: " + batPath);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 配置进程启动信息
|
|
|
+ ProcessStartInfo psi = new ProcessStartInfo
|
|
|
+ {
|
|
|
+ FileName = "cmd.exe", // 通过cmd调用
|
|
|
+ Arguments = $"/K \"{batPath}\"", // 传递.bat路径
|
|
|
+ WorkingDirectory = System.IO.Path.GetDirectoryName(batPath),
|
|
|
+ UseShellExecute = true,
|
|
|
+ CreateNoWindow = false
|
|
|
+ };
|
|
|
+
|
|
|
+ // 启动进程
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Process.Start(psi);
|
|
|
+ UnityEngine.Debug.Log("成功启动.bat文件: " + batPath);
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ UnityEngine.Debug.LogError("启动失败: " + e.Message);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void ReloadExcelData(string path, int mapIdx)
|
|
|
@@ -351,8 +382,8 @@ public class GameMapEdPopup : PopupWindowContent
|
|
|
if (cfgCreateEnemy[i].WaveID - cfgCreateEnemy[i - 1].WaveID > 1
|
|
|
|| cfgCreateEnemy[i].WaveID < cfgCreateEnemy[i - 1].WaveID)
|
|
|
{
|
|
|
- Debug.Log(cfgCreateEnemy[i].WaveID);
|
|
|
- Debug.Log(cfgCreateEnemy[i - 1].WaveID);
|
|
|
+ UnityEngine.Debug.Log(cfgCreateEnemy[i].WaveID);
|
|
|
+ UnityEngine.Debug.Log(cfgCreateEnemy[i - 1].WaveID);
|
|
|
EditorUtility.DisplayDialog("Error", $"\"{excelWorksheets[mapIdx - 1]}\"关卡第\"{cfgCreateEnemy[i].WaveID}\"波顺序有误", "OK");
|
|
|
}
|
|
|
if (cfgCreateEnemy[i].WaveID != id)
|
|
|
@@ -392,14 +423,14 @@ public class GameMapEdPopup : PopupWindowContent
|
|
|
{
|
|
|
if(i == cfgCreateEnemy.Count - 1)
|
|
|
{
|
|
|
- Debug.LogError("请运行\"gen_code_json.bat\"更新表格数据");
|
|
|
+ UnityEngine.Debug.LogError("请运行\"gen_code_json.bat\"更新表格数据");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// 标记资源为脏数据,以便保存更改
|
|
|
EditorUtility.SetDirty(GameMapEditor.asset);
|
|
|
AssetDatabase.SaveAssets();
|
|
|
- Debug.Log($"\"{excelWorksheets[mapIdx - 1]}\"表导入完毕!");
|
|
|
+ UnityEngine.Debug.Log($"\"{excelWorksheets[mapIdx - 1]}\"表导入完毕!");
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -419,7 +450,7 @@ public class GameMapEdPopup : PopupWindowContent
|
|
|
spawnTime.id = tile.id;
|
|
|
if (cfgData.Position.Count % 2 != 0)
|
|
|
{
|
|
|
- Debug.LogError($"出怪表\"{cfgData.WaveName}\"中\"{cfgData.EnemyName}\"的Position格式错误");
|
|
|
+ UnityEngine.Debug.LogError($"出怪表\"{cfgData.WaveName}\"中\"{cfgData.EnemyName}\"的Position格式错误");
|
|
|
}
|
|
|
spawnTime.pos = new();
|
|
|
for(int i = 0; i < cfgData.Position.Count; i+=2)
|
|
|
@@ -440,7 +471,7 @@ public class GameMapEdPopup : PopupWindowContent
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Debug.LogError($"波次中\"{cfgData.EnemyName}\"重复");
|
|
|
+ UnityEngine.Debug.LogError($"波次中\"{cfgData.EnemyName}\"重复");
|
|
|
}
|
|
|
}
|
|
|
// ----------------------------------------------------------------------------------------------------------------
|