예제 #1
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);
    }
예제 #2
0
    static string BeforeBuild()
    {
        GameConstConfig config = new GameConstConfig();

        config.DevelopMode = false;
        GameConstJsonGenerator.GenerateByGameConsConfig(config);

        LuaBinding.Binding();

        string exportPath = "";

        foreach (var arg in System.Environment.GetCommandLineArgs())
        {
            if (arg.StartsWith("path="))
            {
                exportPath = arg.Split("="[0])[1];
                break;
            }
        }
        if (exportPath == "")
        {
            Debug.LogError("<color=red>Build Error : export path is null</color>");
            return("");
        }
        return(exportPath);
    }
        /** 开发 */
        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();
        }
        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;
                    }
                }
            }
        }
예제 #5
0
        /** 读取配置  */
        IEnumerator ReadConst(bool final)
        {
            string url = "";

            string file = PathUtil.DataPath + GameConst.GameConstFileName;

//			if(Application.isEditor)
//			{
//				file = Application.dataPath + "/../res/" + GameConst.GameConstFileName;
//			}

            Debug.Log("File.Exists(" + file + ")=" + File.Exists(file));
            if (File.Exists(file))
            {
                url = PathUtil.DataUrl + GameConst.GameConstFileName;
            }
            else
            {
                url = PathUtil.AppDataUrl + GameConst.GameConstFileName;
            }

            WWW www = new WWW(url);

            yield return(www);

            if (string.IsNullOrEmpty(www.error))
            {
                Debug.Log(url);
                Debug.Log(www.text);
                GameConstConfig obj = JsonConvert.DeserializeObject(www.text, typeof(GameConstConfig)) as GameConstConfig;
                obj.Set();
            }
            else
            {
                Debug.Log(string.Format("<color=red>[EnterPanel.ReadConst] 读取game_const.json失败 url={0} error={1}  text={2}</color>", url, www.error, www.text));
            }

            www.Dispose();
            www = null;

            if (final)
            {
                VersionFinal();
            }
            else
            {
                CheckConst();
            }
        }
예제 #6
0
    void OnFocus()
    {
        var f   = new FileInfo("Assets/StreamingAssets/" + GameConst.GameConstFileName);
        var sr  = f.OpenText();
        var str = sr.ReadToEnd();

        sr.Close();

        _constConfig = JsonConvert.DeserializeObject(str, typeof(GameConstConfig)) as GameConstConfig;

        foreach (CenterItem item in _centerItemList)
        {
            if (item.name == _constConfig.CenterName)
            {
                _centerIndex = item.typeID;
                break;
            }
        }
    }
        public static void GenerateByGameConsConfig(GameConstConfig config)
        {
            string str = JsonConvert.SerializeObject(config, Formatting.Indented);

            string filesPath = Application.streamingAssetsPath + "/" + GameConst.GameConstFileName;

            PathUtil.CheckPath(filesPath, true);
            if (File.Exists(filesPath))
            {
                File.Delete(filesPath);
            }

            FileStream   fs = new FileStream(filesPath, FileMode.CreateNew);
            StreamWriter sw = new StreamWriter(fs);

            sw.Write(str);
            sw.Close(); fs.Close();
            AssetDatabase.Refresh();
            Debug.Log("[GameConstJsonGenerator]" + filesPath);
        }
예제 #8
0
        IEnumerator ReadGameConst_Persistent()
        {
            OnState("读取persistent game_const.json");
            string url = AssetManagerSetting.GameConstUrl_Persistent;
            WWW    www = new WWW(url);

            yield return(www);

            if (string.IsNullOrEmpty(www.error))
            {
                Debug.Log(url);
                Debug.Log(www.text);

                curGameConstConfig = JsonUtility.FromJson <GameConstConfig>(www.text);
            }
            else
            {
                Debug.LogFormat("读取game_const.json失败 ReadGameConst_Persistent url={0} error={1}", url, www.error);
            }

            www.Dispose();
            www = null;
        }
        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();
            }
        }
예제 #10
0
        /** 读取streaming下只读配置  */
        IEnumerator ReadGameConst_Streaming()
        {
            OnState("读取streaming game_const.json");
            string url = AssetManagerSetting.GameConstUrl_Streaming;
            WWW    www = new WWW(url);

            yield return(www);

            if (string.IsNullOrEmpty(www.error))
            {
                Debug.Log(url);
                Debug.Log(www.text);

                appGameConstConfig = JsonUtility.FromJson <GameConstConfig>(www.text);
            }
            else
            {
                OnError("读取Streaming下game_const.json失败");
                Debug.LogErrorFormat("读取game_const.json失败 ReadGameConst_Streaming url={0} error={1}", url, www.error);
            }

            www.Dispose();
            www = null;
        }
예제 #11
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();
        }
        public static void Generator()
        {
            GameConstConfig obj = new GameConstConfig();

            GenerateByGameConsConfig(obj);
        }
        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();
        }