Exemple #1
0
        /////////////////////////////////////////

        public static bool IsModuleInstalled(BuildTargetGroup buildTargetGroup, BuildTarget buildTarget)
        {
            bool   flag             = UnityEditorBuildPipeline.LicenseCheck(buildTarget);
            string targetStringFrom = UnityEditorModulesModuleManager.GetTargetStringFrom(buildTargetGroup, buildTarget);

            return(flag &&
                   !string.IsNullOrEmpty(targetStringFrom) &&
                   UnityEditorModulesModuleManager.GetBuildPostProcessor(targetStringFrom) == null &&
                   (buildTargetGroup != BuildTargetGroup.Standalone || !UnityEditorBuildPlayerWindow.IsAnyStandaloneModuleLoaded()));
        }
        /////////////////////////////////////////
        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);
        }