Esempio 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); };
                }
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
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);
            }
        }