private void TitleGUI() { if (IsAdminMode) { GUI.backgroundColor = _adminModeColor; GUILayout.BeginHorizontal(EditorStyles.toolbar); GUILayout.Label("Developer Mode"); GUILayout.FlexibleSpace(); if (GUILayout.Button("Logout", EditorStyles.toolbarPopup)) { IsAdminMode = false; } GUILayout.EndHorizontal(); GUI.backgroundColor = Color.white; } else { GUILayout.BeginHorizontal(EditorStyles.toolbar); GUILayout.FlexibleSpace(); if (GUILayout.Button("Admin Login", EditorStyles.toolbarPopup)) { AdminLoginWindow.OpenWindow(this); } GUILayout.EndHorizontal(); } }
public static void OpenWindow(IAdminLoginWindow parent) { AdminLoginWindow window = GetWindow <AdminLoginWindow>(); window._parent = parent; window.titleContent.text = "Admin Login"; window.minSize = new Vector2(250, 50); window.maxSize = new Vector2(250, 50); window.Show(); }
public static void OpenWindow(IAdminLoginWindow parent, HTFAction <string> checkAction) { AdminLoginWindow window = GetWindow <AdminLoginWindow>(); window._parent = parent; window._checkAction = checkAction; window.titleContent.text = "Admin Login"; window.position = new Rect(parent.Cast <HTFEditorWindow>().position.center - new Vector2(125, 0), new Vector2(250, 50)); window.minSize = new Vector2(250, 50); window.maxSize = new Vector2(250, 50); window.Show(); }
protected void OnGUI() { OnGUIReady(); if (IsEnableTitleGUI) { GUI.backgroundColor = IsAdminMode ? AdminModeColor : Color.white; GUILayout.BeginHorizontal(EditorStyles.toolbar); if (IsAdminMode) { GUILayout.Label(GetWord("Admin Mode")); } OnTitleGUI(); if (_localizeWindow != null) { if (GUILayout.Button(GetWord("Localize"), EditorStyles.toolbarPopup)) { GenericMenu gm = new GenericMenu(); gm.AddItem(new GUIContent("简体中文"), CurrentLanguage == Language.Chinese, () => { CurrentLanguage = Language.Chinese; }); gm.AddItem(new GUIContent("English"), CurrentLanguage == Language.English, () => { CurrentLanguage = Language.English; }); if (IsEnableKorean) { gm.AddItem(new GUIContent("한국어"), CurrentLanguage == Language.Korean, () => { CurrentLanguage = Language.Korean; }); } else { gm.AddDisabledItem(new GUIContent("한국어")); } if (IsEnableJapanese) { gm.AddItem(new GUIContent("日本語"), CurrentLanguage == Language.Japanese, () => { CurrentLanguage = Language.Japanese; }); } else { gm.AddDisabledItem(new GUIContent("日本語")); } gm.ShowAsContext(); } } if (_adminLoginWindow != null) { if (IsAdminMode) { if (GUILayout.Button(GetWord("Logout"), EditorStyles.toolbarPopup)) { IsAdminMode = false; } } else { if (GUILayout.Button(GetWord("Admin Login"), EditorStyles.toolbarPopup)) { AdminLoginWindow.OpenWindow(_adminLoginWindow, OnAdminCheck); } } } if (!string.IsNullOrEmpty(HelpUrl)) { if (GUILayout.Button(_helpGC, EditorGlobalTools.Styles.IconButton)) { Application.OpenURL(HelpUrl); } } GUILayout.EndHorizontal(); GUI.backgroundColor = Color.white; } OnBodyGUI(); }