void OnGUI() { if (initialized) { if (createNew) { EditorGUILayout.LabelField("Add credential ", EditorStyles.whiteLargeLabel); registry.url = EditorGUILayout.TextField("url: ", registry.url); } else { EditorGUILayout.LabelField("Edit credential", EditorStyles.whiteLargeLabel); EditorGUILayout.LabelField("url: " + registry.url); } registry.auth = EditorGUILayout.Toggle("Always auth: ", registry.auth); registry.token = EditorGUILayout.TextField("Token: ", registry.token); EditorGUILayout.Space(); tokenMethod = GetTokenView.CreateGUI(tokenMethod, registry); EditorGUILayout.Space(); EditorGUILayout.LabelField("Tip: Restart Unity to reload credentials after saving."); if (createNew) { if (GUILayout.Button("Add")) { Save(); } } else { if (GUILayout.Button("Save")) { Save(); } } if (GUILayout.Button("Cancel")) { Close(); GUIUtility.ExitGUI(); } } }
void OnGUI() { if (initialized) { if (createNew) { EditorGUILayout.LabelField("Add scoped registry ", EditorStyles.whiteLargeLabel); registry.name = EditorGUILayout.TextField("name: ", registry.name); EditorGUI.BeginChangeCheck(); registry.url = EditorGUILayout.TextField("url: ", registry.url); if (EditorGUI.EndChangeCheck()) { UpdateCredential(); } } else { EditorGUILayout.LabelField("Edit scoped registry", EditorStyles.whiteLargeLabel); EditorGUILayout.LabelField("Name: " + registry.name); EditorGUILayout.LabelField("url: " + registry.url); } string scope = String.Join(",", registry.scopes); scope = EditorGUILayout.TextField("Scope: ", scope); registry.scopes = scope.Split(','); registry.auth = EditorGUILayout.Toggle("Always auth: ", registry.auth); registry.token = EditorGUILayout.TextField("Token: ", registry.token); EditorGUILayout.Space(); tokenMethod = GetTokenView.CreateGUI(tokenMethod, registry); EditorGUILayout.Space(); EditorGUILayout.LabelField("Tip: Restart Unity to reload credentials after saving."); if (createNew) { if (GUILayout.Button("Add")) { Add(); } } else { if (GUILayout.Button("Save")) { Save(); } } if (GUILayout.Button("Cancel")) { Close(); GUIUtility.ExitGUI(); } } }
private static void CreateWindow(TokenMethod method, ScopedRegistry registry) { GetTokenView getTokenView = EditorWindow.GetWindow <GetTokenView>(true, "Get token", true); getTokenView.SetRegistry(method, registry); }