Esempio n. 1
0
    public static string GetHotFixUrl(HotFixOption option, string defaultUrl)
    {
        string url = defaultUrl;

        switch (option)
        {
        case HotFixOption.Intranet:
            url = VersionConst.IntranatHotFixCdn;
            break;

        case HotFixOption.Cdn:
            url = VersionConst.HotFixUrl;
            break;

        case HotFixOption.None:
            url = String.Empty;
            break;

        case HotFixOption.Customize:
            break;

        default:
            throw new ArgumentOutOfRangeException("option", option, null);
        }

        return(url);
    }
    private void OnGUI()
    {
        GUILayout.Label("出包工具:", EditorStyles.boldLabel);

        _buildMode = (BuildMode)EditorGUILayout.EnumPopup("出包方式", _buildMode);

        GUILayout.Space(10);
        // -选择目标平台类型-//
        _buildTarget   = (BuildTarget)EditorGUILayout.EnumPopup("选择平台", _buildTarget);
        _versionOption = (VersionOption)EditorGUILayout.EnumPopup("版本号模式", _versionOption);
        EditorGUI.indentLevel++;
        if (_versionOption == VersionOption.CustomizeVersion)
        {
            _customizeVersion = new AppVersion(EditorGUILayout.TextField("3位(前两位0~99之间):", _customizeVersion.ToString()));
        }
        else
        {
            EditorGUILayout.LabelField("新的版本号:", GameBuilder.GetBuildVersion(_versionOption, _customizeVersion, _buildTarget).ToString());
        }
        EditorGUI.indentLevel--;

        _applyAllRule = EditorGUILayout.Toggle("强制应用所有Rule", _applyAllRule);
        _increativeBuildAssetBundles = EditorGUILayout.Toggle("增量式构建Bundle", _increativeBuildAssetBundles);
        _bundleCompress = EditorGUILayout.Toggle("开启Bundle压缩", _bundleCompress);


        if (_buildMode != BuildMode.Patch)
        {
            GUILayout.Space(10);
            _hotFixOption = (HotFixOption)EditorGUILayout.EnumPopup("热更url", _hotFixOption);
            EditorGUI.indentLevel++;
            if (_hotFixOption == HotFixOption.Customize)
            {
                _hotFixUrl = EditorGUILayout.TextField("热更Url:", _hotFixUrl);
            }
            EditorGUI.indentLevel--;

            _development = EditorGUILayout.Toggle("开发版本:", _development);
            if (_buildTarget != BuildTarget.iOS)
            {
                _useMono2X = EditorGUILayout.Toggle("是否使用mono打包", _useMono2X);
            }

            if (_buildTarget == BuildTarget.Android)
            {
                _exportProject = EditorGUILayout.Toggle("是否导出工程", _exportProject);
                if (_exportProject)
                {
                    _useGradle = EditorGUILayout.Toggle("是否使用gradle", _useGradle);
                }
            }

            _bundleIdentifier = EditorGUILayout.TextField("Bundle Identifier", _bundleIdentifier);

            _appName = EditorGUILayout.TextField("app名字", _appName);
        }

        if (GUILayout.Button("构建"))
        {
            BuildGame();
        }
    }