Skip to content

Commit

Permalink
v1.0.117 LocaleText 避免批量编辑造成的文本覆盖问题
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Dec 16, 2023
1 parent 044cac3 commit 68d8d4b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Id": "",
"Version": "v1.0.116",
"Version": "v1.0.117",
"Type": 0,
"AccessRight": 0,
"DownloadUrl": "",
Expand All @@ -11,10 +11,10 @@
],
"DocUrl": "https://liangxiegame.com",
"Readme": {
"version": "v1.0.116",
"content": "LocaleKit: LanguageText 的 Inspector 显示改进",
"version": "v1.0.117",
"content": "LocaleText 避免批量编辑造成的文本覆盖问题",
"author": "liangxie",
"date": "2023 年 12 月 1622:59",
"date": "2023 年 12 月 1700:38",
"PackageId": ""
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,20 @@ public class LanguageTextDrawer : PropertyDrawer
{
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
if (property.serializedObject.isEditingMultipleObjects)
return EditorGUIUtility.singleLineHeight;

var textProperty = property.FindPropertyRelative("Text");
var height = EditorGUI.GetPropertyHeight(textProperty);
return height;
}


public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
if (property.serializedObject.isEditingMultipleObjects)
return;

var languageIndex = property.FindPropertyRelative("LanguageIndex");
var language = property.FindPropertyRelative("Language");
var text = property.FindPropertyRelative("Text");
Expand All @@ -54,7 +61,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
{
language.intValue = (int)languages[languageIndex.intValue].Language;
}

var indent = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
var textHeight = EditorGUI.GetPropertyHeight(text);
Expand Down

0 comments on commit 68d8d4b

Please sign in to comment.