private void HandleRequestCompleted(bool success, string fileData) { if (success) { ProcessCSVData(fileData); } _request = null; }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.Space(); EditorGUILayout.PropertyField(_properyDefaultLanguage); if (Application.isPlaying) { string[] languageOptions = _controller.GetSupportedLanguages(); int languageCode = System.Array.IndexOf <string>(languageOptions, _controller.currentLanguage); int newCode = EditorGUILayout.Popup("Current Language", languageCode, languageOptions); if (languageCode != newCode && newCode > -1) { _controller.currentLanguage = languageOptions[newCode]; } } EditorGUILayout.Space(); EditorGUILayout.LabelField("Importer", EditorStyles.boldLabel); EditorGUI.BeginDisabledGroup(_request != null && !_request.IsDone); EditorGUILayout.PropertyField(_properyOutputCharacters); if (_properyOutputCharacters.boolValue) { EditorGUILayout.PropertyField(_properyOutputCharactersMap, true); EditorGUILayout.PropertyField(_properyIgnoreRichText); EditorGUILayout.PropertyField(_properyOutputCharactersInclude); } EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Load From CSV", GUILayout.Width(150))) { ProcessCSV(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("Google Sheets", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(_properyDocumentID); if (GUILayout.Button("Open Document", EditorStyles.miniButton, GUILayout.Width(100))) { GoogleSheetsDownloader.OpenGoogleSheet(_properyDocumentID.stringValue, _properySheetID.stringValue); } EditorGUILayout.EndHorizontal(); EditorGUILayout.PropertyField(_properySheetID); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Download CSV", GUILayout.Width(150))) { _request = new GoogleSheetsDownloader(_properyDocumentID.stringValue, _properySheetID.stringValue); _request.SendRequest(HandleRequestCompleted); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUI.EndDisabledGroup(); serializedObject.ApplyModifiedProperties(); }