2023-08-22 17:44:02 +08:00
|
|
|
|
using UnityEditor;
|
2022-11-07 09:03:06 +08:00
|
|
|
|
|
2022-11-11 12:39:58 +08:00
|
|
|
|
namespace nadena.dev.modular_avatar.core.editor
|
2022-11-07 09:03:06 +08:00
|
|
|
|
{
|
2022-11-10 09:39:52 +08:00
|
|
|
|
[CustomEditor(typeof(ModularAvatarVisibleHeadAccessory))]
|
2022-11-11 12:30:10 +08:00
|
|
|
|
internal class FirstPersonVisibleEditor : MAEditorBase
|
2022-11-07 09:03:06 +08:00
|
|
|
|
{
|
2023-11-26 19:52:36 +08:00
|
|
|
|
private VisibleHeadAccessoryValidation _validation;
|
2022-11-07 09:03:06 +08:00
|
|
|
|
|
|
|
|
|
private void OnEnable()
|
|
|
|
|
{
|
2022-11-10 09:39:52 +08:00
|
|
|
|
var target = (ModularAvatarVisibleHeadAccessory) this.target;
|
2023-10-15 17:44:53 +08:00
|
|
|
|
var avatar = RuntimeUtil.FindAvatarTransformInParents(target.transform);
|
2022-11-07 09:03:06 +08:00
|
|
|
|
|
2023-11-26 19:52:36 +08:00
|
|
|
|
if (avatar != null) _validation = new VisibleHeadAccessoryValidation(avatar.gameObject);
|
2022-11-07 09:03:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-11 12:30:10 +08:00
|
|
|
|
protected override void OnInnerInspectorGUI()
|
2022-11-07 09:03:06 +08:00
|
|
|
|
{
|
2022-11-10 09:39:52 +08:00
|
|
|
|
var target = (ModularAvatarVisibleHeadAccessory) this.target;
|
2022-11-07 09:03:06 +08:00
|
|
|
|
|
2022-11-08 12:43:51 +08:00
|
|
|
|
|
2022-11-07 09:03:06 +08:00
|
|
|
|
#if UNITY_ANDROID
|
|
|
|
|
EditorGUILayout.HelpBox(Localization.S("fpvisible.quest"), MessageType.Warning);
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
2023-11-26 19:52:36 +08:00
|
|
|
|
if (_validation != null)
|
2022-11-07 09:03:06 +08:00
|
|
|
|
{
|
2023-11-26 19:52:36 +08:00
|
|
|
|
var status = _validation.Validate(target);
|
2022-11-07 09:03:06 +08:00
|
|
|
|
|
|
|
|
|
switch (status)
|
|
|
|
|
{
|
2023-11-26 19:52:36 +08:00
|
|
|
|
case VisibleHeadAccessoryValidation.ReadyStatus.Ready:
|
|
|
|
|
case VisibleHeadAccessoryValidation.ReadyStatus.ParentMarked:
|
2022-11-07 09:03:06 +08:00
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|