|
@@ -1,22 +1,359 @@
|
|
|
using System;
|
|
|
+using System.Collections;
|
|
|
using Kasizuki;
|
|
|
using UnityEngine;
|
|
|
+using UnityEngine.SceneManagement;
|
|
|
|
|
|
public class ControllerShortcutWindow : MonoBehaviour
|
|
|
{
|
|
|
+ public float fadeSpeed
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return this.m_FadeSpeed;
|
|
|
+ }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ this.m_FadeSpeed = Mathf.Clamp(value, 0.001f, 1f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool IsEnableTypeVR()
|
|
|
+ {
|
|
|
+ GameMain instance = GameMain.Instance;
|
|
|
+ if (!instance.VRMode)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ GameMain.VRFamilyType vrfamily = instance.VRFamily;
|
|
|
+ return vrfamily != GameMain.VRFamilyType.FOVE;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Awake()
|
|
|
+ {
|
|
|
+ if (!this.IsEnableTypeVR())
|
|
|
+ {
|
|
|
+ Debug.Log("[ControllerShortcutWindow] ハンドコントローラが存在しない操作系だったので、UIを無効化します。");
|
|
|
+ base.gameObject.SetActive(false);
|
|
|
+ }
|
|
|
+ this.m_ButtonDic = new ObjectCacheDic();
|
|
|
+ }
|
|
|
+
|
|
|
public void Init(PhotoFaceDataShortcutParent rightHandUI, PhotoFaceDataShortcutParent leftHandUI)
|
|
|
{
|
|
|
+ PhotoFaceDataShortcutSetter component = this.m_FadeWindowFaceShortcut.GetComponent<PhotoFaceDataShortcutSetter>();
|
|
|
+ component.Init(rightHandUI.handUI, leftHandUI.handUI);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Start()
|
|
|
+ {
|
|
|
+ UIWFTabButton uiwftabButton = this.m_ButtonDic.CacheChildObject<UIWFTabButton>(this.m_ParentButtonMainMenu.gameObject, "button config", "コンフィグ");
|
|
|
+ UIWFTabButton uiwftabButton2 = this.m_ButtonDic.CacheChildObject<UIWFTabButton>(this.m_ParentButtonMainMenu.gameObject, "button calibration", "キャリブレーション");
|
|
|
+ UIWFTabButton uiwftabButton3 = this.m_ButtonDic.CacheChildObject<UIWFTabButton>(this.m_ParentButtonMainMenu.gameObject, "button face", "表情");
|
|
|
+ UIWFTabButton uiwftabButton4 = this.m_ButtonDic.CacheChildObject<UIWFTabButton>(this.m_ParentButtonMainMenu.gameObject, "button hand", "ハンドサイン");
|
|
|
+ UIWFTabButton uiwftabButton5 = this.m_ButtonDic.CacheChildObject<UIWFTabButton>(this.m_ParentButtonMainMenu.gameObject, "button motion", "モーション");
|
|
|
+ UIWFTabButton uiwftabButton6 = this.m_ButtonDic.CacheChildObject<UIWFTabButton>(this.m_ParentButtonMainMenu.gameObject, "button general object", "一般オブジェクト");
|
|
|
+ uiwftabButton5.gameObject.SetActive(false);
|
|
|
+ uiwftabButton4.gameObject.SetActive(false);
|
|
|
+ Debug.Log("メインメニューのうち、モーション登録ボタンを隠します。");
|
|
|
+ this.m_ParentButtonMainMenu.GetComponent<UIGrid>().Reposition();
|
|
|
+ EventDelegate.Add(uiwftabButton.onClick, new EventDelegate.Callback(this.OpenWindowConfig));
|
|
|
+ EventDelegate.Add(uiwftabButton2.onClick, new EventDelegate.Callback(this.OpenWindowCalibration));
|
|
|
+ EventDelegate.Add(uiwftabButton3.onClick, new EventDelegate.Callback(this.OpenWindowFaceShortcut));
|
|
|
+ EventDelegate.Add(uiwftabButton4.onClick, new EventDelegate.Callback(this.OpenWindowHandShortcut));
|
|
|
+ EventDelegate.Add(uiwftabButton5.onClick, new EventDelegate.Callback(this.OpenWindowMotionShortcut));
|
|
|
+ EventDelegate.Add(uiwftabButton6.onClick, new EventDelegate.Callback(this.OpenWindowGeneralObject));
|
|
|
+ this.m_FadeWindowHideButton = UTY.GetChildObject(this.m_FadeWindowParent.gameObject, "parent button/Button Hide", false).GetComponent<UIButton>();
|
|
|
+ EventDelegate.Add(this.m_FadeWindowHideButton.onClick, delegate()
|
|
|
+ {
|
|
|
+ this.m_FadeWindowParent.Close(0.25f, null);
|
|
|
+ });
|
|
|
+ this.SetupCaribWindow();
|
|
|
+ this.m_ParentButtonMainMenu.Select(uiwftabButton2);
|
|
|
+ uiwftabButton2.SetSelect(true);
|
|
|
+ NGUIWindow fadeWindowParent = this.m_FadeWindowParent;
|
|
|
+ fadeWindowParent.OnOpen = (Action)Delegate.Combine(fadeWindowParent.OnOpen, new Action(this.OnOpenFadeWindowParent));
|
|
|
+ this.ChangeLayout();
|
|
|
+ SceneManager.activeSceneChanged += this.OnActiveSceneChanged;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void SetupCaribWindow()
|
|
|
+ {
|
|
|
+ this.m_FadeWindowCalibration.CacheChildObject<NGUIWindow>("Window Start", "FadeWindow Start");
|
|
|
+ this.m_FadeWindowCalibration.CacheChildObject<NGUIWindow>("Window Countdown", "FadeWindow Countdown");
|
|
|
+ this.m_FadeWindowCalibration.CacheChildObject<UILabel>("Window Countdown/label countdown", "countdown");
|
|
|
+ this.m_FadeWindowCalibration.CacheChildObject<UILabel>("Window Countdown/label description", "label count desc");
|
|
|
+ this.m_FadeWindowCalibration.CacheChildObject<UILabel>("Window Start/label", "label start desc");
|
|
|
+ UIButton uibutton = this.m_FadeWindowCalibration.CacheChildObject<UIButton>("Window Start/button start", "startButton");
|
|
|
+ UIButton uibutton2 = this.m_FadeWindowCalibration.CacheChildObject<UIButton>("Window Start/button end", "endButton");
|
|
|
+ NGUIWindow fadeWindowCalibration = this.m_FadeWindowCalibration;
|
|
|
+ fadeWindowCalibration.OnOpen = (Action)Delegate.Combine(fadeWindowCalibration.OnOpen, new Action(delegate()
|
|
|
+ {
|
|
|
+ NGUIWindow cache = this.m_FadeWindowCalibration.GetCache<NGUIWindow>("FadeWindow Start");
|
|
|
+ NGUIWindow cache2 = this.m_FadeWindowCalibration.GetCache<NGUIWindow>("FadeWindow Countdown");
|
|
|
+ cache.Open(0.001f, null);
|
|
|
+ cache2.Close(0.001f, null);
|
|
|
+ cache.gameObject.SetActive(true);
|
|
|
+ cache2.gameObject.SetActive(false);
|
|
|
+ this.ChangeLayout();
|
|
|
+ }));
|
|
|
+ EventDelegate.Add(uibutton.onClick, new EventDelegate.Callback(this.OnClickCalibrationStart));
|
|
|
+ EventDelegate.Add(uibutton2.onClick, new EventDelegate.Callback(this.OnClickCalibrationEnd));
|
|
|
+ this.m_FadeWindowCalibration.GetCache<UILabel>("label count desc").text = ControllerShortcutWindow.STR_LABEL_DESC_COUNT_DOWN;
|
|
|
+ this.m_FadeWindowCalibration.GetCache<UILabel>("label start desc").supportEncoding = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnOpenFadeWindowParent()
|
|
|
+ {
|
|
|
+ this.ChangeLayout();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ChangeLayout()
|
|
|
+ {
|
|
|
+ UILabel cache = this.m_FadeWindowCalibration.GetCache<UILabel>("label start desc");
|
|
|
+ UIButton cache2 = this.m_FadeWindowCalibration.GetCache<UIButton>("startButton");
|
|
|
+ UIButton cache3 = this.m_FadeWindowCalibration.GetCache<UIButton>("endButton");
|
|
|
+ UIWFTabButton cache4 = this.m_ButtonDic.GetCache<UIWFTabButton>("表情");
|
|
|
+ UIWFTabButton cache5 = this.m_ButtonDic.GetCache<UIWFTabButton>("モーション");
|
|
|
+ UIWFTabButton cache6 = this.m_ButtonDic.GetCache<UIWFTabButton>("ハンドサイン");
|
|
|
+ UIWFTabButton cache7 = this.m_ButtonDic.GetCache<UIWFTabButton>("一般オブジェクト");
|
|
|
+ if (!OvrIK.IsVRIKMode)
|
|
|
+ {
|
|
|
+ Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
|
|
|
+ if (maid == null || !maid.Visible || maid.IsBusy || !maid.body0.isLoadedBody)
|
|
|
+ {
|
|
|
+ cache.text = ControllerShortcutWindow.STR_LABEL_DESC_MISSING_MAID;
|
|
|
+ cache2.gameObject.SetActive(false);
|
|
|
+ cache3.gameObject.SetActive(false);
|
|
|
+ Debug.Log("OvrIK\u3000メイドの準備がまだ行われていません。");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bool flag = false;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ string nowSceneName = GameMain.Instance.GetNowSceneName();
|
|
|
+ if (!string.IsNullOrEmpty(nowSceneName) && nowSceneName.IndexOf("SceneDance_") == 0)
|
|
|
+ {
|
|
|
+ DanceMain danceMain = UnityEngine.Object.FindObjectOfType<DanceMain>();
|
|
|
+ if (danceMain != null && danceMain.OvrCamTrans != null)
|
|
|
+ {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ Debug.Log("シーン名の取得に失敗しました");
|
|
|
+ }
|
|
|
+ if (!GameMain.Instance.CMSystem.SConfig.OvrIkAllSceneEnable && flag)
|
|
|
+ {
|
|
|
+ cache.text = ControllerShortcutWindow.STR_LABEL_DESC_NOT_SUPPORT_MOVE_CAMERA;
|
|
|
+ cache2.gameObject.SetActive(false);
|
|
|
+ cache3.gameObject.SetActive(false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cache.text = ControllerShortcutWindow.STR_LABEL_DESC_START;
|
|
|
+ cache2.gameObject.SetActive(true);
|
|
|
+ cache3.gameObject.SetActive(false);
|
|
|
+ if (GameMain.Instance.VRDeviceTypeID == GameMain.VRDeviceType.VIVE && ControllerShortcutSettingData.config.use1TrackerForHead)
|
|
|
+ {
|
|
|
+ UILabel uilabel = cache;
|
|
|
+ uilabel.text = uilabel.text + "\n" + ControllerShortcutWindow.STR_LABEL_DESC_START_NOTES_TRACKER;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cache4.isEnabled = false;
|
|
|
+ cache5.isEnabled = false;
|
|
|
+ cache6.isEnabled = false;
|
|
|
+ cache7.isEnabled = false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cache.text = ControllerShortcutWindow.STR_LABEL_DESC_END;
|
|
|
+ cache2.gameObject.SetActive(false);
|
|
|
+ cache3.gameObject.SetActive(true);
|
|
|
+ cache4.isEnabled = true;
|
|
|
+ cache5.isEnabled = true;
|
|
|
+ cache6.isEnabled = true;
|
|
|
+ cache7.isEnabled = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OpenWindowConfig()
|
|
|
+ {
|
|
|
+ this.m_FadeWindowCalibration.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowFaceShortcut.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowMotionShortcut.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowGeneralObject.Close(this.fadeSpeed, null);
|
|
|
+ this.WaitTime(this.fadeSpeed, delegate
|
|
|
+ {
|
|
|
+ this.m_FadeWindowConfig.Open(this.fadeSpeed, null);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OpenWindowCalibration()
|
|
|
+ {
|
|
|
+ this.m_FadeWindowFaceShortcut.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowMotionShortcut.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowConfig.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowGeneralObject.Close(this.fadeSpeed, null);
|
|
|
+ this.WaitTime(this.fadeSpeed, delegate
|
|
|
+ {
|
|
|
+ this.m_FadeWindowCalibration.Open(this.fadeSpeed, null);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OpenWindowFaceShortcut()
|
|
|
+ {
|
|
|
+ this.m_FadeWindowCalibration.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowMotionShortcut.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowConfig.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowGeneralObject.Close(this.fadeSpeed, null);
|
|
|
+ this.WaitTime(this.fadeSpeed, delegate
|
|
|
+ {
|
|
|
+ this.m_FadeWindowFaceShortcut.Open(this.fadeSpeed, null);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OpenWindowHandShortcut()
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OpenWindowMotionShortcut()
|
|
|
+ {
|
|
|
+ this.m_FadeWindowCalibration.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowFaceShortcut.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowConfig.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowGeneralObject.Close(this.fadeSpeed, null);
|
|
|
+ this.WaitTime(this.fadeSpeed, delegate
|
|
|
+ {
|
|
|
+ this.m_FadeWindowMotionShortcut.Open(this.fadeSpeed, null);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OpenWindowGeneralObject()
|
|
|
+ {
|
|
|
+ this.m_FadeWindowCalibration.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowFaceShortcut.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowConfig.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowMotionShortcut.Close(this.fadeSpeed, null);
|
|
|
+ this.WaitTime(this.fadeSpeed, delegate
|
|
|
+ {
|
|
|
+ this.m_FadeWindowGeneralObject.Open(this.fadeSpeed, null);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickCalibrationStart()
|
|
|
+ {
|
|
|
+ NGUIWindow cache = this.m_FadeWindowCalibration.GetCache<NGUIWindow>("FadeWindow Start");
|
|
|
+ NGUIWindow windowCount = this.m_FadeWindowCalibration.GetCache<NGUIWindow>("FadeWindow Countdown");
|
|
|
+ this.m_FadeWindowCalibration.GetCache<UILabel>("countdown").text = 5.ToString("f2");
|
|
|
+ cache.Close(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowMainMenu.Close(this.fadeSpeed, null);
|
|
|
+ this.WaitTime(this.fadeSpeed, delegate
|
|
|
+ {
|
|
|
+ windowCount.Open(this.fadeSpeed, null);
|
|
|
+ });
|
|
|
+ this.WaitTime(this.fadeSpeed + 1f, delegate
|
|
|
+ {
|
|
|
+ if (!OvrIK.IsVRIKMode)
|
|
|
+ {
|
|
|
+ OvrIK.InitStart();
|
|
|
+ }
|
|
|
+ this.StartCoroutine(this.CoCalibrationCountdown(delegate
|
|
|
+ {
|
|
|
+ this.m_FadeWindowCalibration.GetCache<NGUIWindow>("FadeWindow Countdown").Close(this.fadeSpeed, null);
|
|
|
+ this.WaitTime(this.fadeSpeed, delegate
|
|
|
+ {
|
|
|
+ this.m_FadeWindowCalibration.GetCache<NGUIWindow>("FadeWindow Start").Open(this.fadeSpeed, null);
|
|
|
+ this.m_FadeWindowMainMenu.Open(this.fadeSpeed, null);
|
|
|
+ this.ChangeLayout();
|
|
|
+ });
|
|
|
+ }));
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickCalibrationEnd()
|
|
|
+ {
|
|
|
+ this.m_FadeWindowParent.Close(this.fadeSpeed, delegate
|
|
|
+ {
|
|
|
+ if (OvrIK.IsVRIKMode)
|
|
|
+ {
|
|
|
+ OvrIK.UninitEnd();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private IEnumerator CoCalibrationCountdown(Action onEnd)
|
|
|
+ {
|
|
|
+ Debug.Log("キャリブレーション開始");
|
|
|
+ float nowTime = 0f;
|
|
|
+ float maxTime = 5f;
|
|
|
+ UILabel textCountdown = this.m_FadeWindowCalibration.GetCache<UILabel>("countdown");
|
|
|
+ while (nowTime <= maxTime)
|
|
|
+ {
|
|
|
+ textCountdown.text = (maxTime - nowTime).ToString("f2");
|
|
|
+ nowTime += Time.deltaTime;
|
|
|
+ yield return null;
|
|
|
+ }
|
|
|
+ textCountdown.text = 0.ToString("f2");
|
|
|
+ if (onEnd != null)
|
|
|
+ {
|
|
|
+ onEnd();
|
|
|
+ }
|
|
|
+ Debug.Log("キャリブレーション完了");
|
|
|
+ yield break;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void WaitTime(float time, Action onFinish)
|
|
|
+ {
|
|
|
+ base.StartCoroutine(this.CoWaitTime(time, onFinish));
|
|
|
+ }
|
|
|
+
|
|
|
+ private IEnumerator CoWaitTime(float time, Action onFinish)
|
|
|
+ {
|
|
|
+ yield return new WaitForSeconds(time);
|
|
|
+ if (onFinish != null)
|
|
|
+ {
|
|
|
+ onFinish();
|
|
|
+ }
|
|
|
+ yield break;
|
|
|
}
|
|
|
|
|
|
public void Open()
|
|
|
{
|
|
|
+ this.m_FadeWindowParent.Open(this.fadeSpeed, null);
|
|
|
}
|
|
|
|
|
|
public void Close()
|
|
|
{
|
|
|
+ this.m_FadeWindowParent.Close(this.fadeSpeed, null);
|
|
|
}
|
|
|
|
|
|
- public bool isOpen { get; set; }
|
|
|
+ public bool isOpen
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return this.m_FadeWindowParent.gameObject.activeSelf;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnActiveSceneChanged(Scene beforeScene, Scene activeScene)
|
|
|
+ {
|
|
|
+ if (this.m_IsDestroyed)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ UnityEngine.Object.Destroy(base.gameObject);
|
|
|
+ Debug.Log("VRIK用UIを削除しました : シーン切り替え");
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnDestroy()
|
|
|
+ {
|
|
|
+ this.m_IsDestroyed = true;
|
|
|
+ }
|
|
|
|
|
|
[SerializeField]
|
|
|
[Range(0.001f, 1f)]
|
|
@@ -47,4 +384,20 @@ public class ControllerShortcutWindow : MonoBehaviour
|
|
|
|
|
|
[SerializeField]
|
|
|
private UIWFTabPanel m_ParentButtonMainMenu;
|
|
|
+
|
|
|
+ private ObjectCacheDic m_ButtonDic;
|
|
|
+
|
|
|
+ private static readonly string STR_LABEL_DESC_MISSING_MAID = "メイドの準備ができていません。";
|
|
|
+
|
|
|
+ private static readonly string STR_LABEL_DESC_NOT_SUPPORT_MOVE_CAMERA = "移動カメラモードでは実行できません。";
|
|
|
+
|
|
|
+ private static readonly string STR_LABEL_DESC_START = "「スタート」ボタンを押して、キャリブレーションを開始します。\r\n\r\nキャリブレーション中は、\r\nHDMを装着して、正面を向いて足を肩幅に開いて直立し、\r\nコントローラを持った手を肩幅で胸の前に出してお待ち下さい。";
|
|
|
+
|
|
|
+ private static readonly string STR_LABEL_DESC_START_NOTES_TRACKER = "[FF8000]HMDを顔に装着した状態で、\r\n頭のトラッカーを装着予定位置に固定して下さい。[-]";
|
|
|
+
|
|
|
+ private static readonly string STR_LABEL_DESC_COUNT_DOWN = "手を前に出し、\r\n足を肩幅に広げ、\r\n正面を向いて、\r\n背筋を伸ばして下さい。\r\n";
|
|
|
+
|
|
|
+ private static readonly string STR_LABEL_DESC_END = "バーチャルアバタースタジオ機能を終了します。\r\n\r\n(終了後にキャラクターに不具合がある場合は\r\n\u3000シーンに入り直して下さい。)";
|
|
|
+
|
|
|
+ private bool m_IsDestroyed;
|
|
|
}
|