public override void OnGUI(Rect rect) { GUI.skin.label.richText = true; GUILayout.Space(10); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { GUILayout.Label(new GUIContent("Create New SpreadSheet Config".ToBold(), GUIHelper.Textures.ScriptableObjectIcon), GUILayout.Height(20)); newSpreadSheetConfigName = EditorGUILayout.TextField(newSpreadSheetConfigName); if (GUILayout.Button("Create")) { WindowHelper.CreateNewSpreadSheetConfig(newSpreadSheetConfigName); WindowHelper.ConstructData(); SpreadSheetConvertToolWindow.win.Initialize(); this.editorWindow.Close(); } } EditorGUILayout.EndVertical(); GUILayout.Space(5); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { GUILayout.Label(new GUIContent("Create New Converter Script".ToBold(), GUIHelper.Textures.ScriptIcon), GUILayout.Height(20)); newConverterScriptName = EditorGUILayout.TextField(newConverterScriptName); if (GUILayout.Button("Create")) { FileUtility.CreateConverterScript(newConverterScriptName); } } EditorGUILayout.EndVertical(); GUILayout.Space(10); GUI.skin.label.richText = false; }
private void OnGUI() { if (GoogleAPIOAuthEditorConfig.Instance == null) { EditorGUILayout.HelpBox("fatal error.", MessageType.Error); return; } if (!IsInitialized) { Initialize(); } EditorGUI.BeginChangeCheck(); WindowHelper.OnGUIStart(); Draw(); WindowHelper.OnGUIEnd(); if (EditorGUI.EndChangeCheck()) { if (GoogleAPIOAuthEditorConfig.Instance != null) { EditorUtility.SetDirty(GoogleAPIOAuthEditorConfig.Instance); } if (SelectedConverter != null) { EditorUtility.SetDirty(SelectedConverter); } if (SelectedSpreadSheet != null) { EditorUtility.SetDirty(SelectedSpreadSheet); } } }
public void Initialize() { popupWin = new SpreadSheetConvertToolPopupWindow(); textAPIWin = new SpreadSheetConverterTestAPIPopupWindow(); ConverterUtility.GetConverterSubClass(); WindowHelper.Initialize(position); if (OAuthConfigItem == null) { OAuthConfigItem = new GoogleAPIOAuthConfigEditorGUI(GoogleAPIOAuthEditorConfig.Instance); } if (SpreadSheetConfigItem == null) { SpreadSheetConfigItem = new GoogleSpreadSheetConfigEditorGUI(SelectedSpreadSheet); OnSelectedSpreadSheetChange(); } Repaint(); IsInitialized = true; }
private void SheetContents() { if (SpreadSheetConfigItem == null) { return; } EditorGUILayout.BeginVertical(); { if (!WindowHelper.IsSpreadSheetDataExists) { EditorGUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); GUI.backgroundColor = Color.green; if (GUILayout.Button("+", EditorStyles.toolbarButton, GUILayout.Width(35))) { EditorGUIUtility.keyboardControl = 0; PopupWindow.Show(GUILayoutUtility.GetLastRect(), popupWin); } GUI.backgroundColor = Color.white; } EditorGUILayout.EndHorizontal(); EditorGUILayout.HelpBox("no spreadsheets", MessageType.Warning); } else { EditorGUILayout.BeginHorizontal(); { var select = EditorGUILayout.Popup(selectedSpreadSheet, WindowHelper.SpreadSheetList, EditorStyles.toolbarDropDown); if (select != selectedSpreadSheet) { selectedSpreadSheet = select; OnSelectedSpreadSheetChange(); } GUI.backgroundColor = Color.green; if (GUILayout.Button("+", EditorStyles.toolbarButton, GUILayout.Width(35))) { EditorGUIUtility.keyboardControl = 0; PopupWindow.Show(GUILayoutUtility.GetLastRect(), popupWin); } GUI.backgroundColor = Color.white; } EditorGUILayout.EndHorizontal(); GUILayout.Space(10); SpreadSheetConfigItem.OnGUI(); if (SpreadSheetConfigItem.IsContextClick) { var menu = new GenericMenu(); menu.AddItem(new GUIContent("Delete " + SelectedSpreadSheet.Name), false, () => { if (EditorUtility.DisplayDialog("Delete " + SelectedSpreadSheet.Name, " You cannot undo this. ", "ok", "cancel")) { AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(SelectedSpreadSheet)); AssetDatabase.Refresh(); WindowHelper.ConstructData(); selectedConverter = 0; selectedSpreadSheet = 0; OnSelectedSpreadSheetChange(); } }); menu.ShowAsContext(); } GUILayout.FlexibleSpace(); EditorGUILayout.BeginVertical(); { GUILayout.FlexibleSpace(); EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true)); { GUILayout.FlexibleSpace(); if (GUILayout.Button("Refresh", EditorStyles.toolbarButton, GUILayout.Width(80))) { SpreadSheetConfigItem.SelectedCoverter = -1; SpreadSheetConfigItem.Refresh(); EditorGUIUtility.keyboardControl = 0; } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); } } EditorGUILayout.EndVertical(); }