2022-11-07 09:03:06 +08:00
|
|
|
|
using System;
|
|
|
|
|
using UnityEditor;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace net.fushizen.modular_avatar.core.editor
|
|
|
|
|
{
|
|
|
|
|
[CustomEditor(typeof(ModularAvatarFirstPersonVisible))]
|
|
|
|
|
public class FirstPersonVisibleEditor : Editor
|
|
|
|
|
{
|
|
|
|
|
private FirstPersonVisibleProcessor _processor;
|
|
|
|
|
|
|
|
|
|
private void OnEnable()
|
|
|
|
|
{
|
|
|
|
|
var target = (ModularAvatarFirstPersonVisible) this.target;
|
|
|
|
|
var avatar = RuntimeUtil.FindAvatarInParents(target.transform);
|
|
|
|
|
|
|
|
|
|
if (avatar != null) _processor = new FirstPersonVisibleProcessor(avatar);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnInspectorGUI()
|
|
|
|
|
{
|
|
|
|
|
var target = (ModularAvatarFirstPersonVisible) this.target;
|
|
|
|
|
|
2022-11-08 12:43:51 +08:00
|
|
|
|
LogoDisplay.DisplayLogo();
|
|
|
|
|
|
|
|
|
|
InspectorCommon.DisplayOutOfAvatarWarning(targets);
|
|
|
|
|
|
2022-11-07 09:03:06 +08:00
|
|
|
|
#if UNITY_ANDROID
|
|
|
|
|
EditorGUILayout.HelpBox(Localization.S("fpvisible.quest"), MessageType.Warning);
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
if (_processor != null)
|
|
|
|
|
{
|
|
|
|
|
var status = _processor.Validate(target);
|
|
|
|
|
|
|
|
|
|
switch (status)
|
|
|
|
|
{
|
|
|
|
|
case FirstPersonVisibleProcessor.ReadyStatus.Ready:
|
|
|
|
|
case FirstPersonVisibleProcessor.ReadyStatus.ParentMarked:
|
|
|
|
|
EditorGUILayout.HelpBox(Localization.S("fpvisible.normal"), MessageType.Info);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
var label = "fpvisible." + status;
|
|
|
|
|
EditorGUILayout.HelpBox(Localization.S(label), MessageType.Error);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
Localization.ShowLanguageUI();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|