protected virtual void DrawWit() { // Recommended max size based on EditorWindow.maxSize doc for resizable window. if (welcomeSizeSet) { welcomeSizeSet = false; maxSize = new Vector2(4000, 4000); } titleContent = new GUIContent("Wit Configuration"); GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.BeginHorizontal(); if (null == serverToken) { serverToken = WitAuthUtility.ServerToken; } serverToken = EditorGUILayout.PasswordField("Server Access Token", serverToken); if (GUILayout.Button(WitStyles.PasteIcon, WitStyles.ImageIcon)) { serverToken = EditorGUIUtility.systemCopyBuffer; WitAuthUtility.ServerToken = serverToken; RefreshContent(); } if (GUILayout.Button("Relink", GUILayout.Width(75))) { if (WitAuthUtility.IsServerTokenValid(serverToken)) { WitConfigurationEditor.UpdateTokenData(serverToken, RefreshContent); } WitAuthUtility.ServerToken = serverToken; RefreshContent(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); var configChanged = DrawWitConfigurationPopup(); if (GUILayout.Button("Create", GUILayout.Width(75))) { CreateConfiguration(); } GUILayout.EndHorizontal(); if (witConfiguration && (configChanged || !witEditor)) { WitConfiguration config = (WitConfiguration)witConfiguration; SetWitEditor(); } if (witConfiguration && witEditor) { witEditor.OnInspectorGUI(); } GUILayout.EndVertical(); }
protected virtual void SetWitEditor() { if (witConfiguration) { witEditor = (WitConfigurationEditor)Editor.CreateEditor(witConfiguration); witEditor.drawHeader = false; witEditor.Initialize(); } }
protected virtual void CreateConfiguration() { var asset = WitConfigurationEditor.CreateWitConfiguration(serverToken, Repaint); if (asset) { RefreshConfigList(); witConfigIndex = Array.IndexOf(witConfigs, asset); witConfiguration = asset; SetWitEditor(); } }