private void OnGUI() { EditorGUILayout.Space(); if (_luaReflect == null) { List <string> excelFileList = BattleEditorUtility.GetExcelFileList(Setting.excelFolder); for (int i = 0; i < excelFileList.Count; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(excelFileList[i]); if (NeedGenerateHeaderJson(excelFileList[i]) && GUILayout.Button("Generate")) { ExcelEditor excelEditor = new ExcelEditor(excelFileList[i]); excelEditor.GenerateHeaderJson(false); } if (GUILayout.Button("Force Generate")) { ExcelEditor excelEditor = new ExcelEditor(excelFileList[i]); excelEditor.GenerateHeaderJson(true); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); EditorGUILayout.HelpBox("请先启动游戏,并进入测试关卡", MessageType.Warning); } else { if (_luaReflectDict != null) { EditorGUILayout.BeginHorizontal(); // foreach (var camp in Camp) { var camp = _camp[0]; EditorGUILayout.BeginVertical(); EditorGUILayout.LabelField(camp); if (_luaReflectDict.TryGetValue(camp, out List <LuaReflect> list)) { for (int i = 0; i < list.Count; i++) { LuaReflect luaReflect = list[i]; if (luaReflect) { DrawLuaReflect(list, camp, luaReflect); } } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); } if (GUILayout.Button("Add Attacker" + _camp[0])) { SelectWnd wnd = SelectWnd.Create("Select Attacker", this, _luaReflect, Setting.battleUnitExcelPath); wnd.rowSelect = delegate(string battleUnit, int index) { AddBattle(battleUnit); }; } } }
public static RowEditorWnd Create(string title, EditorWindow parent, LuaReflect luaReflect, string excelPath) { Rect rect = new Rect(parent.position.x + parent.position.width + 20, parent.position.y, parent.position.width, parent.position.height); EditorWindow.FocusWindowIfItsOpen(typeof(RowEditorWnd)); RowEditorWnd wnd = EditorWindow.CreateWindow <RowEditorWnd>(title); wnd.position = rect; wnd.ShowWnd(parent, luaReflect, excelPath); return(wnd); }
public static ListEditorWnd Create(string title, EditorWindow parent, LuaReflect luaReflect, ExcelColHeader header, string vid) { Rect rect = new Rect(parent.position.x + parent.position.width + 20, parent.position.y, parent.position.width, parent.position.height); ListEditorWnd wnd = EditorWindow.CreateWindow <ListEditorWnd>(title); wnd.position = rect; ExcelEditor excelEditor = new ExcelEditor(header.linkEditorUrl); wnd.ShowWnd(excelEditor); wnd.SetShowRows(excelEditor.GetRowIndexes(header.linkEditorField, vid), true); wnd.header = header; wnd.luaReflect = luaReflect; return(wnd); }
void DrawLuaReflect(List <LuaReflect> list, string camp, LuaReflect luaReflect) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(luaReflect.name, GUILayout.Width(160)); if (GUILayout.Button("Del")) { RemoveUnit(camp, luaReflect.keyValueMap["layoutIndex"]); list.Remove(luaReflect); LoadLuaReflects(); } EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel++; DrawLuaReflectSkill(camp, luaReflect); EditorGUI.indentLevel--; }
public new static SelectWnd Create(string title, EditorWindow parent, LuaReflect luaReflect, string excelPath) { Rect rect = new Rect(parent.position.x + parent.position.width + 20, parent.position.y, parent.position.width, parent.position.height); SelectWnd wnd = EditorWindow.CreateWindow <SelectWnd>(title); wnd.position = rect; ExcelEditor excelEditor = new ExcelEditor(excelPath); wnd.ShowWnd(excelEditor); int[] showRows = new int[excelEditor.dataTable.Rows.Count - 2]; for (int i = 0; i < showRows.Length; i++) { showRows[i] = i + 2; } wnd.SetShowRows(showRows, false); wnd.luaReflect = luaReflect; return(wnd); }
private void WaitBattleStart() { if (!_luaReflect) { rootGameObjects = SceneManager.GetActiveScene().GetRootGameObjects(); foreach (var obj in rootGameObjects) { if (obj.name.ToLowerInvariant().IndexOf("avatarroot", StringComparison.Ordinal) != -1) { _luaReflect = obj.GetComponent <LuaReflect>(); break; } } } if (_luaReflect) { LoadLuaReflects(); } }
void DrawLuaReflectSkill(string camp, LuaReflect luaReflect) { var skillJsonArray = luaReflect.jsonArrayMap["Skill"]; for (int i = 0; i < skillJsonArray.Count; i++) { var skillId = skillJsonArray[i]["id"]; EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(skillId.ToString()); if (GUILayout.Button("Edit")) { RowEditorWnd wnd = RowEditorWnd.Create("Skill", this, luaReflect, Setting.skillExcelPath); wnd.rowIndex = wnd.GetRowIndex("id", skillId.ToString()); wnd.luaKey = LuaKey.Skill; } if (GUILayout.Button("Test")) { ManualAttack(camp, luaReflect.keyValueMap["layoutIndex"], skillId.ToString()); } EditorGUILayout.EndHorizontal(); } }
public void ShowWnd(EditorWindow parent, LuaReflect luaReflect, string excelPath) { this.luaReflect = luaReflect; excelEditor = new ExcelEditor(excelPath); excelEditor.LinkEditor = LinkEditor; }