SceneVRCommunication.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using UnityEngine;
  7. using UnityEngine.Events;
  8. public class SceneVRCommunication : MonoBehaviour
  9. {
  10. public static SceneVRCommunication Instance
  11. {
  12. get
  13. {
  14. return SceneVRCommunication.m_this;
  15. }
  16. }
  17. public bool IsFreeMode
  18. {
  19. get
  20. {
  21. return this.m_bFreeMode;
  22. }
  23. }
  24. public bool IsEnableSkip
  25. {
  26. get
  27. {
  28. return this.m_bEnableSkip;
  29. }
  30. }
  31. public bool UiNoMoveMode
  32. {
  33. get
  34. {
  35. return this.m_bUiNoMove;
  36. }
  37. set
  38. {
  39. this.m_bUiNoMove = value;
  40. }
  41. }
  42. public bool UiNoTimeMode
  43. {
  44. get
  45. {
  46. return this.m_bUiNoTime;
  47. }
  48. set
  49. {
  50. this.m_bUiNoTime = value;
  51. }
  52. }
  53. public bool UiNoHomeMode
  54. {
  55. get
  56. {
  57. return this.m_bUiNoHome;
  58. }
  59. set
  60. {
  61. this.m_bUiNoHome = value;
  62. }
  63. }
  64. public bool MouseOnlyMode
  65. {
  66. get
  67. {
  68. return this.m_bMouseOnlyMode;
  69. }
  70. }
  71. public VRChoices Choices
  72. {
  73. get
  74. {
  75. return this.m_VRChoices;
  76. }
  77. }
  78. public VRMiniGameManager MiniGameMgr
  79. {
  80. get
  81. {
  82. return this.m_VRMinigameMgr;
  83. }
  84. }
  85. public VRTouchComm TouchComm
  86. {
  87. get
  88. {
  89. return this.m_VRTouchComm;
  90. }
  91. }
  92. public bool KaraokeMode
  93. {
  94. get
  95. {
  96. return this.m_bKaraokeMode;
  97. }
  98. }
  99. private void Awake()
  100. {
  101. if (!GameMain.Instance.VRMode || GameMain.Instance.VRFamily == GameMain.VRFamilyType.NON)
  102. {
  103. GameMain.Instance.VRDummyMode = true;
  104. GameMain.Instance.OvrInit();
  105. GameMain.Instance.MainCamera.SetPos(new Vector3(0f, 1.6f, 0f));
  106. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  107. }
  108. UICamera.isDisableRightClick = true;
  109. GameMain.Instance.OvrMgr.OvrCamera.ChangeControllerNew(true);
  110. GameMain.Instance.OvrMgr.OvrCamera.IsForceRightClickUiToggle = true;
  111. this.m_VRMinigameMgr = base.GetComponent<VRMiniGameManager>();
  112. if (this.m_VRMinigameMgr == null)
  113. {
  114. this.m_VRMinigameMgr = base.gameObject.AddComponent<VRMiniGameManager>();
  115. }
  116. NDebug.Assert(this.m_VRMinigameMgr != null, "MiniGameManagerがみつかりません。");
  117. this.m_VRTouchComm = base.GetComponent<VRTouchComm>();
  118. if (this.m_VRTouchComm == null)
  119. {
  120. this.m_VRTouchComm = base.gameObject.AddComponent<VRTouchComm>();
  121. }
  122. NDebug.Assert(this.m_VRTouchComm != null, "VRTouchCommがみつかりません。");
  123. }
  124. private void Start()
  125. {
  126. SceneVRCommunication.m_this = this;
  127. this.m_goUiRoot = GameObject.Find("UI Root");
  128. NDebug.Assert(this.m_goUiRoot != null, "UI Rootが見つかりません。");
  129. this.m_VRChoices = base.GetComponent<VRChoices>();
  130. if (this.m_VRChoices == null)
  131. {
  132. this.m_VRChoices = base.gameObject.AddComponent<VRChoices>();
  133. }
  134. GameMain.Instance.MsgWnd.CloseMessageWindowPanel();
  135. GameMain.Instance.MsgWnd.ForceDisableWindow(true);
  136. GameMain.Instance.ScriptMgr.adv_kag.vr_commu_mode = true;
  137. if (GameMain.Instance.VRFamily == GameMain.VRFamilyType.NON)
  138. {
  139. this.m_bManShow = GameMain.Instance.CMSystem.VRManShow;
  140. }
  141. Maid man = GameMain.Instance.CharacterMgr.GetMan(0);
  142. if (man != null)
  143. {
  144. man.body0.SetManHide(!this.m_bManShow);
  145. }
  146. this.m_dicTagBackup = GameMain.Instance.ScriptMgr.adv_kag.tag_backup;
  147. Dictionary<string, string> dicTagBackup = this.m_dicTagBackup;
  148. string text;
  149. if (dicTagBackup != null && dicTagBackup.TryGetValue("name", out text) && text.Contains("SceneVRCommunication"))
  150. {
  151. string text2;
  152. if (dicTagBackup.TryGetValue("start_jump_file", out text2))
  153. {
  154. this.m_strStartScriptFile = text2 + ".ks";
  155. }
  156. if (dicTagBackup.TryGetValue("start_jump_label", out text2))
  157. {
  158. this.m_strStartScriptLabel = text2;
  159. }
  160. if (dicTagBackup.TryGetValue("karaoke", out text))
  161. {
  162. this.m_bKaraokeMode = true;
  163. }
  164. }
  165. base.StartCoroutine(this.CoScriptStart());
  166. }
  167. private IEnumerator CoScriptStart()
  168. {
  169. yield return null;
  170. Debug.Log("Canvas Manager attach start.");
  171. if (!this.m_bKaraokeMode)
  172. {
  173. this.m_goCanvas = UnityEngine.Object.Instantiate<GameObject>(Resources.Load<GameObject>("SceneVRCommunication/Tablet/Canvas Manager"));
  174. }
  175. else
  176. {
  177. this.m_goCanvas = UnityEngine.Object.Instantiate<GameObject>(Resources.Load<GameObject>("SceneVRCommunication/Tablet/Karaoke/Prefab/Canvas Manager Mini"));
  178. }
  179. NDebug.Assert(this.m_goCanvas != null, "Canvas Managerが見つかりません。");
  180. VRCanvasManager.Instance.SetSkipButtonEvent(new UnityAction(this.OnSkipScenario));
  181. this.m_goCanvas.transform.SetParent(GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.transform, false);
  182. this.m_goCanvas.transform.localPosition = Vector3.zero;
  183. this.m_goCanvas.transform.localRotation = Quaternion.Euler(90f, 0f, 0f);
  184. Debug.Log("Canvas Manager attach finish.");
  185. yield return null;
  186. Debug.Log("Canvas Manager attach wait1.");
  187. yield return null;
  188. Debug.Log("Canvas Manager attach wait2.");
  189. bool bStart = false;
  190. if (!string.IsNullOrEmpty(this.m_strStartScriptFile))
  191. {
  192. GameMain.Instance.ScriptMgr.LoadAdvScenarioScript(this.m_strStartScriptFile, string.Empty);
  193. bStart = true;
  194. }
  195. if (!string.IsNullOrEmpty(this.m_strStartScriptLabel))
  196. {
  197. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_strStartScriptLabel);
  198. bStart = true;
  199. }
  200. if (bStart)
  201. {
  202. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  203. }
  204. yield break;
  205. }
  206. private void OnDestroy()
  207. {
  208. this.Uninit();
  209. }
  210. private void Uninit()
  211. {
  212. if (!this.m_bFinished)
  213. {
  214. GameMain instance = GameMain.Instance;
  215. if (instance != null)
  216. {
  217. if (this.TouchComm != null)
  218. {
  219. this.TouchComm.Touch_End();
  220. this.TouchComm.enabled = false;
  221. }
  222. if (this.Choices != null)
  223. {
  224. this.Choices.Clear();
  225. this.Choices.enabled = false;
  226. }
  227. UnityEngine.Object.DestroyImmediate(this.m_goCanvas);
  228. if (instance.SoundMgr != null)
  229. {
  230. instance.SoundMgr.VoiceStopAll();
  231. instance.SoundMgr.StopBGM(0.5f);
  232. }
  233. CharacterMgr characterMgr = instance.CharacterMgr;
  234. if (characterMgr != null)
  235. {
  236. for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
  237. {
  238. Maid stockMaid = characterMgr.GetStockMaid(i);
  239. if (stockMaid != null && stockMaid.body0 != null && stockMaid.body0.isLoadedBody)
  240. {
  241. stockMaid.body0.MuneYureL(1f);
  242. stockMaid.body0.MuneYureR(1f);
  243. stockMaid.IKTargetToBone("左手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, 0f, false, false);
  244. stockMaid.IKTargetToBone("右手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, 0f, false, false);
  245. stockMaid.transform.localScale = Vector3.one;
  246. stockMaid.StopKuchipakuPattern();
  247. stockMaid.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f);
  248. stockMaid.DelPrefabAll();
  249. }
  250. }
  251. for (int j = 0; j < characterMgr.GetStockManCount(); j++)
  252. {
  253. Maid stockMan = characterMgr.GetStockMan(j);
  254. if (stockMan != null && stockMan.body0 != null && stockMan.body0.isLoadedBody)
  255. {
  256. stockMan.IKTargetToBone("左手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, 0f, false, false);
  257. stockMan.IKTargetToBone("右手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, 0f, false, false);
  258. stockMan.DelPrefabAll();
  259. }
  260. }
  261. string[] array = new string[]
  262. {
  263. "handitem",
  264. "kousoku_upper",
  265. "kousoku_lower",
  266. "skirt",
  267. "panz",
  268. "mizugi",
  269. "onepiece",
  270. "accanl",
  271. "accvag",
  272. "KubiScl",
  273. "UdeScl",
  274. "DouPer",
  275. "sintyou",
  276. "kata"
  277. };
  278. for (int k = 0; k < characterMgr.GetMaidCount(); k++)
  279. {
  280. Maid maid = characterMgr.GetMaid(k);
  281. if (maid != null && maid.Visible)
  282. {
  283. maid.OpenMouth(false);
  284. maid.DelPrefabAll();
  285. for (int l = 0; l < array.Length; l++)
  286. {
  287. maid.ResetProp(array[l], true);
  288. }
  289. maid.AllProcPropSeqStart();
  290. }
  291. }
  292. for (int m = 0; m < characterMgr.GetManCount(); m++)
  293. {
  294. Maid man = characterMgr.GetMan(m);
  295. if (man != null && man.Visible)
  296. {
  297. man.DelPrefabAll();
  298. for (int n = 0; n < array.Length; n++)
  299. {
  300. man.ResetProp(array[n], false);
  301. }
  302. man.AllProcPropSeqStart();
  303. }
  304. }
  305. }
  306. if (VRTestInputModule.Instance != null)
  307. {
  308. VRTestInputModule.Instance.enabled = false;
  309. }
  310. if (instance.OvrMgr.OvrCamera != null)
  311. {
  312. VRTestInputModule[] componentsInChildren = instance.OvrMgr.OvrCamera.GetComponentsInChildren<VRTestInputModule>(true);
  313. foreach (VRTestInputModule vrtestInputModule in componentsInChildren)
  314. {
  315. vrtestInputModule.enabled = false;
  316. UnityEngine.Object.DestroyImmediate(vrtestInputModule.gameObject);
  317. }
  318. VRControllerLaserCast[] componentsInChildren2 = instance.OvrMgr.OvrCamera.GetComponentsInChildren<VRControllerLaserCast>(true);
  319. foreach (VRControllerLaserCast vrcontrollerLaserCast in componentsInChildren2)
  320. {
  321. vrcontrollerLaserCast.enabled = false;
  322. UnityEngine.Object.DestroyImmediate(vrcontrollerLaserCast.gameObject);
  323. }
  324. instance.OvrMgr.OvrCamera.ForceHideUI(false);
  325. instance.OvrMgr.OvrCamera.HandLimitMode = AVRControllerBehavior.LIMIT_MODE.NORMAL;
  326. instance.OvrMgr.OvrCamera.ChangeControllerNew(GameMain.Instance.CMSystem.OvrUseNewControllerType);
  327. instance.OvrMgr.OvrCamera.IsForceRightClickUiToggle = false;
  328. }
  329. UICamera.isDisableRightClick = false;
  330. instance.MsgWnd.ForceDisableWindow(false);
  331. ScriptManager scriptMgr = instance.ScriptMgr;
  332. if (scriptMgr != null && scriptMgr.adv_kag != null)
  333. {
  334. scriptMgr.adv_kag.vr_commu_mode = false;
  335. if (scriptMgr.adv_kag.kag != null)
  336. {
  337. scriptMgr.adv_kag.kag.TextClear();
  338. }
  339. }
  340. Maid man2 = instance.CharacterMgr.GetMan(0);
  341. if (man2 != null)
  342. {
  343. man2.body0.SetManHide(false);
  344. }
  345. instance.CMSystem.SetTmpGenericFlag("VR夜伽中", 0);
  346. instance.CMSystem.SetTmpGenericFlag("VRエディット中", 0);
  347. if (instance.VRDeviceTypeID == GameMain.VRDeviceType.NON)
  348. {
  349. instance.OvrUninit();
  350. }
  351. else if (instance.VRDeviceTypeID == GameMain.VRDeviceType.RIFT || instance.VRDeviceTypeID == GameMain.VRDeviceType.RIFT_TOUCH)
  352. {
  353. instance.OvrMgr.OvrCamera.ChangeTouchUse(true);
  354. }
  355. }
  356. this.m_bFinished = true;
  357. }
  358. }
  359. public void kagFreeSceneSwitch(bool f_bFreeMode, bool f_bEnableSkip = true, bool f_bNoStartText = false)
  360. {
  361. this.m_bEnableSkip = false;
  362. if (!f_bFreeMode)
  363. {
  364. this.TouchComm.Touch_End();
  365. if (this.m_coFreeSceneStartText != null)
  366. {
  367. base.StopCoroutine(this.m_coFreeSceneStartText);
  368. }
  369. ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
  370. this.m_strFreeSceneEndScriptName = scriptMgr.adv_kag.kag.GetCurrentFileName();
  371. this.m_bEnableSkip = f_bEnableSkip;
  372. }
  373. else
  374. {
  375. if (!this.m_bKaraokeMode && !f_bNoStartText)
  376. {
  377. this.StartFreeSceneText();
  378. }
  379. this.m_strFreeSceneEndScriptName = string.Empty;
  380. }
  381. GameMain.Instance.OvrMgr.OvrCamera.HandLimitMode = ((!f_bFreeMode) ? AVRControllerBehavior.LIMIT_MODE.NO_WARP : AVRControllerBehavior.LIMIT_MODE.NORMAL);
  382. if (!this.m_bFreeMode || !f_bFreeMode)
  383. {
  384. }
  385. this.m_bFreeMode = f_bFreeMode;
  386. this.KagTabletUIUpdate();
  387. }
  388. public void StartDay()
  389. {
  390. Farm_Mng.Instance.Day_Start();
  391. this.KagTabletUIUpdate();
  392. }
  393. public void KagTabletUIUpdate()
  394. {
  395. VRCanvasManager instance = VRCanvasManager.Instance;
  396. instance.UpdateCanvas();
  397. }
  398. private void DupCheck(GameObject[] value)
  399. {
  400. }
  401. public void KagBGChangeInit(Dictionary<string, string> f_tag_backup)
  402. {
  403. try
  404. {
  405. GameObject[] array = GameObject.FindGameObjectsWithTag("OvrEventObj");
  406. this.DupCheck(array);
  407. this.m_dicEventObj = array.ToDictionary((GameObject n) => n.name, (GameObject n) => n);
  408. GameObject[] array2 = GameObject.FindGameObjectsWithTag("OvrEventGroup");
  409. this.DupCheck(array2);
  410. this.m_dicEventGroup = array2.ToDictionary((GameObject n) => n.name, (GameObject n) => new SceneVRCommunication.EventGroup(n, this.FindChild(n.transform, null)));
  411. }
  412. catch (Exception ex)
  413. {
  414. NDebug.Assert("同じ名前のオブジェクトが入ったプレハブをロードしようとしませんでしたか?\n" + ex.Message, false);
  415. }
  416. if (f_tag_backup != null && f_tag_backup.ContainsKey("farm"))
  417. {
  418. Farm_Mng.Instance.Farm_Start();
  419. }
  420. }
  421. public void KagEventObj(string f_strName, int f_nVisible, int f_nTrigger, int f_nGrab, string f_strAnimation)
  422. {
  423. GameObject gameObject;
  424. if (this.m_dicEventObj.TryGetValue(f_strName, out gameObject))
  425. {
  426. if (f_nVisible != 0)
  427. {
  428. gameObject.SetActive(f_nVisible == 1);
  429. }
  430. if (f_nTrigger != 0)
  431. {
  432. VREventTrigger component = gameObject.GetComponent<VREventTrigger>();
  433. if (component != null)
  434. {
  435. component.SetEnableEvent(f_nTrigger == 1);
  436. }
  437. }
  438. if (f_nGrab != 0)
  439. {
  440. VREventTrigger component2 = gameObject.GetComponent<VREventTrigger>();
  441. if (component2 != null)
  442. {
  443. component2.SetEnableCollider(f_nGrab == 1);
  444. }
  445. }
  446. if (!string.IsNullOrEmpty(f_strAnimation))
  447. {
  448. Animator component3 = gameObject.GetComponent<Animator>();
  449. if (component3 != null)
  450. {
  451. component3.SetTrigger(f_strAnimation);
  452. }
  453. }
  454. }
  455. else
  456. {
  457. NDebug.Assert("指定名のオブジェクトがありません。" + f_strName, false);
  458. }
  459. }
  460. public void KagEventObjGroup(string f_strName, int f_nVisible, int f_nTrigger, int f_nGrab)
  461. {
  462. SceneVRCommunication.EventGroup eventGroup;
  463. if (this.m_dicEventGroup.TryGetValue(f_strName, out eventGroup))
  464. {
  465. if (f_nVisible != 0 || f_nTrigger != 0 || f_nGrab != 0)
  466. {
  467. for (int i = 0; i < eventGroup.listChild.Count; i++)
  468. {
  469. if (f_nVisible != 0)
  470. {
  471. eventGroup.listChild[i].SetActive(f_nVisible == 1);
  472. }
  473. VREventTrigger component = eventGroup.listChild[i].GetComponent<VREventTrigger>();
  474. if (component != null)
  475. {
  476. if (f_nTrigger != 0)
  477. {
  478. component.SetEnableEvent(f_nTrigger == 1);
  479. }
  480. if (f_nGrab != 0)
  481. {
  482. component.SetEnableCollider(f_nGrab == 1);
  483. }
  484. }
  485. }
  486. }
  487. }
  488. else
  489. {
  490. NDebug.Assert("指定名のオブジェクトグループがありません。" + f_strName, false);
  491. }
  492. }
  493. public void KagDoNextTime()
  494. {
  495. string str = "VRmainOP_0001";
  496. string label_name = string.Empty;
  497. SceneVRCommunication.VR_TIME nowTime = this.GetNowTime();
  498. if (nowTime == SceneVRCommunication.VR_TIME.MONING)
  499. {
  500. GameMain.Instance.CharacterMgr.status.SetFlag("時間帯", 2);
  501. label_name = "*昼_ループ";
  502. }
  503. else if (nowTime == SceneVRCommunication.VR_TIME.DAY)
  504. {
  505. GameMain.Instance.CharacterMgr.status.SetFlag("時間帯", 3);
  506. label_name = "*夜_ループ";
  507. }
  508. else if (nowTime == SceneVRCommunication.VR_TIME.NIGHT)
  509. {
  510. GameMain.Instance.CharacterMgr.status.SetFlag("時間帯", 1);
  511. label_name = "*朝_ループ";
  512. this.StartDay();
  513. }
  514. this.KagTabletUIUpdate();
  515. GameMain.Instance.ScriptMgr.LoadAdvScenarioScript(str + ".ks", string.Empty);
  516. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(label_name);
  517. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  518. }
  519. private List<GameObject> FindChild(Transform f_trParent, List<GameObject> f_list = null)
  520. {
  521. if (f_list == null)
  522. {
  523. f_list = new List<GameObject>();
  524. }
  525. for (int i = 0; i < f_trParent.childCount; i++)
  526. {
  527. this.FindChild(f_trParent.GetChild(i), f_list);
  528. }
  529. if (f_trParent.tag == "OvrEventObj")
  530. {
  531. f_list.Add(f_trParent.gameObject);
  532. }
  533. return f_list;
  534. }
  535. public void YotogiStart(Action f_actDecide, Action f_actCancel)
  536. {
  537. this.m_actDecide = f_actDecide;
  538. this.m_actCancel = f_actCancel;
  539. }
  540. public void MaidEditStart()
  541. {
  542. if (GameMain.Instance.CharacterMgr.GetMaid(0) == null)
  543. {
  544. Debug.LogError("エディット対象メイドが居ません。");
  545. return;
  546. }
  547. ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
  548. string currentFileName = scriptMgr.adv_kag.kag.GetCurrentFileName();
  549. GameMain.Instance.ScriptMgr.EvalScript("tf['back_edit_script_name'] = '" + currentFileName + "';");
  550. scriptMgr.LoadAdvScenarioScript(Path.ChangeExtension("vr_edit_call", ".ks"), "*start_vr");
  551. scriptMgr.adv_kag.Exec();
  552. }
  553. public SceneVRCommunication.VR_TIME GetNowTime()
  554. {
  555. SceneVRCommunication.VR_TIME result = SceneVRCommunication.VR_TIME.DAY;
  556. int flag = GameMain.Instance.CharacterMgr.status.GetFlag("時間帯");
  557. if (flag == 0 || flag == 1)
  558. {
  559. result = SceneVRCommunication.VR_TIME.MONING;
  560. }
  561. else if (flag == 2)
  562. {
  563. result = SceneVRCommunication.VR_TIME.DAY;
  564. }
  565. else if (flag == 3)
  566. {
  567. result = SceneVRCommunication.VR_TIME.NIGHT;
  568. }
  569. else
  570. {
  571. NDebug.Assert("現在の時間帯が不正です", false);
  572. }
  573. return result;
  574. }
  575. public void KagStartDayTimeShow(string f_strReturnFile, string f_strReturnLabel)
  576. {
  577. this.m_strRetrunFile = f_strReturnFile;
  578. this.m_strRetrunLabel = f_strReturnLabel;
  579. Day_UI.Day_UI_Start(new Action(this.OnEndDayTimeShow));
  580. }
  581. private void OnEndDayTimeShow()
  582. {
  583. ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
  584. if (!string.IsNullOrEmpty(this.m_strRetrunFile))
  585. {
  586. scriptMgr.LoadAdvScenarioScript(this.m_strRetrunFile + ".ks", string.Empty);
  587. }
  588. if (!string.IsNullOrEmpty(this.m_strRetrunLabel))
  589. {
  590. scriptMgr.adv_kag.JumpLabel(this.m_strRetrunLabel);
  591. }
  592. scriptMgr.adv_kag.Exec();
  593. }
  594. public void KagDialog(string f_strText, string f_strLabelOk, string f_strLabelCancel, string f_strLabelYes, string strLabelNo)
  595. {
  596. this.m_DialogMenu = VRDialogMenu.CreateDialog();
  597. VRDialogMenu.TYPE_STYLE type_STYLE = (VRDialogMenu.TYPE_STYLE)0;
  598. this.m_strLabelOk = f_strLabelOk;
  599. this.m_strLabelCancel = f_strLabelCancel;
  600. this.m_strLabelYes = f_strLabelYes;
  601. this.m_strLabelNo = strLabelNo;
  602. if (!string.IsNullOrEmpty(this.m_strLabelOk))
  603. {
  604. type_STYLE |= VRDialogMenu.TYPE_STYLE.OK;
  605. }
  606. if (!string.IsNullOrEmpty(this.m_strLabelCancel))
  607. {
  608. type_STYLE |= VRDialogMenu.TYPE_STYLE.CANCEL;
  609. }
  610. if (!string.IsNullOrEmpty(this.m_strLabelYes))
  611. {
  612. type_STYLE |= VRDialogMenu.TYPE_STYLE.YES;
  613. }
  614. if (!string.IsNullOrEmpty(this.m_strLabelNo))
  615. {
  616. type_STYLE |= VRDialogMenu.TYPE_STYLE.NO;
  617. }
  618. this.m_DialogMenu.OpenDialog(f_strText, type_STYLE, new UnityAction<VRDialogMenu.TYPE_STYLE>(this.OnEndDialog));
  619. }
  620. private void OnEndDialog(VRDialogMenu.TYPE_STYLE style)
  621. {
  622. string text = string.Empty;
  623. if (style == VRDialogMenu.TYPE_STYLE.OK)
  624. {
  625. text = this.m_strLabelOk;
  626. }
  627. else if (style == VRDialogMenu.TYPE_STYLE.CANCEL)
  628. {
  629. text = this.m_strLabelCancel;
  630. }
  631. if (style == VRDialogMenu.TYPE_STYLE.YES)
  632. {
  633. text = this.m_strLabelYes;
  634. }
  635. else if (style == VRDialogMenu.TYPE_STYLE.NO)
  636. {
  637. text = this.m_strLabelNo;
  638. }
  639. this.m_DialogMenu.CloseDialog();
  640. NDebug.Assert(!string.IsNullOrEmpty(text), "ダイアログとび先ラベルがありません");
  641. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(text);
  642. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  643. }
  644. public void KagStartMovieMusicPlayerTV()
  645. {
  646. VRExternalFileLoader.Event_OpenSelect();
  647. }
  648. public void KagVRMovieTV(bool f_bStart, string f_strFileName = "", bool f_bLoop = false)
  649. {
  650. if (f_bStart)
  651. {
  652. VRExternalFileLoader.Event_PlayMovie(f_strFileName);
  653. }
  654. else
  655. {
  656. VRExternalFileLoader.Event_CloseMovie();
  657. }
  658. }
  659. public void KagPlantWindowShow(string strFileName, string strLabelOK, string strLabelCancel)
  660. {
  661. this.m_strFilePlant = strFileName;
  662. this.m_strLabelPlantOk = strLabelOK;
  663. this.m_strLabelPlantCancel = strLabelCancel;
  664. VRCanvasManager instance = VRCanvasManager.Instance;
  665. instance.OpenVRCulture(new UnityAction(this.OnPlantOk), new UnityAction(this.OnPlantCancel));
  666. }
  667. private void OnPlantOk()
  668. {
  669. if (!string.IsNullOrEmpty(this.m_strFilePlant))
  670. {
  671. GameMain.Instance.ScriptMgr.adv_kag.LoadScriptFile(this.m_strFilePlant, string.Empty);
  672. }
  673. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_strLabelPlantOk);
  674. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  675. }
  676. private void OnPlantCancel()
  677. {
  678. if (!string.IsNullOrEmpty(this.m_strFilePlant))
  679. {
  680. GameMain.Instance.ScriptMgr.adv_kag.LoadScriptFile(this.m_strFilePlant, string.Empty);
  681. }
  682. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_strLabelPlantCancel);
  683. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  684. }
  685. public void KagPlantUpdate()
  686. {
  687. Farm_Mng.Instance.SyuKaku();
  688. }
  689. public void KagTutorialStart(string f_strReturnLabel)
  690. {
  691. this.m_strRetrunLabel = f_strReturnLabel;
  692. VRCanvasManager instance = VRCanvasManager.Instance;
  693. instance.OpenVRTutorialMenu(new UnityAction(this.OnEndTutorial));
  694. }
  695. private void OnEndTutorial()
  696. {
  697. if (!string.IsNullOrEmpty(this.m_strRetrunLabel))
  698. {
  699. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_strRetrunLabel);
  700. }
  701. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  702. }
  703. public void KagVRNoChangeBG(bool f_bStart)
  704. {
  705. this.m_bUiNoMove = f_bStart;
  706. }
  707. public void KagVRTrophyGet(string f_strText)
  708. {
  709. Trophy_UI.Trophy_Start(f_strText);
  710. }
  711. private void StartFreeSceneText()
  712. {
  713. if (this.m_coFreeSceneStartText != null)
  714. {
  715. base.StopCoroutine(this.m_coFreeSceneStartText);
  716. }
  717. this.m_coFreeSceneStartText = base.StartCoroutine(this.CoFreeSceneText());
  718. }
  719. private IEnumerator CoFreeSceneText()
  720. {
  721. yield return new WaitForSeconds(1f);
  722. SceneVRCommunication.VR_TIME time = this.GetNowTime();
  723. string[] aryTimeStr = new string[]
  724. {
  725. "朝",
  726. "昼",
  727. "夜"
  728. };
  729. string strBGName = string.Empty;
  730. if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_Night".ToLower())
  731. {
  732. strBGName = "ヴィラ1F";
  733. }
  734. else if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_BedRoom".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_BedRoom_Night".ToLower())
  735. {
  736. strBGName = "ヴィラ2F";
  737. }
  738. else if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_Farm".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_Farm_Night".ToLower())
  739. {
  740. strBGName = "庭";
  741. }
  742. else if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Sea_VR".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Sea_VR_Night".ToLower())
  743. {
  744. strBGName = "海岸";
  745. }
  746. else if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Rotenburo".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Rotenburo_Night".ToLower())
  747. {
  748. strBGName = "露天風呂";
  749. }
  750. if (!string.IsNullOrEmpty(strBGName))
  751. {
  752. FreeScene_UI.FreeScene_Start(strBGName + "\u3000" + aryTimeStr[(int)this.GetNowTime()], null);
  753. }
  754. this.m_coFreeSceneStartText = null;
  755. yield break;
  756. }
  757. public void KagRentalMaidSelectStart()
  758. {
  759. VRCanvasManager instance = VRCanvasManager.Instance;
  760. instance.OpenVRRentalMaid();
  761. }
  762. public void KagTouchUseSelect(string f_strReturnLabel)
  763. {
  764. this.m_strRetrunLabel = f_strReturnLabel;
  765. VRCanvasManager instance = VRCanvasManager.Instance;
  766. instance.OpenVRDecideUseTouch(new UnityAction<bool>(this.OnTouchUseSelect));
  767. }
  768. private void OnTouchUseSelect(bool f_bUseTouch)
  769. {
  770. GameMain.Instance.OvrMgr.OvrCamera.ChangeTouchUse(f_bUseTouch);
  771. if (!string.IsNullOrEmpty(this.m_strRetrunLabel))
  772. {
  773. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_strRetrunLabel);
  774. }
  775. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  776. }
  777. private void OnSkipScenario()
  778. {
  779. if (!string.IsNullOrEmpty(this.m_strFreeSceneEndScriptName))
  780. {
  781. GameMain.Instance.SoundMgr.VoiceStopAll();
  782. GameMain.Instance.ScriptMgr.adv_kag.LoadScriptFile(this.m_strFreeSceneEndScriptName, string.Empty);
  783. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel("*アフターファイル挿入箇所");
  784. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  785. }
  786. }
  787. public void KagHintShow(string f_strHintMsg)
  788. {
  789. SelectMessage_UI.Message_Start(f_strHintMsg);
  790. }
  791. public void KagKaraokeWindowShow(string f_strReturnFile, string f_strReturnLabel)
  792. {
  793. this.m_strKaraokeRetrunFile = f_strReturnFile;
  794. this.m_strKaraokeRetrunLabel = f_strReturnLabel;
  795. VRCanvasManager instance = VRCanvasManager.Instance;
  796. instance.StartKaraokeMode(new Action(this.OnKaraokeCancel));
  797. }
  798. private void OnKaraokeCancel()
  799. {
  800. if (!string.IsNullOrEmpty(this.m_strKaraokeRetrunFile))
  801. {
  802. GameMain.Instance.ScriptMgr.adv_kag.LoadScriptFile(this.m_strKaraokeRetrunFile, string.Empty);
  803. }
  804. if (!string.IsNullOrEmpty(this.m_strKaraokeRetrunLabel))
  805. {
  806. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_strKaraokeRetrunLabel);
  807. }
  808. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  809. }
  810. public void OnEnd()
  811. {
  812. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  813. base.StartCoroutine(this.CoEnd());
  814. }
  815. private IEnumerator CoEnd()
  816. {
  817. yield return null;
  818. GameMain.Instance.UnloadPopScene();
  819. yield return null;
  820. this.Uninit();
  821. yield return null;
  822. Debug.Log("vr_end_call");
  823. GameMain.Instance.ScriptMgr.adv_kag.LoadScriptFile("vr_end_call.ks", string.Empty);
  824. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  825. yield break;
  826. }
  827. private void Update()
  828. {
  829. if (GameMain.Instance.VRFamily == GameMain.VRFamilyType.NON && this.m_bManShow != GameMain.Instance.CMSystem.VRManShow)
  830. {
  831. this.m_bManShow = GameMain.Instance.CMSystem.VRManShow;
  832. Maid man = GameMain.Instance.CharacterMgr.GetMan(0);
  833. if (man != null)
  834. {
  835. man.body0.SetManHide(!this.m_bManShow);
  836. }
  837. }
  838. }
  839. private static SceneVRCommunication m_this;
  840. private bool m_bFreeMode = true;
  841. private bool m_bEnableSkip;
  842. private bool m_bUiNoMove;
  843. private bool m_bUiNoTime;
  844. private bool m_bUiNoHome;
  845. private bool m_bMouseOnlyMode;
  846. private Dictionary<string, GameObject> m_dicEventObj;
  847. private VRChoices m_VRChoices;
  848. private VRMiniGameManager m_VRMinigameMgr;
  849. private VRTouchComm m_VRTouchComm;
  850. private GameObject m_goUiRoot;
  851. private string m_strRetrunFile = string.Empty;
  852. private string m_strRetrunLabel = string.Empty;
  853. private string m_strKaraokeRetrunFile = string.Empty;
  854. private string m_strKaraokeRetrunLabel = string.Empty;
  855. private Dictionary<string, SceneVRCommunication.EventGroup> m_dicEventGroup;
  856. public Dictionary<string, string> m_dicTagBackup;
  857. private Coroutine m_coFreeSceneStartText;
  858. private GameObject m_goCanvas;
  859. private string m_strFreeSceneEndScriptName;
  860. private bool m_bManShow;
  861. private bool m_bFinished;
  862. private bool m_bKaraokeMode;
  863. private string m_strStartScriptFile;
  864. private string m_strStartScriptLabel;
  865. private Action m_actDecide;
  866. private Action m_actCancel;
  867. private VRDialogMenu m_DialogMenu;
  868. private string m_strLabelOk = string.Empty;
  869. private string m_strLabelCancel = string.Empty;
  870. private string m_strLabelYes = string.Empty;
  871. private string m_strLabelNo = string.Empty;
  872. private string m_strFilePlant = string.Empty;
  873. private string m_strLabelPlantOk = string.Empty;
  874. private string m_strLabelPlantCancel = string.Empty;
  875. public enum VR_TIME
  876. {
  877. MONING,
  878. DAY,
  879. NIGHT,
  880. MAX
  881. }
  882. private class EventGroup
  883. {
  884. public EventGroup(GameObject go, List<GameObject> lst)
  885. {
  886. this.goParent = go;
  887. this.listChild = lst;
  888. }
  889. public GameObject goParent;
  890. public List<GameObject> listChild = new List<GameObject>();
  891. }
  892. }