void Step_AddTag()
        {
            GameConstConfig gameConstConfig = GameConstConfig.Load(gitServerEditor.gitGameConstPath);

            for (int i = 0; i < centerList.Count; i++)
            {
                CenterSwitcher.CenterItem item = centerList[i];

                if (item.gitToggle)
                {
                    item.gitTagUse = alreadyExistTagPlan == AlreadyExistTagPlan.Suffix ? item.gitTagLast : item.gitTag;



                    gameConstConfig.CenterName = item.name;
                    gameConstConfig.Save(gitServerEditor.gitGameConstPath);

                    string      verinfoPath = gitServerEditor.GetGitVerinfoPath(item.name, true);
                    VersionInfo versionInfo = VersionInfo.Load(verinfoPath);
                    versionInfo.version       = gameConstConfig.Version;
                    versionInfo.updateLoadUrl = gitServerEditor.GetGitHostUpdateUrlRoot(item.gitTagUse);
                    versionInfo.Save(verinfoPath);


                    tmp.Clear();
                    tmp.WriteLine("cd " + gitRoot);

                    if (item.gitTagMaxIndex > 0)
                    {
                        switch (alreadyExistTagPlan)
                        {
                        case AlreadyExistTagPlan.Replace:
                            tmp.WriteLine(string.Format("git tag -d {1} 2>&1 | tee -a {0}", Shell.txt_vertmp, item.gitTag));
                            break;
                        }
                    }

                    tmp.WriteLine(string.Format("git add . 2>&1 | tee -a {0}", Shell.txt_vertmp));
                    tmp.WriteLine(string.Format("git commit -am \" 修改GameConstConfig.centerName= {1}\" 2>&1 | tee -a {0}", Shell.txt_vertmp, item.name));

                    string cmd = string.Format("git tag -a {1} -m \"add tag {1}\"  2>&1 | tee -a {0}", Shell.txt_vertmp, item.gitTagUse);
                    tmp.WriteLine(cmd);


                    tmp.Save();
                    Shell.RunTmp(Shell.sh_tmp);

                    string txt = File.ReadAllText(Shell.txt_vertmp);
                    if (txt.IndexOf("error:") != -1 || txt.IndexOf("fatal:") != -1)
                    {
                        EditorUtility.DisplayDialog(cmd, "错误: 建议先用git工具处理好再执行!\n" + txt, "终止执行");

                        stepIsContinue = false;
                        return;
                    }
                }
            }
        }
        public static void WriteServerURL()
        {
            string      downloadURL;
            IPHostEntry host;
            string      localIP = "";

            host = Dns.GetHostEntry(Dns.GetHostName());
            foreach (IPAddress ip in host.AddressList)
            {
                if (ip.AddressFamily == AddressFamily.InterNetwork)
                {
                    localIP = ip.ToString();
                    break;
                }
            }
            downloadURL = "http://" + localIP + ":7888/";
            Host        = downloadURL;

            Games.GameConstConfig gameConstConfig = Games.GameConstConfig.Load();
            gameConstConfig.WebUrl_Develop = downloadURL;
            gameConstConfig.Save();

            VersionInfo versionInfo = VersionInfo.Load(ServerRootPath + "/" + AssetManagerSetting.VersionInfoName);

            versionInfo.version = gameConstConfig.Version;
            if (ServerRootPath == AssetManagerSetting.EditorAssetBundleServerRoot_StreamingAssets)
            {
                versionInfo.updateLoadUrl = downloadURL;
            }
            else
            {
                versionInfo.updateLoadUrl = downloadURL + "StreamingAssets/";
            }



            string versionPath = AssetManagerSetting.GetServerVersionInfoURL(ServerRootPath, gameConstConfig.CenterName);

            versionInfo.Save(versionPath);
        }
Exemplo n.º 3
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();
        }