private void DrawEntry(LeanPhrase.Entry entry, bool unexpected)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(entry.Language, EditorStyles.boldLabel);
            if (GUILayout.Button("Remove", EditorStyles.miniButton, GUILayout.Width(55.0f)) == true)
            {
                Undo.RecordObject(Target, "Remove Translation");

                Target.RemoveTranslation(entry.Language);

                Dirty();
            }
            EditorGUILayout.EndHorizontal();

            if (unexpected == true)
            {
                EditorGUILayout.HelpBox("Your LeanLocalization component doesn't define the " + entry.Language + " language.", MessageType.Warning);
            }

            Undo.RecordObject(Target, "Modified Translation");

            EditorGUI.BeginChangeCheck();

            switch (Target.Data)
            {
            case LeanPhrase.DataType.Text:
                if (entry.Language.ToLower().Equals("inversedarabic"))
                {
                    if (!string.IsNullOrEmpty(entry.Text))
                    {
                        fixedArabic = ArabicFixer.Fix(entry.Text, false, false);
                    }
                }

                if (entry.Language.ToLower().Equals("arabic"))
                {
                    if (!string.IsNullOrEmpty(fixedArabic))
                    {
                        entry.Text = fixedArabic;
                    }
                }
                entry.Text = EditorGUILayout.TextArea(entry.Text ?? "", GUILayout.MinHeight(40.0f));
                break;

            case LeanPhrase.DataType.Object:
                entry.Object = EditorGUILayout.ObjectField(entry.Object, typeof(Object), true);
                break;

            case LeanPhrase.DataType.Sprite:
                entry.Object = EditorGUILayout.ObjectField(entry.Object, typeof(Sprite), true);
                break;
            }

            if (EditorGUI.EndChangeCheck() == true)
            {
                Dirty(); LeanLocalization.UpdateTranslations();
            }

            EditorGUILayout.Separator();
        }
Exemple #2
0
        private void DrawEntry(LeanPhrase.Entry entry, bool unexpected)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(entry.Language, EditorStyles.boldLabel);
            if (GUILayout.Button("Remove", EditorStyles.miniButton, GUILayout.Width(55.0f)) == true)
            {
                Undo.RecordObject(tgt, "Remove Translation");

                tgt.RemoveTranslation(entry.Language);

                Dirty();
            }
            EditorGUILayout.EndHorizontal();

            if (unexpected == true)
            {
                EditorGUILayout.HelpBox("Your LeanLocalization component doesn't define the " + entry.Language + " language.", MessageType.Warning);
            }

            Undo.RecordObject(tgt, "Modified Translation");

            EditorGUI.BeginChangeCheck();

            switch (tgt.Data)
            {
            case LeanPhrase.DataType.Text:
                entry.Text = EditorGUILayout.TextArea(entry.Text ?? "", GUILayout.MinHeight(40.0f));
                break;

            case LeanPhrase.DataType.Object:
                entry.Object = EditorGUILayout.ObjectField(entry.Object, typeof(Object), true);
                break;

            case LeanPhrase.DataType.Sprite:
                entry.Object = EditorGUILayout.ObjectField(entry.Object, typeof(Sprite), true);
                break;
            }

            if (EditorGUI.EndChangeCheck() == true)
            {
                Dirty(); LeanLocalization.UpdateTranslations();
            }

            EditorGUILayout.Separator();
        }