wip : subtitles & flash hallu
This commit is contained in:
@@ -3,50 +3,43 @@ using UnityEngine;
|
||||
|
||||
namespace OctoCore.Localization.Editor
|
||||
{
|
||||
[CustomEditor(typeof(OctoLocalizedText))]
|
||||
public class OctoLocalizedTextEditor : UnityEditor.Editor
|
||||
{
|
||||
SerializedProperty dataProp;
|
||||
SerializedProperty textProp;
|
||||
SerializedProperty textMeshProProp;
|
||||
SerializedProperty textMeshProUGUIProp;
|
||||
|
||||
void OnEnable()
|
||||
[CustomEditor(typeof(OctoLocalizedText))]
|
||||
public class OctoLocalizedTextEditor : UnityEditor.Editor
|
||||
{
|
||||
dataProp = serializedObject.FindProperty("data");
|
||||
textProp = serializedObject.FindProperty("text");
|
||||
textMeshProProp = serializedObject.FindProperty("textMeshPro");
|
||||
textMeshProUGUIProp = serializedObject.FindProperty("textMeshProUGUI");
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
OctoLocalizedText target = (OctoLocalizedText)this.target;
|
||||
|
||||
target.Data = (OctoLocalizedTextData)EditorGUILayout.ObjectField(
|
||||
"Data",
|
||||
target.Data,
|
||||
typeof(OctoLocalizedTextData),
|
||||
false
|
||||
);
|
||||
|
||||
GUI.enabled = false;
|
||||
|
||||
SerializedProperty textProp = serializedObject.FindProperty("text");
|
||||
SerializedProperty textMeshProProp = serializedObject.FindProperty("textMeshPro");
|
||||
SerializedProperty textMeshProUGUIProp = serializedObject.FindProperty("textMeshProUGUI");
|
||||
|
||||
if (textProp.objectReferenceValue != null)
|
||||
EditorGUILayout.PropertyField(textProp, new GUIContent("Text"));
|
||||
else if (textMeshProProp.objectReferenceValue != null)
|
||||
EditorGUILayout.PropertyField(textMeshProProp, new GUIContent("Text"));
|
||||
else if (textMeshProUGUIProp.objectReferenceValue != null)
|
||||
EditorGUILayout.PropertyField(textMeshProUGUIProp, new GUIContent("Text"));
|
||||
else
|
||||
EditorGUILayout.HelpBox("No text component found.", MessageType.Info);
|
||||
|
||||
GUI.enabled = true;
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (GUI.changed)
|
||||
EditorUtility.SetDirty(target);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
EditorGUILayout.PropertyField(dataProp);
|
||||
|
||||
GUI.enabled = false;
|
||||
|
||||
if (textProp.objectReferenceValue != null)
|
||||
{
|
||||
EditorGUILayout.PropertyField(textProp, new GUIContent("Text"));
|
||||
}
|
||||
else if (textMeshProProp.objectReferenceValue != null)
|
||||
{
|
||||
EditorGUILayout.PropertyField(textMeshProProp, new GUIContent("Text"));
|
||||
}
|
||||
else if (textMeshProUGUIProp.objectReferenceValue != null)
|
||||
{
|
||||
EditorGUILayout.PropertyField(textMeshProUGUIProp, new GUIContent("Text"));
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.HelpBox("No text componant found.", MessageType.Info);
|
||||
}
|
||||
|
||||
GUI.enabled = true;
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user