Beispiel #1
0
        private void BeginRenderSection(string title, string content, ref bool shouldFoldout)
        {
            EditorGUILayout.BeginVertical(EditorStyles.helpBox, new GUILayoutOption[0]);
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUIStyle guistyle = new GUIStyle(EditorStyles.foldout);

            guistyle.margin = new RectOffset(10, 0, 15, 0);
            if (shouldFoldout)
            {
                guistyle.normal.background = guistyle.onActive.background;
            }
            else
            {
                guistyle.normal.background = guistyle.active.background;
            }
            GUILayout.Label(string.Empty, guistyle, new GUILayoutOption[0]);
            GUIStyle guistyle2 = new GUIStyle(EditorStyles.helpBox);

            guistyle2.onHover.background = Texture2D.blackTexture;
            guistyle2.normal.background  = Texture2D.blackTexture;
            guistyle2.fontSize           = 16;
            if (EditorGUIUtility.isProSkin)
            {
                guistyle2.normal.textColor = new Color(1f, 1f, 1f);
            }
            EditorGUILayout.LabelField(new GUIContent(title, EditorGUIUtility.IconContent("d_console.infoicon").image), guistyle2, new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), (MouseCursor)4);
            if (GUIUtil.IsClickedOnLastRect())
            {
                shouldFoldout = !shouldFoldout;
            }
            if (shouldFoldout)
            {
                HelpWindow.RenderHorizontalLine(new Color32(37, 37, 37, byte.MaxValue));
                if (!string.IsNullOrEmpty(content))
                {
                    EditorGUILayout.LabelField(content, new GUIStyle(EditorStyles.wordWrappedLabel)
                    {
                        richText = true
                    }, new GUILayoutOption[0]);
                }
            }
        }
        private void RenderMenu()
        {
            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            this.RenderToolbar();
            GUILayout.EndHorizontal();
            bool flag = false;

            if (!LoginWindow.IsLoggedIn)
            {
                if (!LoginWindow.IsVisible)
                {
                    LoginWindow.Login("To upload packages, please log in to your Asset Store Publisher account.", new LoginWindow.LoginCallback(AssetStoreManager.OnLoggedIn), GUIUtil.RectOnRect(360f, 180f, base.position));
                }
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.Space(10f);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUILayout.Label(GUIUtil.StatusWheel, new GUILayoutOption[0]);
                GUILayout.Label("Please login", new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
            }
            else
            {
                if (this.Account.mStatus == AssetStorePublisher.Status.NotLoaded)
                {
                    this.Account.mStatus = AssetStorePublisher.Status.Loading;
                    AssetStoreAPI.GetMetaData(this.Account, this.m_PackageDataSource, delegate(string errMessage)
                    {
                        if (errMessage != null)
                        {
                            Debug.LogError("Error fetching metadata: " + errMessage);
                            LoginWindow.Logout();
                            AssetStoreManager.Login("To upload packages, please log in to your Asset Store Publisher account.", "Account is not registered as a Publisher. \nPlease create a Publisher ID.");
                            this.Repaint();
                            return;
                        }
                        this.m_PackageController.AutoSetSelected(this);
                        this.Repaint();
                    });
                }
                if (this.Account.mStatus == AssetStorePublisher.Status.NotLoaded || this.Account.mStatus == AssetStorePublisher.Status.Loading)
                {
                    GUILayout.BeginVertical(new GUILayoutOption[0]);
                    GUILayout.Space(10f);
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(GUIUtil.StatusWheel, new GUILayoutOption[0]);
                    GUILayout.Label("Fetching account information", new GUILayoutOption[0]);
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();
                    GUILayout.EndVertical();
                    this.Repaint();
                }
                else
                {
                    bool enabled = GUI.enabled;
                    if (this.Account.mStatus != AssetStorePublisher.Status.Existing)
                    {
                        GUI.enabled = false;
                    }
                    GUI.enabled = enabled;
                    flag        = true;
                }
            }
            if (!flag && this.m_PackageController.SelectedPackage != null)
            {
                this.m_PackageController.SelectedPackage = null;
            }
        }