【工具】战斗数据表同步工具添加

dev_chengFeng
gaoxin 2021-04-30 14:37:01 +08:00
parent 65454a8e23
commit fff810429e
1 changed files with 25 additions and 1 deletions

View File

@ -12,6 +12,7 @@ namespace GameEditor.Core.DataConfig
public class ConfigExportWindow:EditorWindow
{
static string m_ExcelPath;
static string m_BattleConfigPath;
static string m_Bench;
static string[] m_Files;
static bool[] m_Choose;
@ -21,6 +22,7 @@ namespace GameEditor.Core.DataConfig
private static void ShowConfigWin()
{
m_ExcelPath = EditorPrefs.GetString("m_ExcelPath");
m_BattleConfigPath = EditorPrefs.GetString("m_BattleConfigPath");
m_Bench = EditorPrefs.GetString("m_Bench");
LoadDic();
@ -64,6 +66,7 @@ namespace GameEditor.Core.DataConfig
}
// 保存数据
EditorPrefs.SetString("m_ExcelPath", m_ExcelPath);
EditorPrefs.SetString("m_BattleConfigPath", m_BattleConfigPath);
EditorPrefs.SetString("m_Bench", m_Bench);
}
@ -111,6 +114,10 @@ namespace GameEditor.Core.DataConfig
p.Close();
}
private string[] battleConfigList = new string[]
{
"PassiveSkillLogicConfig"
};
private void OnGUI()
{
@ -159,7 +166,24 @@ namespace GameEditor.Core.DataConfig
// 导表
DataConfigWindow.excelALLConfig(true, m_Bench + "/base_data");
}
EditorGUILayout.LabelField("战斗数据表同步路径:");
m_BattleConfigPath = EditorGUILayout.TextField("", m_BattleConfigPath);
if (GUILayout.Button("同步战斗数据表", GUILayout.Height(40f)))
{
string sourcePath = Application.dataPath + "/ManagedResources/~lua/Config/Data/";
for(int i = 0; i < battleConfigList.Length; i++)
{
string luaFile = sourcePath + battleConfigList[i] + ".lua";
string targetPath = m_BattleConfigPath +"/"+ battleConfigList[i] + ".lua";
UnityEngine.Debug.Log(battleConfigList[i]);
File.Copy(luaFile, targetPath, true);
}
// 同步
UnityEngine.Debug.Log("同步成功");
// 保存数据
SaveLocalConfig();
}
}
}