OctoCore 0.0.1
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace OctoCore.Localization.Editor
|
||||
{
|
||||
[CustomEditor(typeof(OctoLocalizedText))]
|
||||
public class OctoLocalizedTextEditor : UnityEditor.Editor
|
||||
{
|
||||
SerializedProperty dataProp;
|
||||
SerializedProperty textProp;
|
||||
SerializedProperty textMeshProProp;
|
||||
SerializedProperty textMeshProUGUIProp;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
dataProp = serializedObject.FindProperty("data");
|
||||
textProp = serializedObject.FindProperty("text");
|
||||
textMeshProProp = serializedObject.FindProperty("textMeshPro");
|
||||
textMeshProUGUIProp = serializedObject.FindProperty("textMeshProUGUI");
|
||||
}
|
||||
|
||||
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