Exemplo n.º 1
0
        /////////////////////////////////////////

        static void Batch()
        {
            Log("Batch");
            P.Load();

            Log($"{string.Join( "; ", EditorUserBuildSettings.activeScriptCompilationDefines )}");

            Log($"activeBuildTargetGroup: {UnityEditorEditorUserBuildSettings.activeBuildTargetGroup.ToString()}");
            Log($"activeBuildTarget: {EditorUserBuildSettings.activeBuildTarget.ToString()}");

            var currentParams = P.GetActiveTargetParams();

            Log($"{currentParams.buildTarget}");

            foreach (var arg in Environment.GetCommandLineArgs())
            {
                if (arg.Contains("-buildIndex"))
                {
                    int index = int.Parse(arg.Split(':')[1]);
                    P.i.buildParamIndex = index;
                    break;
                }
            }
            Build(0x01);
        }
Exemplo n.º 2
0
        public bool UIDraw(Rect rect, P.Params currentParams)
        {
            string[] ss    = { "Default", "LZ4", "LZ4HC" };
            var      index = currentParams.compression.ToIndex();

            ScopeChange.Begin();
            var _index = EditorGUI.Popup(rect, index, ss, Styles.miniPopup);

            if (ScopeChange.End())
            {
                switch (_index)
                {
                case 0:
                    currentParams.compression = Compression.None;
                    break;

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

                case 2:
                    currentParams.compression = Compression.Lz4HC;
                    break;
                }
                P.Save();
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
        /////////////////////////////////////////
        protected override void OnRowGUI(Item item, RowGUIArgs args)
        {
            m_lastCellRect = args.rowRect;

            if (item.uiDraw != null)
            {
                var p = P.GetCurrentParams();
                ScopeDisable.Begin(item.uiDraw.isDisable(p));

                DefaultRowGUI(args);

                var rect = args.rowRect;
                ScopeChange.Begin();
                if (item.uiDraw.UIDraw(rect.TrimL(250), p))
                {
                    m_buildPlatformDrawer.CheckError();
                }
                ScopeChange.End();

                ScopeDisable.End();
            }
            else
            {
                DefaultRowGUI(args);
            }
        }
Exemplo n.º 4
0
        public BuildReport BuildPackage(string[] scenes)
        {
            var p    = P.GetActiveTargetParams();
            var path = $"{p.outputDirectory}/{P.GetOutputPackageName( p )}";

            try {
                B.development = p.development;

                B.compressionType             = p.compression;
                B.il2CppCompilerConfiguration = p.il2CppCompilerConfiguration;
                B.WebGL_compressionFormat     = p.WebGL_compressionFormat;
                B.WebGL_linkerTarget          = p.WebGL_linkerTarget;
                B.WebGL_memorySize            = p.WebGL_memorySize;
                B.WebGL_exceptionSupport      = p.WebGL_exceptionSupport;
#if UNITY_2019_1_OR_NEWER
                B.WebGL_threadsSupport = p.WebGL_threadsSupport;
                //B.WebGL_wasmStreaming = p.WebGL_wasmStreaming;
#endif
                Log($"path: {path}");
                Log($"buildTarget: {p.buildTarget.ToString()}");
                Log($"options: {p.options.ToString()}");
                return(BuildPipeline.BuildPlayer(scenes, path, BuildTarget.WebGL, p.options));
            }
            catch (Exception e) {
                Debug.LogException(e);
            }

            return(null);
        }
Exemplo n.º 5
0
        /////////////////////////////////////////

        public static void SelectItemUpdate()
        {
            if (s_currentPlatform != null && s_currentPlatform.buildTargetGroup != P.i.selectBuildTargetGroup)
            {
                s_currentPlatform = null;
            }
            if (s_currentPlatform == null)
            {
                s_currentPlatform = P.GetSelectPlatform();
                //BMS.i.platformList.Add( m_currentPlatform );
            }
            if (s_currentPlatform.parameters.Count == 0)
            {
                if (s_currentPlatform.buildTargetGroup != BuildTargetGroup.Unknown)
                {
                    s_currentPlatform.AddParams("Debug");
                    s_currentPlatform.AddParams("Release");
                    s_currentPlatform.AddParams("Master");
                    s_changed = true;
                }
            }
            if (P.i.selectParamsIndex < 0)
            {
                P.i.selectParamsIndex = 0;
            }
            else if (s_currentPlatform.parameters.Count <= P.i.selectParamsIndex)
            {
                P.i.selectParamsIndex = s_currentPlatform.parameters.Count - 1;
            }
        }
Exemplo n.º 6
0
        /////////////////////////////////////////

        public static void DrawGUI()
        {
            //E.Load();
            P.Load();
            var targetGroupList = PlatformUtils.GetSupportList();

            ScopeIsCompile.Begin();

            ScopeVertical.Begin();
            HEditorGUILayout.HeaderTitle("Platform");
            GUILayout.Space(8);
            foreach (var t in targetGroupList)
            {
                ScopeChange.Begin();

                var _b = HEditorGUILayout.ToggleBox(P.GetPlatform(t).enable, t.Icon(), t.GetName());
                if (ScopeChange.End())
                {
                    P.GetPlatform(t).enable = _b;
                    P.Save();
                    BuildAssistWindow.ChangeActiveTarget();
                }
            }
            ScopeVertical.End();

            ScopeIsCompile.End();
        }
Exemplo n.º 7
0
        /////////////////////////////////////////

        void DrawGUI()
        {
            Utils.s_changed = false;
            Utils.SelectItemUpdate();

            var w = position.width;
            var h = position.height;

            var drawArea = new Rect(0, EditorStyles.toolbar.fixedHeight, w, position.height - EditorStyles.toolbar.fixedHeight);

            using (new GUILayout.AreaScope(drawArea)) {
                if (P.i.selectScene)
                {
                    m_Drawer_ScenesInBuild.DrawGUI();
                    return;
                }
                else
                {
                    m_Drawer_BuildPlatforms.DrawGUI();
                }

                if (Utils.s_changed)
                {
                    P.Save();
                }
            }
        }
Exemplo n.º 8
0
        /////////////////////////////////////////
        void DrawLeftPane()
        {
            HGUIToolbar.Begin();
            if (HGUIToolbar.Button(EditorIcon.toolbar_plus))
            {
                _add();
            }
            if (HGUIToolbar.Button(EditorIcon.toolbar_minus))
            {
                _minus();
            }
            GUILayout.FlexibleSpace();
            HGUIToolbar.End();

            m_treeViewL?.DrawLayoutGUI();

            void _add()
            {
                m_platform.AddParams($"New ({m_platform.parameters.Count})");
                P.i.selectParamsIndex = m_platform.parameters.Count - 1;
                P.Save();
                m_treeViewL.RegisterFiles();
            }

            void _minus()
            {
                m_platform.parameters.RemoveAt(m_treeViewL.currentItem.index);
                P.Save();
                Utils.SelectItemUpdate();
                m_treeViewL.RegisterFiles();
            }
        }
Exemplo n.º 9
0
        //public virtual void CheckError() { }

        public override void DrawErrorReport(Rect rect)
        {
            var currentParams = P.GetCurrentParams();

            if (currentParams.development)
            {
                MessageInfo(ref rect, SS._Info);
                MessageInfo(ref rect, S._NotethatWebGLdevelopmentbuildsaremuchlargerthanreleasebuildsandshoundnotbepublicsed);
            }
        }
Exemplo n.º 10
0
 public bool UIDraw(Rect rect, P.Params currentParams)
 {
     ScopeChange.Begin();
     currentParams.development = EditorGUI.Toggle(rect.W(16), currentParams.development);
     if (ScopeChange.End())
     {
         P.Save();
         return(true);
     }
     return(false);
 }
Exemplo n.º 11
0
 public bool UIDraw(Rect rect, P.Params currentParams)
 {
     ScopeChange.Begin();
     currentParams.WebGL_exceptionSupport = (WebGLExceptionSupport)EditorGUI.EnumPopup(rect.TrimR(20), currentParams.WebGL_exceptionSupport);
     if (HEditorGUI.IconButton(rect.AlignR(16).AddX(-4), EditorIcon._help))
     {
         EditorUtility.DisplayDialog(SS._Info, infoText, SS._OK);
     }
     if (ScopeChange.End())
     {
         P.Save();
         return(true);
     }
     return(false);
 }
Exemplo n.º 12
0
 public bool UIDraw(Rect rect, P.Params currentParams)
 {
     ScopeChange.Begin();
     currentParams.WebGL_threadsSupport = EditorGUI.Toggle(rect.W(16), currentParams.WebGL_threadsSupport);
     if (HEditorGUI.IconButton(rect.AlignR(16).AddX(-4), EditorIcon._help))
     {
         EditorUtility.DisplayDialog(SS._Info, infoText, SS._OK);
     }
     if (ScopeChange.End())
     {
         P.Save();
         return(true);
     }
     return(false);
 }
Exemplo n.º 13
0
        public static void DrawGUI()
        {
            P.Load();
            PB.Load();
            Styles.Init();

            DrawContentConfig();

            if (s_changed)
            {
                P.Save();
                PB.Save();
                BuildAssistWindow.Repaint();
            }
        }
Exemplo n.º 14
0
        /////////////////////////////////////////

        public static void MakeDefaultOutputDirectory()
        {
            var currentParams = P.GetCurrentParams();

            if (!currentParams.outputDirectoryAuto)
            {
                return;
            }

            var s = $"{Environment.CurrentDirectory}/{currentParams.buildTarget.ToString()}";

            if (currentParams.outputUseConfiguration)
            {
                s += $"/{currentParams.name}";
            }
            currentParams.outputDirectory = DirectoryUtils.Prettyfy(s);
        }
Exemplo n.º 15
0
        public override void CheckError()
        {
            var currentParams = P.GetCurrentParams();
            var lst           = new List <string>(32);

            if (currentParams.scriptingBackend == ScriptingImplementation.IL2CPP)
            {
                var    ss  = UnityEditorModulesModuleManager.GetTargetStringFrom(UnityEditorEditorUserBuildSettings.activeBuildTargetGroup, EditorUserBuildSettings.activeBuildTarget);
                object obj = UnityEditorModulesModuleManager.GetBuildWindowExtension(ss);
                var    ext = new DesktopStandaloneBuildWindowExtension(obj);
                var    mes = ext.GetCannotBuildIl2CppPlayerInCurrentSetupError();
                if (!mes.IsEmpty())
                {
                    lst.Add(mes);
                }
            }
            errorMessages = lst.ToArray();
        }
Exemplo n.º 16
0
        /////////////////////////////////////////

        static string BuildPackage()
        {
            var currentParams = P.GetActiveTargetParams();

            IBuildPlatform builder = null;

            switch (UnityEditorEditorUserBuildSettings.activeBuildTargetGroup)
            {
            case BuildTargetGroup.Standalone:
                builder = new BuildPlatformStandard();
                break;

            case BuildTargetGroup.Android:
                builder = new BuildPlatformAndroid();
                break;

            case BuildTargetGroup.WebGL:
                builder = new BuildPlatformWebGL();
                break;
            }

            if (builder == null)
            {
                return(string.Empty);
            }

            Log($"{builder.GetType().Name}");
            Utils.CallEvent(typeof(Hananoki_BuildPreProcess));

            //Debug.Log( string.Join( " ", PB.GetBuildSceneName( currentParams ) ) );
            var report = builder.BuildPackage(PB.GetBuildSceneName(currentParams));

            //var report = ( UnityEditor.Build.Reporting.BuildReport ) null;
            Utils.CallEvent(typeof(Hananoki_BuildPostProcess));

            if (report == null)
            {
                return(string.Empty);
            }

            Log($"# BuildPipeline Result: {report.summary.result.ToString()}");
            return(report.summary.result.ToString());
        }
Exemplo n.º 17
0
        //static string BuildAssetBundle() {
        //	if( !PB.i.enableAssetBundleBuild ) return string.Empty;

        //	var currentParams = P.GetCurrentParams();
        //	string result = "";

        //	var outputPath = "AssetBundles/" + currentParams.buildTarget.ToString();

        //	if( currentParams.assetBundleOption.Has( P.BUNDLE_OPTION_CLEAR_FILES ) ) {
        //		try {
        //			fs.rm( outputPath, true );
        //		}
        //		catch( Exception e ) {
        //			Debug.LogException( e );
        //		}
        //	}

        //	try {
        //		string[] assetBundleNames = AssetDatabase.GetAllAssetBundleNames();

        //		AssetBundleBuild[] builds = new AssetBundleBuild[ assetBundleNames.Length ];
        //		for( int i = 0; i < builds.Length; i++ ) {
        //			builds[ i ].assetBundleName = assetBundleNames[ i ];
        //			builds[ i ].assetNames = AssetDatabase.GetAssetPathsFromAssetBundle( assetBundleNames[ i ] );
        //		}

        //		fs.mkdir( outputPath );

        //		Debug.Log( "# Start BuildPipeline.BuildAssetBundles:" );
        //		var manifest = BuildPipeline.BuildAssetBundles(
        //				outputPath,
        //				builds,
        //				currentParams.assetBundleOptions,
        //				currentParams.buildTarget );

        //		if( currentParams.assetBundleOption.Has( P.BUNDLE_OPTION_COPY_STREAMINGASSETS ) ) {
        //			for( int i = 0; i < builds.Length; i++ ) {
        //				var p = builds[ i ].assetBundleName;
        //				fs.cp( $"{outputPath}/{p}", $"{Application.streamingAssetsPath}/{p}", true );
        //			}
        //		}

        //		B.CallEvent( typeof( BuildAssistEventAssetBundleBuildPostProcess ) );

        //		AssetDatabase.SaveAssets();
        //		AssetDatabase.Refresh();
        //	}
        //	catch( Exception e ) {
        //		Debug.LogException( e );
        //		throw;
        //	}
        //	return result;
        //}



        public static string Build(int mode)
        {
            Log("Start Build:");
            PB.Load();
            Utils.CallEvent(typeof(Hananoki_BuildStartProcess));

            using (new ScopeBuildExclusionAssets(PB.i.enableExlusionAssets, PB.i.exclusionFileList))
                using (new ScopeBuildSettings())
                    using (new ScopeScriptingDefineSymbols()) {
                        var currentParams = P.GetActiveTargetParams();

                        if (!Application.isBatchMode)
                        {
                            if (EditorUserBuildSettings.activeBuildTarget != currentParams.buildTarget)
                            {
                                EditorUserBuildSettings.SwitchActiveBuildTarget(UnityEditorEditorUserBuildSettings.activeBuildTargetGroup, currentParams.buildTarget);
                            }
                        }

                        var    activeBuildTargetGroup = UnityEditorEditorUserBuildSettings.activeBuildTargetGroup;
                        string symbol = PlayerSettings.GetScriptingDefineSymbolsForGroup(activeBuildTargetGroup);

                        symbol = string.Join(";", symbol, currentParams.scriptingDefineSymbols);

                        PlayerSettings.SetScriptingDefineSymbolsForGroup(activeBuildTargetGroup, symbol);

                        Log($"ActiveBuildTargetGroup: {activeBuildTargetGroup.ToString()}");
                        Log($"ScriptingDefineSymbols: {symbol}");
                        if (mode.Has(0x02))
                        {
                            //BuildAssetBundle();
                            Debug.LogError("BuildAssetBundle is no longer valid");
                        }
                        if (mode.Has(0x01))
                        {
                            BuildPackage();
                        }
                    }

            Log("Exit Build:");

            return("");
        }
Exemplo n.º 18
0
        public bool UIDraw(Rect rect, P.Params currentParams)
        {
            int idx = ArrayUtility.IndexOf(m_memorySize, currentParams.WebGL_memorySize);

            if (idx < 0)
            {
                idx = 1;
            }
            ScopeChange.Begin();
            idx = EditorGUI.Popup(rect.TrimR(20), idx, m_memorySizePopup);

            if (ScopeChange.End())
            {
                currentParams.WebGL_memorySize = m_memorySize[idx];
                P.Save();
                return(true);
            }
            return(false);
        }
Exemplo n.º 19
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());
        }
Exemplo n.º 20
0
        /////////////////////////////////////////

        public static void ChangeActiveTarget()
        {
            if (!P.GetPlatform(P.i.selectBuildTargetGroup).enable)
            {
                //int cur = (int)P.i.selectBuildTargetGroup;
                var  lst    = PlatformUtils.GetSupportList();
                int  cur    = lst.IndexOf(P.i.selectBuildTargetGroup);
                bool finded = false;
                int  idx    = cur - 1;
                while (0 <= idx)
                {
                    if (P.GetPlatform(lst[idx]).enable)
                    {
                        finded = true;
                        goto find;
                    }
                    idx--;
                }
                idx = cur + 1;
                while (idx < lst.Count)
                {
                    if (P.GetPlatform(lst[idx]).enable)
                    {
                        finded = true;
                        goto find;
                    }
                    idx++;
                }
find:
                if (finded)
                {
                    P.i.selectBuildTargetGroup = lst[idx];
                }
                else
                {
                    P.i.selectBuildTargetGroup = BuildTargetGroup.Unknown;
                }
                P.Save();
            }
            s_window.MakeDrawBuildTarget();
            Repaint();
        }
Exemplo n.º 21
0
        public BuildReport BuildPackage(string[] scenes)
        {
            var p    = P.GetActiveTargetParams();
            var path = $"{p.outputDirectory}/{P.GetOutputPackageName( p )}";

            //var scenes = BuildManagerCommand.GetBuildSceneName();
            try {
                B.development    = p.development;
                B.buildAppBundle = p.buildAppBundle;

                B.compressionType             = p.compression;
                B.il2CppCompilerConfiguration = p.il2CppCompilerConfiguration;
                B.scriptingBackend            = p.scriptingBackend;

                if (p.scriptingBackend == ScriptingImplementation.Mono2x)
                {
                    B.targetArchitectures = AndroidArchitecture.ARMv7;
                }
                else
                {
                    B.targetArchitectures = AndroidArchitecture.ARMv7 | AndroidArchitecture.ARM64;
                }

                // どちらのMinifyが利用されるかの調査、下記コードで"Release"がセットされると、後の工程で"Release"の文字列判定でReleaseが選択される模様
                //
                // string value2 = (!Unsupported.IsSourceBuild()) ? ((!development) ? "Release" : "Development") : EditorUserBuildSettings.androidBuildType.ToString();
                //
                // Unsupported.IsSourceBuild()はエディタ上ではFalseが返ってくる
                // 過去バージョンとの兼ね合いかわからないがTrueの場合はEditorUserBuildSettings.androidBuildTypeが利用されることになる
                // 2018.4.12f1時点ではEditorUserBuildSettings.androidBuildTypeは封印されているため、エディタ上からの入力は不可能
                // なのでUnsupported.IsSourceBuild()がTrueでもいいようにEditorUserBuildSettings.androidBuildTypeを書き換える
                B.androidBuildType = p.development ? AndroidBuildType.Development : AndroidBuildType.Release;
                //Log( $"path: {path}" );
                Log($"buildTarget: {p.buildTarget.ToString()}");
                return(BuildPipeline.BuildPlayer(scenes, path, BuildTarget.Android, p.options));
            }
            catch (System.Exception e) {
                Debug.LogException(e);
            }

            return(null);
        }
Exemplo n.º 22
0
        //public void Reinit() => Init();

        public void Init()
        {
            s_window = this;
            s_window.SetTitle(new GUIContent(Package.nameNicify, EditorIcon.buildsettings_psm_small));

            m_Drawer_ScenesInBuild  = new GUI_BuildScenes();
            m_Drawer_BuildPlatforms = new GUI_BuildProperty();

            P.Load();
            Utils.s_currentPlatform = null;

            m_supportBuildTarget = PlatformUtils.GetSupportList();

            //_enableAssetBundle = EditorHelper.HasMenuItem( Window_AssetBundle_Browser );
            _enableBuildReport = EditorHelper.HasMenuItem(Window_Show_Build_Report);


            MakeDrawBuildTarget();
            OnFocus();

            Utils.SelectItemUpdate();
            ChangeActiveTarget();
            m_Drawer_BuildPlatforms.SelectPlatform(Utils.s_currentPlatform, m_buildPlatformDrawer);
        }
Exemplo n.º 23
0
        public BuildReport BuildPackage(string[] scenes)
        {
            var p    = P.GetActiveTargetParams();
            var path = $"{p.outputDirectory}/{P.GetOutputPackageName( p )}";

            //var scenes = BuildManagerCommand.GetBuildSceneName();
            try {
                B.development = p.development;
                //B.buildAppBundle = p.buildAppBundle;

                B.compressionType             = p.compression;
                B.il2CppCompilerConfiguration = p.il2CppCompilerConfiguration;
                B.scriptingBackend            = p.scriptingBackend;

                Log($"path: {path}");
                Log($"buildTarget: {p.buildTarget.ToString()}");
                return(BuildPipeline.BuildPlayer(scenes, path, p.buildTarget, p.options));
            }
            catch (System.Exception e) {
                Debug.LogException(e);
            }

            return(null);
        }
Exemplo n.º 24
0
        /////////////////////////////////////////

        public static void ExecuteBuildPackage()
        {
            EditorApplication.delayCall += BuildPackage;
            B.s_buildProcess             = true;
            BuildAssistWindow.Repaint();

            void BuildPackage()
            {
                using (new BuildProcessScope()) {
                    P.SetBuildParamIndex();
                    try {
                        var flag = 0x01;
                        if (P.GetCurrentParams().buildAssetBundlesTogether)
                        {
                            flag |= 0x02;
                        }
                        BuildCommands.Build(flag);
                    }
                    catch (Exception e) {
                        Debug.LogException(e);
                    }
                }
            };
        }
Exemplo n.º 25
0
        public bool UIDraw(Rect rect, P.Params currentParams)
        {
            EditorGUI.LabelField(rect, PB.i.GetSelectedPopupName(currentParams), EditorStyles.popup);

            if (EditorHelper.HasMouseClick(rect))
            {
                void OnSelect(object context)
                {
                    currentParams.buildSceneSetIndex = (int)context;
                    P.Save();
                }

                var m = new GenericMenu();
                m.AddItem(S._UsethestandardBuildSettings, false, OnSelect, -1);
                m.AddSeparator("");
                for (int idx = 0; idx < PB.i.profileList.Count; idx++)
                {
                    var p = PB.i.profileList[idx];
                    m.AddItem(p.profileName, false, OnSelect, idx);
                }
                m.DropDownPopupRect(rect);
            }
            return(false);
        }
Exemplo n.º 26
0
        /////////////////////////////////////////
        void DrawRightPane()
        {
            var currentParams = P.GetCurrentParams();

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

            HGUIToolbar.Begin();
            GUILayout.Label(EditorHelper.TempContent($"{PlayerSettings.productName}",
                                                     $"{S._CompanyName}\t{PlayerSettings.companyName}\n{S._ProductName}\t{PlayerSettings.productName}\n{S._Version}\t{PlayerSettings.bundleVersion}"), EditorStyles.toolbarButton);
            GUILayout.FlexibleSpace();

            ScopeDisable.Begin(!currentParams.development);
            E.connectProfiler.Value = HEditorGUILayout.SessionToggleLeft(S._ConnectProfiler, S._ProfilingisonlyenabledinaDevelopmentPlayer, E.connectProfiler.Value);
            ScopeDisable.End();

            E.autoRunPlayer.Value = HEditorGUILayout.SessionToggleLeft(S._AutoRunPlayer, E.autoRunPlayer.Value);

            if (UnityEditorEditorUserBuildSettings.activeBuildTargetGroup != P.i.selectBuildTargetGroup)
            {
                HGUIToolbar.DropDown2(S._SwitchPlatform, EditorIcon.warning
                                      , OnSwitchPlatform
                                      , OnDropAction);
            }
            else
            {
                HGUIToolbar.DropDown2(E.autoRunPlayer.Value ? S._BuildAndRun : S._Build
                                      , OnBuild
                                      , OnDropAction);
            }

            OnPlayButton(currentParams);

            HGUIToolbar.End();

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

            using (new GUILayoutScope(1, 0)) {
                m_treeViewR?.DrawLayoutGUI();

                var aa = GUILayoutUtility.GetLastRect();                // .GetRect( GUIContent.none, EditorStyles.label );

                var rc = m_treeViewR.m_lastCellRect;
                rc.x      = aa.x;
                rc.y     += EditorStyles.toolbar.fixedHeight;
                rc.y     += EditorGUIUtility.singleLineHeight;
                rc.y     += 8;
                rc.height = EditorGUIUtility.singleLineHeight;

                if (Utils.IsModuleInstalled(m_platform.buildTargetGroup, currentParams.buildTarget))
                {
                    rc.height = 40;
                    EditorGUI.HelpBox(rc.AlignCenterW(rc.width - 40), string.Format(S._No_0_moduleloaded_, m_UnityEditorBuildBuildPlatforms.GetModuleDisplayName(m_platform.buildTargetGroup, currentParams.buildTarget)), MessageType.Warning);
                    var rc2 = rc;
                    rc2.x     = rc.xMax - 240;
                    rc2.width = 200;
                    if (GUI.Button(rc2.AlignCenterH(20), S._InstallWithUnityHub))
                    {
                        string playbackEngineDownloadURL = UnityEditorBuildPlayerWindow.GetUnityHubModuleDownloadURL(m_platform.buildTargetGroup, currentParams.buildTarget);
                        Debug.Log(playbackEngineDownloadURL);
                        Help.BrowseURL(playbackEngineDownloadURL);
                    }
                    rc.y += 40 + 8;
                }
                m_buildPlatformDrawer?.DrawErrorReport(rc);
            }

            var lrc = GUILayoutUtility.GetLastRect();

            lrc.y      = lrc.yMax - EditorGUIUtility.singleLineHeight - 8;
            lrc.height = EditorGUIUtility.singleLineHeight;
            lrc        = lrc.AlignR(B.currentOutputPackageFullName.CalcSize(HEditorStyles.treeViewLine).x);
            lrc.x     -= 8;
            GUI.Label(lrc, B.currentOutputPackageFullName, HEditorStyles.treeViewLine);
        }
Exemplo n.º 27
0
 public void Draw(BuildAssistWindow parent)
 {
     var currentParams = P.GetCurrentParams();
 }
Exemplo n.º 28
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();
        }