protected bool AddingTypeTest(UILocalization myTarget) { if (myTarget.InitializeTextObject() == TextType.None) { EditorGUILayout.HelpBox("TEXT component not found \n\n[UIText|MeshText|TextMeshPro]", MessageType.Error); return(false); } return(true); }
private void UpdateValue(UILocalization myTarget) { int keyIndex = GetIdByKey(myTarget.Key, searchKeys); if (keyIndex != -1) { myTarget.SetEditorValue(localizationValues[keyIndex]); // update lower case to real one myTarget.Key = localizationKeys[keyIndex]; } }
private void ShowLocalizeValues(UILocalization myTarget) { string searchValue = myTarget.Key.ToLower(); const int maxCount = 5; Dictionary <string, int> helpKeys = new Dictionary <string, int>(maxCount); for (int i = 0; i < searchKeys.Length; i++) { string key = searchKeys[i]; if (key == searchValue) { return; } if (key.Contains(searchValue)) { helpKeys.Add(key, i); if (helpKeys.Count == maxCount) { break; } } } if (helpKeys.Count == 0) { return; } EditorGUILayout.Space(); var color = GUI.backgroundColor; GUI.backgroundColor = Color.green; foreach (KeyValuePair <string, int> kvp in helpKeys) { if (GUILayout.Button(kvp.Key)) { myTarget.Key = localizationKeys[kvp.Value]; UpdateValue(myTarget); GUI.FocusControl(string.Empty); } } GUI.backgroundColor = color; }