public static void ShowWindow() { SmartLocalizationWindow thisWindow = (SmartLocalizationWindow)EditorWindow.GetWindow(typeof(SmartLocalizationWindow)); thisWindow.title = "Smart Localization"; thisWindow.Initialize(); }
/// <summary> /// Shows the translate window window. /// </summary> public static TranslateLanguageWindow ShowWindow(CultureInfo info, SmartLocalizationWindow smartLocWindow) { TranslateLanguageWindow thisWindow = (TranslateLanguageWindow)EditorWindow.GetWindow<TranslateLanguageWindow>("Translate Language",true,typeof(SmartLocalizationWindow)); thisWindow.smartLocWindow = smartLocWindow; thisWindow.Initialize(info); return thisWindow; }
/// <summary> /// Call this from OnInspectorGUI in your own editor class /// </summary> /// <returns> /// The selected key. /// </returns> /// <param name='currentKey'> /// Current key. /// </param> /// <param name='sort'> /// Set this to true if you only want to show keys of a specific type /// </param> /// <param name='sortType'> /// Sort type. /// </param> public static string SelectKeyGUI(string currentKey, bool sort = false, LocalizedObjectType sortType = LocalizedObjectType.INVALID) { EditorGUILayout.BeginHorizontal(); GUILayout.Label("Smart Localization", EditorStyles.boldLabel); if (GUILayout.Button("Open", GUILayout.Width(50))) { SmartLocalizationWindow.ShowWindow(); } EditorGUILayout.EndHorizontal(); if (autoRefresh || parsedRootValues.Count == 0 || sortType != loadedObjectType) { RefreshList(sort, sortType); } EditorGUILayout.BeginHorizontal(); GUILayout.Label("Sort Mode: ", EditorStyles.miniLabel, GUILayout.Width(55)); if (sort) { GUILayout.Label(sortType.ToString() + " only.", EditorStyles.miniLabel); } else { GUILayout.Label("Showing ALL types", EditorStyles.miniLabel); } EditorGUILayout.EndHorizontal(); if (LocFileUtility.CheckIfRootLanguageFileExists() && !Application.isPlaying) { int index = parsedRootValues.IndexOf(currentKey); index = Mathf.Max(0, index); int newIndex = index; newIndex = EditorGUILayout.Popup(index, parsedRootValues.ToArray()); if (newIndex != index) { currentKey = parsedRootValues[newIndex]; } if (!autoRefresh && GUILayout.Button("Refresh list", GUILayout.Width(80))) { RefreshList(sort, sortType); } } else if (Application.isPlaying) { GUILayout.Label("Feature not available in play mode.", EditorStyles.miniLabel); } else { GUILayout.Label("There is no Smart Localization system created", EditorStyles.miniLabel); //There is no language created if (GUILayout.Button("Create New Localization System")) { LocFileUtility.CreateRootResourceFile(); } } return(currentKey); }
/// <summary> /// Shows the translate window window. /// </summary> public static TranslateLanguageWindow ShowWindow(CultureInfo info, SmartLocalizationWindow smartLocWindow) { TranslateLanguageWindow thisWindow = (TranslateLanguageWindow)EditorWindow.GetWindow <TranslateLanguageWindow>("Translate Language", true, typeof(SmartLocalizationWindow)); thisWindow.smartLocWindow = smartLocWindow; thisWindow.Initialize(info); return(thisWindow); }