void OnEnable() { mLocalize = (Localize)target; mLocalizeInspector = this; LocalizationEditor.mCurrentInspector = this; mProp_mTerm = serializedObject.FindProperty("mTerm"); mProp_mTermSecondary = serializedObject.FindProperty("mTermSecondary"); mProp_TranslatedObjects = serializedObject.FindProperty("TranslatedObjects"); mProp_IgnoreRTL = serializedObject.FindProperty("IgnoreRTL"); mProp_SeparateWords = serializedObject.FindProperty("AddSpacesToJoinedLanguages"); mProp_MaxCharactersInRTL = serializedObject.FindProperty("MaxCharactersInRTL"); mProp_IgnoreNumbersInRTL = serializedObject.FindProperty("IgnoreNumbersInRTL"); mProp_CorrectAlignmentForRTL = serializedObject.FindProperty("CorrectAlignmentForRTL"); mProp_LocalizeOnAwake = serializedObject.FindProperty("LocalizeOnAwake"); mProp_AlwaysForceLocalize = serializedObject.FindProperty("AlwaysForceLocalize"); mProp_TermSuffix = serializedObject.FindProperty("TermSuffix"); mProp_TermPrefix = serializedObject.FindProperty("TermPrefix"); mProp_CallbackEvent = serializedObject.FindProperty("LocalizeEvent"); mProp_AllowLocalizedParameters = serializedObject.FindProperty("AllowLocalizedParameters"); mProp_AllowParameters = serializedObject.FindProperty("AllowParameters"); if (LocalizationManager.Sources.Count == 0) { LocalizationManager.UpdateSources(); } //LocalizationEditor.ParseTerms (true); //mGUI_ShowReferences = (mLocalize.TranslatedObjects!=null && mLocalize.TranslatedObjects.Length>0); //mGUI_ShowCallback = (mLocalize.LocalizeCallBack.Target!=null); //mGUI_ShowTems = true; LocalizationEditor.mKeysDesc_AllowEdit = false; GUI_SelectedTerm = 0; mNewKeyName = mLocalize.Term; if (mLocalize.Source != null) { LocalizationEditor.mLanguageSource = mLocalize.Source.SourceData; } else { if (LocalizationManager.Sources.Count == 0) { LocalizationManager.UpdateSources(); } LocalizationEditor.mLanguageSource = LocalizationManager.GetSourceContaining(mLocalize.Term); } //UpgradeManager.EnablePlugins(); LocalizationEditor.ApplyInferredTerm(mLocalize); RemoveUnusedReferences(mLocalize); }
void OnDisable() { mLocalizeInspector = null; if (LocalizationEditor.mCurrentInspector == this) { LocalizationEditor.mCurrentInspector = null; } if (mLocalize == null) { return; } //#if TextMeshPro //string previous = null; //if (!Application.isPlaying && !string.IsNullOrEmpty(mLocalize.TMP_previewLanguage)) //{ // previous = LocalizationManager.CurrentLanguage; // LocalizationManager.PreviewLanguage( mLocalize.TMP_previewLanguage ); //} //#endif //mLocalize.OnLocalize(); // Revert the preview language // except when in TMPro and not changing to another GameObject (TMPro has a bug where any change causes the inspector to Disable and Enable) if (!mLocalize.mLocalizeTargetName.Contains("LocalizeTarget_TextMeshPro") || Selection.activeGameObject == null || !Selection.gameObjects.Contains(mLocalize.gameObject)) { LocalizationManager.LocalizeAll(); } //#if TextMeshPro //if (!string.IsNullOrEmpty(previous)) //{ // LocalizationManager.PreviewLanguage(previous); // mLocalize.TMP_previewLanguage = null; //} //#endif RemoveUnusedReferences(mLocalize); }