modular-avatar/Editor/Inspector/FirstPersonVisibleEditor.cs
bd_ ddbc3b164b
chore: restructure repository to put package at top-level (#477)
* chore: rearrange package structure to have the package at the root

* ci: update CI workflows

* ci: fixing workflow bugs

* ci: recurse building .zip package

* ci: more fixes

* ci: add back in the nadena.dev VPM repo

* ci: fix tests
2023-10-08 15:39:57 +09:00

52 lines
1.6 KiB
C#

using UnityEditor;
namespace nadena.dev.modular_avatar.core.editor
{
[CustomEditor(typeof(ModularAvatarVisibleHeadAccessory))]
internal class FirstPersonVisibleEditor : MAEditorBase
{
private VisibleHeadAccessoryProcessor _processor;
private void OnEnable()
{
var target = (ModularAvatarVisibleHeadAccessory) this.target;
var avatar = RuntimeUtil.FindAvatarInParents(target.transform);
if (avatar != null) _processor = new VisibleHeadAccessoryProcessor(avatar);
}
protected override void OnInnerInspectorGUI()
{
var target = (ModularAvatarVisibleHeadAccessory) this.target;
#if UNITY_ANDROID
EditorGUILayout.HelpBox(Localization.S("fpvisible.quest"), MessageType.Warning);
#else
if (_processor != null)
{
var status = _processor.Validate(target);
switch (status)
{
case VisibleHeadAccessoryProcessor.ReadyStatus.Ready:
case VisibleHeadAccessoryProcessor.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();
}
}
}