Ejemplo n.º 1
0
        public static void Draw()
        {
            GUILayout.Space(10);
            EditorGUILayout.BeginVertical();
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("<", GUILayout.Width(20)))
            {
                PlayModeTools.curProvince = -1;
                return;
            }

            EditorGUILayout.LabelField("", GUILayout.Width(400));

            EditorGUILayout.LabelField(PlayModeTools.pData.name + "玩法编辑", GUILayout.Width(400));

            EditorGUILayout.EndHorizontal();
            GUILayout.Space(10);
            HeadState state = HeadState.Nomal;

            scroll = GUILayout.BeginScrollView(scroll);
            for (int i = 0; i < PlayModeTools.pData.configs.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.BeginVertical(GUILayout.Width(490));
                if (editIndex == i)
                {
                    state = HeadState.Edit;
                }
                else
                {
                    state = HeadState.Nomal;
                }
                if (DrawItemHeader(PlayModeTools.pData.configs[i], ref state, i))
                {
                    // if(i == 0)
                    //  Debug.Log(state);
                    switch (state)
                    {
                    case HeadState.Nomal:
                        editIndex    = i;
                        locationName = string.Empty;
                        break;

                    default:
                        editIndex = i;
                        if (i < PlayModeTools.pData.configs.Count)
                        {
                            DrawItem(PlayModeTools.pData.configs[i]);
                        }
                        break;
                    }
                }
                EditorGUILayout.EndVertical();
                EditorGUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();
            GUILayout.Space(5);
            EditorGUILayout.BeginHorizontal();
            //createLocationName = EditorGUILayout.TextField(createLocationName,GUILayout.Width(200));
            if (GUILayout.Button("+", "OL Titlemid", GUILayout.Width(PlayModeEditorWindow.window.maxSize.x)))
            {
                PlayModeConfig config = new PlayModeConfig();
                config.key   = PlayModeTools.pData.GetConfigNextId();
                config.value = "新增的地区";
                PlayModeTools.pData.configs.Add(config);
            }

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal("TextArea", GUILayout.MinHeight(100));
            EditorGUILayout.BeginVertical(GUILayout.Width(85));
            EditorGUILayout.LabelField(" ", GUILayout.Width(85));
            EditorGUILayout.EndVertical();
            EditorGUILayout.BeginVertical(GUILayout.Width(100));
            EditorGUILayout.LabelField(" ", GUILayout.Width(5), GUILayout.Height(25));
            if (GUILayout.Button("手动保存", GUILayout.Width(100), GUILayout.Height(50)))
            {
                PlayModeTools.SortData();
                if (EditorUtility.DisplayDialog("提示", "已手动保存!", "知道了"))                                 //显示对话框
                {
                }
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.BeginVertical(GUILayout.Width(100));
            EditorGUILayout.LabelField(" ", GUILayout.Width(5), GUILayout.Height(25));
            if (GUILayout.Button("生成Lua配置", GUILayout.Width(100), GUILayout.Height(50)))
            {
                PlayModeTools.ExportLuaScript();
                if (EditorUtility.DisplayDialog("提示", "已生成全国与省份配置!", "确定"))                                 //显示对话框
                {
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(GUILayout.Width(100));
            EditorGUILayout.LabelField(" ", GUILayout.Width(5), GUILayout.Height(25));
            if (GUILayout.Button("生成本省Lua配置", GUILayout.Width(100), GUILayout.Height(50)))
            {
                PlayModeTools.ExportPlayModeLuaScript();
                if (EditorUtility.DisplayDialog("提示", "已导出本省Lua文件至" + PlayModeTools.luaPath, "确定"))                               //显示对话框
                {
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(GUILayout.Width(75));
            EditorGUILayout.LabelField(" ", GUILayout.Width(75));
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
        }
Ejemplo n.º 2
0
        public static void Draw()         //Dictionary<,string,ProvinceData> Draw()
        {
            GUILayout.Space(10);
            EditorGUILayout.BeginVertical();

            EditorGUILayout.BeginHorizontal();
            PlayModeTools.data.isLocal = EditorGUILayout.ToggleLeft("单省包", PlayModeTools.data.isLocal, GUILayout.Width(100));
            int lableWidth = 300;

            if (PlayModeTools.data.isLocal && PlayModeTools.provinceNames.Count > 0)
            {
                lableWidth = 200;
                int selectIndex = PlayModeTools.provinceNames.IndexOf(PlayModeTools.data.configs.Find(a => a.key == PlayModeTools.data.localId).name);
                int index       = selectIndex;
                selectIndex = EditorGUILayout.Popup(selectIndex, PlayModeTools.provinceNames.ToArray(), GUILayout.Width(100));
                if (index != selectIndex)
                {
                    PlayModeTools.data.localId = PlayModeTools.data.configs.Find(a => a.name == PlayModeTools.provinceNames[selectIndex]).key;
                }
            }

            EditorGUILayout.LabelField("", GUILayout.Width(lableWidth));

            EditorGUILayout.LabelField("省份编辑", GUILayout.Width(60));

            EditorGUILayout.EndHorizontal();

            scroll = GUILayout.BeginScrollView(scroll);
            {
                HeadState state = HeadState.Nomal;
                for (int i = 0; i < PlayModeTools.data.configs.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.BeginVertical(GUILayout.Width(490));
                    if (editIndex == i)
                    {
                        state = HeadState.Edit;
                    }
                    else
                    {
                        state = HeadState.Nomal;
                    }
                    if (DrawItemHeader(PlayModeTools.data.configs[i], ref state, i))
                    {
                        // if(i == 0)
                        //  Debug.Log(state);
                        switch (state)
                        {
                        case HeadState.Nomal:
                            editIndex = i;
                            break;

                        default:
                            editIndex = i;
                            if (i < PlayModeTools.data.configs.Count)
                            {
                                DrawItem(PlayModeTools.data.configs[i], i);
                            }
                            break;
                        }
                    }
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.EndHorizontal();
                }
                GUILayout.EndScrollView();
                GUILayout.Space(5);
                EditorGUILayout.BeginHorizontal();

                if (GUILayout.Button("+", "OL Titlemid", GUILayout.Width(PlayModeEditorWindow.window.maxSize.x)))
                {
                    ProvinceData config = new ProvinceData();
                    config.key       = PlayModeTools.data.GetConfigNextId();
                    config.name      = "新增的省份";
                    config.shortName = "新省";
                    config.gameName  = "NewProvince";

                    config.configs.Add(PublicConfig.instance.GetClone());
                    PlayModeTools.data.configs.Add(config);
                }

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal("TextArea", GUILayout.MinHeight(100));
                EditorGUILayout.BeginVertical(GUILayout.Width(85));
                EditorGUILayout.LabelField(" ", GUILayout.Width(85));
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical(GUILayout.Width(100));
                EditorGUILayout.LabelField(" ", GUILayout.Width(5), GUILayout.Height(25));
                if (GUILayout.Button("手动保存", GUILayout.Width(100), GUILayout.Height(50)))
                {
                    PlayModeTools.SaveData();
                    if (EditorUtility.DisplayDialog("提示", "已手动保存!", "知道了"))                                     //显示对话框
                    {
                    }
                }
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical(GUILayout.Width(100));
                EditorGUILayout.LabelField(" ", GUILayout.Width(5), GUILayout.Height(25));
                if (GUILayout.Button("生成Lua配置", GUILayout.Width(100), GUILayout.Height(50)))
                {
                    PlayModeTools.ExportLuaScript();
                    if (EditorUtility.DisplayDialog("提示", "已生成全国与省份配置!", "确定"))                                     //显示对话框
                    {
                    }
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(GUILayout.Width(100));
                EditorGUILayout.LabelField(" ", GUILayout.Width(5), GUILayout.Height(25));
                if (GUILayout.Button("生成全国Lua配置", GUILayout.Width(100), GUILayout.Height(50)))
                {
                    PlayModeTools.ExportProvinceLuaScript();
                    if (EditorUtility.DisplayDialog("提示", "已导出全国Lua文件至" + PlayModeTools.provinceLuaPath, "确定"))                                   //显示对话框
                    {
                    }
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(GUILayout.Width(75));
                EditorGUILayout.LabelField(" ", GUILayout.Width(75));
                EditorGUILayout.EndVertical();
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
        }