Exemplo n.º 1
0
        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); };
                }
            }
        }
Exemplo n.º 2
0
        protected void LinkEditor(ExcelColHeader excelColHeader, DataRowCollection rows, int rowIndex, int colIndex, bool showAll)
        {
            if (childWnd)
            {
                childWnd.Close();
            }
            string vid = rows?[rowIndex][colIndex].ToString();

            if (showAll)
            {
                childWnd = SelectWnd.Create("Select " + excelColHeader.linkEditorLuaKey, this, luaReflect, excelColHeader.linkEditorUrl);
                ((SelectWnd)childWnd).SetSelectDelegate(delegate(string id)
                {
                    OnSelect(id, rowIndex, colIndex);
                });
            }
            else
            {
                childWnd = ListEditorWnd.Create(excelColHeader.linkEditorLuaKey, this, luaReflect, excelColHeader, vid);
            }
        }