public void OnGUI() { if (AssetStoreClient.LoginInProgress() || LoginWindow.IsLoggedIn) { GUI.enabled = false; } GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.Label(GUIUtil.Logo, GUIStyle.none, new GUILayoutOption[] { GUILayout.Width(80f), GUILayout.Height(80f) }); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.BeginHorizontal(new GUILayoutOption[0]); if (this.m_LoginReason.Length > 80) { this.m_LoginReason = this.m_LoginReason.Substring(0, 80) + "..."; } GUILayout.Label(this.m_LoginReason, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]); GUILayout.EndHorizontal(); GUILayout.Space(3f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); if (this.m_LoginRemoteMessage != null) { Color color = GUI.color; GUI.color = GUIUtil.ErrorColor; if (this.m_LoginRemoteMessage.Length > 80) { this.m_LoginRemoteMessage = this.m_LoginRemoteMessage.Substring(0, 80) + "..."; } GUILayout.Label(this.m_LoginRemoteMessage, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]); GUI.color = color; } GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label("Email", new GUILayoutOption[] { GUILayout.Width(62f) }); this.m_Email = EditorGUILayout.TextField(this.m_Email, new GUILayoutOption[0]); GUILayout.EndHorizontal(); GUILayout.Space(3f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label("Password", new GUILayoutOption[] { GUILayout.Width(62f) }); this.m_Password = EditorGUILayout.PasswordField(this.m_Password, new GUILayoutOption[0]); GUILayout.EndHorizontal(); GUILayout.Space(3f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); bool rememberSession = AssetStoreClient.RememberSession; bool flag = EditorGUILayout.ToggleLeft("Remember me", rememberSession, new GUILayoutOption[] { GUILayout.MaxWidth(160f) }); if (flag != rememberSession) { AssetStoreClient.RememberSession = flag; } GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(new GUILayoutOption[0]); Color color2 = GUI.color; GUI.color = Color.grey; if (GUILayout.Button("Forgot password?", EditorStyles.miniLabel, new GUILayoutOption[0])) { Application.OpenURL("https://accounts.unity3d.com/password/new"); } EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), (MouseCursor)4); GUI.color = color2; GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(3f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(10f); if (GUILayout.Button("Create Publisher ID", new GUILayoutOption[0])) { Application.OpenURL("https://publisher.assetstore.unity3d.com/?xunitysession=" + AssetStoreClient.XUnitySession); this.m_LoginRemoteMessage = "Cancelled - creating Publisher ID"; base.Close(); } GUILayout.FlexibleSpace(); if (GUILayout.Button("Cancel", new GUILayoutOption[0])) { this.m_LoginRemoteMessage = "Cancelled"; base.Close(); } GUILayout.Space(3f); if (GUILayout.Button("Login", new GUILayoutOption[0])) { this.Login(); this.Repaint(); } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.EndVertical(); if (Event.current.Equals(Event.KeyboardEvent("return"))) { this.Login(); this.Repaint(); } }
public void OnGUI() { if (AssetStoreClient.LoginInProgress() || LoginWindow.IsLoggedIn) { GUI.enabled = false; } GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(5f); GUILayout.Label(GUIUtil.Logo, GUIStyle.none, new GUILayoutOption[] { GUILayout.ExpandWidth(false) }); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(6f); GUILayout.Label(this.m_LoginReason, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]); Rect lastRect = GUILayoutUtility.GetLastRect(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(6f); Rect lastRect2 = new Rect(0f, 0f, 0f, 0f); if (this.m_LoginRemoteMessage != null) { Color color = GUI.color; GUI.color = Color.red; GUILayout.Label(this.m_LoginRemoteMessage, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]); GUI.color = color; lastRect2 = GUILayoutUtility.GetLastRect(); } float num = lastRect.height + lastRect2.height + 110f; if (Event.current.type == EventType.Repaint && num != base.position.height) { base.position = new Rect(base.position.x, base.position.y, base.position.width, num); base.Repaint(); } GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(6f); GUILayout.BeginVertical(new GUILayoutOption[0]); GUI.SetNextControlName("username"); GUILayout.Label("Username", new GUILayoutOption[0]); GUILayout.Label("Password", new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.BeginVertical(new GUILayoutOption[0]); this.m_Username = EditorGUILayout.TextField(this.m_Username, new GUILayoutOption[0]); this.m_Password = EditorGUILayout.PasswordField(this.m_Password, new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.Label(" ", new GUILayoutOption[0]); Color color2 = GUI.color; GUI.color = Color.blue; if (GUILayout.Button("Forgot?", EditorStyles.miniLabel, new GUILayoutOption[0])) { Application.OpenURL("https://accounts.unity3d.com/password/new"); } GUI.color = color2; GUILayout.EndVertical(); GUILayout.EndHorizontal(); bool rememberSession = AssetStoreClient.RememberSession; bool flag = EditorGUILayout.Toggle("Remember me", rememberSession, new GUILayoutOption[0]); if (flag != rememberSession) { AssetStoreClient.RememberSession = flag; } GUILayout.EndVertical(); GUILayout.Space(5f); GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); if (GUILayout.Button("Create account", new GUILayoutOption[0])) { AssetStore.Open("createuser/"); this.m_LoginRemoteMessage = "Cancelled - create user"; base.Close(); } GUILayout.FlexibleSpace(); if (GUILayout.Button("Cancel", new GUILayoutOption[0])) { this.m_LoginRemoteMessage = "Cancelled"; base.Close(); } GUILayout.Space(5f); if (GUILayout.Button("Login", new GUILayoutOption[0])) { this.Login(); base.Repaint(); } GUILayout.Space(5f); GUILayout.EndHorizontal(); GUILayout.Space(5f); GUILayout.EndVertical(); if (Event.current.Equals(Event.KeyboardEvent("return"))) { this.Login(); base.Repaint(); } if (this.m_Username == string.Empty) { GUI.FocusControl("username"); } }