コード例 #1
0
ファイル: BaseBuildWindow.cs プロジェクト: mengtest/CYMCommon
        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();
        }
コード例 #2
0
ファイル: BaseBuildWindow.cs プロジェクト: mengtest/CYMCommon
        void Present_ExpressSetup()
        {
            EditorGUILayout.BeginVertical(VerticalStyle);
            if (BuildLocalConfig.Ins.Fold_Present_ExpressSetup = EditorGUILayout.Foldout(BuildLocalConfig.Ins.Fold_Present_ExpressSetup, "平台", true))
            {
                string path         = BuildConfig.CurDistributionSetupPath;
                Rect   dragAreaRect = new Rect();
                //获得一个长300的框
                dragAreaRect = EditorGUILayout.GetControlRect(/*GUILayout.Width(600)*/ true, 18);
                //将上面的框作为文本输入框
                BuildConfig.CurDistributionSetupPath = EditorGUI.TextField(dragAreaRect, "路径", BuildConfig.CurDistributionSetupPath);

                //如果鼠标正在拖拽中或拖拽结束时,并且鼠标所在位置在文本输入框内
                if ((Event.current.type == EventType.DragUpdated ||
                     Event.current.type == EventType.DragExited) &&
                    dragAreaRect.Contains(Event.current.mousePosition))
                {
                    //改变鼠标的外表
                    DragAndDrop.visualMode = DragAndDropVisualMode.Generic;
                    if (DragAndDrop.paths != null && DragAndDrop.paths.Length > 0)
                    {
                        BuildConfig.CurDistributionSetupPath = DragAndDrop.paths[0];
                    }
                }
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("安装到本地"))
                {
                    if (BuildConfig.CurDistributionSetupPath != null)
                    {
                        BaseFileUtils.DeletePath(BuildConfig.CurDistributionSetupPath);
                        BaseFileUtils.EnsureDirectory(BuildConfig.CurDistributionSetupPath);
                        BaseFileUtils.CopyDir(BuildConfig.DirPath, BuildConfig.CurDistributionSetupPath);
                    }
                }
                if (GUILayout.Button("打开安装目录"))
                {
                    if (BuildConfig.CurDistributionSetupPath != null)
                    {
                        BaseFileUtils.OpenExplorer(BuildConfig.CurDistributionSetupPath);
                    }
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginVertical();
                BuildConfig.Username = EditorGUILayout.TextField("用户名", BuildConfig.Username);
                BuildConfig.Password = EditorGUILayout.PasswordField("密码", BuildConfig.Password);

                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("上传"))
                {
                    if (string.IsNullOrEmpty(BuildConfig.Username) || string.IsNullOrEmpty(BuildConfig.Password))
                    {
                        EditorUtility.DisplayDialog("错误", "请先输入用户名密码", "好的");
                    }
                    else
                    {
                        if (EditorUtility.DisplayDialog("重要操作", "确定要上传吗.", "上传", "取消"))
                        {
                            BuildConfig.GetBuildData(BuildConfig.Distribution).Upload();
                        }
                    }
                }

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();
        }