/** 开发 */
        void OnGUI_Develop()
        {
            HGUILayout.BeginCenterHorizontal();
            if (GUILayout.Button("生成版本信息", GUILayout.MinHeight(50), GUILayout.MaxWidth(200)))
            {
                if (currentDvancedSettingData.GetValue(DvancedSettingType.GameConstConfig))
                {
                    GameConstConfig config = GameConstConfig.Load();
                    config.DevelopMode     = true;
                    config.TestVersionMode = false;
                    config.Save();
                }


                if (currentDvancedSettingData.GetValue(DvancedSettingType.Clear_AssetBundleName))
                {
                    AssetBundleEditor.ClearAssetBundleNames();
                    AssetDatabase.RemoveUnusedAssetBundleNames();
                }


                if (currentDvancedSettingData.GetValue(DvancedSettingType.Set_AssetBundleName))
                {
                    AssetBundleEditor.SetNames_Develop();
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorLoadAssetListCsv))
                {
                    LoadAssetListCsv.Generator();
                }
            }
            HGUILayout.EndCenterHorizontal();
        }
Exemplo n.º 2
0
    public void Load()
    {
        config = GameConstConfig.Load(AssetManagerSetting.GameConstPath);

        Type type = typeof(GameConstConfig);


        FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public);
        for (int i = 0; i < fields.Length; i++)
        {
            FieldInfo fieldInfo = fields[i];

            DebugGameConstConfigItem item;
            if (i < items.Count)
            {
                item = items[i];
            }
            else
            {
                GameObject go = GameObject.Instantiate(prefabItem.gameObject);
                item = go.GetComponent <DebugGameConstConfigItem>();
                item.transform.SetParent(content, false);
                items.Add(item);
                item.gameObject.SetActive(true);
            }

            item.fieldInfo = fieldInfo;
            item.SetObject(fieldInfo.Name, fieldInfo.GetValue(config));
            RectTransform rectTransform = (RectTransform)item.transform;
            rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x, -itemHeight * i);
        }

        content.sizeDelta = new Vector2(content.sizeDelta.x, itemHeight * fields.Length);
    }
        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;
                    }
                }
            }
        }
        void OnGUI_TestVersionModel()
        {
            testVersionModel_foldout = EditorGUILayout.Foldout(testVersionModel_foldout, "测试模拟版本模式");

            if (testVersionModel_foldout)
            {
                if (GameConstConfig.last == null)
                {
                    GameConstConfig.Load();
                }


                GUILayout.BeginVertical(HGUILayout.boxMPStyle, GUILayout.Height(50));
                testVersionModel_value = GameConstConfig.last.TestVersionMode;
                GameConstConfig.last.TestVersionMode = EditorGUILayout.ToggleLeft("测试模拟版本模式", GameConstConfig.last.TestVersionMode);
                if (testVersionModel_value != GameConstConfig.last.TestVersionMode)
                {
                    testVersionModel_value = GameConstConfig.last.TestVersionMode;
                    if (testVersionModel_value)
                    {
                        GameConstConfig.last.DevelopMode = false;
                    }

                    GameConstConfig.last.Save();
                }


                testVersionModel_webIsDevelop = EditorGUILayout.ToggleLeft("WebUrl Is Develop", GameConst.WebUrlIsDevelop);
                if (testVersionModel_webIsDevelop != GameConst.WebUrlIsDevelop)
                {
                    GameConst.WebUrlIsDevelop = testVersionModel_webIsDevelop;
                }

                GUILayout.EndVertical();
            }
        }
Exemplo n.º 5
0
        /** 补丁 */
        void OnGUI_Patch()
        {
            Version version = patchVersion;

            if (version.revised <= 0)
            {
                version.revised = 1;
            }

            GUILayout.BeginHorizontal(HGUILayout.boxMPStyle, GUILayout.Height(50));
            EditorGUILayout.LabelField("参照App版本", HGUILayout.labelCenterStyle, GUILayout.Width(150), GUILayout.Height(25));
            int preCompareIndex = compareIndex;

            compareIndex = EditorGUILayout.Popup(compareIndex, VersionList.appVersionStrArr);
            if (preCompareIndex != compareIndex && compareIndex != -1)
            {
                Version v = VersionList.appVersionList[compareIndex];

                compareVersion.Copy(v);
                version.Copy(VersionList.GetLastAppRevised(compareVersion));
                version.verType = VersionType.Patch;
                version.revised++;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            HGUILayout.Version("补丁版本", version, VersionType.Patch);
            GUILayout.BeginVertical();

            if (GUILayout.Button("最后一次", GUILayout.Width(100), GUILayout.Height(30)))
            {
                VersionList.Read(true);

                compareVersion.Copy(VersionList.lastAppVersion);

                version.Copy(VersionList.GetLastAppRevised(compareVersion));
                version.verType = VersionType.Patch;
                compareIndex    = VersionList.appVersionStrList.IndexOf(compareVersion.ToString());
            }

            if (GUILayout.Button("自动", GUILayout.Width(100), GUILayout.Height(30)))
            {
                VersionList.Read(true);

                compareVersion.Copy(VersionList.lastAppVersion);
                version.Copy(VersionList.GetLastAppRevised(compareVersion));
                version.verType = VersionType.Patch;
                version.revised++;
                compareIndex = VersionList.appVersionStrList.IndexOf(compareVersion.ToString());
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            GUILayout.Space(20);


            HGUILayout.BeginCenterHorizontal();
            if (GUILayout.Button("生成版本信息", GUILayout.MinHeight(50), GUILayout.MaxWidth(200)))
            {
                version.SetNowDatetime();

                bool isRefresh = false;
                if (currentDvancedSettingData.GetValue(DvancedSettingType.ClearAllPlatformDirctory))
                {
                    PathUtil.ClearAllPlatformDirctory();
                    isRefresh = true;
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.ClearOtherPlatformDirctory))
                {
                    PathUtil.ClearOtherPlatformDirctory(runtimePlatform);
                    isRefresh = true;
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.ClearTestData))
                {
                    PathUtil.ClearTestData();
                    isRefresh = true;
                }

                if (isRefresh)
                {
                    AssetDatabase.Refresh();
                }


                if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_luacode))
                {
                    AB.Lua();
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_config))
                {
                    AB.Config();
                }


                if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_luacode))
                {
                    AB.Lua();
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_config))
                {
                    AB.Config();
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.Clear_AssetBundleName))
                {
                    AssetBundleEditor.ClearAssetBundleNames();
                    AssetDatabase.RemoveUnusedAssetBundleNames();
                }


                if (currentDvancedSettingData.GetValue(DvancedSettingType.Set_AssetBundleName))
                {
                    AssetBundleEditor.SetNames();
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_AssetBundle))
                {
                    AssetBundleEditor.BuildAssetBundles();
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.GameConstConfig))
                {
                    GameConstConfig config = GameConstConfig.Load();
                    config.DevelopMode = false;
                    config.Version     = version.ToConfig();
                    config.Save();
                }



                if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorStreamingAssetsFilesCSV))
                {
                    FilesCsvForStreamingAssets.Generator();
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorResourcesFilesCSV))
                {
                    FilesCsvForResources.Generator();
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.PlayerSettings))
                {
                    SetPlayerSettings(runtimePlatform);
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.PlayerSettingsVersion))
                {
                    SetPlayerSettingsVersion(appVersion);
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.GenerateVersionInfo))
                {
                    FilesCsvForStreamingAssets.CopyStreamFilesCsvToVersion(version);
                }


                if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorUpdateAssetList))
                {
                    FilesCsvForStreamingAssets.GeneratorUpdateList(compareVersion);
                }
            }
            HGUILayout.EndCenterHorizontal();
        }
        /** App */
        void OnGUI_App()
        {
            Version version = appVersion;


            GUILayout.BeginHorizontal();
            HGUILayout.Version("App版本", version, VersionType.App);
            GUILayout.BeginVertical();
            if (GUILayout.Button("最后一次", GUILayout.Width(100), GUILayout.Height(30)))
            {
                VersionList.Read(true);

                version.Copy(VersionList.lastAppVersion);
                version.revised = 0;
                version.verType = VersionType.App;
            }

            if (GUILayout.Button("自动", GUILayout.Width(100), GUILayout.Height(30)))
            {
                VersionList.Read(true);

                version.Copy(VersionList.lastAppVersion);
                version.minor++;
                version.revised = 0;
                version.verType = VersionType.App;
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            GUILayout.Space(20);


            HGUILayout.BeginCenterHorizontal();
            if (GUILayout.Button("生成版本信息", GUILayout.MinHeight(50), GUILayout.MaxWidth(200)))
            {
                version.SetNowDatetime();


                bool isRefresh = false;
                if (currentDvancedSettingData.GetValue(DvancedSettingType.ClearAllPlatformDirctory))
                {
                    PathUtil.ClearAllPlatformDirctory();
                    isRefresh = true;
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.ClearOtherPlatformDirctory))
                {
                    PathUtil.ClearOtherPlatformDirctory(runtimePlatform);
                    isRefresh = true;
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.ClearTestData))
                {
                    PathUtil.ClearTestData();
                    isRefresh = true;
                }

                if (isRefresh)
                {
                    AssetDatabase.Refresh();
                }


                if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_luacode))
                {
                    AB.Lua();
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_config))
                {
                    AB.Config();
                }


                if (currentDvancedSettingData.GetValue(DvancedSettingType.Clear_AssetBundleName))
                {
                    AssetBundleEditor.ClearAssetBundleNames();
                    AssetDatabase.RemoveUnusedAssetBundleNames();
                }


                if (currentDvancedSettingData.GetValue(DvancedSettingType.Set_AssetBundleName))
                {
                    AssetBundleEditor.SetNames();
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.AB_AssetBundle))
                {
                    AssetBundleEditor.BuildAssetBundles();
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.GameConstConfig))
                {
                    GameConstConfig config = GameConstConfig.Load();
                    config.DevelopMode = false;
                    config.Version     = version.ToConfig();
                    config.Save();
                }



                if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorStreamingAssetsFilesCSV))
                {
                    FilesCsvForStreamingAssets.Generator();
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorResourcesFilesCSV))
                {
                    FilesCsvForResources.Generator();
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.PlayerSettings))
                {
                    SetPlayerSettings(runtimePlatform);
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.PlayerSettingsVersion))
                {
                    SetPlayerSettingsVersion(appVersion);
                }

                if (currentDvancedSettingData.GetValue(DvancedSettingType.GenerateVersionInfo))
                {
                    FilesCsvForStreamingAssets.CopyStreamFilesCsvToVersion(version);
                }


                if (currentDvancedSettingData.GetValue(DvancedSettingType.GeneratorUpdateAssetList))
                {
                    FilesCsvForStreamingAssets.GeneratorUpdateList(null);
                }
            }
            HGUILayout.EndCenterHorizontal();
        }
        void OnGUI()
        {
            VersionList.Read();



            TabType tabType = HGUILayout.TabGroup <TabType>(tabGroupData);

            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
            GUILayout.Space(20);


            currentDvancedSettingData = dvancedSettingDataDict[tabType];
            switch (tabType)
            {
            case TabType.Develop:
                OnGUI_Develop();
                break;

            case TabType.App:
                OnGUI_App();
                break;

            case TabType.Patch:
                OnGUI_Patch();
                break;
            }



            currentDvancedSettingData.foldout = EditorGUILayout.Foldout(currentDvancedSettingData.foldout, "高级设置");

            if (currentDvancedSettingData.foldout)
            {
                GUILayout.BeginVertical(HGUILayout.boxMPStyle);
                for (int i = 0; i < currentDvancedSettingData.list.Count; i++)
                {
                    DvancedSettingItem item = currentDvancedSettingData.list[i];



                    GUILayout.BeginHorizontal();
                    item.value = EditorGUILayout.ToggleLeft(item.name, item.value, GUILayout.Width(250));



                    if (GUILayout.Button(item.name, GUILayout.Width(250)))
                    {
                        switch (item.type)
                        {
                        case DvancedSettingType.ClearAllPlatformDirctory:
                            PathUtil.ClearAllPlatformDirctory();
                            AssetDatabase.Refresh();
                            break;


                        case DvancedSettingType.ClearOtherPlatformDirctory:
                            PathUtil.ClearOtherPlatformDirctory(runtimePlatform);
                            AssetDatabase.Refresh();
                            break;


                        case DvancedSettingType.ClearTestData:
                            PathUtil.ClearTestData();
                            AssetDatabase.Refresh();
                            break;


                        case DvancedSettingType.AB_luacode:
                            AB.Lua();
                            break;

                        case DvancedSettingType.AB_config:
                            AB.Config();
                            break;



                        case DvancedSettingType.Clear_AssetBundleName:
                            AssetBundleEditor.ClearAssetBundleNames();
                            AssetDatabase.RemoveUnusedAssetBundleNames();
                            break;

                        case DvancedSettingType.Set_AssetBundleName:
                            AssetBundleEditor.SetNames();
                            break;



                        case DvancedSettingType.GameConstConfig:

                            GameConstConfig config = GameConstConfig.Load();
                            switch (tabType)
                            {
                            case TabType.Develop:
                                config.DevelopMode     = true;
                                config.TestVersionMode = false;
                                break;

                            case TabType.App:
                                config.DevelopMode = false;
                                config.Version     = appVersion.ToConfig();
                                break;

                            case TabType.Patch:
                                config.DevelopMode = false;
                                config.Version     = patchVersion.ToConfig();
                                break;
                            }

                            config.Save();
                            break;


                        case DvancedSettingType.GeneratorStreamingAssetsFilesCSV:
                            switch (tabType)
                            {
                            case TabType.App:
                            case TabType.Patch:
                                FilesCsvForStreamingAssets.Generator();
                                break;

                            case TabType.Develop:
                                FilesCsvForStreamingAssets.Generator(true);
                                break;
                            }
                            break;


                        case DvancedSettingType.GeneratorResourcesFilesCSV:
                            FilesCsvForResources.Generator();
                            break;


                        case DvancedSettingType.PlayerSettings:
                            SetPlayerSettings(runtimePlatform);
                            break;

                        case DvancedSettingType.PlayerSettingsVersion:
                            switch (tabType)
                            {
                            case TabType.App:
                                SetPlayerSettingsVersion(appVersion);
                                break;

                            case TabType.Patch:
                                SetPlayerSettingsVersion(patchVersion);
                                break;
                            }
                            break;


                        case DvancedSettingType.GenerateVersionInfo:
                            switch (tabType)
                            {
                            case TabType.App:
                                appVersion.SetNowDatetime();
                                FilesCsvForStreamingAssets.CopyStreamFilesCsvToVersion(appVersion);
                                break;

                            case TabType.Patch:
                                patchVersion.SetNowDatetime();
                                FilesCsvForStreamingAssets.CopyStreamFilesCsvToVersion(patchVersion);
                                break;
                            }
                            break;

                        case DvancedSettingType.GeneratorUpdateAssetList:
                            switch (tabType)
                            {
                            case TabType.App:
                                FilesCsvForStreamingAssets.GeneratorUpdateList(null);
                                break;

                            case TabType.Patch:
                                FilesCsvForStreamingAssets.GeneratorUpdateList(compareVersion);
                                break;
                            }
                            break;
                        }
                    }

                    GUILayout.EndHorizontal();

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



            switch (tabType)
            {
            case TabType.App:
            case TabType.Patch:
                OnGUI_AssetBundleServer();
                OnGUI_TestVersionModel();
                break;
            }

            EditorGUILayout.EndScrollView();
        }