コード例 #1
0
        private void GetSearchResults()
        {
            EditorGUILayout.BeginVertical();
            Scroll = EditorGUILayout.BeginScrollView(Scroll);
            foreach (KeyValuePair <string, string> element in dictionary)
            {
                if (value == null || element.Key.ToLower().Contains(value.ToLower()) || element.Value.ToLower().Contains(value.ToLower()))
                {
                    EditorGUILayout.BeginHorizontal("box");
                    Texture    deleteIcon    = (Texture)Resources.Load("Localization/delete");
                    GUIContent deleteContent = new GUIContent(deleteIcon);

                    if (GUILayout.Button(deleteContent, GUILayout.MaxWidth(20), GUILayout.MaxHeight(20)))
                    {
                        if (EditorUtility.DisplayDialog("Remove Key " + element.Key + "?", "This will remove the element from Localization, Are you sure?", "Do it"))
                        {
                            LocalizationManager.Remove(element.Key);
                            AssetDatabase.Refresh();
                            LocalizationManager.Initialize();
                            dictionary = LocalizationManager.GetDictionaryForEditor();
                            Selection.activeGameObject.GetComponent <Localize>().SetKey(string.Empty);
                        }
                    }

                    EditorGUILayout.TextField(element.Key);
                    EditorGUILayout.LabelField(element.Value);
                    EditorGUILayout.EndHorizontal();
                }
            }
            EditorGUILayout.EndScrollView();
            EditorGUILayout.EndVertical();
        }
コード例 #2
0
 private void OnEnable()
 {
     dictionary = LocalizationManager.GetDictionaryForEditor();
 }