Merge branch 'china/dev' of http://60.1.1.230/gaoxin/JL_Client into china/dev
commit
bcfb63e451
|
@ -14,12 +14,15 @@ namespace GameEditor.FrameTool
|
|||
{
|
||||
string tempConfigPath;
|
||||
string configPath;
|
||||
string downloadConfigPath;
|
||||
string previous;
|
||||
Dictionary<string, object> dic;
|
||||
Dictionary<string, object> curDic;
|
||||
bool isFinish;
|
||||
Dictionary<string, int> indexDic;
|
||||
//Dictionary<string, object> curDic;
|
||||
//bool isFinish;
|
||||
string addKey;
|
||||
string targetPath;
|
||||
int index;
|
||||
// Add menu named "My Window" to the Window menu
|
||||
[MenuItem("Build/Config")]
|
||||
static void Init()
|
||||
|
@ -33,32 +36,51 @@ namespace GameEditor.FrameTool
|
|||
void OnGUI()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
if (GUILayout.Button("加载config模板", GUILayout.ExpandWidth(false)))
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Label("加载config模板");
|
||||
tempConfigPath = GUILayout.TextArea(tempConfigPath);
|
||||
if (GUILayout.Button("Brown", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
dic.Clear();
|
||||
tempConfigPath = EditorUtility.OpenFilePanel("Resource path", tempConfigPath,"*.*");
|
||||
tempConfigPath = EditorUtility.OpenFilePanel("Resource path", tempConfigPath, "*.*");
|
||||
EditorPrefs.SetString("IMPORTCCONFIG_SOURCESFOLDERPATH", tempConfigPath);
|
||||
StreamReader sr = File.OpenText(tempConfigPath);
|
||||
SetConfigData(sr.ReadToEnd());
|
||||
sr.Close();
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
downloadConfigPath = GUILayout.TextArea(downloadConfigPath);
|
||||
if (GUILayout.Button("下载config模板", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
isFinish = false;
|
||||
dic.Clear();
|
||||
string path = "http://60.1.1.12/assetbundles/config.txt";
|
||||
EditorCoroutineRunner.StartEditorCoroutine(DownLoadTempComfig(path));
|
||||
if (string.IsNullOrEmpty(downloadConfigPath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
dic.Clear();
|
||||
EditorPrefs.SetString("IMPORTCCONFIG_DownLOADCONFIGPATH", downloadConfigPath);
|
||||
EditorCoroutineRunner.StartEditorCoroutine(DownLoadTempComfig(downloadConfigPath));
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Label("加载数据");
|
||||
configPath = GUILayout.TextArea(configPath);
|
||||
if (GUILayout.Button("Brown", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
configPath = EditorUtility.OpenFilePanel("Resource path", configPath, "*.*");
|
||||
EditorPrefs.SetString("IMPORTCCONFIG_DATAFOLDERPATH", configPath);
|
||||
StreamReader sr = File.OpenText(configPath);
|
||||
SetConfigData(sr.ReadToEnd());
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (dic != null && dic.Count > 0)
|
||||
{
|
||||
RefreshWindowShow();
|
||||
}
|
||||
if (isFinish)
|
||||
{
|
||||
if (curDic != null && curDic.Count > 0)
|
||||
{
|
||||
RefreshWindowShow1();
|
||||
}
|
||||
index = 0;
|
||||
RefreshWindowShow2(dic);
|
||||
}
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
targetPath = GUILayout.TextArea(targetPath);
|
||||
|
@ -72,7 +94,7 @@ namespace GameEditor.FrameTool
|
|||
JsonData jsonData = new JsonData();
|
||||
SetDicToJsonData(jsonData,dic);
|
||||
string json = JsonMapper.ToJson(jsonData);
|
||||
Debug.Log("jsonData:" + json);
|
||||
//Debug.Log("jsonData:" + json);
|
||||
File.WriteAllText(targetPath, json, Encoding.UTF8);
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
@ -99,12 +121,14 @@ namespace GameEditor.FrameTool
|
|||
|
||||
void InitWindow()
|
||||
{
|
||||
isFinish = true;
|
||||
//isFinish = true;
|
||||
addKey = "";
|
||||
dic = new Dictionary<string, object>();
|
||||
indexDic = new Dictionary<string, int>();
|
||||
tempConfigPath = EditorPrefs.GetString("IMPORTCCONFIG_SOURCESFOLDERPATH");
|
||||
targetPath = EditorPrefs.GetString("IMPORTCCONFIG_TARGETFOLDERPATH");
|
||||
configPath = EditorPrefs.GetString("IMPORTCCONFIG_DATAFOLDERPATH");
|
||||
downloadConfigPath = EditorPrefs.GetString("IMPORTCCONFIG_DownLOADCONFIGPATH");
|
||||
}
|
||||
|
||||
void SetJsonDataToDic(IDictionary data,Dictionary<string,object> dicc)
|
||||
|
@ -112,7 +136,6 @@ namespace GameEditor.FrameTool
|
|||
foreach (var item in data.Keys)
|
||||
{
|
||||
string key = item.ToString();
|
||||
//Debug.Log(string.Format("{0}", item));
|
||||
try
|
||||
{
|
||||
IDictionary localData = data[item] as IDictionary;
|
||||
|
@ -137,7 +160,7 @@ namespace GameEditor.FrameTool
|
|||
{
|
||||
foreach (KeyValuePair<string, object> keyValue in dicc)
|
||||
{
|
||||
Debug.Log(string.Format("{0}", keyValue.Key));
|
||||
//Debug.Log(string.Format("{0}", keyValue.Key));
|
||||
try
|
||||
{
|
||||
Dictionary<string, object> localData = keyValue.Value as Dictionary<string, object>;
|
||||
|
@ -147,7 +170,7 @@ namespace GameEditor.FrameTool
|
|||
}
|
||||
catch
|
||||
{
|
||||
Debug.Log(string.Format("{0}-{1}", keyValue.Key, keyValue.Value.ToString()));
|
||||
//Debug.Log(string.Format("{0}-{1}", keyValue.Key, keyValue.Value.ToString()));
|
||||
jsonData[keyValue.Key] = keyValue.Value.ToString();
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +180,7 @@ namespace GameEditor.FrameTool
|
|||
{
|
||||
foreach (KeyValuePair<string, object> keyValue in dicc)
|
||||
{
|
||||
Debug.Log(string.Format("{0}", keyValue.Key));
|
||||
//Debug.Log(string.Format("{0}", keyValue.Key));
|
||||
try
|
||||
{
|
||||
Dictionary<string, object> localData = keyValue.Value as Dictionary<string, object>;
|
||||
|
@ -165,97 +188,142 @@ namespace GameEditor.FrameTool
|
|||
}
|
||||
catch
|
||||
{
|
||||
Debug.Log(string.Format("{0}-{1}", keyValue.Key, keyValue.Value.ToString()));
|
||||
//Debug.Log(string.Format("{0}-{1}", keyValue.Key, keyValue.Value.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetConfigData(string strinfo)
|
||||
{
|
||||
Debug.Log(strinfo);
|
||||
//Debug.Log(strinfo);
|
||||
JsonData modeInfo = JsonMapper.ToObject(strinfo);
|
||||
IDictionary data = modeInfo;
|
||||
SetJsonDataToDic(data,dic);
|
||||
isFinish = true;
|
||||
//isFinish = true;
|
||||
//GetDicData(dic);
|
||||
}
|
||||
|
||||
void RefreshWindowShow()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
//void RefreshWindowShow()
|
||||
//{
|
||||
// EditorGUILayout.BeginVertical();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Label("加载数据");
|
||||
configPath = GUILayout.TextArea(configPath);
|
||||
if (GUILayout.Button("Brown", GUILayout.ExpandWidth(false)))
|
||||
// EditorGUILayout.BeginHorizontal();
|
||||
// GUILayout.Label("加载数据");
|
||||
// configPath = GUILayout.TextArea(configPath);
|
||||
// if (GUILayout.Button("Brown", GUILayout.ExpandWidth(false)))
|
||||
// {
|
||||
// configPath = EditorUtility.OpenFilePanel("Resource path", configPath, "*.*");
|
||||
// EditorPrefs.SetString("IMPORTCCONFIG_DATAFOLDERPATH", configPath);
|
||||
// StreamReader sr = File.OpenText(configPath);
|
||||
// SetConfigData(sr.ReadToEnd());
|
||||
// }
|
||||
// EditorGUILayout.EndHorizontal();
|
||||
|
||||
// EditorGUILayout.BeginHorizontal();
|
||||
// foreach (string key in dic.Keys)
|
||||
// {
|
||||
// if (GUILayout.Button(key, GUILayout.ExpandWidth(false)))
|
||||
// {
|
||||
// curDic = dic[key] as Dictionary<string, object>;
|
||||
// }
|
||||
// }
|
||||
// //if (isFinish)
|
||||
// //{
|
||||
// if (curDic != null && curDic.Count > 0)
|
||||
// {
|
||||
// addKey = GUILayout.TextField(addKey);
|
||||
// if (GUILayout.Button("添加key", GUILayout.ExpandWidth(false)))
|
||||
// {
|
||||
// curDic.Add(addKey, new Dictionary<string, object>());
|
||||
// }
|
||||
// }
|
||||
// //}
|
||||
// EditorGUILayout.EndHorizontal();
|
||||
// EditorGUILayout.EndVertical();
|
||||
//}
|
||||
|
||||
//void RefreshWindowShow1()
|
||||
//{
|
||||
// EditorGUILayout.BeginVertical();
|
||||
|
||||
// for (int i = 0; i < curDic.Count; i++)
|
||||
// {
|
||||
// EditorGUILayout.BeginHorizontal();
|
||||
// GUILayout.Space(30);
|
||||
// var item = curDic.ElementAt(i);
|
||||
// var item1 = (curDic[item.Key] as Dictionary<string, object>);
|
||||
// GUILayout.Label(item.Key);
|
||||
// addKey = GUILayout.TextField(addKey);
|
||||
// if (GUILayout.Button("添加key", GUILayout.ExpandWidth(false)))
|
||||
// {
|
||||
// item1.Add(addKey, "");
|
||||
// }
|
||||
// if (GUILayout.Button("删除", GUILayout.ExpandWidth(false)))
|
||||
// {
|
||||
// curDic.Remove(item.Key);
|
||||
// }
|
||||
// EditorGUILayout.EndHorizontal();
|
||||
|
||||
// for (int j = 0; j < item1.Count; j++)
|
||||
// {
|
||||
// EditorGUILayout.BeginHorizontal();
|
||||
// GUILayout.Space(60);
|
||||
// var item2 = item1.ElementAt(j);
|
||||
// GUILayout.Label(item2.Key);
|
||||
// item1[item2.Key] = GUILayout.TextField(item1[item2.Key].ToString());
|
||||
// if (GUILayout.Button("删除", GUILayout.ExpandWidth(false)))
|
||||
// {
|
||||
// item1.Remove(item2.Key);
|
||||
// }
|
||||
// EditorGUILayout.EndHorizontal();
|
||||
// }
|
||||
// }
|
||||
// EditorGUILayout.EndVertical();
|
||||
//}
|
||||
|
||||
void RefreshWindowShow2(Dictionary<string,object> dicc,string indexDicKey = "0")
|
||||
{
|
||||
configPath = EditorUtility.OpenFilePanel("Resource path", configPath, "*.*");
|
||||
EditorPrefs.SetString("IMPORTCCONFIG_DATAFOLDERPATH", configPath);
|
||||
StreamReader sr = File.OpenText(configPath);
|
||||
SetConfigData(sr.ReadToEnd());
|
||||
for (int i = 0; i < dicc.Count; i++)
|
||||
{
|
||||
var item = dicc.ElementAt(i);
|
||||
if (!indexDic.ContainsKey(indexDicKey))
|
||||
{
|
||||
index = index + 1;
|
||||
indexDic.Add(indexDicKey, index);
|
||||
}
|
||||
index = indexDic[indexDicKey];
|
||||
//Debug.Log(string.Format("{0}-{1}", item.Key, item.Value));
|
||||
Dictionary<string, object> localData = item.Value as Dictionary<string, object>;
|
||||
if (localData == null)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Space(30 * index);
|
||||
GUILayout.Label(item.Key);
|
||||
dicc[item.Key] = GUILayout.TextField(dicc[item.Key].ToString());
|
||||
if (GUILayout.Button("删除", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
dicc.Remove(item.Key);
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
foreach (string key in dic.Keys)
|
||||
{
|
||||
if (GUILayout.Button(key, GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
curDic = dic[key] as Dictionary<string, object>;
|
||||
}
|
||||
}
|
||||
if (isFinish)
|
||||
{
|
||||
if (curDic != null && curDic.Count > 0)
|
||||
{
|
||||
addKey = GUILayout.TextField(addKey);
|
||||
if (GUILayout.Button("添加key", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
curDic.Add(addKey, new Dictionary<string, object>());
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
void RefreshWindowShow1()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
for (int i = 0; i < curDic.Count; i++)
|
||||
else
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Space(30);
|
||||
var item = curDic.ElementAt(i);
|
||||
var item1 = (curDic[item.Key] as Dictionary<string, object>);
|
||||
GUILayout.Space(30 * index);
|
||||
GUILayout.Label(item.Key);
|
||||
addKey = GUILayout.TextField(addKey);
|
||||
if (GUILayout.Button("添加key", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
item1.Add(addKey, "");
|
||||
localData.Add(addKey, "");
|
||||
}
|
||||
if (GUILayout.Button("删除", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
curDic.Remove(item.Key);
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
for (int j = 0; j < item1.Count; j++)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Space(60);
|
||||
var item2 = item1.ElementAt(j);
|
||||
GUILayout.Label(item2.Key);
|
||||
item1[item2.Key] = GUILayout.TextField(item1[item2.Key].ToString());
|
||||
if (GUILayout.Button("删除", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
item1.Remove(item2.Key);
|
||||
localData.Remove(item.Key);
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
RefreshWindowShow2(localData, item.Key);
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue