/// <summary>
        ///
        /// </summary>
        static void DrawGUI()
        {
            EditorGUI.BeginChangeCheck();

            using (new PreferenceLayoutScope(ref s_scrollPos)) {
                E.i.Enable = HEditorGUILayout.ToggleLeft(SS._Enable, E.i.Enable);
                EditorGUI.indentLevel++;
                GUILayout.Space(8f);

                using (new EditorGUI.DisabledGroupScope(!E.i.Enable)) {
                    E.i.showExtension = HEditorGUILayout.ToggleLeft(S._ShowExtension, E.i.showExtension);
                    using (new EditorGUI.DisabledGroupScope(!E.i.showExtension)) {
                        EditorGUI.indentLevel++;
                        E.i.extBackColor = EditorGUILayout.ColorField(SS._BackColor, E.i.extBackColor);
                        E.i.extTextColor = EditorGUILayout.ColorField(SS._TextColor, E.i.extTextColor);
                        EditorGUI.indentLevel--;
                    }

                    E.i.showLineColor = HEditorGUILayout.ToggleLeft(SS._Changecolorforeachrow, E.i.showLineColor);

                    using (new EditorGUI.DisabledGroupScope(!E.i.showLineColor)) {
                        EditorGUI.indentLevel++;
                        E.i.lineColor = EditorGUILayout.ColorField(SS._Rowcolor, E.i.lineColor);
                        EditorGUI.indentLevel--;
                    }

                    GUILayout.Space(8f);
                    EditorGUILayout.LabelField($"* {SS._Experimental}", EditorStyles.boldLabel);
                    E.i.IconClickContext = HEditorGUILayout.ToggleLeft(SS._ContextMenuWithIconClick, E.i.IconClickContext);
                    if (UnitySymbol.Has("UNITY_EDITOR_WIN"))
                    {
                        using (new EditorGUI.DisabledGroupScope(!E.i.showExtension)) {
                            E.i.enableExtensionRun = HEditorGUILayout.ToggleLeft(S._Clickontheextensiontorunitinthefiler, E.i.enableExtensionRun);
                        }
                    }
                    else
                    {
                        E.i.enableExtensionRun = false;
                    }
                    E.i.adressableSupport = HEditorGUILayout.ToggleLeft(S._EnablingAddressablesupport, E.i.adressableSupport);
                }
                EditorGUI.indentLevel--;
            }

            GUILayout.Space(8f);


            if (EditorGUI.EndChangeCheck())
            {
                E.Save();
                CustomProjectBrowser.s_styles.lineColor = E.i.lineColor;
                EditorApplication.RepaintProjectWindow();
            }

            GUILayout.Space(8f);
        }
示例#2
0
        public Styles()
        {
            LabelAndIcon             = new GUIStyle(EditorStyles.label);
            LabelAndIcon.fixedHeight = 16;

            ProjectBrowserHeaderBgMiddle = new GUIStyle("ProjectBrowserHeaderBgTop");
            DopesheetBackground          = new GUIStyle("DopesheetBackground");

            Toolbar = new GUIStyle(EditorStyles.toolbar);

            Foldout           = new GUIStyle("Foldout");
            Foldout.font      = EditorStyles.boldLabel.font;
            Foldout.alignment = TextAnchor.MiddleLeft;
            if (UnitySymbol.Has("UNITY_2018_3_OR_NEWER"))
            {
                Foldout.margin = new RectOffset(Foldout.margin.left, Foldout.margin.right, 0, 0);
            }
            Toolbarbutton           = new GUIStyle(EditorStyles.toolbarButton);
            Toolbarbutton.alignment = TextAnchor.MiddleCenter;
            Toolbarbutton.padding   = new RectOffset(2, 2, 2, 2);
            //Toolbarbutton.margin = new RectOffset( 2, 2, 2, 2 );
            ToolbarbuttonActive                = new GUIStyle(Toolbarbutton);
            ToolbarbuttonActive.alignment      = TextAnchor.MiddleCenter;
            ToolbarbuttonActive.padding.right += 20;            // = new RectOffset( ToolbarbuttonActive.padding.left );

            ToolbarButtonBold               = new GUIStyle(Toolbarbutton);
            ToolbarButtonBold.fontStyle     = FontStyle.Bold;
            ToolbarButtonBold.padding.left  = 8;
            ToolbarButtonBold.padding.right = 8;

            HelpBox = new GUIStyle(EditorStyles.helpBox);

            Minibutton = new GUIStyle("minibutton");
            MiniPopup  = new GUIStyle("MiniPopup");
            BoldLabel  = new GUIStyle("BoldLabel");

            DropDownButton             = new GUIStyle("Button");
            DropDownButton.fixedHeight = 0;
            if (UnitySymbol.Has("UNITY_2018_3_OR_NEWER"))
            {
                DropDownButton.padding = new RectOffset(DropDownButton.padding.left, 16, 0, 0);
            }
            Icon = new GUIStyle();
            Icon.stretchWidth = false;
            Icon.alignment    = TextAnchor.MiddleCenter;
            Icon.margin       = new RectOffset(0, 0, 4, 0);

            IconEdit = EditorHelper.LoadIcon("editicon.sml");
        }
示例#3
0
        static ToolbarCallback()
        {
            if (UnitySymbol.Has("UNITY_2020_1_OR_NEWER"))
            {
                m_iWindowBackendType = typeof(Editor).Assembly.GetType("UnityEditor.IWindowBackend");
                m_windowBackend      = UnityTypes.UnityEditor_GUIView.GetProperty("windowBackend", bindFlags);
                m_viewVisualTree     = m_iWindowBackendType.GetProperty("visualTree", bindFlags);
            }
            else
            {
                m_viewVisualTree = UnityTypes.UnityEditor_GUIView.GetProperty("visualTree", bindFlags);
            }

            m_imguiContainerOnGui = UnityTypes.UnityEngine_UIElements_IMGUIContainer.GetField("m_OnGUIHandler", bindFlags);

            EditorApplication.update -= OnUpdate;
            EditorApplication.update += OnUpdate;
        }
示例#4
0
        static void OnUpdate()
        {
            // Relying on the fact that toolbar is ScriptableObject and gets deleted when layout changes
            if (m_currentToolbar != null)
            {
                return;
            }

            // Find toolbar
            var toolbars = Resources.FindObjectsOfTypeAll(UnityTypes.UnityEditor_Toolbar);

            m_currentToolbar = toolbars.Length > 0 ? (ScriptableObject)toolbars[0] : null;

            if (m_currentToolbar == null)
            {
                return;
            }

            // Get it's visual tree
            var pi = UnityTypes.UnityEngine_UIElements_VisualElement.GetProperty("Item", BindingFlags.Public | BindingFlags.Instance);

            object visualTree;

            if (UnitySymbol.Has("UNITY_2020_1_OR_NEWER"))
            {
                var windowBackend = m_windowBackend.GetValue(m_currentToolbar);
                visualTree = /*(VisualElement)*/ m_viewVisualTree.GetValue(windowBackend, null);
            }
            else
            {
                visualTree = /*(VisualElement)*/ m_viewVisualTree.GetValue(m_currentToolbar, null);
            }
            // Get first child which 'happens' to be toolbar IMGUIContainer
            //var container = (IMGUIContainer) visualTree[ 0 ];
            var container = pi.GetValue(visualTree, new object[] { 0 });

            // (Re)attach handler
            var handler = (Action)m_imguiContainerOnGui.GetValue(container);

            handler -= OnGUI;
            handler += OnGUI;
            m_imguiContainerOnGui.SetValue(container, handler);
        }
示例#5
0
        /////////////////////////////////////////
        void OnDropAction()
        {
            var currentParams = P.GetCurrentParams();

            var m = new GenericMenu();

            if (Directory.Exists(P.currentOutputPackageDirectory))
            {
                m.AddItem(SS._OpenOutputFolder, () => {
                    ShellUtils.OpenDirectory(P.currentOutputPackageDirectory);
                });
            }
            else
            {
                m.AddDisabledItem($"{S.__NotFoundDirectory__}{P.currentOutputPackageDirectory.TryReplace( "/", "." )}]".content());
            }
            m.AddSeparator("");

            if (PB.i.enableAssetBundleBuild)
            {
                m.AddItem(S._BuildAssetBundletogether, currentParams.buildAssetBundlesTogether, () => { currentParams.buildAssetBundlesTogether = !currentParams.buildAssetBundlesTogether; });
            }
            if (UnitySymbol.Has("UNITY_EDITOR_WIN"))
            {
                m.AddItem(S._CreateabuildBATfile, () => {
                    var tname = $"{UnityEditorEditorUserBuildSettings.activeBuildTargetGroup.ToString()}_{currentParams.name}";
                    fs.WriteFileAll($"Build_{tname}.bat", b => {
                        b.AppendLine($"@echo off");
                        b.AppendLine($"set PATH=%PATH%;{EditorApplication.applicationPath.GetDirectory()}");
                        b.AppendLine($"set OPT1=-batchmode -nographics");
                        b.AppendLine($"set BUILD=-buildTarget {B.BuildTargetToBatchName( currentParams.buildTarget )}");
                        b.AppendLine($"set PROJ=-projectPath {Environment.CurrentDirectory}");
                        b.AppendLine($"set LOG=-logFile \"Logs/Editor_{tname}.log\"");
                        b.AppendLine($"set METHOD=-executeMethod Hananoki.{Package.name}.{nameof( BuildCommands )}.Batch -buildIndex:{P.i.selectParamsIndex}");
                        b.AppendLine($"Unity.exe %OPT1% %BUILD% %PROJ% %LOG% %METHOD% -quit");
                        b.AppendLine($"pause");
                    }, utf8bom: false);
                    EditorUtility.DisplayDialog(SS._Confirm, $"{S._BuildBATcreated}\n{Environment.CurrentDirectory}/{$"Build_{tname}.bat"}", SS._OK);
                });
            }
            m.DropDown(HEditorGUI.lastRect.PopupRect());
        }
示例#6
0
        static ToolbarExtender()
        {
            //Type toolbarType = typeof( Editor ).Assembly.GetType( "UnityEditor.Toolbar" );
            if (UnitySymbol.UNITY_2021_1_OR_NEWER)
            {
                return;
            }

            string fieldName;

            if (UnitySymbol.UNITY_2019_1_OR_NEWER)
            {
                fieldName = "k_ToolCount";
            }
            else
            {
                fieldName = "s_ShownToolIcons";
            }

            var toolIcons = UnityTypes.UnityEditor_Toolbar.GetField(fieldName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);

            if (UnitySymbol.Has("UNITY_2019_1_OR_NEWER"))
            {
                m_toolCount = toolIcons != null ? ((int)toolIcons.GetValue(null)) : 7;
            }
            else if (UnitySymbol.Has("UNITY_2018_1_OR_NEWER"))
            {
                m_toolCount = toolIcons != null ? ((Array)toolIcons.GetValue(null)).Length : 6;
            }
            else
            {
                m_toolCount = toolIcons != null ? ((Array)toolIcons.GetValue(null)).Length : 5;
            }

            ToolbarCallback.OnToolbarGUI -= OnGUI;
            ToolbarCallback.OnToolbarGUI += OnGUI;
        }
示例#7
0
        static void OnGUI()
        {
            // Create two containers, left and right
            // Screen is whole toolbar

            if (m_commandStyle == null)
            {
                m_commandStyle = new GUIStyle("CommandLeft");
            }

            var screenWidth = EditorGUIUtility.currentViewWidth;

            // Following calculations match code reflected from Toolbar.OldOnGUI()
            float playButtonsPosition = (screenWidth - 100) / 2;

            Rect leftRect = new Rect(0, 0, screenWidth, Screen.height);

            leftRect.xMin += 10;               // Spacing left
            leftRect.xMin += 32 * m_toolCount; // Tool buttons
            leftRect.xMin += 20;               // Spacing between tools and pivot
            leftRect.xMin += 64 * 2;           // Pivot buttons
            leftRect.xMax  = playButtonsPosition;

            Rect rightRect = new Rect(0, 0, screenWidth, Screen.height);

            rightRect.xMin  = playButtonsPosition;
            rightRect.xMin += m_commandStyle.fixedWidth * 3; // Play buttons
            rightRect.xMax  = screenWidth;
            rightRect.xMax -= 10;                            // Spacing right
            rightRect.xMax -= 80;                            // Layout
            rightRect.xMax -= 10;                            // Spacing between layout and layers
            rightRect.xMax -= 80;                            // Layers
            rightRect.xMax -= 20;                            // Spacing between layers and account
            rightRect.xMax -= 80;                            // Account
            rightRect.xMax -= 10;                            // Spacing between account and cloud
            rightRect.xMax -= 32;                            // Cloud

            if (UnityEditorCollaborationCollab.IsToolbarVisible != null)
            {
                rightRect.xMax -= 10;                 // Spacing between cloud and collab
                rightRect.xMax -= 78;                 // Colab
            }

            // Add spacing around existing controls
            leftRect.xMin  += 10;
            leftRect.xMax  -= 10;
            rightRect.xMin += 10;
            rightRect.xMax -= 10;

            // Add top and bottom margins
            float rectY = 5;

            if (UnitySymbol.Has("UNITY_2019_3_OR_NEWER"))
            {
                rectY = 4;
            }
            leftRect.y      = rectY;
            leftRect.height = 24;

            rightRect.y      = rectY;
            rightRect.height = 24;

            if (leftRect.width > 0)
            {
                GUILayout.BeginArea(leftRect);
                GUILayout.BeginHorizontal();
                foreach (var handler in LeftToolbarGUI)
                {
                    handler();
                }

                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }

            if (rightRect.width > 0)
            {
                if (UnitySymbol.Has("UNITY_2019_1_OR_NEWER"))
                {
                    rightRect.x -= 20;
                }
                GUILayout.BeginArea(rightRect);
                GUILayout.BeginHorizontal();
                foreach (var handler in RightToolbarGUI)
                {
                    handler();
                }

                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }
            //EditorGUI.DrawRect(rightRect,new Color(0,0,1,0.1f));
        }
示例#8
0
 public bool isDisable(P.Params currentParams) => !UnitySymbol.Has("UNITY_2019_1_OR_NEWER");
示例#9
0
        /// <summary>
        /// GUI 下部のビルド開始ボタン等の描画を行います
        /// </summary>
        public void DrawGUI_Bottom()
        {
            var currentParams = P.GetCurrentParams();

            using (new GUILayout.HorizontalScope()) {
                GUILayout.FlexibleSpace();
                GUILayout.Label(P.currentOutputPackageFullName);
            }
            using (new GUILayout.HorizontalScope()) {
                GUILayout.FlexibleSpace();

                using (new EditorGUI.DisabledGroupScope(!currentParams.development)) {
                    bool b2 = HEditorGUILayout.SessionToggleLeft(S._ConnectProfiler, S._ProfilingisonlyenabledinaDevelopmentPlayer, E.connectProfiler.Value);
                    E.connectProfiler.Value = b2;
                }
                bool b3 = HEditorGUILayout.SessionToggleLeft(S._AutoRunPlayer, E.autoRunPlayer.Value);
                E.autoRunPlayer.Value = b3;
                //GUILayout.Space( 16 );

                var rc = GUILayoutUtility.GetRect(EditorHelper.TempContent(S._SwitchPlatform, EditorIcon.Warning), GUI.skin.button, GUILayout.Width(150));


                void OnDropAction()
                {
                    var m = new GenericMenu();

                    if (Directory.Exists(P.currentOutputPackageDirectory))
                    {
                        m.AddItem(SS._OpenOutputFolder.content(), false, () => {
                            EditorUtils.ShellOpenDirectory(P.currentOutputPackageDirectory);
                        });
                    }
                    else
                    {
                        m.AddDisabledItem($"{notDirectory}{P.currentOutputPackageDirectory.Replace( "/", "." )}]".content());
                    }
                    m.AddSeparator("");
                    if (PB.i.enableAssetBundleBuild)
                    {
                        m.AddItem(S._BuildAssetBundletogether.content(), currentParams.buildAssetBundlesTogether, () => { currentParams.buildAssetBundlesTogether = !currentParams.buildAssetBundlesTogether; });
                    }
                    if (UnitySymbol.Has("UNITY_EDITOR_WIN"))
                    {
                        m.AddItem(S._CreateabuildBATfile, false, () => {
                            var tname = $"{UnityEditorUserBuildSettings.activeBuildTargetGroup.ToString()}_{currentParams.name}";
                            EditorHelper.WriteFile($"Build_{tname}.bat", b => {
                                b.AppendLine($"@echo off");
                                b.AppendLine($"set PATH=%PATH%;{EditorApplication.applicationPath.GetDirectory()}");
                                b.AppendLine($"set OPT1=-batchmode -nographics");
                                b.AppendLine($"set BUILD=-buildTarget {B.BuildTargetToBatchName( currentParams.buildTarget )}");
                                b.AppendLine($"set PROJ=-projectPath {Environment.CurrentDirectory}");
                                b.AppendLine($"set LOG=-logFile \"Logs/Editor_{tname}.log\"");
                                b.AppendLine($"set METHOD=-executeMethod Hananoki.{Package.name}.{nameof( BuildCommands )}.Batch -buildIndex:{P.i.selectParamsIndex}");
                                b.AppendLine($"Unity.exe %OPT1% %BUILD% %PROJ% %LOG% %METHOD% -quit");
                                b.AppendLine($"pause");
                            }, utf8bom: false);
                            EditorUtility.DisplayDialog(SS._Confirm, $"{S._BuildBATcreated}\n{Environment.CurrentDirectory}/{$"Build_{tname}.bat"}", SS._OK);
                        });
                    }
                    m.DropDown(HEditorGUI.lastRect.PopupRect());
                }

                if (UnityEditorUserBuildSettings.activeBuildTargetGroup != P.i.selectBuildTargetGroup)
                {
                    HEditorGUI.DropDown(rc, EditorHelper.TempContent(S._SwitchPlatform, EditorIcon.Warning), Styles.dropDownButton, 20,
                                        () => PlatformUtils.SwitchActiveBuildTarget(P.i.selectBuildTargetGroup),
                                        OnDropAction
                                        );
                }
                else
                {
                    HEditorGUI.DropDown(rc, E.autoRunPlayer.Value ? S._BuildAndRun : S._Build, Styles.dropDownButton, 20,
                                        () => {
                        if (IsSwitchPlatformAbort())
                        {
                            return;
                        }
                        ExecuteBuildPackage();
                    },
                                        OnDropAction);
                }
                rc = HEditorGUI.lastRect;
                GUI.Label(rc.AddH(-3), GUIContent.none, Styles.dopesheetBackground);
                if (UnitySymbol.Has("UNITY_EDITOR_WIN"))
                {
                    if (P.GetSelectPlatform().buildTargetGroup == BuildTargetGroup.Standalone)
                    {
                        if (File.Exists(P.currentOutputPackageFullName))
                        {
                            if (HEditorGUILayout.ImageButton(EditorIcon.PlayButton, GUILayout.Width(30)))
                            {
                                System.Diagnostics.Process.Start(P.currentOutputPackageFullName);
                            }
                        }
                    }
                    if (P.GetSelectPlatform().buildTargetGroup == BuildTargetGroup.WebGL)
                    {
                        if (File.Exists($"{P.currentOutputPackageFullName}/index.html"))
                        {
                            if (HEditorGUILayout.ImageButton(EditorIcon.PlayButton, GUILayout.Width(30)))
                            {
                                //System.Diagnostics.Process.Start( $"{P.currentOutputPackageFullName}/index.html" );
                                Application.OpenURL("http://localhost/");
                            }
                        }
                    }
                }
            }
            GUILayout.Space(10);
        }
示例#10
0
        /////////////////////////////////////////
        internal static void DrawLeftBottom(SceneView sceneView)
        {
            Rect rcPop    = new Rect(8, 0, 0, 24);
            Rect rcRad    = new Rect(12, 0, 160 - 4, 16);
            Rect rcToggle = new Rect(rcPop.max.x, 0, 16, 16);

            var cameras = UnityObject.FindObjectsOfType <Camera>();

            rcPop.y = Screen.height - (24 * 2) - (8 * 2);

            if (E.i.syncScene2Game)
            {
                string[] displayNames = new string[] { "None", "" };
                ArrayUtility.AddRange(ref displayNames, cameras.Select(c => c.name).ToArray());

                rcPop.width = 160;

                //GUI.skin = EditorGUIUtility.GetBuiltinSkin( EditorSkin.Inspector );
                s_cameraSelect = EditorGUI.Popup(rcPop, s_cameraSelect, displayNames, Styles.popup);

                // Match GameView

                int index = s_cameraSelect - 2;

                if (index >= 0 && index < cameras.Length)
                {
                    var camera = cameras[index];
                    if (s_gameviewMatch)
                    {
                        var a = camera.transform.rotation * Vector3.forward;
                        a *= 25.0f;
                        sceneView.pivot    = camera.transform.position + a;
                        sceneView.rotation = camera.transform.rotation;
                        sceneView.size     = 25.0f;

                        s_gameviewMatch = false;
                    }
                    else
                    {
                        camera.transform.position = sceneView.camera.transform.position;
                        camera.transform.rotation = sceneView.camera.transform.rotation;
                    }
                }
                else
                {
                    rcRad.y = rcPop.y - 16;
                    if (UnitySymbol.Has("UNITY_2019_3_OR_NEWER"))
                    {
                        rcRad.y -= 2;
                    }
                    var cont = EditorHelper.TempContent(S._MatchGameView);
                    var sz   = EditorStyles.toggle.CalcSize(cont);
                    rcRad.width = sz.x;
                    var rc = rcRad.AddW(2);
                    EditorGUI.DrawRect(rc, E.i.uiBkColor);
                    s_gameviewMatch = GUI.Toggle(rcRad, s_gameviewMatch, S._MatchGameView, Styles.toggle);
                }
            }


            // orthographic
            if (E.i.toggleOrthographic)
            {
                rcToggle.y = rcPop.y + 1;
                rcToggle.x = rcPop.x + rcPop.width;
                if (UnitySymbol.Has("UNITY_2019_3_OR_NEWER"))
                {
                    rcToggle.x += 2;
                }
                var cont = EditorHelper.TempContent("Iso");
                var sz   = EditorStyles.toggle.CalcSize(cont);
                rcToggle.width = sz.x;

                var rc = rcToggle.AddW(2);
                EditorGUI.DrawRect(rc, E.i.uiBkColor);
                sceneView.orthographic = GUI.Toggle(rcToggle, sceneView.orthographic, cont, Styles.toggle);
            }
        }
示例#11
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;
                }
            }
        }
示例#12
0
        //public void DrawGUI_AssetBundle() {
        //	if( !PB.i.enableAssetBundleBuild ) return;

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

        //	EditorGUI.BeginChangeCheck();
        //	using( new GUILayout.VerticalScope( EditorStyles.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( EditorIcon.settings, Styles.dropDownButton, GUILayout.Width( 80 ), GUILayout.Height( 16 ) );

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


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

        //			rc = HEditorGUI.lastRect;
        //			GUI.Label( rc.AddH( -3 ), GUIContent.none, HEditorStyles.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;
        //		Utils.s_changed = true;
        //	}
        //}


        /////////////////////////////////////////

        void DrawToolBar()
        {
            HGUIToolbar.Begin();

            if (HGUIToolbar.Button(EditorIcon.settings))
            {
                SharedModule.SettingsWindow.OpenProject(Package.nameNicify);
            }

            if (HGUIToolbar.Toggle(P.i.selectScene, "Scenes in Build", EditorIcon.sceneasset))
            {
                P.i.selectScene = true;
                P.Save();
            }

            var lst = m_supportBuildTarget.Where(x => P.GetPlatform(x).enable).ToArray();

            var reo    = Styles.toolbarbutton.padding;
            var active = UnityEditorEditorUserBuildSettings.activeBuildTargetGroup;

            for (int i = 0; i < lst.Length; i++)
            {
                var s = lst[i];

                var style = active == s ? Styles.toolbarbuttonActive : Styles.toolbarbutton;

                var cont = EditorHelper.TempContent(s.GetShortName(), s.Icon());
                var size = style.CalcSize(cont);
                size.x -= 8;

                bool bb = P.i.selectScene || P.i.selectScene;

                ScopeChange.Begin();
                if (HGUIToolbar.Toggle(P.i.selectBuildTargetGroup == s && !bb, cont, style, GUILayout.Width(size.x)))
                {
                    P.i.selectScene = false;
                    P.Save();

                    P.i.selectBuildTargetGroup = s;
                    Utils.SelectItemUpdate();
                    ChangeActiveTarget();
                    m_Drawer_BuildPlatforms.SelectPlatform(Utils.s_currentPlatform, m_buildPlatformDrawer);
                }
                if (ScopeChange.End())
                {
                    P.Save();
                }

                if (active == s)
                {
                    var rc = GUILayoutUtility.GetLastRect();
                    EditorGUI.DrawRect(rc, new Color(0, 0, 1, 0.1f));

                    rc.x -= 4;
                    rc    = rc.AlignCenterH(16);
                    if (UnitySymbol.Has("UNITY_2019_3_OR_NEWER"))
                    {
                        rc.y += 1;
                    }
                    GUI.DrawTexture(rc.AlignR(16), EditorIcon.buildsettings_editor_small, ScaleMode.ScaleToFit);
                }
            }

            GUILayout.FlexibleSpace();
            if (_enableBuildReport)
            {
                if (HGUIToolbar.Button("Build Report"))
                {
                    EditorApplication.ExecuteMenuItem(Window_Show_Build_Report);
                }
            }


            HGUIToolbar.End();
        }