예제 #1
0
 private void RenderDebug()
 {
     if (AssetStoreManager.sDbgButtons)
     {
         GUILayout.FlexibleSpace();
         GUILayout.Label("Debug: ", AssetStoreManager.Styles.ToolbarLabel, new GUILayoutOption[0]);
         if (GUILayout.Button("FileSelector", EditorStyles.toolbarButton, new GUILayoutOption[0]))
         {
             FileSelector.Show("/", new List <string>(), delegate(List <string> newList)
             {
                 foreach (string str in newList)
                 {
                     DebugUtils.Log(str);
                 }
             });
         }
         if (GUILayout.Button("Reload", EditorStyles.toolbarButton, new GUILayoutOption[0]))
         {
             AssetStoreAPI.GetMetaData(this.Account, this.m_PackageDataSource, delegate(string errMessage)
             {
                 if (errMessage != null)
                 {
                     Debug.LogError("Error fetching metadata: " + errMessage);
                     LoginWindow.Logout();
                     AssetStoreManager.Login("Login to fetch current list of published packages");
                     base.Repaint();
                     return;
                 }
                 this.m_PackageController.AutoSetSelected(this);
                 base.Repaint();
             });
         }
         if (GUILayout.Button("Logout", EditorStyles.toolbarButton, new GUILayoutOption[0]))
         {
             AssetStoreClient.Logout();
         }
     }
 }
예제 #2
0
 public static void Login(string loginReason, LoginWindow.LoginCallback callback, Rect windowRect)
 {
     if (AssetStoreClient.HasActiveSessionID)
     {
         AssetStoreClient.Logout();
     }
     if (UnityConnectSession.instance.LoggedIn())
     {
         AssetStoreClient.LoginWithAccessToken(delegate(string errorMessage)
         {
             if (string.IsNullOrEmpty(errorMessage))
             {
                 callback(errorMessage);
             }
             else
             {
                 LoginWindow.ShowLoginWindow(loginReason, callback, windowRect);
             }
         });
         return;
     }
     if (!AssetStoreClient.RememberSession || !AssetStoreClient.HasSavedSessionID)
     {
         LoginWindow.ShowLoginWindow(loginReason, callback, windowRect);
         return;
     }
     AssetStoreClient.LoginWithRememberedSession(delegate(string errorMessage)
     {
         if (string.IsNullOrEmpty(errorMessage))
         {
             callback(errorMessage);
         }
         else
         {
             LoginWindow.ShowLoginWindow(loginReason, callback, windowRect);
         }
     });
 }
예제 #3
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;
            }
        }
예제 #4
0
 public static void Login(string loginReason, LoginWindow.LoginCallback callback)
 {
     LoginWindow.Login(loginReason, callback, new Rect(100f, 100f, 360f, 180f));
 }
예제 #5
0
 private static void ShowLoginWindow(string loginReason, LoginWindow.LoginCallback callback, Rect windowRect)
 {
     LoginWindow.ShowLoginWindow(loginReason, null, callback, new Rect(100f, 100f, 360f, 180f));
 }
예제 #6
0
 public static void ShowLoginWindow(string loginReason, string errorMessage, LoginWindow.LoginCallback callback)
 {
     LoginWindow.ShowLoginWindow(loginReason, errorMessage, callback, new Rect(100f, 100f, 360f, 180f));
 }
예제 #7
0
 public static void ShowLoginWindow(string loginReason, LoginWindow.LoginCallback callback)
 {
     LoginWindow.ShowLoginWindow(loginReason, callback, new Rect(100f, 100f, 360f, 140f));
 }