public override void OnInspectorGUI() { if (GUILayout.Button("Edit")) { LocalizeFromTextAssetConfig.Open(target as LocalizeFromTextAsset); } M8.EditorExt.Utility.DrawSeparator(); // var propTables = serializedObject.FindProperty("tables"); var prevColor = GUI.backgroundColor; GUI.backgroundColor = Color.red; GUI.enabled = propTables.arraySize > 0; if (GUILayout.Button("Clear Table")) { propTables.arraySize = 0; } GUI.backgroundColor = prevColor; // serializedObject.ApplyModifiedProperties(); }
public static LocalizeFromTextAssetConfig Open(LocalizeFromTextAsset localize) { SetLocalize(localize, false); LocalizeFromTextAssetConfig win = EditorWindow.GetWindow(typeof(LocalizeFromTextAssetConfig)) as LocalizeFromTextAssetConfig; if (mLocalize) { //check if base path is already set if (mLocalizeTable != null && mLocalizeTable.Length > 0 && mLocalizeTable[0].file) { win.mMode = Mode.EditItems; } else { win.mMode = Mode.EditLanguages; } win.LoadAllItems(); GenerateBaseKeyItems(); win.InitCurrentMode(); } else { //ask to select component win.mMode = Mode.SelectComponent; } return(win); }