RhythmAction_Mgr.cs 31 KB

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