Esempio n. 1
0
        void OnGUI()
        {
            gitServerEditor.Init();


            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

            GUILayout.Space(20);
            gitServerEditor.OnGUI();
            GUILayout.Space(30);

            // center
            foldout_center = EditorGUILayout.Foldout(foldout_center, "发行商选择");
            if (foldout_center)
            {
                GUILayout.BeginVertical(HGUILayout.boxMPStyle, GUILayout.Height(50));
                for (int i = 0; i < centerList.Count; i++)
                {
                    CenterSwitcher.CenterItem item = centerList[i];
                    item.gitToggle = EditorGUILayout.ToggleLeft(item.name, item.gitToggle, GUILayout.Width(250));
                }

                GUILayout.Space(20);

                HGUILayout.BeginCenterHorizontal();
                if (GUILayout.Button("全选", GUILayout.MinHeight(30), GUILayout.MaxWidth(200)))
                {
                    for (int i = 0; i < centerList.Count; i++)
                    {
                        CenterSwitcher.CenterItem item = centerList[i];
                        item.gitToggle = true;
                    }
                }


                GUILayout.Space(20);

                if (GUILayout.Button("全不选", GUILayout.MinHeight(30), GUILayout.MaxWidth(200)))
                {
                    for (int i = 0; i < CenterSwitcher.centerItemList.Length; i++)
                    {
                        CenterSwitcher.CenterItem item = CenterSwitcher.centerItemList[i];
                        item.gitToggle = false;
                    }
                }

                HGUILayout.EndCenterHorizontal();

                GUILayout.EndVertical();
            }

            GUILayout.Space(30);



            // global
            foldout_global = EditorGUILayout.Foldout(foldout_global, "全局");
            if (foldout_global)
            {
                if (GUILayout.Button("刷新", GUILayout.MinHeight(25)))
                {
                    _versionInfo = null;
                }
                GUILayout.Space(30);


                GUILayout.BeginVertical(HGUILayout.boxMPStyle, GUILayout.ExpandWidth(true));
                versionInfo.version = EditorGUILayout.TextField("版本号: ", versionInfo.version, GUILayout.ExpandWidth(true));
                if (GUILayout.Button("修改选择的应用商", GUILayout.MinHeight(25), GUILayout.MaxWidth(200)))
                {
                    for (int i = 0; i < CenterSwitcher.centerItemList.Length; i++)
                    {
                        CenterSwitcher.CenterItem item = CenterSwitcher.centerItemList[i];
                        if (item.gitToggle)
                        {
                            VersionInfo itemVerInfo = VersionInfo.Load(gitServerEditor.GetGitVerinfoPath(item.name, true));
                            itemVerInfo.version = versionInfo.version;
                            itemVerInfo.Save(gitServerEditor.GetGitVerinfoPath(item.name, true));
                        }
                    }
                }
                GUILayout.Space(30);

                EditorGUILayout.LabelField("大版本更新通知:");
                versionInfo.noteDownApp = EditorGUILayout.TextArea(versionInfo.noteDownApp, GUILayout.ExpandWidth(true), GUILayout.Height(60));
                if (GUILayout.Button("修改选择的应用商", GUILayout.MinHeight(25), GUILayout.MaxWidth(200)))
                {
                    for (int i = 0; i < CenterSwitcher.centerItemList.Length; i++)
                    {
                        CenterSwitcher.CenterItem item = CenterSwitcher.centerItemList[i];
                        if (item.gitToggle)
                        {
                            VersionInfo itemVerInfo = VersionInfo.Load(gitServerEditor.GetGitVerinfoPath(item.name, true));
                            itemVerInfo.noteDownApp = versionInfo.noteDownApp;
                            itemVerInfo.Save(gitServerEditor.GetGitVerinfoPath(item.name, true));
                        }
                    }
                }

                GUILayout.Space(30);
                EditorGUILayout.LabelField("热更新通知:");
                versionInfo.noteHostUpdate = EditorGUILayout.TextArea(versionInfo.noteHostUpdate, GUILayout.ExpandWidth(true), GUILayout.Height(60));
                if (GUILayout.Button("修改选择的应用商", GUILayout.MinHeight(25), GUILayout.MaxWidth(200)))
                {
                    for (int i = 0; i < CenterSwitcher.centerItemList.Length; i++)
                    {
                        CenterSwitcher.CenterItem item = CenterSwitcher.centerItemList[i];
                        if (item.gitToggle)
                        {
                            VersionInfo itemVerInfo = VersionInfo.Load(gitServerEditor.GetGitVerinfoPath(item.name, true));
                            itemVerInfo.noteHostUpdate = versionInfo.noteHostUpdate;
                            itemVerInfo.Save(gitServerEditor.GetGitVerinfoPath(item.name, true));
                        }
                    }
                }



                GUILayout.Space(30);
                versionInfo.isClose = EditorGUILayout.ToggleLeft("是否停服", versionInfo.isClose == 1) ? 1 : 0;
                if (GUILayout.Button("修改选择的应用商", GUILayout.MinHeight(25), GUILayout.MaxWidth(200)))
                {
                    for (int i = 0; i < CenterSwitcher.centerItemList.Length; i++)
                    {
                        CenterSwitcher.CenterItem item = CenterSwitcher.centerItemList[i];
                        if (item.gitToggle)
                        {
                            VersionInfo itemVerInfo = VersionInfo.Load(gitServerEditor.GetGitVerinfoPath(item.name, true));
                            itemVerInfo.isClose = versionInfo.isClose;
                            itemVerInfo.Save(gitServerEditor.GetGitVerinfoPath(item.name, true));
                        }
                    }
                }
                GUILayout.EndVertical();
            }


            // center list
            foldout_centerList = EditorGUILayout.Foldout(foldout_centerList, "版本信息列表");
            if (foldout_centerList)
            {
                if (GUILayout.Button("刷新所有", GUILayout.MinHeight(25)))
                {
                    for (int i = 0; i < CenterSwitcher.centerItemList.Length; i++)
                    {
                        CenterSwitcher.CenterItem item = CenterSwitcher.centerItemList[i];
                        item.versionInfo = null;
                    }
                }
                GUILayout.Space(20);


                for (int i = 0; i < CenterSwitcher.centerItemList.Length; i++)
                {
                    GUILayout.Space(20);
                    CenterSwitcher.CenterItem item = CenterSwitcher.centerItemList[i];
                    GUILayout.BeginVertical(HGUILayout.boxMPStyle, GUILayout.ExpandWidth(true));

                    EditorGUILayout.LabelField(item.name + "  ( " + gitServerEditor.GetGitVerinfoPath(item.name, true).Replace(gitServerEditor.gitVerinfoRoot, "") + " )");


                    GUILayout.Space(20);

                    if (item.versionInfo == null)
                    {
                        item.versionInfo = VersionInfo.Load(gitServerEditor.GetGitVerinfoPath(item.name, true));
                    }


                    item.versionInfo.version = EditorGUILayout.TextField("版本号: ", item.versionInfo.version, GUILayout.ExpandWidth(true));
                    GUILayout.Space(10);

                    EditorGUILayout.LabelField("大版本更新通知:");
                    item.versionInfo.noteDownApp = EditorGUILayout.TextArea(item.versionInfo.noteDownApp, GUILayout.ExpandWidth(true), GUILayout.Height(60));
                    GUILayout.Space(10);

                    EditorGUILayout.LabelField("热更新通知:");
                    item.versionInfo.noteHostUpdate = EditorGUILayout.TextArea(item.versionInfo.noteHostUpdate, GUILayout.ExpandWidth(true), GUILayout.Height(60));
                    GUILayout.Space(10);

                    item.versionInfo.isClose = EditorGUILayout.ToggleLeft("是否停服", item.versionInfo.isClose == 1) ? 1 : 0;
                    GUILayout.Space(10);

                    HGUILayout.BeginCenterHorizontal();

                    if (GUILayout.Button("保存", GUILayout.MinHeight(25), GUILayout.MaxWidth(200)))
                    {
                        item.versionInfo.Save(gitServerEditor.GetGitVerinfoPath(item.name, true));
                    }

                    if (GUILayout.Button("刷新", GUILayout.MinHeight(25), GUILayout.MaxWidth(200)))
                    {
                        item.versionInfo = null;
                    }
                    HGUILayout.EndCenterHorizontal();

                    GUILayout.EndVertical();
                    GUILayout.Space(20);
                }
            }


            // git
            foldout_git = EditorGUILayout.Foldout(foldout_git, "git");
            if (foldout_git)
            {
                GUILayout.BeginVertical(HGUILayout.boxMPStyle, GUILayout.ExpandWidth(true));

                HGUILayout.BeginCenterHorizontal();
                if (GUILayout.Button("CopyFromTest", GUILayout.MinHeight(50), GUILayout.MaxWidth(200)))
                {
                    Step_Verinfo_CopyFromTest();
                }
                HGUILayout.EndCenterHorizontal();
                GUILayout.Space(10);

                HGUILayout.BeginCenterHorizontal();
                if (GUILayout.Button("推送", GUILayout.MinHeight(50), GUILayout.MaxWidth(200)))
                {
                    Step_Begin();


//                    if (stepIsContinue)
//                        Step_CheckBranch();

                    if (stepIsContinue)
                    {
                        Step_CommitBranch();
                    }

                    if (stepIsContinue)
                    {
                        Step_PushBranchAndTag();
                    }
                }
                HGUILayout.EndCenterHorizontal();



                GUILayout.EndVertical();
                GUILayout.Space(30);
            }



            EditorGUILayout.EndScrollView();
        }