Esempio n. 1
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);
            }
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
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);
        }
Esempio n. 4
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();
        }
Esempio n. 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());
        }
Esempio n. 6
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);
                    }
                }
            };
        }
Esempio n. 7
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);
        }
Esempio n. 8
0
 public void Draw(BuildAssistWindow parent)
 {
     var currentParams = P.GetCurrentParams();
 }