public static void Open(SerializedProperty sp)
        {
            TextLocaliserSearchWindow.sp = sp;

            instance = (TextLocaliserSearchWindow)CreateInstance(typeof(TextLocaliserSearchWindow));
            instance.titleContent = new GUIContent("Localisation Search");

            Vector2 mouse = GUIUtility.GUIToScreenPoint(Event.current.mousePosition);
            Rect    rect  = new Rect(mouse.x - 450, mouse.y + 10, 10, 10);

            instance.ShowAsDropDown(rect, new Vector2(480, 250));

            instance.value = string.Empty; // show all results
        }
Beispiel #2
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);
            position        = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
            position.width -= 48;
            position.height = 18;

            Rect valueRect = new Rect(position);

            valueRect.x     += 15;
            valueRect.width -= 15;

            Rect foldButtonRect = new Rect(position);

            foldButtonRect.width = 15;

            EditorGUI.LabelField(position, "Key", EditorStyles.wordWrappedLabel);

            position.x     += 30;
            position.width -= 80;

            SerializedProperty key = property.FindPropertyRelative("key");

            key.stringValue = EditorGUI.TextField(position, key.stringValue, GetGUIStyle(key.stringValue));

            position.x     += position.width + 2;
            position.width  = 40;
            position.height = 18;

            GUIContent editContent = new GUIContent("edit");

            GUI.enabled = key.stringValue != string.Empty;
            if (GUI.Button(position, editContent))
            {
                TextLocaliserEditWindow.Open(key.stringValue);
            }
            GUI.enabled = true;

            position.x    += position.width + 2;
            position.width = 54;

            GUIContent searchContent = new GUIContent("search");

            if (GUI.Button(position, searchContent))
            {
                TextLocaliserSearchWindow.Open(key);
            }

            EditorGUI.EndProperty();
        }