コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        public void DrawGUI_OutputDirectory()
        {
            var  currentParams = P.GetCurrentParams();
            bool fold;
            bool _outputDirectoryAuto    = currentParams.outputDirectoryAuto;
            bool _outputUseConfiguration = currentParams.outputUseConfiguration;

            using (new GUILayout.VerticalScope(Styles.helpBox)) {
                using (new GUILayout.HorizontalScope()) {
                    EditorGUI.BeginChangeCheck();
                    fold = HEditorGUILayout.Foldout(E.i.fold.Has(E.FoldOutputDirectory), "Output Directory");
                    E.i.fold.Toggle(E.FoldOutputDirectory, fold);
                    if (EditorGUI.EndChangeCheck())
                    {
                        s_changed = true;
                    }

                    GUILayout.FlexibleSpace();
                    var r = GUILayoutUtility.GetRect(20, 18);
                }


                if (fold)
                {
                    EditorGUI.BeginChangeCheck();
                    EditorGUI.indentLevel++;

                    EditorGUI.BeginChangeCheck();
                    using (new GUILayout.HorizontalScope()) {
                        _outputDirectoryAuto = HEditorGUILayout.ToggleLeft(S._Autosetting, _outputDirectoryAuto);
                        using (new EditorGUI.DisabledGroupScope(!_outputDirectoryAuto)) {
                            _outputUseConfiguration = HEditorGUILayout.ToggleLeft(S._UseConfigurationName, _outputUseConfiguration);
                        }
                        GUILayout.FlexibleSpace();
                    }
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (_outputDirectoryAuto)
                        {
                            currentParams.outputDirectoryAuto    = _outputDirectoryAuto;
                            currentParams.outputUseConfiguration = _outputUseConfiguration;
                            MakeDefaultOutputDirectory();
                        }
                        s_changed = true;
                    }

                    string _outputDirectory = currentParams.outputDirectory;
                    var    rect             = GUILayoutUtility.GetRect(_outputDirectory.content(), EditorStyles.label, GUILayout.Height(16));

                    var r1 = rect;
                    r1.width -= 16;
                    EditorGUI.LabelField(r1, SS._Directory, _outputDirectory);
                    if (!_outputDirectoryAuto)
                    {
                        var r2 = rect;
                        r2.x     = r1.xMax;
                        r2.width = 16;
                        if (HEditorGUI.IconButton(r2, Icon.Get("Folder Icon")))
                        {
                            var _path = EditorUtility.OpenFolderPanel(S._SelectOutputDirectory, _outputDirectory, "");
                            if (!string.IsNullOrEmpty(_path))
                            {
                                _outputDirectory = _path;
                                s_changed        = true;
                            }
                        }
                    }

                    EditorGUI.indentLevel--;
                    if (EditorGUI.EndChangeCheck() || s_changed)
                    {
                        currentParams.outputDirectoryAuto    = _outputDirectoryAuto;
                        currentParams.outputUseConfiguration = _outputUseConfiguration;
                        currentParams.outputDirectory        = _outputDirectory;
                        s_changed = true;
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// GUI Player Settingsの描画を行います
        /// </summary>
        public void DrawGUI_PlayerSettings()
        {
            var currentParams = P.GetCurrentParams();

            int  opt = currentParams.platformOption;
            bool fold;


            using (new GUILayout.VerticalScope(Styles.helpBox)) {
                using (new GUILayout.HorizontalScope()) {
                    EditorGUI.BeginChangeCheck();

                    fold = HEditorGUILayout.Foldout(E.i.fold.Has(E.FoldPlatform), "Player Settings");
                    E.i.fold.Toggle(E.FoldPlatform, fold);
                    if (EditorGUI.EndChangeCheck())
                    {
                        s_changed = true;
                    }

                    GUILayout.FlexibleSpace();

                    var r = EditorHelper.GetLayout(Styles.iconSettings, HEditorStyles.iconButton);

                    if (HEditorGUI.IconButton(r, Styles.iconSettings, 1))
                    {
                        if (PB.i.enableOldStyleProjectSettings)
                        {
                            Selection.activeObject = AssetDatabase.LoadAssetAtPath <UnityObject>(AssetDatabase.GUIDToAssetPath("00000000000000004000000000000000"));
                            EditorUtils.InspectorWindow().Focus();
                        }
                        else
                        {
                            UnityEditorMenu.Edit_Project_Settings();
                        }
                    }
                }

                EditorGUI.BeginChangeCheck();
                if (fold)
                {
                    EditorGUI.indentLevel++;

                    if (P.i.selectBuildTargetGroup == BuildTargetGroup.Standalone ||
                        P.i.selectBuildTargetGroup == BuildTargetGroup.Android)
                    {
                        currentParams.scriptingBackend = (ScriptingImplementation)EditorGUILayout.Popup(S._ScriptingBackend, (int)currentParams.scriptingBackend, B.kScriptingBackendNames);
                    }

                    bool backend = false;
                    if (P.i.selectBuildTargetGroup == BuildTargetGroup.WebGL)
                    {
                    }
                    else if (currentParams.scriptingBackend == ScriptingImplementation.Mono2x)
                    {
                        backend = true;
                    }
                    using (new EditorGUI.DisabledGroupScope(backend)) {
                        currentParams.il2CppCompilerConfiguration = (Il2CppCompilerConfiguration)EditorGUILayout.EnumPopup(S._C__CompilerConfiguration, currentParams.il2CppCompilerConfiguration);
                    }
                    EditorGUILayout.LabelField($"{S._ScriptingDefineSymbols} ({S._Applybuildonly})");


                    using (new GUILayout.HorizontalScope()) {
                        currentParams.scriptingDefineSymbols = EditorGUILayout.TextField(currentParams.scriptingDefineSymbols);
                        var mm = R.Method("GetSymbolList", "Hananoki.SymbolSettings.SettingsProject", "Hananoki.SymbolSettings.Editor");
                        if (mm != null)
                        {
                            var tc = GUILayoutUtility.GetRect(EditorHelper.TempContent(Styles.iconPlus), HEditorStyles.iconButton, GUILayout.Width(16), GUILayout.Height(16));

                            if (HEditorGUI.IconButton(tc, Styles.iconPlus, 3))
                            {
                                GUI.FocusControl("");
                                void add(object obj)
                                {
                                    var s  = obj as string;
                                    var ss = currentParams.scriptingDefineSymbols.Split(';');

                                    ArrayUtility.Add(ref ss, s);
                                    currentParams.scriptingDefineSymbols = string.Join(";", ss.Where(x => !x.IsEmpty()).Distinct().ToArray());
                                }

                                var hoge = (ValueTuple <string[], string[]>)mm.Invoke(null, null);
                                var lst  = new List <string>();
                                var m    = new GenericMenu();
                                foreach (var s in hoge.Item1)
                                {
                                    m.AddItem("Project/" + s, false, add, s);
                                }
                                foreach (var s in hoge.Item2)
                                {
                                    m.AddItem("Editor/" + s, false, add, s);
                                }
                                m.DropDown(tc);
                            }
                        }
                    }
                    EditorGUILayout.LabelField($"{S._ScriptingDefineSymbols} ({S._Current})");
                    EditorGUI.BeginDisabledGroup(true);
                    EditorGUILayout.TextField(B.scriptingDefineSymbols);
                    EditorGUI.EndDisabledGroup();

                    EditorGUI.indentLevel--;
                    GUILayout.Space(4);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    currentParams.platformOption = opt;
                    s_changed = true;
                }
            }
        }
コード例 #3
0
        public void DrawGUI_AssetBundle()
        {
            if (!PB.i.enableAssetBundleBuild)
            {
                return;
            }

            var currentParams = P.GetCurrentParams();
            int opt           = currentParams.assetBundleOption;

            EditorGUI.BeginChangeCheck();
            using (new GUILayout.VerticalScope(Styles.helpBox)) {
                bool fold;
                using (new GUILayout.HorizontalScope()) {
                    fold = HEditorGUILayout.Foldout(E.i.fold.Has(E.FoldAssetBundle), "Asset Bundle");
                    E.i.fold.Toggle(E.FoldAssetBundle, fold);

                    GUILayout.FlexibleSpace();
                    bool b7 = HEditorGUILayout.ToggleLeft(S._ClearFiles, opt.Has(P.BUNDLE_OPTION_CLEAR_FILES));
                    opt.Toggle(P.BUNDLE_OPTION_CLEAR_FILES, b7);

                    var rc = EditorHelper.GetLayout(Styles.iconSettings, Styles.dropDownButton, GUILayout.Width(80), GUILayout.Height(16));

                    HEditorGUI.DropDown(rc, S._Build, Styles.dropDownButton, 18,
                                        () => {
                        if (IsSwitchPlatformAbort())
                        {
                            return;
                        }
                        ExecuteBuildBundle();
                    },
                                        () => {
                        var m = new GenericMenu();
                        if (Directory.Exists(P.i.outputAssetBundleDirectory))
                        {
                            m.AddItem(new GUIContent(SS._OpenOutputFolder), false, () => { EditorUtils.ShellOpenDirectory(P.i.outputAssetBundleDirectory); });
                        }
                        else
                        {
                            m.AddDisabledItem(new GUIContent($"{notDirectory}{P.i.outputAssetBundleDirectory.Replace( "/", "." )}"));
                        }
                        m.DropDown(HEditorGUI.lastRect.PopupRect());
                    });


                    if (_enableAssetBundle)
                    {
                        var r = EditorHelper.GetLayout(Styles.iconSettings, HEditorStyles.iconButton);
                        if (HEditorGUI.IconButton(r, Styles.iconSettings, 2))
                        {
                            EditorApplication.ExecuteMenuItem(Window_AssetBundle_Browser);
                            Event.current.Use();
                        }
                    }

                    rc = HEditorGUI.lastRect;
                    GUI.Label(rc.AddH(-3), GUIContent.none, Styles.dopesheetBackground);
                }
                GUILayout.Space(2);
                if (fold)
                {
                    EditorGUI.indentLevel++;
                    bool bst = HEditorGUILayout.ToggleLeft(S._CopyingthebuildresultstoStreamingAssets, opt.Has(P.BUNDLE_OPTION_COPY_STREAMINGASSETS));
                    currentParams.assetBundleCompressionMode = EditorGUILayout.Popup(S._Compression, currentParams.assetBundleCompressionMode, s_CompressionMode, Styles.miniPopup);
                    bool b1 = HEditorGUILayout.ToggleLeft(s_BundleOptions[0], opt.Has(P.BUNDLE_OPTION_EXCLUDETYPEINFORMATION));
                    bool b2 = HEditorGUILayout.ToggleLeft(s_BundleOptions[1], opt.Has(P.BUNDLE_OPTION_FORCEREBUILD));
                    bool b3 = HEditorGUILayout.ToggleLeft(s_BundleOptions[2], opt.Has(P.BUNDLE_OPTION_IGNORETYPETREECHANGES));
                    bool b4 = HEditorGUILayout.ToggleLeft(s_BundleOptions[3], opt.Has(P.BUNDLE_OPTION_APPENDHASH));
                    bool b5 = HEditorGUILayout.ToggleLeft(s_BundleOptions[4], opt.Has(P.BUNDLE_OPTION_STRICTMODE));
                    bool b6 = HEditorGUILayout.ToggleLeft(s_BundleOptions[5], opt.Has(P.BUNDLE_OPTION_DRYRUNBUILD));

                    opt.Toggle(P.BUNDLE_OPTION_COPY_STREAMINGASSETS, bst);
                    opt.Toggle(P.BUNDLE_OPTION_EXCLUDETYPEINFORMATION, b1);
                    opt.Toggle(P.BUNDLE_OPTION_FORCEREBUILD, b2);
                    opt.Toggle(P.BUNDLE_OPTION_IGNORETYPETREECHANGES, b3);
                    opt.Toggle(P.BUNDLE_OPTION_APPENDHASH, b4);
                    opt.Toggle(P.BUNDLE_OPTION_STRICTMODE, b5);
                    opt.Toggle(P.BUNDLE_OPTION_DRYRUNBUILD, b6);
                    GUILayout.Space(2);

                    EditorGUI.indentLevel--;
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                currentParams.assetBundleOption = opt;
                s_changed = true;
            }
        }
コード例 #4
0
        /// <summary>
        /// GUI Build Settingsの描画を行います
        /// </summary>
        public void DrawGUI_BuildSettings()
        {
            var currentParams = P.GetCurrentParams();

            EditorGUI.BeginChangeCheck();

            bool fold;

            using (new GUILayout.VerticalScope(Styles.helpBox)) {
                using (new GUILayout.HorizontalScope()) {
                    fold = HEditorGUILayout.Foldout(E.i.fold.Has(E.FoldBuildSettings), "Build Settings");
                    E.i.fold.Toggle(E.FoldBuildSettings, fold);
                    GUILayout.FlexibleSpace();
                    //EditorGUI.DrawRect( GUILayoutUtility.GetLastRect(), new Color( 0, 0, 1, 0.2f ) );

                    var r = EditorHelper.GetLayout(Styles.iconSettings, HEditorStyles.iconButton);
                    if (HEditorGUI.IconButton(r, Styles.iconSettings, B.kBuildSettings, 1))
                    {
                        UnityEditorMenu.File_Build_Settings();
                    }
                }

                if (fold)
                {
                    EditorGUI.indentLevel++;
                    currentParams.development = EditorGUILayout.Toggle(S._DevelopmentBuild, currentParams.development);

                    if (P.i.selectBuildTargetGroup == BuildTargetGroup.Android)
                    {
                        currentParams.buildAppBundle = EditorGUILayout.Toggle(S._BuildAppBundle_GooglePlay_, currentParams.buildAppBundle);
                    }

                    if (P.i.selectBuildTargetGroup == BuildTargetGroup.Standalone ||
                        P.i.selectBuildTargetGroup == BuildTargetGroup.Android)
                    {
                        string[] ss = { "Default", "LZ4", "LZ4HC" };
                        switch (EditorGUILayout.Popup(S._CompressionMethod, currentParams.compression.ToIndex(), ss, Styles.miniPopup))
                        {
                        case 0:
                            currentParams.compression = Compression.None;
                            break;

                        case 1:
                            currentParams.compression = Compression.Lz4;
                            break;

                        case 2:
                            currentParams.compression = Compression.Lz4HC;
                            break;
                        }
                    }

                    EditorGUI.indentLevel--;
                    GUILayout.Space(2);
                }
            }

            if (EditorGUI.EndChangeCheck())
            {
                s_changed = true;
            }
        }
コード例 #5
0
        void DrawGUI_WebGL(P.Params currentParams)
        {
            int opt = currentParams.platformOption;

            using (new GUILayout.VerticalScope(Styles.helpBox)) {
                EditorGUI.BeginChangeCheck();
                var fold = HEditorGUILayout.Foldout(E.i.fold.Has(E.FoldPlayerSettingsWebGL), "WebGL");
                E.i.fold.Toggle(E.FoldPlayerSettingsWebGL, fold);
                if (EditorGUI.EndChangeCheck())
                {
                    s_changed = true;
                }

                EditorGUI.BeginChangeCheck();
                if (fold)
                {
                    EditorGUI.indentLevel++;
                    using (new GUILayout.HorizontalScope()) {
                        currentParams.WebGL_compressionFormat = (WebGLCompressionFormat)EditorGUILayout.EnumPopup(S._CompressionFormat, currentParams.WebGL_compressionFormat);
                        if (HEditorGUILayout.IconButton(Styles.iconHelp, 3))
                        {
                            EditorUtility.DisplayDialog(SS._Info, $@"Brotli (default: 2019.1~):
{S._WebGLresourcesarestoredusingBrotlicompression_}

Gzip (default: ~2018.4):
{S._WebGLresourcesarestoredusingGzipcompression_}

Disabled:
{S._WebGLresourcesareuncompressed_}", SS._OK);
                        }
                    }
                    using (new GUILayout.HorizontalScope()) {
                        currentParams.WebGL_linkerTarget = (WebGLLinkerTarget)EditorGUILayout.EnumPopup(S._LinkerTarget, currentParams.WebGL_linkerTarget);
                        if (HEditorGUILayout.IconButton(Styles.iconHelp, 3))
                        {
                            EditorUtility.DisplayDialog(SS._Info, $@"Asm:
{S._Onlyasm_jsoutputwillbegenerated_Thissettinghasbeendeprecated_}

Wasm (default):
{S._OnlyWebAssemblyoutputwillbegenerated_ThiswillrequireabrowserwithWebAssemblysupporttorunthegeneratedcontent_}

Both:
{S._Bothasm_jsandWebAssemblyoutputwillbegenerated_TheWebAssemblyversionofthegeneratedcontentwillbeusedifsupportedbythebrowser_otherwise_theasm_jsversionwillbeused_Thissettinghasbeendeprecated_}", SS._OK);
                        }
                    }
                    string[] memS = { "16MB", "32MB", "64MB", "128MB", "256MB", "512MB", "1GB", "2GB", "4GB", "8GB" };
                    int[]    memI = { 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192 };
                    int      idx  = ArrayUtility.IndexOf(memI, currentParams.WebGL_memorySize);
                    if (idx < 0)
                    {
                        idx = 1;
                    }
                    idx = EditorGUILayout.Popup(S._MemorySize, idx, memS);
                    currentParams.WebGL_memorySize = memI[idx];
                    using (new GUILayout.HorizontalScope()) {
                        currentParams.WebGL_exceptionSupport = (WebGLExceptionSupport)EditorGUILayout.EnumPopup(S._EnableExceptions, currentParams.WebGL_exceptionSupport);
                        if (HEditorGUILayout.IconButton(Styles.iconHelp, 3))
                        {
                            EditorUtility.DisplayDialog(SS._Info, $@"None:
{S._Disableexceptionsupport_}

Explicitly Thrown Exceptions Only (default):
{S._Enablethrowsupport_}

Full Without Stacktrace:
{S._Enableexceptionsupportforallexceptions_withoutstacktraceinformation_}

Full With Stacktrace:
{S._Enableexceptionsupportforallexceptions_includingstacktraceinformation_}
", SS._OK);
                        }
                    }

                    if (UnitySymbol.Has("UNITY_2019_1_OR_NEWER"))
                    {
                        using (new GUILayout.HorizontalScope()) {
                            currentParams.WebGL_wasmStreaming = EditorGUILayout.ToggleLeft(S._WebAssemblyStreaming, currentParams.WebGL_wasmStreaming);
                            if (HEditorGUILayout.IconButton(Styles.iconHelp, 3))
                            {
                                EditorUtility.DisplayDialog(SS._Info, $@"{S._EnableWebAssemblystreamingcompilation_}
{S._Whenenabled_UnitycompilestheWebAssemblybinaryfilewhilethefiledownloads_Thissettingrequiresan_application_wasm_mimetype_sosetuptheserveraccordingly_}", SS._OK);
                            }
                        }
                        using (new GUILayout.HorizontalScope()) {
                            currentParams.WebGL_threadsSupport = EditorGUILayout.ToggleLeft(S._EnableMultiThread, currentParams.WebGL_threadsSupport);
                            if (HEditorGUILayout.IconButton(Styles.iconHelp, 3))
                            {
                                EditorUtility.DisplayDialog(SS._Info, $@"{S._EnableMultithreadingsupport_}
{S._Whenenabled_Unityoutputsabuildwithmultithreadingsupport_ThegeneratedcontentrequiresabrowserthatsupportsWebAssemblythreads_Thisisanexperimentalfeatureandshouldonlybeusedfortestingpurposes_}", SS._OK);
                            }
                        }
                    }
                    EditorGUI.indentLevel--;
                }
                if (EditorGUI.EndChangeCheck())
                {
                    currentParams.platformOption = opt;
                    s_changed = true;
                }
            }
        }