Exemple #1
0
        void Present_Version()
        {
            EditorGUILayout.BeginVertical(VerticalStyle);
            if (LocalConfig.Ins.FoldVersion = EditorGUILayout.Foldout(LocalConfig.Ins.FoldVersion, "版本", true))
            {
                BuildConfig.Platform     = (Platform)EditorGUILayout.Popup("目标", (int)BuildConfig.Platform, Enum.GetNames(typeof(Platform)));
                BuildConfig.Distribution = (Distribution)EditorGUILayout.EnumPopup("发布平台", BuildConfig.Distribution);
                BuildConfig.BuildType    = (BuildType)EditorGUILayout.EnumPopup("打包版本", BuildConfig.BuildType);

                BuildConfig.Name = EditorGUILayout.TextField("名称", BuildConfig.Name);
                if (PlayerSettings.productName != BuildConfig.Name)
                {
                    PlayerSettings.productName = BuildConfig.Name;
                    RefreshAppIdentifier();
                }
                BuildConfig.CompanyName = EditorGUILayout.TextField("公司", BuildConfig.CompanyName);
                if (PlayerSettings.companyName != BuildConfig.CompanyName)
                {
                    PlayerSettings.companyName = BuildConfig.Name;
                    RefreshAppIdentifier();
                }

                BuildConfig.Major = EditorGUILayout.IntField("主版本", BuildConfig.Major);
                BuildConfig.Minor = EditorGUILayout.IntField("副版本", BuildConfig.Minor);
                BuildConfig.Data  = EditorGUILayout.IntField("存档标", BuildConfig.Data);
                BuildConfig.Prefs = EditorGUILayout.IntField("Prefs", BuildConfig.Prefs);

                EditorGUILayout.BeginHorizontal();
                BuildConfig.Tag    = (VersionTag)EditorGUILayout.EnumPopup("后缀", BuildConfig.Tag);
                BuildConfig.Suffix = EditorGUILayout.IntField(BuildConfig.Suffix);
                EditorGUILayout.EndHorizontal();


                if (PlayerSettings.bundleVersion != BuildConfig.ToString())
                {
                    PlayerSettings.bundleVersion = BuildConfig.ToString();
                }

                if (PlayerSettings.productName != BuildConfig.Name)
                {
                    PlayerSettings.productName = BuildConfig.Name;
                }

                if (PlayerSettings.companyName != BuildConfig.CompanyName)
                {
                    PlayerSettings.companyName = BuildConfig.CompanyName;
                }

                EditorGUILayout.BeginVertical();
                OnDrawSettings();
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();

            void RefreshAppIdentifier()
            {
                PlayerSettings.applicationIdentifier = "com." + BuildConfig.CompanyName + "." + BuildConfig.Name;
            }
        }
        void Present_Main()
        {
            EditorGUILayout.BeginVertical(VerticalStyle);
            if (BuildLocalConfig.Ins.Fold_Present_Main = EditorGUILayout.Foldout(BuildLocalConfig.Ins.Fold_Present_Main, "构建", true))
            {
                BuildConfig.Platform     = (Platform)EditorGUILayout.Popup("目标", (int)BuildConfig.Platform, Enum.GetNames(typeof(Platform)));
                BuildConfig.Distribution = (Distribution)EditorGUILayout.EnumPopup("发布平台", BuildConfig.Distribution);
                EditorGUILayout.LabelField(string.Format("版本号预览:{0}", BuildConfig));
                EditorGUILayout.LabelField(string.Format("完整版本号预览:{0}", BuildConfig.FullVersionName));
                BuildConfig.Name     = EditorGUILayout.TextField("名称", BuildConfig.Name);
                BuildConfig.SubTitle = EditorGUILayout.TextField("副标题", BuildConfig.SubTitle);
                BuildConfig.Major    = EditorGUILayout.IntField("主版本", BuildConfig.Major);
                BuildConfig.Minor    = EditorGUILayout.IntField("副版本", BuildConfig.Minor);
                BuildConfig.Data     = EditorGUILayout.IntField("数据库版本", BuildConfig.Data);
                BuildConfig.Prefs    = EditorGUILayout.IntField("Prefs", BuildConfig.Prefs);

                EditorGUILayout.BeginHorizontal();
                BuildConfig.Tag    = (VersionTag)EditorGUILayout.EnumPopup("后缀", BuildConfig.Tag);
                BuildConfig.Suffix = EditorGUILayout.IntField(BuildConfig.Suffix);
                EditorGUILayout.EndHorizontal();

                BuildConfig.BuildType = (BuildType)EditorGUILayout.EnumPopup("打包版本", BuildConfig.BuildType);

                BuildConfig.IgnoreChecker = EditorGUILayout.Toggle("忽略检查", BuildConfig.IgnoreChecker);
                bool preDevelopmentBuild = BuildConfig.IsUnityDevelopmentBuild;
                BuildConfig.IsUnityDevelopmentBuild = EditorGUILayout.Toggle("UnityDevBuild", BuildConfig.IsUnityDevelopmentBuild);
                if (preDevelopmentBuild != BuildConfig.IsUnityDevelopmentBuild)
                {
                    EditorUserBuildSettings.development = BuildConfig.IsUnityDevelopmentBuild;
                }

                if (PlayerSettings.bundleVersion != BuildConfig.ToString())
                {
                    PlayerSettings.bundleVersion = BuildConfig.ToString();
                }


                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("构建Manifest"))
                {
                    Builder.BuildManifest(Native);
                }
                if (GUILayout.Button("构建AB"))
                {
                    Builder.BuildBundle(Native);
                }
                if (GUILayout.Button("构建EXE"))
                {
                    if (CheckEorr())
                    {
                        return;
                    }
                    if (!CheckDevBuildWarring())
                    {
                        return;
                    }
                    if (!CheckAuthority())
                    {
                        return;
                    }
                    Builder.BuildEXE();
                }
                if (GUILayout.Button("构建AB&EXE"))
                {
                    if (CheckEorr())
                    {
                        return;
                    }
                    if (!CheckDevBuildWarring())
                    {
                        return;
                    }
                    if (!CheckAuthority())
                    {
                        return;
                    }
                    Builder.BuildBundleAndEXE(Native);
                }
                EditorGUILayout.EndHorizontal();


                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("运行游戏"))
                {
                    BaseFileUtils.OpenFile(BuildConfig.ExePath);
                    CLog.Info("Run:{0}", BuildConfig.ExePath);
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
        }