Exemplo n.º 1
0
        public override void OnGUI(Rect position)
        {
            Styles.Init();

            GUILayout.Label(Content.welcomeText, GlobalStyles.welcomeTextStyle);

            var selectorRect = GUILayoutUtility.GetRect(position.width, 260);

            selector.Draw(selectorRect);

            GUILayout.BeginVertical(Styles.extraStyle);

            GUILayout.Label(Content.extraText, EditorStyles.boldLabel);

            EditorGUIUtility.SetIconSize(new Vector2(16, 16));

            var noExtrasToShow = true;
            var documentPath   = GetDocumentationPath();

            if (!string.IsNullOrEmpty(documentPath))
            {
                GlobalStyles.LayoutExternalLink(Content.documentationText, GetDocumentationPath());
                noExtrasToShow = false;
            }

            var demoPath = GetDemoPath();

            if (!string.IsNullOrEmpty(demoPath))
            {
                if (GlobalStyles.LayoutButtonLink(Content.viewDemoText))
                {
                    EditorSceneManager.OpenScene(demoPath, OpenSceneMode.Single);
                }
                noExtrasToShow = false;
            }

            if (noExtrasToShow)
            {
                GUILayout.Label(Content.noExtrasText);
            }

            GUILayout.EndVertical();
        }
Exemplo n.º 2
0
        public override void OnGUI(Rect position)
        {
            Styles.Init();

            Rect headerRect;

            var   halfWidth     = position.width * 0.5f;
            float runningHeight = 0;

            float headerHeight = 200;
            var   splashImg    = Content.splashImg;

            if (splashImg != null)
            {
                // image splash
                headerRect = new Rect(position.width * 0.5f - splashImg.width * 0.5f, 0, splashImg.width, headerHeight);
                GUI.Box(new Rect(0, 0, position.width, headerHeight), GUIContent.none, Styles.fallbackHeaderStyle);
                GUI.DrawTexture(headerRect, splashImg, ScaleMode.ScaleToFit);
            }
            else
            {
                // text splash
                headerRect = new Rect(0, 0, position.width, headerHeight);
                GUI.Label(headerRect, Content.headerText, Styles.fallbackHeaderStyle);
            }

            runningHeight += headerRect.height;

            var textWidth       = Mathf.Min(position.width * 0.6f, 500);
            var welcomeTextRect = new Rect(halfWidth - textWidth * 0.5f, headerRect.height, textWidth, GlobalStyles.welcomeTextStyle.CalcHeight(Content.welcomeText, textWidth));

            GUI.Label(welcomeTextRect, Content.welcomeText, GlobalStyles.welcomeTextStyle);

            runningHeight += welcomeTextRect.height;

            var selectionBounds = new Rect(0, runningHeight, position.width, 260);

            selector.Draw(selectionBounds);
        }