RhythmAction_Mgr.cs 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using wf;
  6. public class RhythmAction_Mgr : MonoBehaviour
  7. {
  8. public static RhythmAction_Mgr.DanceType NowDance
  9. {
  10. get
  11. {
  12. return RhythmAction_Mgr.m_DanceType;
  13. }
  14. }
  15. public static int DanceReward { get; private set; }
  16. public static RhythmAction_Mgr.DanceState NowState { get; private set; }
  17. public static RhythmAction_Mgr Instance
  18. {
  19. get
  20. {
  21. return RhythmAction_Mgr.m_Instance;
  22. }
  23. }
  24. public string MusicCSV_Path
  25. {
  26. get
  27. {
  28. return "csv_rhythm_action/" + this.m_UseMusicName + "/";
  29. }
  30. }
  31. public List<Maid> DanceMaid
  32. {
  33. get
  34. {
  35. return this.m_DanceMain.DanceMaid;
  36. }
  37. }
  38. public Maid UserMaid
  39. {
  40. get
  41. {
  42. return this.m_DanceMain.UserMaid;
  43. }
  44. }
  45. public bool IsTakeEnd
  46. {
  47. get
  48. {
  49. return this.m_DanceMain.m_AnimatorData.takeName == null;
  50. }
  51. }
  52. public float TakeTime
  53. {
  54. get
  55. {
  56. return this.m_DanceMain.m_AnimatorData.GetTakeTime();
  57. }
  58. }
  59. public bool IsPause
  60. {
  61. get
  62. {
  63. return this.m_IsPause;
  64. }
  65. }
  66. public AVProVideoPlayer MovieMgr { get; private set; }
  67. public float DanceDeltaTime { get; private set; }
  68. public Transform OvrCamTrans
  69. {
  70. get
  71. {
  72. return this.m_DanceMain.OvrCamTrans;
  73. }
  74. }
  75. public GameObject UIScreen { get; private set; }
  76. public bool IsReadyNow
  77. {
  78. get
  79. {
  80. return this.m_ReadyPanel;
  81. }
  82. }
  83. public float DanceTimer { get; private set; }
  84. public bool DanceEnd
  85. {
  86. get
  87. {
  88. return this.m_DanceMain.IsDanceEnd;
  89. }
  90. }
  91. public bool ForceDanceEnd
  92. {
  93. get
  94. {
  95. return this.m_DanceMain.IsForceDanceEnd;
  96. }
  97. }
  98. public List<Maid> FactOrderList
  99. {
  100. get
  101. {
  102. return this.m_FactOrderList;
  103. }
  104. }
  105. public bool IsDanceSkip
  106. {
  107. get
  108. {
  109. return this.m_DanceMain.IsDanceSkip;
  110. }
  111. }
  112. public bool IsNewController
  113. {
  114. get
  115. {
  116. return GameMain.Instance.VRMode && GameMain.Instance.OvrMgr.ovr_obj.left_controller.controller.IsControllerTypeNew && GameMain.Instance.OvrMgr.ovr_obj.right_controller.controller.IsControllerTypeNew;
  117. }
  118. }
  119. public float RemainingTime
  120. {
  121. get
  122. {
  123. return Mathf.Max(this.TakeTime - this.DanceTimer, 0f);
  124. }
  125. }
  126. public static int MusicReleaseFlag
  127. {
  128. get
  129. {
  130. return GameMain.Instance.CharacterMgr.status.GetFlag("_楽曲解放");
  131. }
  132. set
  133. {
  134. GameMain.Instance.CharacterMgr.status.SetFlag("_楽曲解放", value);
  135. }
  136. }
  137. public static bool IsVSDance
  138. {
  139. get
  140. {
  141. return RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.VS || RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.VS_Skip;
  142. }
  143. }
  144. private void Awake()
  145. {
  146. RhythmAction_Mgr.m_Instance = this;
  147. this.m_NowTime = 0f;
  148. this.m_LastTime = 0f;
  149. this.m_DanceMain = GameObject.Find("_DanceMain_").GetComponent<DanceMain>();
  150. if (!base.transform.parent)
  151. {
  152. GameObject gameObject = GameObject.Find("UI Root");
  153. base.transform.SetParent(gameObject.transform, false);
  154. }
  155. GameObject gameObject2 = base.transform.parent.Find("Camera").gameObject;
  156. this.m_RhythmActionCam = UnityEngine.Object.Instantiate<GameObject>(gameObject2, base.transform.parent).GetComponent<Camera>();
  157. this.m_RhythmActionCam.name = "RhythmActionCam";
  158. this.m_NguiCam = gameObject2.GetComponent<Camera>();
  159. if (!GameMain.Instance.VRMode || !this.IsNewController)
  160. {
  161. this.m_NguiCam.cullingMask = this.m_RhythmAction2DLayer;
  162. this.m_RhythmActionCam.gameObject.SetActive(false);
  163. }
  164. else
  165. {
  166. this.m_OrijinLimit = GameMain.Instance.OvrMgr.OvrCamera.HandLimitMode;
  167. GameMain.Instance.OvrMgr.OvrCamera.HandLimitMode = AVRControllerBehavior.LIMIT_MODE.NO_WARP;
  168. this.m_RhythmActionCam.cullingMask = this.m_RhythmActionLayer;
  169. this.m_LeftPenlight = Utility.CreatePrefab(GameMain.Instance.OvrMgr.GetVRControllerTransform(true).gameObject, "SceneDance/Rhythm_Action/Prefab/StickLight", true);
  170. this.m_LeftPenlight.name = "PenLight(left)";
  171. this.m_RightPenlight = Utility.CreatePrefab(GameMain.Instance.OvrMgr.GetVRControllerTransform(false).gameObject, "SceneDance/Rhythm_Action/Prefab/StickLight", true);
  172. this.m_RightPenlight.name = "PenLight(light)";
  173. Transform transform = this.m_LeftPenlight.transform;
  174. Vector3 vector = Vector3.zero;
  175. this.m_RightPenlight.transform.localEulerAngles = vector;
  176. transform.localEulerAngles = vector;
  177. Transform transform2 = this.m_LeftPenlight.transform;
  178. vector = this.m_PenlightOffset;
  179. this.m_RightPenlight.transform.localPosition = vector;
  180. transform2.localPosition = vector;
  181. Transform transform3 = this.m_LeftPenlight.transform;
  182. vector = this.m_PenlightScale;
  183. this.m_RightPenlight.transform.localScale = vector;
  184. transform3.localScale = vector;
  185. UnityEngine.Object.Destroy(this.m_LeftPenlight.GetComponent<OvrControllerHit>());
  186. UnityEngine.Object.Destroy(this.m_RightPenlight.GetComponent<OvrControllerHit>());
  187. UnityEngine.Object.Destroy(this.m_LeftPenlight.GetComponent<ViveControllerHit>());
  188. UnityEngine.Object.Destroy(this.m_RightPenlight.GetComponent<ViveControllerHit>());
  189. }
  190. if (!DanceMain.KaraokeMode && GameMain.Instance.VRMode)
  191. {
  192. this.m_OvrUI = GameMain.Instance.OvrMgr.OvrCamera.m_goOvrUiScreen.GetComponent<OvrUI>();
  193. GameMain.Instance.OvrMgr.OvrCamera.m_goOvrUiScreen.SetActive(true);
  194. this.UIScreen = this.m_OvrUI.transform.Find("ovr_screen").gameObject;
  195. this.m_FirstScreen = this.UIScreen.transform.localPosition;
  196. if (this.IsNewController)
  197. {
  198. this.m_RhythmActionTex = Resources.Load<RenderTexture>("SceneDance/Rhythm_Action/rtRhythmActionUI");
  199. this.m_RhythmActionCam.targetTexture = this.m_RhythmActionTex;
  200. this.m_ScreenMat = this.UIScreen.transform.Find("default").GetComponent<MeshRenderer>().material;
  201. this.m_ScreenMat.mainTexture = this.m_RhythmActionTex;
  202. this.UIScreen.transform.Find("hit").gameObject.SetActive(false);
  203. }
  204. GameMain.Instance.OvrMgr.OvrCamera.HandDanceMode = (RhythmAction_Mgr.NowDance != RhythmAction_Mgr.DanceType.VS_Skip);
  205. }
  206. this.m_MainCamDepth = GameMain.Instance.MainCamera.GetComponent<DepthOfFieldScatter>();
  207. if (this.m_MainCamDepth)
  208. {
  209. this.m_OrijinDepthEnable = this.m_MainCamDepth.enabled;
  210. this.m_OrijinFocalSize = this.m_MainCamDepth.focalSize;
  211. this.m_MainCamDepth.focalSize = this.m_DanceMain.DepthFocalSize;
  212. this.m_MainCamDepth.enabled = DanceSetting.Settings.IsDepthOfFieldOn;
  213. }
  214. foreach (RhythmAction_Mgr.ChoiceObjpair choiceObjpair in this.m_ChoiceUIList)
  215. {
  216. choiceObjpair.UIImage = choiceObjpair.EventUI.GetComponent<UISprite>();
  217. switch (choiceObjpair.Choice)
  218. {
  219. case RhythmAction_Mgr.PauseChoices.Continue:
  220. this.AddEventMethod(choiceObjpair.EventUI, new EventDelegate.Callback(this.SelectContinue));
  221. break;
  222. case RhythmAction_Mgr.PauseChoices.End:
  223. if (RhythmAction_Mgr.NowDance != RhythmAction_Mgr.DanceType.VS_Skip)
  224. {
  225. this.AddEventMethod(choiceObjpair.EventUI, new EventDelegate.Callback(this.SelectEnd));
  226. }
  227. else
  228. {
  229. choiceObjpair.EventUI.SetActive(false);
  230. }
  231. break;
  232. case RhythmAction_Mgr.PauseChoices.Recet:
  233. if (RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.Free)
  234. {
  235. this.AddEventMethod(choiceObjpair.EventUI, new EventDelegate.Callback(this.SelectRecet));
  236. }
  237. else
  238. {
  239. choiceObjpair.EventUI.SetActive(false);
  240. choiceObjpair.EventUI.transform.parent.localPosition += Vector3.down * this.m_ChoiceUIDown;
  241. }
  242. break;
  243. case RhythmAction_Mgr.PauseChoices.Skip:
  244. if (RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.VS_Skip)
  245. {
  246. this.AddEventMethod(choiceObjpair.EventUI, new EventDelegate.Callback(this.SelectSkip));
  247. }
  248. else
  249. {
  250. choiceObjpair.EventUI.SetActive(false);
  251. }
  252. break;
  253. }
  254. }
  255. this.ChoicesUIRecet();
  256. this.m_PausePanel.SetActive(false);
  257. GameObject gameObject3 = GameObject.Find("LiveGimic");
  258. if (gameObject3)
  259. {
  260. this.Search_AllEffect(gameObject3.transform, false);
  261. }
  262. if (RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.BenchMark)
  263. {
  264. GameMain.Instance.SysShortcut.gameObject.SetActive(false);
  265. }
  266. }
  267. private void Update()
  268. {
  269. if (this.m_LastTime != 0f)
  270. {
  271. this.m_NowTime = Time.realtimeSinceStartup;
  272. }
  273. if (this.m_LeftPenlight && this.m_RightPenlight)
  274. {
  275. this.m_LeftPenlight.SetActive(GameMain.Instance.OvrMgr.ovr_obj.left_controller.controller.HandDanceMode);
  276. this.m_RightPenlight.SetActive(GameMain.Instance.OvrMgr.ovr_obj.right_controller.controller.HandDanceMode);
  277. }
  278. this.DanceDeltaTime = this.m_NowTime - this.m_LastTime;
  279. this.m_LastTime = Time.realtimeSinceStartup;
  280. if (!this.IsPause && this.m_IsStart)
  281. {
  282. this.DanceTimer += this.DanceDeltaTime;
  283. }
  284. if (GameMain.Instance.VRMode && this.m_OvrUI)
  285. {
  286. if (!this.IsNewController && !Note_Mgr.Instance.IsActive)
  287. {
  288. return;
  289. }
  290. Vector3 eulerAngles = this.m_OvrUI.m_goCenter.transform.eulerAngles;
  291. eulerAngles.z = 0f;
  292. this.m_OvrUI.transform.eulerAngles = eulerAngles;
  293. this.UIScreen.transform.localPosition = new Vector3(0f, -this.m_UIDown, this.m_CameraLength);
  294. this.m_RhythmActionCam.transform.localPosition = this.m_NguiCam.transform.localPosition;
  295. }
  296. }
  297. private void OnDestroy()
  298. {
  299. if (this.m_RhythmActionCam)
  300. {
  301. UnityEngine.Object.DestroyImmediate(this.m_RhythmActionCam.gameObject);
  302. }
  303. if (GameMain.Instance.VRMode && !this.IsNewController)
  304. {
  305. this.m_NguiCam.cullingMask = LayerMask.GetMask(new string[]
  306. {
  307. "NGUI"
  308. });
  309. }
  310. if (!DanceMain.KaraokeMode && GameMain.Instance.VRMode && GameMain.Instance.VRFamily != GameMain.VRFamilyType.NON)
  311. {
  312. if (this.IsNewController)
  313. {
  314. GameMain.Instance.OvrMgr.OvrCamera.ShowUI(true);
  315. GameMain.Instance.OvrMgr.OvrCamera.HandLimitMode = this.m_OrijinLimit;
  316. if (GameMain.Instance.OvrMgr.OvrCamera.m_goOvrUiScreen)
  317. {
  318. GameMain.Instance.OvrMgr.OvrCamera.m_goOvrUiScreen.SetActive(false);
  319. }
  320. }
  321. else if (this.m_OvrUI)
  322. {
  323. this.m_OvrUI.enabled = true;
  324. }
  325. GameMain.Instance.OvrMgr.OvrCamera.HandDanceMode = false;
  326. }
  327. if (this.m_MainCamDepth)
  328. {
  329. this.m_MainCamDepth.focalSize = this.m_OrijinFocalSize;
  330. this.m_MainCamDepth.enabled = this.m_OrijinDepthEnable;
  331. }
  332. if (RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.BenchMark)
  333. {
  334. if (GameMain.Instance && GameMain.Instance.SysShortcut)
  335. {
  336. GameMain.Instance.SysShortcut.gameObject.SetActive(true);
  337. }
  338. BenchSetting.SettingRecet();
  339. }
  340. foreach (Maid maid in this.DanceMaid)
  341. {
  342. if (maid)
  343. {
  344. maid.MabatakiUpdateStop = false;
  345. }
  346. }
  347. if (this.m_LeftPenlight && this.m_RightPenlight)
  348. {
  349. UnityEngine.Object.Destroy(this.m_LeftPenlight);
  350. UnityEngine.Object.Destroy(this.m_RightPenlight);
  351. }
  352. }
  353. private IEnumerator CheckPause()
  354. {
  355. float timer = 0f;
  356. UIPanel ready_panel = (!this.m_ReadyPanel) ? null : this.m_ReadyPanel.GetComponent<UIPanel>();
  357. bool ready_fade = false;
  358. bool ready_display = false;
  359. for (;;)
  360. {
  361. if (RhythmAction_Mgr.NowDance != RhythmAction_Mgr.DanceType.BenchMark)
  362. {
  363. if (this.m_ReadyPanel)
  364. {
  365. if (!ready_display)
  366. {
  367. ready_display = GameMain.Instance.MainCamera.IsFadeProc();
  368. }
  369. else if (!ready_fade)
  370. {
  371. if (!this.IsPause && !this.m_ReadyNotStop)
  372. {
  373. this.SwitchPause(true, true);
  374. }
  375. timer += this.DanceDeltaTime;
  376. if (timer > this.m_ReadyWaitTime)
  377. {
  378. this.SwitchPause(false, true);
  379. ready_fade = true;
  380. timer = 0f;
  381. }
  382. }
  383. else
  384. {
  385. timer += this.DanceDeltaTime;
  386. ready_panel.alpha = 1f - Mathf.Sin(Mathf.Clamp01(timer / this.m_ReadyFadeTime) * 90f * 0.0174532924f);
  387. if (timer > this.m_ReadyFadeTime)
  388. {
  389. ready_fade = false;
  390. ready_display = false;
  391. UnityEngine.Object.Destroy(this.m_ReadyPanel);
  392. timer = 0f;
  393. }
  394. }
  395. }
  396. else if (!GameMain.Instance.MainCamera.IsFadeOut() && Input.GetKeyDown(KeyCode.Return))
  397. {
  398. this.SwitchPause(!this.m_IsPause, false);
  399. }
  400. }
  401. yield return null;
  402. }
  403. yield break;
  404. }
  405. private void DanceStart()
  406. {
  407. this.m_IsStart = true;
  408. if (GameMain.Instance.VRMode)
  409. {
  410. this.m_NguiCam.clearFlags = CameraClearFlags.Color;
  411. this.m_RhythmActionCam.clearFlags = CameraClearFlags.Color;
  412. }
  413. else
  414. {
  415. this.m_NguiCam.clearFlags = CameraClearFlags.Depth;
  416. }
  417. this.m_BlackBG.SetActive(DanceSetting.Settings.IsblackBGon && Note_Mgr.Instance.IsActive);
  418. if (this.m_OvrUI)
  419. {
  420. if (this.IsNewController)
  421. {
  422. GameMain.Instance.OvrMgr.OvrCamera.ShowUI(!Note_Mgr.Instance.IsActive);
  423. this.m_OvrUI.enabled = false;
  424. }
  425. else
  426. {
  427. this.m_OvrUI.enabled = !Note_Mgr.Instance.IsActive;
  428. }
  429. }
  430. if (RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.BenchMark)
  431. {
  432. GameMain.Instance.SysShortcut.gameObject.SetActive(false);
  433. }
  434. if (!Note_Mgr.Instance.IsActive || RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.BenchMark)
  435. {
  436. UnityEngine.Object.Destroy(this.m_ReadyPanel);
  437. }
  438. if (DanceMain.KaraokeMode)
  439. {
  440. return;
  441. }
  442. foreach (Maid maid in this.DanceMaid)
  443. {
  444. this.SetMaidFaceStop(maid, false);
  445. this.SetMaidFaceBlendStop(maid, false);
  446. this.Search_AllEffect(maid.transform, true);
  447. }
  448. base.StartCoroutine(this.CheckPause());
  449. }
  450. private void ToNextState()
  451. {
  452. if (DanceMain.KaraokeMode)
  453. {
  454. return;
  455. }
  456. RhythmAction_Mgr.DanceState nowState = RhythmAction_Mgr.NowState;
  457. if (nowState != RhythmAction_Mgr.DanceState.Dance_First)
  458. {
  459. if (nowState == RhythmAction_Mgr.DanceState.Dance_Second)
  460. {
  461. GameMain.Instance.CharacterMgr.status.SetFlag("バトル回数", 2);
  462. RhythmAction_Mgr.NowState = RhythmAction_Mgr.DanceState.Dance_First;
  463. }
  464. }
  465. else
  466. {
  467. GameMain.Instance.CharacterMgr.status.SetFlag("バトル回数", 1);
  468. if (RhythmAction_Mgr.IsVSDance)
  469. {
  470. RhythmAction_Mgr.NowState = RhythmAction_Mgr.DanceState.Dance_Second;
  471. }
  472. }
  473. }
  474. private void SwitchPause(bool is_pause, bool is_ready = false)
  475. {
  476. this.m_IsPause = is_pause;
  477. this.m_PausePanel.SetActive(this.m_IsPause && !is_ready);
  478. if (this.IsNewController && this.m_PausePanel.activeSelf)
  479. {
  480. GameMain.Instance.OvrMgr.OvrCamera.ShowUI(true);
  481. }
  482. this.ChoicesUIRecet();
  483. if (this.m_IsPause)
  484. {
  485. if (this.MovieMgr)
  486. {
  487. this.MovieMgr.Stop();
  488. }
  489. foreach (ParticleSystem particleSystem in this.m_AllParticleSystem)
  490. {
  491. if (particleSystem && particleSystem.gameObject.activeInHierarchy)
  492. {
  493. particleSystem.Pause();
  494. }
  495. }
  496. foreach (Animator animator in this.m_OtherAnimator)
  497. {
  498. animator.speed = 0f;
  499. }
  500. foreach (AudioSource audioSource in this.m_AudioMgrList)
  501. {
  502. audioSource.Pause();
  503. }
  504. GameMain.Instance.SoundMgr.GetAudioSourceBgm().Pause();
  505. }
  506. else
  507. {
  508. if (this.MovieMgr)
  509. {
  510. this.MovieMgr.Play();
  511. }
  512. foreach (ParticleSystem particleSystem2 in this.m_AllParticleSystem)
  513. {
  514. if (particleSystem2 && particleSystem2.gameObject.activeInHierarchy)
  515. {
  516. particleSystem2.Play();
  517. }
  518. }
  519. foreach (Animator animator2 in this.m_OtherAnimator)
  520. {
  521. animator2.speed = 1f;
  522. }
  523. foreach (AudioSource audioSource2 in this.m_AudioMgrList)
  524. {
  525. audioSource2.UnPause();
  526. }
  527. GameMain.Instance.SoundMgr.GetAudioSourceBgm().UnPause();
  528. }
  529. foreach (EllipsoidParticleEmitter ellipsoidParticleEmitter in this.m_AllParticleEmitter)
  530. {
  531. if (ellipsoidParticleEmitter)
  532. {
  533. ellipsoidParticleEmitter.enabled = !this.m_IsPause;
  534. }
  535. }
  536. foreach (Maid maid in this.DanceMaid)
  537. {
  538. if (GameMain.Instance.VRMode && GameMain.Instance.CMSystem.GetTmpGenericFlag("ダンスOVRカメラタイプ") == 0)
  539. {
  540. if (this.m_IsPause)
  541. {
  542. maid.EyeToCamera(Maid.EyeMoveType.無視する, 0f);
  543. }
  544. else
  545. {
  546. maid.EyeToCamera(Maid.EyeMoveType.目だけ向ける, 0f);
  547. }
  548. }
  549. maid.MabatakiUpdateStop = this.m_IsPause;
  550. }
  551. if (!is_ready)
  552. {
  553. GameMain.Instance.SoundMgr.PlaySystem(SoundMgr.SeType.Click);
  554. }
  555. }
  556. private void SelectContinue()
  557. {
  558. this.m_SelectEnd = false;
  559. this.m_SelectRecet = false;
  560. this.m_SelectSkip = false;
  561. this.ChoicesSelect(RhythmAction_Mgr.PauseChoices.Continue, true);
  562. }
  563. private void SelectEnd()
  564. {
  565. this.m_SelectEnd = true;
  566. this.m_SelectRecet = false;
  567. this.m_SelectSkip = false;
  568. this.ChoicesSelect(RhythmAction_Mgr.PauseChoices.End, true);
  569. }
  570. private void SelectRecet()
  571. {
  572. this.m_SelectEnd = true;
  573. this.m_SelectRecet = true;
  574. this.m_SelectSkip = false;
  575. this.ChoicesSelect(RhythmAction_Mgr.PauseChoices.Recet, true);
  576. }
  577. private void SelectSkip()
  578. {
  579. this.m_SelectEnd = false;
  580. this.m_SelectRecet = false;
  581. this.m_SelectSkip = true;
  582. this.ChoicesSelect(RhythmAction_Mgr.PauseChoices.Skip, true);
  583. }
  584. private void ChoicesSelect(RhythmAction_Mgr.PauseChoices select_choice, bool playse = true)
  585. {
  586. if (playse)
  587. {
  588. GameMain.Instance.SoundMgr.PlaySystem(SoundMgr.SeType.Hover);
  589. }
  590. foreach (RhythmAction_Mgr.ChoiceObjpair choiceObjpair in this.m_ChoiceUIList)
  591. {
  592. if (choiceObjpair.Choice == select_choice)
  593. {
  594. choiceObjpair.UIImage.spriteName = choiceObjpair.CursorOnImage;
  595. }
  596. else
  597. {
  598. choiceObjpair.UIImage.spriteName = choiceObjpair.CursorOffImage;
  599. }
  600. }
  601. }
  602. private void ChoicesUIRecet()
  603. {
  604. this.m_SelectEnd = false;
  605. this.m_SelectRecet = false;
  606. this.m_SelectSkip = false;
  607. this.ChoicesSelect(RhythmAction_Mgr.PauseChoices.Continue, false);
  608. }
  609. private void Decide_GameEnd()
  610. {
  611. GameMain.Instance.SoundMgr.PlaySystem(SoundMgr.SeType.Click);
  612. this.m_DanceMain.IsForceDanceEnd = this.m_SelectEnd;
  613. this.m_DanceMain.IsDanceSkip = this.m_SelectSkip;
  614. DanceMain.IsDanceRecet = this.m_SelectRecet;
  615. if (!this.m_DanceMain.IsForceDanceEnd && !this.m_SelectSkip)
  616. {
  617. this.SwitchPause(false, false);
  618. }
  619. else
  620. {
  621. foreach (Maid maid in this.DanceMaid)
  622. {
  623. maid.boMabataki = true;
  624. }
  625. }
  626. }
  627. private void AddEventMethod(GameObject ui, EventDelegate.Callback callback)
  628. {
  629. UIEventTrigger component = ui.GetComponent<UIEventTrigger>();
  630. EventDelegate.Add(component.onHoverOver, callback);
  631. EventDelegate.Add(component.onPress, new EventDelegate.Callback(this.Decide_GameEnd));
  632. }
  633. public void Search_AllEffect(Transform parent, bool isIgnoreAnime = false)
  634. {
  635. IEnumerator enumerator = parent.GetEnumerator();
  636. try
  637. {
  638. while (enumerator.MoveNext())
  639. {
  640. object obj = enumerator.Current;
  641. Transform transform = (Transform)obj;
  642. ParticleSystem component = transform.GetComponent<ParticleSystem>();
  643. EllipsoidParticleEmitter component2 = transform.GetComponent<EllipsoidParticleEmitter>();
  644. Animator component3 = transform.GetComponent<Animator>();
  645. AVProVideoPlayer component4 = transform.GetComponent<AVProVideoPlayer>();
  646. if (component)
  647. {
  648. this.m_AllParticleSystem.Add(component);
  649. }
  650. else if (component2)
  651. {
  652. this.m_AllParticleEmitter.Add(component2);
  653. }
  654. else if (component3 && !isIgnoreAnime)
  655. {
  656. this.m_OtherAnimator.Add(component3);
  657. }
  658. else if (component4)
  659. {
  660. this.MovieMgr = component4;
  661. }
  662. this.Search_AllEffect(transform, isIgnoreAnime);
  663. }
  664. }
  665. finally
  666. {
  667. IDisposable disposable;
  668. if ((disposable = (enumerator as IDisposable)) != null)
  669. {
  670. disposable.Dispose();
  671. }
  672. }
  673. }
  674. public void AddMgrParts(PartsMgrBase parts)
  675. {
  676. this.m_MgrPartsList.Add(parts);
  677. }
  678. public T GetMgrParts<T>() where T : PartsMgrBase
  679. {
  680. foreach (PartsMgrBase partsMgrBase in this.m_MgrPartsList)
  681. {
  682. if (partsMgrBase is T)
  683. {
  684. return (T)((object)partsMgrBase);
  685. }
  686. }
  687. Debug.LogErrorFormat("指定した管理クラスを取得できませんでした", new object[0]);
  688. return (T)((object)null);
  689. }
  690. public void RhythmGame_Start()
  691. {
  692. this.DanceStart();
  693. foreach (PartsMgrBase partsMgrBase in this.m_MgrPartsList)
  694. {
  695. if (partsMgrBase.IsActive)
  696. {
  697. partsMgrBase.StartAction();
  698. }
  699. }
  700. }
  701. public void RhythmGame_End()
  702. {
  703. if (GameMain.Instance.VRMode && this.m_OvrUI)
  704. {
  705. this.m_OvrUI.enabled = true;
  706. }
  707. base.StopAllCoroutines();
  708. foreach (PartsMgrBase partsMgrBase in this.m_MgrPartsList)
  709. {
  710. if (partsMgrBase.IsActive)
  711. {
  712. partsMgrBase.EndAction();
  713. }
  714. }
  715. this.ToNextState();
  716. }
  717. public void Pause()
  718. {
  719. this.SwitchPause(true, false);
  720. }
  721. public void Play()
  722. {
  723. this.SwitchPause(false, false);
  724. }
  725. public void AddParticleSystem(ParticleSystem particle)
  726. {
  727. if (!this.m_AllParticleSystem.Contains(particle))
  728. {
  729. this.m_AllParticleSystem.Add(particle);
  730. }
  731. if (particle.subEmitters.subEmittersCount > 0)
  732. {
  733. for (int i = 0; i < particle.subEmitters.subEmittersCount; i++)
  734. {
  735. this.AddParticleSystem(particle.subEmitters.GetSubEmitterSystem(i));
  736. }
  737. }
  738. }
  739. public void AddParticleSystem(ParticleSystem[] particle)
  740. {
  741. foreach (ParticleSystem particle2 in particle)
  742. {
  743. this.AddParticleSystem(particle2);
  744. }
  745. }
  746. public void RemoveParticleSystem(ParticleSystem particle)
  747. {
  748. if (this.m_AllParticleSystem.Contains(particle))
  749. {
  750. this.m_AllParticleSystem.Remove(particle);
  751. }
  752. if (particle.subEmitters.subEmittersCount > 0)
  753. {
  754. for (int i = 0; i < particle.subEmitters.subEmittersCount; i++)
  755. {
  756. this.RemoveParticleSystem(particle.subEmitters.GetSubEmitterSystem(i));
  757. }
  758. }
  759. }
  760. public void RemoveParticleSystem(ParticleSystem[] particle)
  761. {
  762. foreach (ParticleSystem particle2 in particle)
  763. {
  764. this.RemoveParticleSystem(particle2);
  765. }
  766. }
  767. public void AddAudioMgr(AudioSource[] audio_array)
  768. {
  769. foreach (AudioSource audio in audio_array)
  770. {
  771. this.AddAudioMgr(audio);
  772. }
  773. }
  774. public void AddAudioMgr(AudioSource audio)
  775. {
  776. if (!this.m_AudioMgrList.Contains(audio))
  777. {
  778. this.m_AudioMgrList.Add(audio);
  779. }
  780. }
  781. public void RemoveAudioMgr(AudioSource[] audio_array)
  782. {
  783. foreach (AudioSource audio in audio_array)
  784. {
  785. this.RemoveAudioMgr(audio);
  786. }
  787. }
  788. public void RemoveAudioMgr(AudioSource audio)
  789. {
  790. if (this.m_AudioMgrList.Contains(audio))
  791. {
  792. this.m_AudioMgrList.Remove(audio);
  793. }
  794. }
  795. public bool GetCamMoveStop()
  796. {
  797. return this.TimeLineStopInfo.CamMoveStop;
  798. }
  799. public void SetCamMoveStop(bool set)
  800. {
  801. this.TimeLineStopInfo.CamMoveStop = set;
  802. }
  803. public void SetTimeLineFace(int maid_no, string face)
  804. {
  805. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(maid_no);
  806. if (this.TimeLineStopInfo.TimeLineFace.ContainsKey(maid))
  807. {
  808. this.TimeLineStopInfo.TimeLineFace[maid] = face;
  809. }
  810. else
  811. {
  812. this.TimeLineStopInfo.TimeLineFace.Add(maid, face);
  813. }
  814. }
  815. public void SetTimeLineFaceBlend(int maid_no, string face)
  816. {
  817. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(maid_no);
  818. if (this.TimeLineStopInfo.TimeLineFaceBlend.ContainsKey(maid))
  819. {
  820. this.TimeLineStopInfo.TimeLineFaceBlend[maid] = face;
  821. }
  822. else
  823. {
  824. this.TimeLineStopInfo.TimeLineFaceBlend.Add(maid, face);
  825. }
  826. }
  827. public bool GetMaidFaceStop(int maid_no)
  828. {
  829. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(maid_no);
  830. return this.GetMaidFaceStop(maid);
  831. }
  832. public bool GetMaidFaceStop(Maid maid)
  833. {
  834. return this.TimeLineStopInfo.FaceStop.ContainsKey(maid) && this.TimeLineStopInfo.FaceStop[maid];
  835. }
  836. public bool GetMaidFaceBlendStop(int maid_no)
  837. {
  838. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(maid_no);
  839. return this.GetMaidFaceBlendStop(maid);
  840. }
  841. public bool GetMaidFaceBlendStop(Maid maid)
  842. {
  843. return this.TimeLineStopInfo.FaceBlendStop.ContainsKey(maid) && this.TimeLineStopInfo.FaceBlendStop[maid];
  844. }
  845. public void SetMaidFaceStop(Maid maid, bool set)
  846. {
  847. if (!this.TimeLineStopInfo.FaceStop.ContainsKey(maid) || !this.TimeLineStopInfo.TimeLineFace.ContainsKey(maid))
  848. {
  849. if (!this.TimeLineStopInfo.FaceStop.ContainsKey(maid))
  850. {
  851. this.TimeLineStopInfo.FaceStop.Add(maid, set);
  852. }
  853. return;
  854. }
  855. if (this.TimeLineStopInfo.FaceStop[maid] != set)
  856. {
  857. this.TimeLineStopInfo.FaceStop[maid] = set;
  858. if (!set)
  859. {
  860. maid.FaceAnime(this.TimeLineStopInfo.TimeLineFace[maid], 1f, 0);
  861. }
  862. }
  863. }
  864. public void SetMaidFaceBlendStop(Maid maid, bool set)
  865. {
  866. if (!this.TimeLineStopInfo.FaceBlendStop.ContainsKey(maid) || !this.TimeLineStopInfo.TimeLineFaceBlend.ContainsKey(maid))
  867. {
  868. if (!this.TimeLineStopInfo.FaceBlendStop.ContainsKey(maid))
  869. {
  870. this.TimeLineStopInfo.FaceBlendStop.Add(maid, set);
  871. }
  872. return;
  873. }
  874. if (this.TimeLineStopInfo.FaceBlendStop[maid] != set)
  875. {
  876. this.TimeLineStopInfo.FaceBlendStop[maid] = set;
  877. if (!set)
  878. {
  879. maid.FaceBlend(this.TimeLineStopInfo.TimeLineFaceBlend[maid]);
  880. }
  881. }
  882. }
  883. public void SetDanceReward(int reward)
  884. {
  885. if (RhythmAction_Mgr.NowDance != RhythmAction_Mgr.DanceType.Challenge)
  886. {
  887. return;
  888. }
  889. RhythmAction_Mgr.DanceReward += reward;
  890. }
  891. public void SetFocalSize(float focal_size)
  892. {
  893. if (this.m_MainCamDepth)
  894. {
  895. this.m_MainCamDepth.focalSize = focal_size;
  896. }
  897. }
  898. public IEnumerator DanceTimeCoroutine(float time_rimmit, Action<float> update_call, Action end_call = null)
  899. {
  900. float timer = 0f;
  901. for (;;)
  902. {
  903. if (!this.IsPause)
  904. {
  905. timer += this.DanceDeltaTime;
  906. if (update_call != null)
  907. {
  908. update_call(timer);
  909. }
  910. if (time_rimmit > 0f && timer > time_rimmit)
  911. {
  912. break;
  913. }
  914. }
  915. yield return null;
  916. }
  917. if (end_call != null)
  918. {
  919. end_call();
  920. }
  921. yield break;
  922. yield break;
  923. }
  924. public IEnumerator DanceTimeCoroutine(Action update_call, Func<bool> endcheck_call = null)
  925. {
  926. for (;;)
  927. {
  928. if (!this.IsPause)
  929. {
  930. if (update_call != null)
  931. {
  932. update_call();
  933. }
  934. if (endcheck_call != null && endcheck_call())
  935. {
  936. break;
  937. }
  938. }
  939. yield return null;
  940. }
  941. yield break;
  942. yield break;
  943. }
  944. public void StartTimeCroutine(float time_rimmit, Action<float> update_call, Action end_call = null)
  945. {
  946. base.StartCoroutine(this.DanceTimeCoroutine(time_rimmit, update_call, end_call));
  947. }
  948. public void StartTimeCroutine(Action update_call, Func<bool> endcheck_call = null)
  949. {
  950. base.StartCoroutine(this.DanceTimeCoroutine(update_call, endcheck_call));
  951. }
  952. public void InstanceInit()
  953. {
  954. RhythmAction_Mgr.m_Instance = this;
  955. }
  956. public void KaraokeEnd()
  957. {
  958. if (this.m_RhythmActionCam)
  959. {
  960. UnityEngine.Object.Destroy(this.m_RhythmActionCam.gameObject);
  961. }
  962. UnityEngine.Object.Destroy(base.gameObject);
  963. }
  964. public static void RewardRecet()
  965. {
  966. RhythmAction_Mgr.DanceReward = 0;
  967. }
  968. public static void KaraokeRecet()
  969. {
  970. RhythmAction_Mgr.NowState = RhythmAction_Mgr.DanceState.Dance_First;
  971. MotionAction_Mgr.CaptureFlagRecet();
  972. }
  973. public static void SetDanceType(RhythmAction_Mgr.DanceType type)
  974. {
  975. if (type == RhythmAction_Mgr.DanceType.VrDance)
  976. {
  977. return;
  978. }
  979. RhythmAction_Mgr.m_DanceType = type;
  980. if (RhythmAction_Mgr.m_DanceType != RhythmAction_Mgr.DanceType.VS_Skip)
  981. {
  982. ShootCutInTex.TextureClear(DanceBattle_Mgr.CharaType.Player);
  983. }
  984. RhythmAction_Mgr.NowState = RhythmAction_Mgr.DanceState.Dance_First;
  985. MotionAction_Mgr.CaptureFlagRecet();
  986. if (RhythmAction_Mgr.m_DanceType == RhythmAction_Mgr.DanceType.Challenge)
  987. {
  988. RhythmAction_Mgr.DoChallengeDance = true;
  989. RhythmAction_Mgr.RewardRecet();
  990. }
  991. }
  992. public const string RhythmResouce_Path = "SceneDance/Rhythm_Action/";
  993. public const string DanceSelectResouce_Path = "SceneDanceSelect/Rhythm_Action/";
  994. public const string RhythmCSVPath = "csv_rhythm_action/";
  995. public const int BenchMarkID = -100;
  996. public const string TestResourcePath = "SceneDance/Rhythm_Action/TestResources/";
  997. public const string ToolResource_path = "SceneDance/Rhythm_Action/Tools/";
  998. private static RhythmAction_Mgr.DanceType m_DanceType = RhythmAction_Mgr.DanceType.View;
  999. public static bool DoChallengeDance;
  1000. private static RhythmAction_Mgr m_Instance;
  1001. private List<PartsMgrBase> m_MgrPartsList = new List<PartsMgrBase>();
  1002. [SerializeField]
  1003. private GameObject m_PausePanel;
  1004. [SerializeField]
  1005. [Header("「Ready?」の表示時間")]
  1006. private float m_ReadyWaitTime = 2f;
  1007. [SerializeField]
  1008. [Header("「Ready?」フェードアウト時間")]
  1009. private float m_ReadyFadeTime = 0.5f;
  1010. [SerializeField]
  1011. private GameObject m_ReadyPanel;
  1012. [SerializeField]
  1013. [Header("csvフォルダ名")]
  1014. private string m_UseMusicName;
  1015. private DanceMain m_DanceMain;
  1016. private bool m_IsPause;
  1017. private List<ParticleSystem> m_AllParticleSystem = new List<ParticleSystem>();
  1018. private List<EllipsoidParticleEmitter> m_AllParticleEmitter = new List<EllipsoidParticleEmitter>();
  1019. private List<Animator> m_OtherAnimator = new List<Animator>();
  1020. private List<AudioSource> m_AudioMgrList = new List<AudioSource>();
  1021. private float m_NowTime;
  1022. private float m_LastTime;
  1023. private OvrUI m_OvrUI;
  1024. private Vector3 m_FirstScreen;
  1025. [Header("VR時カメラ設定")]
  1026. [SerializeField]
  1027. [Header("VR時のカメラとの距離")]
  1028. private float m_CameraLength = 1f;
  1029. [SerializeField]
  1030. [Header("VR時はnGUIを少し下げる")]
  1031. private float m_UIDown = 0.5f;
  1032. private RhythmAction_Mgr.TimeLineStop TimeLineStopInfo = new RhythmAction_Mgr.TimeLineStop();
  1033. private bool m_SelectEnd;
  1034. private bool m_SelectRecet;
  1035. private bool m_SelectSkip;
  1036. [SerializeField]
  1037. [Header("フリー以外の時は選択肢UIを少し下に下げる")]
  1038. private float m_ChoiceUIDown = 65f;
  1039. [SerializeField]
  1040. [Header("ポーズ中の各選択肢毎に設定するUI")]
  1041. private List<RhythmAction_Mgr.ChoiceObjpair> m_ChoiceUIList = new List<RhythmAction_Mgr.ChoiceObjpair>();
  1042. private bool m_OrijinDepthEnable;
  1043. private DepthOfFieldScatter m_MainCamDepth;
  1044. private float m_OrijinFocalSize;
  1045. [SerializeField]
  1046. [Header("黒背景")]
  1047. private GameObject m_BlackBG;
  1048. [SerializeField]
  1049. [Header("Readyでもダンスを止めないフラグ")]
  1050. private bool m_ReadyNotStop;
  1051. [SerializeField]
  1052. [Header("音ゲーのレイヤー")]
  1053. private LayerMask m_RhythmActionLayer = -1;
  1054. [SerializeField]
  1055. [Header("音ゲーのレイヤー(2D時)")]
  1056. private LayerMask m_RhythmAction2DLayer = -1;
  1057. private List<Maid> m_FactOrderList = new List<Maid>();
  1058. private bool m_IsOrijinTablet;
  1059. private Camera m_RhythmActionCam;
  1060. private RenderTexture m_RhythmActionTex;
  1061. private Material m_ScreenMat;
  1062. private Camera m_NguiCam;
  1063. private AVRControllerBehavior.LIMIT_MODE m_OrijinLimit;
  1064. private bool m_IsStart;
  1065. [SerializeField]
  1066. [Header("ペンライトのオフセット")]
  1067. private Vector3 m_PenlightOffset = new Vector3(0f, -0.01f, -0.06f);
  1068. [SerializeField]
  1069. [Header("ペンライトのサイズ")]
  1070. private Vector3 m_PenlightScale = new Vector3(1.25f, 1.25f, 2f);
  1071. private GameObject m_LeftPenlight;
  1072. private GameObject m_RightPenlight;
  1073. public enum DanceType
  1074. {
  1075. Free,
  1076. Challenge,
  1077. VS,
  1078. Encore,
  1079. View,
  1080. BenchMark,
  1081. Touch,
  1082. VS_Skip,
  1083. VrDance
  1084. }
  1085. public enum DanceState
  1086. {
  1087. Dance_First,
  1088. Dance_Second
  1089. }
  1090. private class TimeLineStop
  1091. {
  1092. public bool CamMoveStop;
  1093. public Dictionary<Maid, bool> FaceStop = new Dictionary<Maid, bool>();
  1094. public Dictionary<Maid, bool> FaceBlendStop = new Dictionary<Maid, bool>();
  1095. public Dictionary<Maid, string> TimeLineFace = new Dictionary<Maid, string>();
  1096. public Dictionary<Maid, string> TimeLineFaceBlend = new Dictionary<Maid, string>();
  1097. }
  1098. private enum PauseChoices
  1099. {
  1100. Continue,
  1101. End,
  1102. Recet,
  1103. Skip
  1104. }
  1105. [Serializable]
  1106. private class ChoiceObjpair
  1107. {
  1108. public RhythmAction_Mgr.PauseChoices Choice;
  1109. public GameObject EventUI;
  1110. public string CursorOnImage;
  1111. public string CursorOffImage;
  1112. [HideInInspector]
  1113. public UISprite UIImage;
  1114. }
  1115. }