void FieldsGUI() { AS_Preferences.overrideExistingTables = EditorGUILayout.BeginToggleGroup("Override Existing Tables", AS_Preferences.overrideExistingTables); string dropMsg = "This will DROP (if they exist) the following database tables:\n'Accounts'"; dropMsg += AS_Preferences.requireEmailActivation ? ", 'Confirm'" : ""; dropMsg += AS_Preferences.enablePasswordRecovery ? ", 'PasswordReset'" : ""; GUILayout.Label(dropMsg, EditorStyles.boldLabel, GUILayout.Height(30)); EditorGUILayout.EndToggleGroup(); GUILayout.Label("", GUILayout.Height(8)); GUILayout.Label("Accounts Table:", EditorStyles.boldLabel); string tableMsg = "By default the 'Accounts' table contains the following fields:\n{id, username, password"; tableMsg += AS_Preferences.askUserForEmail ? ", email" : ""; tableMsg += AS_Preferences.requireEmailActivation ? ", isactive" : ""; tableMsg += ", custominfo}"; GUILayout.Label(tableMsg); GUILayout.Label("", GUILayout.Height(8)); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Add Field", new GUILayoutOption[] { GUILayout.Width(150), GUILayout.Height(20) })) { additionalFields.Add(new AS_MySQLField()); } EditorGUILayout.EndHorizontal(); GUILayout.Label("", GUILayout.Height(12)); int count = additionalFields.Count; if (count > 0) { EditorGUILayout.BeginVertical(); lastPos = EditorGUILayout.BeginScrollView(lastPos, new GUILayoutOption[] { GUILayout.Width(600) }); EditorGUILayout.BeginHorizontal(); fieldsOk = true; for (int i = 0; i < count; i++) { if (FieldGUI(i)) { break; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndScrollView(); GUILayout.FlexibleSpace(); EditorGUILayout.EndVertical(); } if (GUI.Button(new Rect(10, 430, 120, 30), "Back")) { state = AS_SetupState.CredentialsAndPreferences; } GUI.Label(new Rect(10, 380, 400, 40), initializeDbMessage); if (GUI.Button(new Rect(200, 420, 200, 50), "Initialize Database")) { InitializeDatabase(); } }
public static void ShowWindow(string name, string _message, AS_SetupWindow caller = null, AS_SetupState _stateToLoad = AS_SetupState.CredentialsAndPreferences) { //Show existing window instance. If one doesn't exist, make one. AS_PopUpWindow window = (AS_PopUpWindow)EditorWindow.GetWindow(typeof(AS_PopUpWindow)); window.minSize = new Vector2(460, 110); window.name = name; window.title = name; window.caller = caller; window.stateToLoad = _stateToLoad; window.position = new Rect(600, 400, window.minSize.x, window.minSize.y); window.message = _message; }