//----- property ----- //----- method ----- public override void OnInspectorGUI() { instance = target as SpreadsheetConfig; if (connector == null) { connector = new SpreadsheetConnector(); connector.Initialize(instance); } serializedObject.Update(); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(serializedObject.FindProperty("clientId")); EditorGUILayout.PropertyField(serializedObject.FindProperty("clientSecret")); EditorGUILayout.PropertyField(serializedObject.FindProperty("redirectUri")); EditorGUILayout.PropertyField(serializedObject.FindProperty("scope")); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } using (new DisableScope(connector.State != SpreadsheetConnector.AuthenticationState.SignIn)) { EditorGUILayout.Separator(); if (GUILayout.Button("SignOut")) { connector.SignOut(); } } }
//----- method ----- protected virtual void Initialize() { minSize = WindowSize; titleContent = new GUIContent(WindowTitle); var spreadsheetConfig = SpreadsheetConfig.Instance; connector = new SpreadsheetConnector(); connector.Initialize(spreadsheetConfig); Show(true); }