SceneVRCommunication.cs 26 KB

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