SceneVRCommunication.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985
  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.fullBodyIK.AllIKDetach(0f);
  244. stockMaid.transform.localScale = Vector3.one;
  245. stockMaid.StopKuchipakuPattern();
  246. stockMaid.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f);
  247. stockMaid.DelPrefabAll();
  248. }
  249. }
  250. for (int j = 0; j < characterMgr.GetStockManCount(); j++)
  251. {
  252. Maid stockMan = characterMgr.GetStockMan(j);
  253. if (stockMan != null && stockMan.body0 != null && stockMan.body0.isLoadedBody)
  254. {
  255. stockMan.fullBodyIK.AllIKDetach(0f);
  256. stockMan.DelPrefabAll();
  257. }
  258. }
  259. string[] array = new string[]
  260. {
  261. "handitem",
  262. "kousoku_upper",
  263. "kousoku_lower",
  264. "skirt",
  265. "panz",
  266. "mizugi",
  267. "onepiece",
  268. "accanl",
  269. "accvag",
  270. "KubiScl",
  271. "UdeScl",
  272. "DouPer",
  273. "sintyou",
  274. "kata"
  275. };
  276. for (int k = 0; k < characterMgr.GetMaidCount(); k++)
  277. {
  278. Maid maid = characterMgr.GetMaid(k);
  279. if (maid != null && maid.Visible)
  280. {
  281. maid.OpenMouth(false);
  282. maid.DelPrefabAll();
  283. for (int l = 0; l < array.Length; l++)
  284. {
  285. maid.ResetProp(array[l], true);
  286. }
  287. maid.AllProcPropSeqStart();
  288. }
  289. }
  290. for (int m = 0; m < characterMgr.GetManCount(); m++)
  291. {
  292. Maid man = characterMgr.GetMan(m);
  293. if (man != null && man.Visible)
  294. {
  295. man.DelPrefabAll();
  296. for (int n = 0; n < array.Length; n++)
  297. {
  298. man.ResetProp(array[n], false);
  299. }
  300. man.AllProcPropSeqStart();
  301. }
  302. }
  303. }
  304. if (VRTestInputModule.Instance != null)
  305. {
  306. VRTestInputModule.Instance.enabled = false;
  307. }
  308. if (instance.OvrMgr.OvrCamera != null)
  309. {
  310. VRTestInputModule[] componentsInChildren = instance.OvrMgr.OvrCamera.GetComponentsInChildren<VRTestInputModule>(true);
  311. foreach (VRTestInputModule vrtestInputModule in componentsInChildren)
  312. {
  313. vrtestInputModule.enabled = false;
  314. UnityEngine.Object.DestroyImmediate(vrtestInputModule.gameObject);
  315. }
  316. VRControllerLaserCast[] componentsInChildren2 = instance.OvrMgr.OvrCamera.GetComponentsInChildren<VRControllerLaserCast>(true);
  317. foreach (VRControllerLaserCast vrcontrollerLaserCast in componentsInChildren2)
  318. {
  319. vrcontrollerLaserCast.enabled = false;
  320. UnityEngine.Object.DestroyImmediate(vrcontrollerLaserCast.gameObject);
  321. }
  322. instance.OvrMgr.OvrCamera.ForceHideUI(false);
  323. instance.OvrMgr.OvrCamera.HandLimitMode = AVRControllerBehavior.LIMIT_MODE.NORMAL;
  324. instance.OvrMgr.OvrCamera.ChangeControllerNew(GameMain.Instance.CMSystem.OvrUseNewControllerType);
  325. instance.OvrMgr.OvrCamera.IsForceRightClickUiToggle = false;
  326. }
  327. UICamera.isDisableRightClick = false;
  328. instance.MsgWnd.ForceDisableWindow(false);
  329. ScriptManager scriptMgr = instance.ScriptMgr;
  330. if (scriptMgr != null && scriptMgr.adv_kag != null)
  331. {
  332. scriptMgr.adv_kag.vr_commu_mode = false;
  333. if (scriptMgr.adv_kag.kag != null)
  334. {
  335. scriptMgr.adv_kag.kag.TextClear();
  336. }
  337. }
  338. Maid man2 = instance.CharacterMgr.GetMan(0);
  339. if (man2 != null)
  340. {
  341. man2.body0.SetManHide(false);
  342. }
  343. instance.CMSystem.SetTmpGenericFlag("VR夜伽中", 0);
  344. instance.CMSystem.SetTmpGenericFlag("VRエディット中", 0);
  345. if (instance.VRDeviceTypeID == GameMain.VRDeviceType.NON)
  346. {
  347. instance.OvrUninit();
  348. }
  349. else if (instance.VRDeviceTypeID == GameMain.VRDeviceType.RIFT || instance.VRDeviceTypeID == GameMain.VRDeviceType.RIFT_TOUCH)
  350. {
  351. instance.OvrMgr.OvrCamera.ChangeTouchUse(true);
  352. }
  353. }
  354. this.m_bFinished = true;
  355. }
  356. }
  357. public void kagFreeSceneSwitch(bool f_bFreeMode, bool f_bEnableSkip = true, bool f_bNoStartText = false)
  358. {
  359. this.m_bEnableSkip = false;
  360. if (!f_bFreeMode)
  361. {
  362. this.TouchComm.Touch_End();
  363. if (this.m_coFreeSceneStartText != null)
  364. {
  365. base.StopCoroutine(this.m_coFreeSceneStartText);
  366. }
  367. ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
  368. this.m_strFreeSceneEndScriptName = scriptMgr.adv_kag.kag.GetCurrentFileName();
  369. this.m_bEnableSkip = f_bEnableSkip;
  370. }
  371. else
  372. {
  373. if (!this.m_bKaraokeMode && !f_bNoStartText)
  374. {
  375. this.StartFreeSceneText();
  376. }
  377. this.m_strFreeSceneEndScriptName = string.Empty;
  378. this.UiNoHomeMode = false;
  379. }
  380. GameMain.Instance.OvrMgr.OvrCamera.HandLimitMode = ((!f_bFreeMode) ? AVRControllerBehavior.LIMIT_MODE.NO_WARP : AVRControllerBehavior.LIMIT_MODE.NORMAL);
  381. if (!this.m_bFreeMode || !f_bFreeMode)
  382. {
  383. }
  384. this.m_bFreeMode = f_bFreeMode;
  385. this.KagTabletUIUpdate();
  386. }
  387. public void StartDay()
  388. {
  389. Farm_Mng.Instance.Day_Start();
  390. this.KagTabletUIUpdate();
  391. }
  392. public void KagTabletUIUpdate()
  393. {
  394. VRCanvasManager instance = VRCanvasManager.Instance;
  395. instance.UpdateCanvas();
  396. }
  397. private void DupCheck(GameObject[] value)
  398. {
  399. }
  400. public void KagBGChangeInit(Dictionary<string, string> f_tag_backup)
  401. {
  402. try
  403. {
  404. GameObject[] array = GameObject.FindGameObjectsWithTag("OvrEventObj");
  405. this.DupCheck(array);
  406. this.m_dicEventObj = array.ToDictionary((GameObject n) => n.name, (GameObject n) => n);
  407. GameObject[] array2 = GameObject.FindGameObjectsWithTag("OvrEventGroup");
  408. this.DupCheck(array2);
  409. this.m_dicEventGroup = array2.ToDictionary((GameObject n) => n.name, (GameObject n) => new SceneVRCommunication.EventGroup(n, this.FindChild(n.transform, null)));
  410. }
  411. catch (Exception ex)
  412. {
  413. NDebug.Assert("同じ名前のオブジェクトが入ったプレハブをロードしようとしませんでしたか?\n" + ex.Message, false);
  414. }
  415. if (f_tag_backup != null && f_tag_backup.ContainsKey("farm"))
  416. {
  417. Farm_Mng.Instance.Farm_Start();
  418. }
  419. }
  420. public void KagEventObj(string f_strName, int f_nVisible, int f_nTrigger, int f_nGrab, string f_strAnimation)
  421. {
  422. GameObject gameObject;
  423. if (this.m_dicEventObj.TryGetValue(f_strName, out gameObject))
  424. {
  425. if (f_nVisible != 0)
  426. {
  427. gameObject.SetActive(f_nVisible == 1);
  428. }
  429. if (f_nTrigger != 0)
  430. {
  431. VREventTrigger component = gameObject.GetComponent<VREventTrigger>();
  432. if (component != null)
  433. {
  434. component.SetEnableEvent(f_nTrigger == 1);
  435. }
  436. }
  437. if (f_nGrab != 0)
  438. {
  439. VREventTrigger component2 = gameObject.GetComponent<VREventTrigger>();
  440. if (component2 != null)
  441. {
  442. component2.SetEnableCollider(f_nGrab == 1);
  443. }
  444. }
  445. if (!string.IsNullOrEmpty(f_strAnimation))
  446. {
  447. Animator component3 = gameObject.GetComponent<Animator>();
  448. if (component3 != null)
  449. {
  450. component3.SetTrigger(f_strAnimation);
  451. }
  452. }
  453. }
  454. else
  455. {
  456. NDebug.Assert("指定名のオブジェクトがありません。" + f_strName, false);
  457. }
  458. }
  459. public void KagEventObjGroup(string f_strName, int f_nVisible, int f_nTrigger, int f_nGrab)
  460. {
  461. SceneVRCommunication.EventGroup eventGroup;
  462. if (this.m_dicEventGroup.TryGetValue(f_strName, out eventGroup))
  463. {
  464. if (f_nVisible != 0 || f_nTrigger != 0 || f_nGrab != 0)
  465. {
  466. for (int i = 0; i < eventGroup.listChild.Count; i++)
  467. {
  468. if (f_nVisible != 0)
  469. {
  470. eventGroup.listChild[i].SetActive(f_nVisible == 1);
  471. }
  472. VREventTrigger component = eventGroup.listChild[i].GetComponent<VREventTrigger>();
  473. if (component != null)
  474. {
  475. if (f_nTrigger != 0)
  476. {
  477. component.SetEnableEvent(f_nTrigger == 1);
  478. }
  479. if (f_nGrab != 0)
  480. {
  481. component.SetEnableCollider(f_nGrab == 1);
  482. }
  483. }
  484. }
  485. }
  486. }
  487. else
  488. {
  489. NDebug.Assert("指定名のオブジェクトグループがありません。" + f_strName, false);
  490. }
  491. }
  492. public void KagDoNextTime()
  493. {
  494. string str = "VRmainOP_0001";
  495. string label_name = string.Empty;
  496. SceneVRCommunication.VR_TIME nowTime = this.GetNowTime();
  497. if (nowTime == SceneVRCommunication.VR_TIME.MONING)
  498. {
  499. GameMain.Instance.CharacterMgr.status.SetFlag("時間帯", 2);
  500. label_name = "*昼_ループ";
  501. }
  502. else if (nowTime == SceneVRCommunication.VR_TIME.DAY)
  503. {
  504. GameMain.Instance.CharacterMgr.status.SetFlag("時間帯", 3);
  505. label_name = "*夜_ループ";
  506. }
  507. else if (nowTime == SceneVRCommunication.VR_TIME.NIGHT)
  508. {
  509. GameMain.Instance.CharacterMgr.status.SetFlag("時間帯", 1);
  510. label_name = "*朝_ループ";
  511. this.StartDay();
  512. }
  513. this.KagTabletUIUpdate();
  514. GameMain.Instance.ScriptMgr.LoadAdvScenarioScript(str + ".ks", string.Empty);
  515. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(label_name);
  516. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  517. }
  518. private List<GameObject> FindChild(Transform f_trParent, List<GameObject> f_list = null)
  519. {
  520. if (f_list == null)
  521. {
  522. f_list = new List<GameObject>();
  523. }
  524. for (int i = 0; i < f_trParent.childCount; i++)
  525. {
  526. this.FindChild(f_trParent.GetChild(i), f_list);
  527. }
  528. if (f_trParent.tag == "OvrEventObj")
  529. {
  530. f_list.Add(f_trParent.gameObject);
  531. }
  532. return f_list;
  533. }
  534. public void YotogiStart(Action f_actDecide, Action f_actCancel)
  535. {
  536. this.m_actDecide = f_actDecide;
  537. this.m_actCancel = f_actCancel;
  538. }
  539. public void MaidEditStart()
  540. {
  541. if (GameMain.Instance.CharacterMgr.GetMaid(0) == null)
  542. {
  543. Debug.LogError("エディット対象メイドが居ません。");
  544. return;
  545. }
  546. ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
  547. string currentFileName = scriptMgr.adv_kag.kag.GetCurrentFileName();
  548. GameMain.Instance.ScriptMgr.EvalScript("tf['back_edit_script_name'] = '" + currentFileName + "';");
  549. scriptMgr.LoadAdvScenarioScript(Path.ChangeExtension("vr_edit_call", ".ks"), "*start_vr");
  550. scriptMgr.adv_kag.Exec();
  551. }
  552. public SceneVRCommunication.VR_TIME GetNowTime()
  553. {
  554. SceneVRCommunication.VR_TIME result = SceneVRCommunication.VR_TIME.DAY;
  555. int flag = GameMain.Instance.CharacterMgr.status.GetFlag("時間帯");
  556. if (flag == 0 || flag == 1)
  557. {
  558. result = SceneVRCommunication.VR_TIME.MONING;
  559. }
  560. else if (flag == 2)
  561. {
  562. result = SceneVRCommunication.VR_TIME.DAY;
  563. }
  564. else if (flag == 3)
  565. {
  566. result = SceneVRCommunication.VR_TIME.NIGHT;
  567. }
  568. else
  569. {
  570. NDebug.Assert("現在の時間帯が不正です", false);
  571. }
  572. return result;
  573. }
  574. public void KagStartDayTimeShow(string f_strReturnFile, string f_strReturnLabel)
  575. {
  576. this.m_strRetrunFile = f_strReturnFile;
  577. this.m_strRetrunLabel = f_strReturnLabel;
  578. Day_UI.Day_UI_Start(new Action(this.OnEndDayTimeShow));
  579. }
  580. private void OnEndDayTimeShow()
  581. {
  582. ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
  583. if (!string.IsNullOrEmpty(this.m_strRetrunFile))
  584. {
  585. scriptMgr.LoadAdvScenarioScript(this.m_strRetrunFile + ".ks", string.Empty);
  586. }
  587. if (!string.IsNullOrEmpty(this.m_strRetrunLabel))
  588. {
  589. scriptMgr.adv_kag.JumpLabel(this.m_strRetrunLabel);
  590. }
  591. scriptMgr.adv_kag.Exec();
  592. }
  593. public void KagDialog(string f_strText, string f_strLabelOk, string f_strLabelCancel, string f_strLabelYes, string strLabelNo)
  594. {
  595. this.m_DialogMenu = VRDialogMenu.CreateDialog();
  596. VRDialogMenu.TYPE_STYLE type_STYLE = (VRDialogMenu.TYPE_STYLE)0;
  597. this.m_strLabelOk = f_strLabelOk;
  598. this.m_strLabelCancel = f_strLabelCancel;
  599. this.m_strLabelYes = f_strLabelYes;
  600. this.m_strLabelNo = strLabelNo;
  601. if (!string.IsNullOrEmpty(this.m_strLabelOk))
  602. {
  603. type_STYLE |= VRDialogMenu.TYPE_STYLE.OK;
  604. }
  605. if (!string.IsNullOrEmpty(this.m_strLabelCancel))
  606. {
  607. type_STYLE |= VRDialogMenu.TYPE_STYLE.CANCEL;
  608. }
  609. if (!string.IsNullOrEmpty(this.m_strLabelYes))
  610. {
  611. type_STYLE |= VRDialogMenu.TYPE_STYLE.YES;
  612. }
  613. if (!string.IsNullOrEmpty(this.m_strLabelNo))
  614. {
  615. type_STYLE |= VRDialogMenu.TYPE_STYLE.NO;
  616. }
  617. this.m_DialogMenu.OpenDialog(f_strText, type_STYLE, new UnityAction<VRDialogMenu.TYPE_STYLE>(this.OnEndDialog));
  618. }
  619. private void OnEndDialog(VRDialogMenu.TYPE_STYLE style)
  620. {
  621. string text = string.Empty;
  622. if (style == VRDialogMenu.TYPE_STYLE.OK)
  623. {
  624. text = this.m_strLabelOk;
  625. }
  626. else if (style == VRDialogMenu.TYPE_STYLE.CANCEL)
  627. {
  628. text = this.m_strLabelCancel;
  629. }
  630. if (style == VRDialogMenu.TYPE_STYLE.YES)
  631. {
  632. text = this.m_strLabelYes;
  633. }
  634. else if (style == VRDialogMenu.TYPE_STYLE.NO)
  635. {
  636. text = this.m_strLabelNo;
  637. }
  638. this.m_DialogMenu.CloseDialog();
  639. NDebug.Assert(!string.IsNullOrEmpty(text), "ダイアログとび先ラベルがありません");
  640. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(text);
  641. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  642. }
  643. public void KagStartMovieMusicPlayerTV()
  644. {
  645. VRExternalFileLoader.Event_OpenSelect();
  646. }
  647. public void KagVRMovieTV(bool f_bStart, string f_strFileName = "", bool f_bLoop = false)
  648. {
  649. if (f_bStart)
  650. {
  651. VRExternalFileLoader.Event_PlayMovie(f_strFileName);
  652. }
  653. else
  654. {
  655. VRExternalFileLoader.Event_CloseMovie();
  656. }
  657. }
  658. public void KagPlantWindowShow(string strFileName, string strLabelOK, string strLabelCancel)
  659. {
  660. this.m_strFilePlant = strFileName;
  661. this.m_strLabelPlantOk = strLabelOK;
  662. this.m_strLabelPlantCancel = strLabelCancel;
  663. VRCanvasManager instance = VRCanvasManager.Instance;
  664. instance.OpenVRCulture(new UnityAction(this.OnPlantOk), new UnityAction(this.OnPlantCancel));
  665. }
  666. private void OnPlantOk()
  667. {
  668. if (!string.IsNullOrEmpty(this.m_strFilePlant))
  669. {
  670. GameMain.Instance.ScriptMgr.adv_kag.LoadScriptFile(this.m_strFilePlant, string.Empty);
  671. }
  672. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_strLabelPlantOk);
  673. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  674. }
  675. private void OnPlantCancel()
  676. {
  677. if (!string.IsNullOrEmpty(this.m_strFilePlant))
  678. {
  679. GameMain.Instance.ScriptMgr.adv_kag.LoadScriptFile(this.m_strFilePlant, string.Empty);
  680. }
  681. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_strLabelPlantCancel);
  682. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  683. }
  684. public void KagPlantUpdate()
  685. {
  686. Farm_Mng.Instance.SyuKaku();
  687. }
  688. public void KagTutorialStart(string f_strReturnLabel)
  689. {
  690. this.m_strRetrunLabel = f_strReturnLabel;
  691. VRCanvasManager instance = VRCanvasManager.Instance;
  692. instance.OpenVRTutorialMenu(new UnityAction(this.OnEndTutorial));
  693. }
  694. private void OnEndTutorial()
  695. {
  696. if (!string.IsNullOrEmpty(this.m_strRetrunLabel))
  697. {
  698. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_strRetrunLabel);
  699. }
  700. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  701. }
  702. public void KagVRNoChangeBG(bool f_bStart)
  703. {
  704. this.m_bUiNoMove = f_bStart;
  705. }
  706. public void KagVRTrophyGet(string f_strText)
  707. {
  708. Trophy_UI.Trophy_Start(f_strText);
  709. }
  710. private void StartFreeSceneText()
  711. {
  712. if (this.m_coFreeSceneStartText != null)
  713. {
  714. base.StopCoroutine(this.m_coFreeSceneStartText);
  715. }
  716. this.m_coFreeSceneStartText = base.StartCoroutine(this.CoFreeSceneText());
  717. }
  718. private IEnumerator CoFreeSceneText()
  719. {
  720. yield return new WaitForSeconds(1f);
  721. SceneVRCommunication.VR_TIME time = this.GetNowTime();
  722. string[] aryTimeStr = new string[]
  723. {
  724. "朝",
  725. "昼",
  726. "夜"
  727. };
  728. string strBGName = string.Empty;
  729. if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_Night".ToLower())
  730. {
  731. strBGName = "ヴィラ1F";
  732. }
  733. else if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_BedRoom".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_BedRoom_Night".ToLower())
  734. {
  735. strBGName = "ヴィラ2F";
  736. }
  737. else if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_Farm".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_Farm_Night".ToLower())
  738. {
  739. strBGName = "庭";
  740. }
  741. else if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Sea_VR".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Sea_VR_Night".ToLower())
  742. {
  743. strBGName = "海岸";
  744. }
  745. else if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Rotenburo".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Rotenburo_Night".ToLower())
  746. {
  747. strBGName = "露天風呂";
  748. }
  749. if (!string.IsNullOrEmpty(strBGName))
  750. {
  751. FreeScene_UI.FreeScene_Start(strBGName + "\u3000" + aryTimeStr[(int)this.GetNowTime()], null);
  752. }
  753. this.m_coFreeSceneStartText = null;
  754. yield break;
  755. }
  756. public void KagRentalMaidSelectStart()
  757. {
  758. VRCanvasManager instance = VRCanvasManager.Instance;
  759. instance.OpenVRRentalMaid();
  760. }
  761. public void KagTouchUseSelect(string f_strReturnLabel)
  762. {
  763. this.m_strRetrunLabel = f_strReturnLabel;
  764. VRCanvasManager instance = VRCanvasManager.Instance;
  765. instance.OpenVRDecideUseTouch(new UnityAction<bool>(this.OnTouchUseSelect));
  766. }
  767. private void OnTouchUseSelect(bool f_bUseTouch)
  768. {
  769. GameMain.Instance.OvrMgr.OvrCamera.ChangeTouchUse(f_bUseTouch);
  770. if (!string.IsNullOrEmpty(this.m_strRetrunLabel))
  771. {
  772. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_strRetrunLabel);
  773. }
  774. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  775. }
  776. private void OnSkipScenario()
  777. {
  778. if (!string.IsNullOrEmpty(this.m_strFreeSceneEndScriptName))
  779. {
  780. GameMain.Instance.SoundMgr.VoiceStopAll();
  781. GameMain.Instance.ScriptMgr.adv_kag.LoadScriptFile(this.m_strFreeSceneEndScriptName, string.Empty);
  782. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel("*アフターファイル挿入箇所");
  783. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  784. }
  785. }
  786. public void KagHintShow(string f_strHintMsg)
  787. {
  788. SelectMessage_UI.Message_Start(f_strHintMsg);
  789. }
  790. public void KagKaraokeWindowShow(string f_strReturnFile, string f_strReturnLabel)
  791. {
  792. this.m_strKaraokeRetrunFile = f_strReturnFile;
  793. this.m_strKaraokeRetrunLabel = f_strReturnLabel;
  794. VRCanvasManager instance = VRCanvasManager.Instance;
  795. instance.StartKaraokeMode(new Action(this.OnKaraokeCancel));
  796. }
  797. private void OnKaraokeCancel()
  798. {
  799. if (!string.IsNullOrEmpty(this.m_strKaraokeRetrunFile))
  800. {
  801. GameMain.Instance.ScriptMgr.adv_kag.LoadScriptFile(this.m_strKaraokeRetrunFile, string.Empty);
  802. }
  803. if (!string.IsNullOrEmpty(this.m_strKaraokeRetrunLabel))
  804. {
  805. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_strKaraokeRetrunLabel);
  806. }
  807. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  808. }
  809. public void OnEnd()
  810. {
  811. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  812. base.StartCoroutine(this.CoEnd());
  813. }
  814. private IEnumerator CoEnd()
  815. {
  816. yield return null;
  817. GameMain.Instance.UnloadPopScene();
  818. yield return null;
  819. this.Uninit();
  820. yield return null;
  821. Debug.Log("vr_end_call");
  822. GameMain.Instance.ScriptMgr.adv_kag.LoadScriptFile("vr_end_call.ks", string.Empty);
  823. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  824. yield break;
  825. }
  826. private void Update()
  827. {
  828. if (GameMain.Instance.VRFamily == GameMain.VRFamilyType.NON && this.m_bManShow != GameMain.Instance.CMSystem.VRManShow)
  829. {
  830. this.m_bManShow = GameMain.Instance.CMSystem.VRManShow;
  831. Maid man = GameMain.Instance.CharacterMgr.GetMan(0);
  832. if (man != null)
  833. {
  834. man.body0.SetManHide(!this.m_bManShow);
  835. }
  836. }
  837. }
  838. private static SceneVRCommunication m_this;
  839. private bool m_bFreeMode = true;
  840. private bool m_bEnableSkip;
  841. private bool m_bUiNoMove;
  842. private bool m_bUiNoTime;
  843. private bool m_bUiNoHome;
  844. private bool m_bMouseOnlyMode;
  845. private Dictionary<string, GameObject> m_dicEventObj;
  846. private VRChoices m_VRChoices;
  847. private VRMiniGameManager m_VRMinigameMgr;
  848. private VRTouchComm m_VRTouchComm;
  849. private GameObject m_goUiRoot;
  850. private string m_strRetrunFile = string.Empty;
  851. private string m_strRetrunLabel = string.Empty;
  852. private string m_strKaraokeRetrunFile = string.Empty;
  853. private string m_strKaraokeRetrunLabel = string.Empty;
  854. private Dictionary<string, SceneVRCommunication.EventGroup> m_dicEventGroup;
  855. public Dictionary<string, string> m_dicTagBackup;
  856. private Coroutine m_coFreeSceneStartText;
  857. private GameObject m_goCanvas;
  858. private string m_strFreeSceneEndScriptName;
  859. private bool m_bManShow;
  860. private bool m_bFinished;
  861. private bool m_bKaraokeMode;
  862. private string m_strStartScriptFile;
  863. private string m_strStartScriptLabel;
  864. private Action m_actDecide;
  865. private Action m_actCancel;
  866. private VRDialogMenu m_DialogMenu;
  867. private string m_strLabelOk = string.Empty;
  868. private string m_strLabelCancel = string.Empty;
  869. private string m_strLabelYes = string.Empty;
  870. private string m_strLabelNo = string.Empty;
  871. private string m_strFilePlant = string.Empty;
  872. private string m_strLabelPlantOk = string.Empty;
  873. private string m_strLabelPlantCancel = string.Empty;
  874. public enum VR_TIME
  875. {
  876. MONING,
  877. DAY,
  878. NIGHT,
  879. MAX
  880. }
  881. private class EventGroup
  882. {
  883. public EventGroup(GameObject go, List<GameObject> lst)
  884. {
  885. this.goParent = go;
  886. this.listChild = lst;
  887. }
  888. public GameObject goParent;
  889. public List<GameObject> listChild = new List<GameObject>();
  890. }
  891. }