DanceMain.cs 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text.RegularExpressions;
  7. using UnityEngine;
  8. using UnityEngine.Rendering;
  9. using UnityEngine.SceneManagement;
  10. public class DanceMain : MonoBehaviour
  11. {
  12. public static string RecetJumpLabel { private get; set; }
  13. public List<Maid> DanceMaid
  14. {
  15. get
  16. {
  17. return this.m_listMaid;
  18. }
  19. }
  20. public Maid UserMaid
  21. {
  22. get
  23. {
  24. return this.m_maidUser;
  25. }
  26. }
  27. public bool IsDanceEnd { get; private set; }
  28. public Transform OvrCamTrans
  29. {
  30. get
  31. {
  32. return this.m_trOvrDummyCam;
  33. }
  34. }
  35. public float DepthFocalSize
  36. {
  37. get
  38. {
  39. return this.m_DepthFocalSize;
  40. }
  41. set
  42. {
  43. this.m_DepthFocalSize = value;
  44. if (RhythmAction_Mgr.Instance)
  45. {
  46. RhythmAction_Mgr.Instance.SetFocalSize(value);
  47. }
  48. }
  49. }
  50. public string GetFolderPathToBinaryData()
  51. {
  52. string binaryFolderName = this.BinaryFolderName;
  53. string text = Path.GetFileNameWithoutExtension(this.BinaryFolderName).ToLower();
  54. return "Assets/Resources/SceneDance/" + Path.GetFileNameWithoutExtension(this.BinaryFolderName).ToLower() + "/";
  55. }
  56. private void Awake()
  57. {
  58. this.m_boDebugDummyBody = false;
  59. NTime.Reset();
  60. string name = SceneManager.GetActiveScene().name;
  61. if (name.ToLower().Contains("_release") && !this.UseBinaryData)
  62. {
  63. Debug.LogError("ダンスシーン:" + name + " でUseBinaryDataがONになっていません。強制でONにします。");
  64. this.UseBinaryData = true;
  65. }
  66. Dictionary<string, string> tag_backup = GameMain.Instance.ScriptMgr.adv_kag.tag_backup;
  67. string strScriptLabel;
  68. if (tag_backup != null && tag_backup.TryGetValue("label", out strScriptLabel))
  69. {
  70. this.m_strScriptLabel = strScriptLabel;
  71. }
  72. NDebug.Assert(this.m_listDummyAnimChara.Count == this.m_listAnimName.Count, "m_listDummyAnimChara と m_listAnimName の数は同一でないといけません。");
  73. NDebug.Assert(this.m_AnimatorData != null, "AnimatorDataが外れています。");
  74. NDebug.Assert(this.m_listTestPreset.Count == this.m_listAnimName.Count, "プリセット数が不正です。");
  75. NDebug.Assert(!string.IsNullOrEmpty(this.m_strMasterAudioFileName), "マスター用MasterAudioFileNameが必要です。");
  76. bool flag = DanceMain.IsDanceRecet;
  77. flag |= (RhythmAction_Mgr.NowState == RhythmAction_Mgr.DanceState.Dance_Second);
  78. flag |= (RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.Encore);
  79. flag |= RhythmAction_Mgr.IsVSDance;
  80. if (flag && !DanceMain.KaraokeMode)
  81. {
  82. DanceSelect.SelectMaidActive(DanceMain.SelectDanceData);
  83. DanceMain.IsDanceRecet = false;
  84. }
  85. if (this.time_line_binary_ == null)
  86. {
  87. this.maid_data_binary_ = new DanceObjectDataBinary();
  88. this.maid_item_binary_ = new DanceObjectDataBinary();
  89. this.maid_event_binary_ = new DanceObjectDataBinary();
  90. this.time_line_binary_ = new AWReadBinaryData();
  91. if (this.UseBinaryData)
  92. {
  93. string file_name = this.GetFolderPathToBinaryData() + "item_data.bytes";
  94. this.maid_item_binary_.ReadData(file_name);
  95. NDebug.Assert(this.m_listItemObject.Count == this.maid_item_binary_.datas.Length, "アイテム数がバイナリデータと不一致");
  96. this.maid_item_binary_.Restoration(false);
  97. for (int i = 0; i < this.m_listItemObject.Count; i++)
  98. {
  99. if (!(this.m_listItemObject[i] != null))
  100. {
  101. this.m_listItemObject[i] = this.maid_item_binary_.datas[i].obj;
  102. }
  103. }
  104. file_name = this.GetFolderPathToBinaryData() + "event_data.bytes";
  105. this.maid_event_binary_.ReadData(file_name);
  106. NDebug.Assert(this.m_listEventObject.Count == this.maid_event_binary_.datas.Length, "イベント数がバイナリデータと不一致");
  107. this.maid_event_binary_.Restoration(false);
  108. for (int j = 0; j < this.m_listEventObject.Count; j++)
  109. {
  110. if (!(this.m_listEventObject[j] != null))
  111. {
  112. this.m_listEventObject[j] = this.maid_event_binary_.datas[j].obj;
  113. }
  114. }
  115. file_name = this.GetFolderPathToBinaryData() + "maid_data.bytes";
  116. this.maid_data_binary_.ReadData(file_name);
  117. NDebug.Assert(this.m_listDummyAnimChara.Count == this.maid_data_binary_.datas.Length, "メイド数がバイナリデータと不一致");
  118. this.maid_data_binary_.Restoration(true);
  119. for (int k = 0; k < this.m_listDummyAnimChara.Count; k++)
  120. {
  121. if (!(this.m_listDummyAnimChara[k] != null))
  122. {
  123. this.m_listDummyAnimChara[k] = this.maid_data_binary_.datas[k].obj;
  124. this.m_listDebugObj.Add(this.m_listDummyAnimChara[k]);
  125. }
  126. }
  127. file_name = this.GetFolderPathToBinaryData() + "timeline_data.bytes";
  128. this.time_line_binary_.ReadFile(file_name);
  129. this.maid_item_binary_.AttachObject(this.m_AnimatorData.getTake(this.m_strPlayTakeName));
  130. this.maid_event_binary_.AttachObject(this.m_AnimatorData.getTake(this.m_strPlayTakeName));
  131. }
  132. }
  133. this.m_listKuchiPattern = new string[this.m_listKuchiPakuFile.Count];
  134. Func<string, string> func = delegate(string fn)
  135. {
  136. TextAsset textAsset2 = Resources.Load("SceneDance/" + fn) as TextAsset;
  137. NDebug.Assert(textAsset2 != null, "口パクパターンテキストファイルが開けません。" + fn);
  138. string text4 = textAsset2.text;
  139. NDebug.Assert(text4.Length != 0, "口パクパターンファイル内が空です。" + fn);
  140. return Regex.Replace(text4, "(\\r|\\n| )", string.Empty);
  141. };
  142. for (int l = 0; l < this.m_listKuchiPakuFile.Count; l++)
  143. {
  144. string text = this.m_listKuchiPakuFile[l];
  145. if (!string.IsNullOrEmpty(text))
  146. {
  147. this.m_listKuchiPattern[l] = func(text);
  148. }
  149. }
  150. if (this.m_KuchipakuCacheFileName != null)
  151. {
  152. for (int m2 = 0; m2 < this.m_KuchipakuCacheFileName.Length; m2++)
  153. {
  154. string text2 = this.m_KuchipakuCacheFileName[m2];
  155. if (!string.IsNullOrEmpty(text2))
  156. {
  157. this.m_KuchiPatternCache[text2] = func(text2);
  158. }
  159. }
  160. }
  161. this.m_AnimatorData.playOnStart = null;
  162. this.m_AnimatorData.bAutoTimeUpdate = false;
  163. if (GameMain.Instance.VRMode && GameMain.Instance.CMSystem.GetTmpGenericFlag("ダンスOVRカメラタイプ") == 1)
  164. {
  165. this.m_trOvrDummyCam = new GameObject("OvrDummyDanceCam").transform;
  166. this.m_trOvrDummyCam.gameObject.AddComponent<Camera>().enabled = false;
  167. this.m_OvrCam = GameMain.Instance.OvrMgr.OvrCamera;
  168. }
  169. GameObject gameObject = GameObject.Find("RhythmAction_Mgr");
  170. if (!gameObject)
  171. {
  172. gameObject = UnityEngine.Object.Instantiate<GameObject>(Resources.Load<GameObject>("SceneDance/Rhythm_Action/Prefab/RhythmAction_Mgr"));
  173. }
  174. if (!RhythmAction_Mgr.Instance)
  175. {
  176. gameObject.GetComponent<RhythmAction_Mgr>().InstanceInit();
  177. }
  178. for (int n = 0; n < this.m_listTestPreset.Count; n++)
  179. {
  180. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(n);
  181. if (maid)
  182. {
  183. if (!this.m_maidUser)
  184. {
  185. this.m_maidUser = DanceSelect.SelectTopMaid;
  186. }
  187. maid.Visible = true;
  188. }
  189. }
  190. if (!this.m_maidUser)
  191. {
  192. this.m_maidUser = GameMain.Instance.CharacterMgr.GetMaid(0);
  193. }
  194. if (DanceMain.KaraokeMode)
  195. {
  196. return;
  197. }
  198. GameMain.Instance.CharacterMgr.ResetCharaPosAll();
  199. if (DanceMain.SelectDanceData != null)
  200. {
  201. for (int num = 0; num < DanceMain.SelectDanceData.select_chara_num; num++)
  202. {
  203. RhythmAction_Mgr.Instance.FactOrderList.Add(GameMain.Instance.CharacterMgr.GetMaid(num));
  204. }
  205. }
  206. if (RhythmAction_Mgr.NowDance != RhythmAction_Mgr.DanceType.BenchMark && DanceMain.SelectDanceData != null && DanceMain.SelectDanceData.maid_order.Count > 0 && (!RhythmAction_Mgr.IsVSDance || !VsDanceDataMgr.Instance.CurrentSetting.isFixedMaidOrder))
  207. {
  208. List<Maid> list = new List<Maid>();
  209. for (int num2 = 0; num2 < DanceMain.SelectDanceData.maid_order.Count; num2++)
  210. {
  211. list.Add(GameMain.Instance.CharacterMgr.GetMaid(num2));
  212. }
  213. GameMain.Instance.CharacterMgr.DeactivateCharaAll();
  214. GameMain.Instance.CharacterMgr.DeactivateMaid(0);
  215. for (int num3 = 0; num3 < DanceMain.SelectDanceData.maid_order.Count; num3++)
  216. {
  217. int index = DanceMain.SelectDanceData.maid_order[num3];
  218. if (list[index])
  219. {
  220. GameMain.Instance.CharacterMgr.SetActiveMaid(list[index], num3);
  221. list[index].Visible = true;
  222. }
  223. }
  224. }
  225. if (this.m_listTestPreset.Count <= RhythmAction_Mgr.Instance.FactOrderList.Count)
  226. {
  227. if (!RhythmAction_Mgr.Instance.FactOrderList.Any((Maid e) => !e) && DanceMain.SelectDanceData != null)
  228. {
  229. goto IL_AF4;
  230. }
  231. }
  232. for (int num4 = 0; num4 < this.m_listTestPreset.Count; num4++)
  233. {
  234. Maid maid2 = GameMain.Instance.CharacterMgr.GetMaid(num4);
  235. if (!maid2 || DanceMain.SelectDanceData == null)
  236. {
  237. if (!maid2)
  238. {
  239. maid2 = GameMain.Instance.CharacterMgr.AddStockMaid();
  240. GameMain.Instance.CharacterMgr.SetActiveMaid(maid2, num4);
  241. this.m_listTempMaid.Add(maid2);
  242. }
  243. CharacterMgr.Preset preset = null;
  244. bool flag2 = DanceMain.SelectDanceData != null && num4 < DanceMain.SelectDanceData.preset_name.Count && !string.IsNullOrEmpty(DanceMain.SelectDanceData.preset_name[num4]);
  245. string text3 = (!flag2) ? this.m_listTestPreset[num4] : DanceMain.SelectDanceData.preset_name[num4];
  246. byte[] buffer = null;
  247. TextAsset textAsset = Resources.Load("Preset/" + text3) as TextAsset;
  248. if (textAsset == null)
  249. {
  250. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text3 + ".preset"))
  251. {
  252. if (afileBase.IsValid())
  253. {
  254. buffer = afileBase.ReadAll();
  255. }
  256. else
  257. {
  258. NDebug.Assert(string.Format("{0}はResourcesにもGameDataにもありませんでした。", text3), false);
  259. }
  260. }
  261. }
  262. else
  263. {
  264. buffer = textAsset.bytes;
  265. }
  266. using (MemoryStream memoryStream = new MemoryStream(buffer))
  267. {
  268. using (BinaryReader binaryReader = new BinaryReader(memoryStream))
  269. {
  270. preset = GameMain.Instance.CharacterMgr.PresetLoad(binaryReader, text3);
  271. }
  272. }
  273. if (preset != null)
  274. {
  275. GameMain.Instance.CharacterMgr.PresetSet(maid2, preset, false);
  276. }
  277. maid2.Visible = true;
  278. }
  279. }
  280. if (DanceMain.SelectDanceData != null)
  281. {
  282. if (DanceMain.SelectDanceData.maid_order.Count > 0)
  283. {
  284. for (int num5 = 0; num5 < DanceMain.SelectDanceData.maid_order.Count; num5++)
  285. {
  286. int index2 = DanceMain.SelectDanceData.maid_order[num5];
  287. if (!RhythmAction_Mgr.Instance.FactOrderList[index2])
  288. {
  289. RhythmAction_Mgr.Instance.FactOrderList[index2] = GameMain.Instance.CharacterMgr.GetMaid(num5);
  290. }
  291. }
  292. }
  293. else
  294. {
  295. for (int num6 = 0; num6 < RhythmAction_Mgr.Instance.FactOrderList.Count; num6++)
  296. {
  297. if (!RhythmAction_Mgr.Instance.FactOrderList[num6])
  298. {
  299. RhythmAction_Mgr.Instance.FactOrderList[num6] = GameMain.Instance.CharacterMgr.GetMaid(num6);
  300. }
  301. }
  302. }
  303. }
  304. IL_AF4:
  305. if (this.m_PresetCopyToDummyChara != null)
  306. {
  307. NDebug.Assert(this.m_PresetCopyToDummyChara.Length <= this.m_listDummyAnimChara.Count<GameObject>(), "PresetCopyToDummyChara は listDummyAnimChara の数以下である必要があります。");
  308. for (int num7 = 0; num7 < this.m_PresetCopyToDummyChara.Length; num7++)
  309. {
  310. int num8 = this.m_PresetCopyToDummyChara[num7];
  311. if (num8 != num7)
  312. {
  313. Maid maid3 = GameMain.Instance.CharacterMgr.GetMaid(num8);
  314. if (maid3)
  315. {
  316. Maid maidDest = GameMain.Instance.CharacterMgr.GetMaid(num7);
  317. if (maid3.IsCrcBody)
  318. {
  319. for (int num9 = 1; num9 < 201; num9++)
  320. {
  321. MaidProp prop = maid3.GetProp((MPN)num9);
  322. MaidProp prop2 = maidDest.GetProp((MPN)num9);
  323. using (MemoryStream memoryStream2 = new MemoryStream())
  324. {
  325. BinaryWriter f_bwWrite = new BinaryWriter(memoryStream2);
  326. prop.Serialize(f_bwWrite);
  327. memoryStream2.Flush();
  328. memoryStream2.Position = 0L;
  329. BinaryReader f_brRead = new BinaryReader(memoryStream2);
  330. prop2.Deserialize(f_brRead);
  331. }
  332. }
  333. }
  334. else
  335. {
  336. byte[] buffer2 = GameMain.Instance.CharacterMgr.PresetSaveNotWriteFile(maid3, CharacterMgr.PresetType.All);
  337. BinaryReader binaryReader2 = new BinaryReader(new MemoryStream(buffer2));
  338. CharacterMgr.Preset f_prest = GameMain.Instance.CharacterMgr.PresetLoad(binaryReader2, string.Empty);
  339. binaryReader2.Close();
  340. if (maidDest != null && this.m_listTempMaid.Find((Maid m) => m == maidDest) != null)
  341. {
  342. GameMain.Instance.CharacterMgr.PresetSet(maidDest, f_prest, false);
  343. maidDest.AllProcPropSeqStart();
  344. }
  345. else
  346. {
  347. Debug.LogError("Presetコピー先メイドが居ないか、一時雇用メイドではありません。");
  348. }
  349. }
  350. }
  351. }
  352. }
  353. }
  354. this.m_KuchipakuAudioStartTimeAtMaid = new float[this.m_listDummyAnimChara.Count<GameObject>()];
  355. for (int num10 = 0; num10 < this.m_KuchipakuAudioStartTimeAtMaid.Length; num10++)
  356. {
  357. this.m_KuchipakuAudioStartTimeAtMaid[num10] = 0f;
  358. }
  359. }
  360. private void Start()
  361. {
  362. if (GameMain.Instance.VRMode)
  363. {
  364. GameObject gameObject = GameObject.Find("effect");
  365. if (gameObject != null)
  366. {
  367. ParticleSystem[] componentsInChildren = gameObject.GetComponentsInChildren<ParticleSystem>(true);
  368. foreach (ParticleSystem particleSystem in componentsInChildren)
  369. {
  370. Renderer component = particleSystem.GetComponent<Renderer>();
  371. if (component != null)
  372. {
  373. component.shadowCastingMode = ShadowCastingMode.Off;
  374. component.receiveShadows = false;
  375. }
  376. }
  377. }
  378. }
  379. if (!DanceMain.KaraokeMode)
  380. {
  381. GameMain.Instance.BgMgr.DeleteBg();
  382. }
  383. GameMain.Instance.MainLight.Reset();
  384. GameMain.Instance.SoundMgr.StopBGM(0f);
  385. GameMain.Instance.MainCamera.gameObject.SetActive(true);
  386. if (!DanceMain.KaraokeMode)
  387. {
  388. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, false);
  389. }
  390. for (int j = 0; j < this.m_listEventObject.Count; j++)
  391. {
  392. GameObject gameObject2 = this.m_listEventObject[j];
  393. NDebug.Assert(!this.m_htEventObj.ContainsKey(gameObject2.name), "listEventObjectに複数同じObjectを追加しようとしました。" + this.m_listEventObject[j].name);
  394. this.m_htEventObj.Add(gameObject2.name, gameObject2);
  395. }
  396. this.m_takeNow = this.m_AnimatorData.getTake(this.m_strPlayTakeName);
  397. NDebug.Assert(this.m_takeNow != null, "再生するテイク名PlayTakeNameが不正です。" + this.m_strPlayTakeName);
  398. }
  399. public void SetFace(int f_nMaidNo, string f_strFace)
  400. {
  401. RhythmAction_Mgr.Instance.SetTimeLineFace(f_nMaidNo, f_strFace);
  402. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(f_nMaidNo);
  403. if (RhythmAction_Mgr.Instance.GetMaidFaceStop(f_nMaidNo))
  404. {
  405. return;
  406. }
  407. maid.FaceAnime(f_strFace, 1f, 0);
  408. }
  409. public void SetFaceBlend(int f_nMaidNo, string f_strFace)
  410. {
  411. RhythmAction_Mgr.Instance.SetTimeLineFaceBlend(f_nMaidNo, f_strFace);
  412. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(f_nMaidNo);
  413. if (RhythmAction_Mgr.Instance.GetMaidFaceBlendStop(f_nMaidNo))
  414. {
  415. return;
  416. }
  417. maid.FaceBlend(f_strFace);
  418. }
  419. public void SetMaidVisible(int f_nMaidNo, bool visible)
  420. {
  421. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(f_nMaidNo);
  422. maid.transform.localScale = ((!visible) ? Vector3.zero : Vector3.one);
  423. }
  424. public void SwitchObject(string f_strObjName, bool bEnable)
  425. {
  426. (this.m_htEventObj[f_strObjName] as GameObject).SetActive(bEnable);
  427. }
  428. public void EyeToCam(int f_nMaidNo, string f_strType)
  429. {
  430. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(f_nMaidNo);
  431. try
  432. {
  433. maid.EyeToCamera((Maid.EyeMoveType)Enum.Parse(typeof(Maid.EyeMoveType), f_strType), 0f);
  434. }
  435. catch (Exception ex)
  436. {
  437. NDebug.Assert("EyeToCam 目線タイプ " + f_strType + " は不正です。\n" + ex.Message, false);
  438. }
  439. }
  440. public void FadeOut(float f_fTime)
  441. {
  442. GameMain.Instance.MainCamera.FadeOut(f_fTime, false, null, false, default(Color));
  443. }
  444. public void FadeIn(float f_fTime)
  445. {
  446. GameMain.Instance.MainCamera.FadeIn(f_fTime, false, null, false, true, default(Color));
  447. }
  448. public void ChangeAnimation(int maidNo, string animName, float fadeTime)
  449. {
  450. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(maidNo);
  451. try
  452. {
  453. if (maid.IsCrcBody && animName.IndexOf("crc_") != 0)
  454. {
  455. animName = "crc_" + animName;
  456. }
  457. maid.CrossFade(animName + ".anm", false, false, false, fadeTime, 1f);
  458. }
  459. catch (Exception ex)
  460. {
  461. NDebug.Assert(string.Concat(new object[]
  462. {
  463. "ChangeAnimation メイド ",
  464. maidNo,
  465. " : ",
  466. animName,
  467. " は不正です。\n",
  468. ex.Message
  469. }), false);
  470. }
  471. }
  472. public void ChangeKuchipaku(int maidNo, string kuchipakuName)
  473. {
  474. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(maidNo);
  475. maid.StartKuchipakuPattern((!(this.m_audioNew != null)) ? 0f : (this.m_audioNew.time * -1f), this.m_KuchiPatternCache[kuchipakuName], true);
  476. }
  477. public void SetActiveObj(GameObject targetObj, bool visible)
  478. {
  479. targetObj.SetActive(visible);
  480. }
  481. public void SetEyeTarget(int maidNo, GameObject targetObj)
  482. {
  483. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(maidNo);
  484. maid.EyeToTargetObject(targetObj.transform, 0f);
  485. }
  486. private void ChangeObj(AMTake f_take, string f_strOldObjName, GameObject f_goNew)
  487. {
  488. AMTranslationTrack[] array = f_take.findTranslationTrack(f_strOldObjName);
  489. for (int i = 0; i < array.Length; i++)
  490. {
  491. array[i].changeObject(f_goNew.transform);
  492. }
  493. AMRotationTrack[] array2 = f_take.findRotationTrack(f_strOldObjName);
  494. for (int j = 0; j < array2.Length; j++)
  495. {
  496. array2[j].changeObject(f_goNew.transform);
  497. }
  498. AMPropertyTrack[] array3 = f_take.findPropertyTrack(f_strOldObjName);
  499. for (int k = 0; k < array3.Length; k++)
  500. {
  501. array3[k].changeObject(f_goNew);
  502. }
  503. }
  504. public void OnDestroy()
  505. {
  506. this.Uninit();
  507. NUty.GCFree();
  508. Debug.Log("DanceMain::OnDestroy");
  509. }
  510. private void Uninit()
  511. {
  512. if (this.m_bFinished)
  513. {
  514. return;
  515. }
  516. if (RhythmAction_Mgr.Instance && DanceMain.KaraokeMode)
  517. {
  518. RhythmAction_Mgr.Instance.KaraokeEnd();
  519. }
  520. Debug.Log("DanceMain::Uninit");
  521. this.m_AnimatorData.StopLoop();
  522. if (GameMain.Instance.MainLight != null)
  523. {
  524. GameMain.Instance.MainLight.Reset();
  525. }
  526. if (GameMain.Instance.MainCamera != null)
  527. {
  528. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  529. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  530. }
  531. if (GameMain.Instance.SoundMgr != null)
  532. {
  533. GameMain.Instance.SoundMgr.StopBGM(0f);
  534. }
  535. if (GameMain.Instance.CharacterMgr != null)
  536. {
  537. GameMain.Instance.CharacterMgr.ResetCharaPosAll();
  538. }
  539. for (int i = 0; i < this.m_listMaid.Count; i++)
  540. {
  541. if (this.m_listMaid[i] != null)
  542. {
  543. this.m_listMaid[i].transform.localScale = Vector3.one;
  544. this.m_listMaid[i].StopKuchipakuPattern();
  545. this.m_listMaid[i].EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f);
  546. this.m_listMaid[i].fullBodyIK.AllIKDetach(0f);
  547. this.m_listMaid[i].body0.fullBodyIK.SetPelvisPull(false);
  548. this.m_listMaid[i].SetAutoTwist(Maid.AutoTwist.WristL, true);
  549. this.m_listMaid[i].SetAutoTwist(Maid.AutoTwist.WristR, true);
  550. Transform[] componentsInChildren = this.m_listMaid[i].gameObject.GetComponentsInChildren<Transform>(true);
  551. foreach (Transform transform in componentsInChildren)
  552. {
  553. transform.gameObject.layer = LayerMask.NameToLayer("Charactor");
  554. }
  555. }
  556. }
  557. for (int k = 0; k < this.m_listItemObject.Count; k++)
  558. {
  559. if (this.m_listItemObject[k] != null)
  560. {
  561. UnityEngine.Object.DestroyImmediate(this.m_listItemObject[k]);
  562. }
  563. }
  564. this.m_listItemObject.Clear();
  565. for (int l = 0; l < this.m_listTempMaid.Count; l++)
  566. {
  567. GameMain.Instance.CharacterMgr.BanishmentMaid(this.m_listTempMaid[l]);
  568. }
  569. if (!DanceMain.KaraokeMode)
  570. {
  571. if (this.DanceMaid.Any((Maid maid) => maid != null))
  572. {
  573. GameMain.Instance.CharacterMgr.DeactivateCharaAll();
  574. }
  575. if (this.m_maidUser != null && this.m_maidUser != GameMain.Instance.CharacterMgr.GetMaid(0))
  576. {
  577. GameMain.Instance.CharacterMgr.DeactivateMaid(0);
  578. GameMain.Instance.CharacterMgr.SetActiveMaid(this.m_maidUser, 0);
  579. }
  580. }
  581. this.m_eMode = DanceMain.Mode.Finish;
  582. this.m_bFinished = true;
  583. }
  584. private void ToFinish()
  585. {
  586. this.IsDanceEnd = !this.IsForceDanceEnd;
  587. RhythmAction_Mgr.Instance.RhythmGame_End();
  588. this.Uninit();
  589. if (!DanceMain.IsDanceRecet)
  590. {
  591. DanceSelect.SetNextDance();
  592. }
  593. else
  594. {
  595. NDebug.Assert(!string.IsNullOrEmpty(DanceMain.RecetJumpLabel), "やりなおし時に飛ぶラベルが設定されてません");
  596. }
  597. Debug.Log("Dance ToFinish Script");
  598. if (!string.IsNullOrEmpty(this.m_strScriptLabel))
  599. {
  600. if (DanceMain.IsDanceRecet)
  601. {
  602. Debug.Log("OnEndScene JumpTo " + DanceMain.RecetJumpLabel);
  603. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(DanceMain.RecetJumpLabel);
  604. }
  605. else
  606. {
  607. if (DanceMain.SelectDanceData != null)
  608. {
  609. GameMain.Instance.ScriptMgr.EvalScript("tf['dance_scene_name'] = '" + DanceMain.SelectDanceData.scene_name + "';");
  610. }
  611. Debug.Log("OnEndScene JumpTo " + this.m_strScriptLabel);
  612. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_strScriptLabel);
  613. }
  614. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  615. }
  616. Debug.Log("Dance Finish!!");
  617. }
  618. private IEnumerator LoadMotionScript()
  619. {
  620. if (this.m_AdjustScript.IndexOf(".ks") < 0)
  621. {
  622. this.m_AdjustScript += ".ks";
  623. }
  624. NDebug.Assert(!string.IsNullOrEmpty(this.m_ScriptLabel), string.Format("{0}の飛び先が未指定です。", this.m_AdjustScript));
  625. if (this.m_ScriptLabel.IndexOf("*") < 0)
  626. {
  627. this.m_ScriptLabel = "*" + this.m_ScriptLabel;
  628. }
  629. ScriptManager script_mgr = GameMain.Instance.ScriptMgr;
  630. script_mgr.StopMotionScript();
  631. script_mgr.is_motion_blend = true;
  632. bool is_exist_crc = this.m_listMaid.Any((Maid ch) => ch.IsCrcBody);
  633. bool flag;
  634. if (is_exist_crc)
  635. {
  636. flag = this.m_listMaid.Any((Maid ch) => !ch.IsCrcBody);
  637. }
  638. else
  639. {
  640. flag = false;
  641. }
  642. bool is_body_mix = flag;
  643. if (is_body_mix)
  644. {
  645. for (int i = 0; i < this.m_listMaid.Count; i++)
  646. {
  647. Maid maid = this.m_listMaid[i];
  648. string text = string.Format("{0}_{1}.ks", Path.GetFileNameWithoutExtension(this.m_AdjustScript), maid.ActiveSlotNo);
  649. if (maid.IsCrcBody)
  650. {
  651. text = "crc_" + text;
  652. }
  653. script_mgr.LoadMotionScript(i, false, text, this.m_ScriptLabel, maid.status.guid, string.Empty, false, true, false, false);
  654. }
  655. }
  656. else
  657. {
  658. script_mgr.LoadMotionScript(0, false, this.m_AdjustScript, this.m_ScriptLabel, string.Empty, string.Empty, false, true, false, false);
  659. }
  660. float timer = 0f;
  661. while (timer <= this.m_LoadScriptTime)
  662. {
  663. timer += Time.deltaTime;
  664. yield return null;
  665. }
  666. script_mgr.StopMotionScript();
  667. this.m_eMode = DanceMain.Mode.LoadAnim;
  668. yield break;
  669. }
  670. private void Update()
  671. {
  672. if (this.m_eMode == DanceMain.Mode.ActiveCam)
  673. {
  674. if (GameMain.Instance.MainCamera.gameObject.activeSelf)
  675. {
  676. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  677. GameMain.Instance.MainCamera.SetCameraType(CameraMain.CameraType.Free);
  678. GameMain.Instance.MainCamera.SetControl(false);
  679. if (this.m_camDummyCamera != null)
  680. {
  681. if (!GameMain.Instance.VRMode)
  682. {
  683. AMTranslationTrack amtranslationTrack = this.m_takeNow.findTranslationTrack(this.m_camDummyCamera.gameObject.transform);
  684. amtranslationTrack.obj = GameMain.Instance.MainCamera.gameObject.transform;
  685. foreach (AMAction amaction in amtranslationTrack.cache)
  686. {
  687. AMTranslationAction amtranslationAction = (AMTranslationAction)amaction;
  688. amtranslationAction.obj = GameMain.Instance.MainCamera.gameObject.transform;
  689. }
  690. AMRotationTrack amrotationTrack = this.m_takeNow.findRotationTrack(this.m_camDummyCamera.gameObject.transform);
  691. amrotationTrack.obj = GameMain.Instance.MainCamera.gameObject.transform;
  692. foreach (AMAction amaction2 in amrotationTrack.cache)
  693. {
  694. AMRotationAction amrotationAction = (AMRotationAction)amaction2;
  695. amrotationAction.obj = GameMain.Instance.MainCamera.gameObject.transform;
  696. }
  697. }
  698. else if (GameMain.Instance.CMSystem.GetTmpGenericFlag("ダンスOVRカメラタイプ") != 0)
  699. {
  700. AMTranslationTrack amtranslationTrack2 = this.m_takeNow.findTranslationTrack(this.m_camDummyCamera.gameObject.transform);
  701. amtranslationTrack2.obj = this.m_trOvrDummyCam;
  702. foreach (AMAction amaction3 in amtranslationTrack2.cache)
  703. {
  704. AMTranslationAction amtranslationAction2 = (AMTranslationAction)amaction3;
  705. amtranslationAction2.obj = this.m_trOvrDummyCam;
  706. }
  707. AMRotationTrack amrotationTrack2 = this.m_takeNow.findRotationTrack(this.m_camDummyCamera.gameObject.transform);
  708. amrotationTrack2.obj = this.m_trOvrDummyCam;
  709. foreach (AMAction amaction4 in amrotationTrack2.cache)
  710. {
  711. AMRotationAction amrotationAction2 = (AMRotationAction)amaction4;
  712. amrotationAction2.obj = this.m_trOvrDummyCam;
  713. }
  714. }
  715. this.m_camDummyCamera.gameObject.SetActive(false);
  716. }
  717. if (!GameMain.Instance.VRMode)
  718. {
  719. this.ChangeObj(this.m_takeNow, "CameraMain", GameMain.Instance.MainCamera.gameObject);
  720. }
  721. else if (GameMain.Instance.CMSystem.GetTmpGenericFlag("ダンスOVRカメラタイプ") == 0)
  722. {
  723. if (!DanceMain.KaraokeMode)
  724. {
  725. GameMain.Instance.MainCamera.SetTargetPos(new Vector3(0f, 1.16f, 0f), true);
  726. GameMain.Instance.MainCamera.SetAroundAngle(new Vector2(180f, 0f), true);
  727. GameMain.Instance.MainCamera.SetDistance(5f, true);
  728. }
  729. }
  730. else
  731. {
  732. GameObject y = GameObject.Find("__GameMain__/Camera/CameraMain/CameraMain");
  733. AMBinaryDataBaseObject[] binary_data_list = this.time_line_binary_.binary_data_list;
  734. if (binary_data_list != null)
  735. {
  736. for (int i = 0; i < binary_data_list.Length; i++)
  737. {
  738. if (binary_data_list[i].obj == y)
  739. {
  740. binary_data_list[i].SetGameObject(this.m_trOvrDummyCam.gameObject);
  741. }
  742. }
  743. }
  744. }
  745. this.ChangeObj(this.m_takeNow, "MainDirectionalLight", GameMain.Instance.MainLight.gameObject);
  746. if (DanceMain.SelectDanceData == null || string.IsNullOrEmpty(DanceMain.SelectDanceData.bgm_file_name))
  747. {
  748. GameMain.Instance.SoundMgr.PlayDanceBGM(this.m_strMasterAudioFileName, 0f, true);
  749. }
  750. else
  751. {
  752. GameMain.Instance.SoundMgr.PlayDanceBGM(DanceMain.SelectDanceData.bgm_file_name + ".ogg", 0f, true);
  753. }
  754. AudioSource audioSourceBgm = GameMain.Instance.SoundMgr.GetAudioSourceBgm();
  755. audioSourceBgm.Stop();
  756. AMAudioTrack[] array = this.m_takeNow.findAudioTrack(this.m_strDummyAudioObjectName);
  757. foreach (AMAudioTrack amaudioTrack in array)
  758. {
  759. amaudioTrack.ChangeAudioSource(audioSourceBgm);
  760. }
  761. this.m_audioNew = audioSourceBgm;
  762. if (!this.m_boDebugDummyBody)
  763. {
  764. for (int k = 0; k < this.m_listAnimName.Count; k++)
  765. {
  766. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(k);
  767. this.m_listMaid.Add(maid);
  768. if (maid.IsCrcBody && !string.IsNullOrEmpty(this.m_listAnimName[k]) && this.m_listAnimName[k].IndexOf("crc_") != 0)
  769. {
  770. this.m_listAnimName[k] = "crc_" + this.m_listAnimName[k];
  771. }
  772. }
  773. for (int l = 0; l < this.m_listMaid.Count; l++)
  774. {
  775. this.m_listMaid[l].EyeToCamera(Maid.EyeMoveType.目だけ向ける, 0f);
  776. }
  777. NDebug.Assert(this.m_listKuchiPattern.Length == this.m_listMaid.Count, "メイド数と口パクパターン数が異なります。");
  778. for (int m = 0; m < this.m_listMaid.Count; m++)
  779. {
  780. if (!string.IsNullOrEmpty(this.m_listKuchiPattern[m]))
  781. {
  782. this.m_listMaid[m].StartKuchipakuPattern(0f, this.m_listKuchiPattern[m], true);
  783. }
  784. }
  785. }
  786. this.m_eMode = DanceMain.Mode.LoadChara;
  787. }
  788. }
  789. else if (this.m_eMode == DanceMain.Mode.LoadChara)
  790. {
  791. if (!GameMain.Instance.CharacterMgr.IsBusy() || this.m_listMaid.Count == 0)
  792. {
  793. if (!this.m_boDebugDummyBody)
  794. {
  795. int num = 1;
  796. for (;;)
  797. {
  798. string arg = "f";
  799. AMAnimationTrack amanimationTrack = this.m_takeNow.findAnimationTrack(arg + num);
  800. if (amanimationTrack == null)
  801. {
  802. break;
  803. }
  804. int num2 = num - 1;
  805. Maid maid2 = GameMain.Instance.CharacterMgr.GetMaid(num2);
  806. IEnumerator enumerator5 = Enum.GetValues(typeof(Maid.AutoTwist)).GetEnumerator();
  807. try
  808. {
  809. while (enumerator5.MoveNext())
  810. {
  811. object obj = enumerator5.Current;
  812. maid2.SetAutoTwist((Maid.AutoTwist)obj, true);
  813. }
  814. }
  815. finally
  816. {
  817. IDisposable disposable;
  818. if ((disposable = (enumerator5 as IDisposable)) != null)
  819. {
  820. disposable.Dispose();
  821. }
  822. }
  823. if (!maid2.IsCrcBody)
  824. {
  825. if (this.m_AutoTwistShoulderL != null && num2 < this.m_AutoTwistShoulderL.Length)
  826. {
  827. maid2.SetAutoTwist(Maid.AutoTwist.ShoulderL, this.m_AutoTwistShoulderL[num2]);
  828. }
  829. if (this.m_AutoTwistShoulderR != null && num2 < this.m_AutoTwistShoulderR.Length)
  830. {
  831. maid2.SetAutoTwist(Maid.AutoTwist.ShoulderR, this.m_AutoTwistShoulderR[num2]);
  832. }
  833. if (this.m_AutoTwistWristL != null && num2 < this.m_AutoTwistWristL.Length)
  834. {
  835. maid2.SetAutoTwist(Maid.AutoTwist.WristL, this.m_AutoTwistWristL[num2]);
  836. }
  837. if (this.m_AutoTwistWristR != null && num2 < this.m_AutoTwistWristR.Length)
  838. {
  839. maid2.SetAutoTwist(Maid.AutoTwist.WristR, this.m_AutoTwistWristR[num2]);
  840. }
  841. if (this.m_AutoTwistThighL != null && num2 < this.m_AutoTwistThighL.Length)
  842. {
  843. maid2.SetAutoTwist(Maid.AutoTwist.ThighL, this.m_AutoTwistThighL[num2]);
  844. }
  845. if (this.m_AutoTwistThighR != null && num2 < this.m_AutoTwistThighR.Length)
  846. {
  847. maid2.SetAutoTwist(Maid.AutoTwist.ThighR, this.m_AutoTwistThighR[num2]);
  848. }
  849. }
  850. if (!string.IsNullOrEmpty(this.m_listAnimName[num2]))
  851. {
  852. string name = maid2.CrossFade(this.m_listAnimName[num2] + ".anm", false, false, false, 0f, 1f);
  853. Animation component = maid2.body0.m_Bones.GetComponent<Animation>();
  854. component.Stop();
  855. amanimationTrack.obj = maid2.body0.m_Bones;
  856. foreach (AMAction amaction5 in amanimationTrack.cache)
  857. {
  858. AMAnimationAction amanimationAction = (AMAnimationAction)amaction5;
  859. amanimationAction.amClip = component.GetClip(name);
  860. amanimationAction.obj = maid2.body0.m_Bones;
  861. }
  862. }
  863. else
  864. {
  865. this.m_focePauseAnim.Add(new DanceMain.AnimTime
  866. {
  867. anim = maid2.body0.m_Bones.GetComponent<Animation>()
  868. });
  869. }
  870. if (this.UseFloorHitY)
  871. {
  872. maid2.body0.SetBoneHitHeightY(this.m_fFloorY);
  873. }
  874. num++;
  875. }
  876. for (int n = 0; n < this.m_listDummyAnimChara.Count; n++)
  877. {
  878. Maid maid3 = GameMain.Instance.CharacterMgr.GetMaid(n);
  879. for (int num3 = 0; num3 < this.m_listItemObject.Count; num3++)
  880. {
  881. Transform transform = CMT.SearchObjObj(this.m_listDummyAnimChara[n].transform, this.m_listItemObject[num3].transform);
  882. if (transform != null)
  883. {
  884. Transform transform2 = transform;
  885. string name2 = transform2.parent.name;
  886. Transform parent = CMT.SearchObjName(maid3.gameObject.transform, name2, true);
  887. transform2.SetParent(parent, false);
  888. }
  889. }
  890. }
  891. if (this.m_MoveToDummyCharaPos != null)
  892. {
  893. NDebug.Assert(this.m_MoveToDummyCharaPos.Length <= this.m_listDummyAnimChara.Count<GameObject>(), "MoveToDummyCharaPos は listDummyAnimChara の数以下である必要があります。");
  894. for (int num4 = 0; num4 < this.m_MoveToDummyCharaPos.Length; num4++)
  895. {
  896. if (this.m_MoveToDummyCharaPos[num4])
  897. {
  898. Vector3 position = this.m_listDummyAnimChara[num4].transform.position;
  899. Maid maid4 = GameMain.Instance.CharacterMgr.GetMaid(num4);
  900. if (maid4 != null)
  901. {
  902. maid4.SetPos(position);
  903. }
  904. }
  905. }
  906. }
  907. if (this.m_LayerChangeToDummyChara != null)
  908. {
  909. NDebug.Assert(this.m_LayerChangeToDummyChara.Length <= this.m_listDummyAnimChara.Count<GameObject>(), "LayerChangeToDummyChara は listDummyAnimChara の数以下である必要があります。");
  910. for (int num5 = 0; num5 < this.m_LayerChangeToDummyChara.Length; num5++)
  911. {
  912. if (this.m_LayerChangeToDummyChara[num5])
  913. {
  914. int layer = this.m_listDummyAnimChara[num5].layer;
  915. Maid maid5 = GameMain.Instance.CharacterMgr.GetMaid(num5);
  916. if (maid5 != null)
  917. {
  918. Transform[] componentsInChildren = maid5.gameObject.GetComponentsInChildren<Transform>(true);
  919. foreach (Transform transform3 in componentsInChildren)
  920. {
  921. transform3.gameObject.layer = layer;
  922. }
  923. }
  924. }
  925. }
  926. }
  927. if (this.m_EyeTarget != null)
  928. {
  929. NDebug.Assert(this.m_EyeTarget.Length <= this.m_listDummyAnimChara.Count<GameObject>(), "EyeTarget は listDummyAnimChara の数以下である必要があります。");
  930. for (int num7 = 0; num7 < this.m_EyeTarget.Length; num7++)
  931. {
  932. if (this.m_EyeTarget[num7] != null)
  933. {
  934. Maid maid6 = GameMain.Instance.CharacterMgr.GetMaid(num7);
  935. if (maid6 != null)
  936. {
  937. maid6.EyeToCamera(Maid.EyeMoveType.目だけ向ける, 0f);
  938. maid6.body0.trsLookTarget = this.m_EyeTarget[num7].transform;
  939. }
  940. }
  941. }
  942. }
  943. if (this.m_MotionCacheEnable != null)
  944. {
  945. NDebug.Assert(this.m_MotionCacheEnable.Length <= this.m_listDummyAnimChara.Count<GameObject>(), "MotionCacheEnable は listDummyAnimChara の数以下である必要があります。");
  946. for (int num8 = 0; num8 < this.m_MotionCacheEnable.Length; num8++)
  947. {
  948. if (this.m_MotionCacheEnable[num8])
  949. {
  950. Maid maid7 = GameMain.Instance.CharacterMgr.GetMaid(num8);
  951. if (maid7 != null)
  952. {
  953. for (int num9 = 0; num9 < this.m_MotionCacheFileName.Length; num9++)
  954. {
  955. string text = this.m_MotionCacheFileName[num9];
  956. if (maid7.IsCrcBody && !string.IsNullOrEmpty(text) && text.IndexOf("crc_") != 0)
  957. {
  958. text = "crc_" + text;
  959. }
  960. maid7.CacheAnime(text, false, false);
  961. }
  962. }
  963. }
  964. }
  965. }
  966. for (int num10 = 0; num10 < this.m_listDebugObj.Count; num10++)
  967. {
  968. UnityEngine.Object.DestroyImmediate(this.m_listDebugObj[num10]);
  969. }
  970. this.m_listDebugObj.Clear();
  971. }
  972. if (string.IsNullOrEmpty(this.m_AdjustScript))
  973. {
  974. this.m_eMode = DanceMain.Mode.LoadAnim;
  975. }
  976. else
  977. {
  978. base.StartCoroutine(this.LoadMotionScript());
  979. this.m_eMode = DanceMain.Mode.LoadScript;
  980. }
  981. }
  982. }
  983. else if (this.m_eMode == DanceMain.Mode.LoadAnim)
  984. {
  985. this.m_AnimatorData.Play(this.m_takeNow.name, true, 0f, false, this.time_line_binary_.GetTrackIDList());
  986. this.m_fTakeStartRealTime = Time.realtimeSinceStartup;
  987. this.m_fNowRealTime = this.m_fTakeStartRealTime;
  988. this.m_eMode = DanceMain.Mode.Exec;
  989. }
  990. else if (this.m_eMode == DanceMain.Mode.Exec)
  991. {
  992. bool isPause = RhythmAction_Mgr.Instance.IsPause;
  993. if (!isPause)
  994. {
  995. float num11 = RhythmAction_Mgr.Instance.DanceDeltaTime;
  996. if (this.m_audioNew != null && this.m_audioNew.isPlaying)
  997. {
  998. float time = this.m_audioNew.time;
  999. for (int num12 = 0; num12 < this.m_listMaid.Count; num12++)
  1000. {
  1001. this.m_listMaid[num12].FoceKuchipakuUpdate(time);
  1002. }
  1003. if (this.m_bAudioFirst)
  1004. {
  1005. float num13 = time;
  1006. num11 = Time.realtimeSinceStartup - this.m_fTakeStartRealTime;
  1007. this.m_bAudioFirst = false;
  1008. this.m_fOffsetTime = num13 - num11;
  1009. RhythmAction_Mgr.Instance.RhythmGame_Start();
  1010. }
  1011. }
  1012. this.m_fNowRealTime += num11;
  1013. }
  1014. if (isPause != this.m_pauseBack)
  1015. {
  1016. foreach (DanceMain.AnimTime animTime in this.m_focePauseAnim)
  1017. {
  1018. if (isPause)
  1019. {
  1020. IEnumerator enumerator8 = animTime.anim.GetEnumerator();
  1021. try
  1022. {
  1023. while (enumerator8.MoveNext())
  1024. {
  1025. object obj2 = enumerator8.Current;
  1026. AnimationState animationState = (AnimationState)obj2;
  1027. animTime.stateTimeList.Add(new DanceMain.AnimTime.StateTime
  1028. {
  1029. state = animationState,
  1030. time = animationState.time
  1031. });
  1032. animationState.speed = 0f;
  1033. }
  1034. }
  1035. finally
  1036. {
  1037. IDisposable disposable2;
  1038. if ((disposable2 = (enumerator8 as IDisposable)) != null)
  1039. {
  1040. disposable2.Dispose();
  1041. }
  1042. }
  1043. }
  1044. else
  1045. {
  1046. foreach (DanceMain.AnimTime.StateTime stateTime in animTime.stateTimeList)
  1047. {
  1048. stateTime.state.time = stateTime.time;
  1049. stateTime.state.speed = 1f;
  1050. }
  1051. animTime.stateTimeList.Clear();
  1052. }
  1053. }
  1054. this.m_pauseBack = isPause;
  1055. }
  1056. if (this.IsForceDanceEnd || this.m_AnimatorData.takeName == null || this.IsDanceSkip || (DanceMain.KaraokeMode && Input.GetKeyDown(KeyCode.Return)))
  1057. {
  1058. this.ToFinish();
  1059. }
  1060. }
  1061. else if (this.m_eMode == DanceMain.Mode.Finish)
  1062. {
  1063. }
  1064. if (this.m_AnimatorData.takeName != null)
  1065. {
  1066. NTime.UpdateNowTime(this.m_fNowRealTime - this.m_fTakeStartRealTime + this.m_fOffsetTime);
  1067. this.time_line_binary_.Update(NTime.time);
  1068. }
  1069. if (GameMain.Instance.VRMode && this.m_trOvrDummyCam != null && this.m_OvrCam != null)
  1070. {
  1071. this.m_OvrCam.SetPos(this.m_trOvrDummyCam.position);
  1072. this.m_OvrCam.SetRotation(this.m_trOvrDummyCam.rotation.eulerAngles);
  1073. }
  1074. }
  1075. private const string m_RhythmMgr_Path = "SceneDance/Rhythm_Action/Prefab/RhythmAction_Mgr";
  1076. public static bool IsDanceRecet;
  1077. public static DanceData SelectDanceData;
  1078. public static bool KaraokeMode;
  1079. private DanceMain.Mode m_eMode;
  1080. public bool m_boDebugDummyBody;
  1081. public Camera m_camDummyCamera;
  1082. public List<GameObject> m_listDebugObj;
  1083. public AnimatorData m_AnimatorData;
  1084. public List<GameObject> m_listDummyAnimChara;
  1085. public List<string> m_listAnimName;
  1086. public List<GameObject> m_listEventObject;
  1087. private Hashtable m_htEventObj = new Hashtable();
  1088. public List<string> m_listTestPreset;
  1089. public List<GameObject> m_listItemObject = new List<GameObject>();
  1090. public List<string> m_listKuchiPakuFile = new List<string>();
  1091. private string[] m_listKuchiPattern;
  1092. private List<Maid> m_listMaid = new List<Maid>();
  1093. public string m_strDummyAudioObjectName;
  1094. private AudioSource m_audioNew;
  1095. public string m_strMasterAudioFileName;
  1096. public string m_strPlayTakeName = "Take1";
  1097. private AMTake m_takeNow;
  1098. private string m_strScriptLabel = string.Empty;
  1099. private List<Maid> m_listTempMaid = new List<Maid>();
  1100. private Maid m_maidUser;
  1101. [HideInInspector]
  1102. public bool IsForceDanceEnd;
  1103. [HideInInspector]
  1104. public bool IsDanceSkip;
  1105. private OvrCamera m_OvrCam;
  1106. private Transform m_trOvrDummyCam;
  1107. public bool UseBinaryData;
  1108. public string BinaryFolderName;
  1109. private DanceObjectDataBinary maid_data_binary_;
  1110. private DanceObjectDataBinary maid_item_binary_;
  1111. private DanceObjectDataBinary maid_event_binary_;
  1112. private AWReadBinaryData time_line_binary_;
  1113. [Header("物理境界を変更するか?")]
  1114. public bool UseFloorHitY;
  1115. public float m_fFloorY;
  1116. [SerializeField]
  1117. [Header("被写界深度の焦点")]
  1118. private float m_DepthFocalSize = 1.2f;
  1119. [SerializeField]
  1120. [Header("マイク位置調整等に使うモーションスクリプト名")]
  1121. private string m_AdjustScript = string.Empty;
  1122. [SerializeField]
  1123. private string m_ScriptLabel = string.Empty;
  1124. [SerializeField]
  1125. [Header("AdjustScript読み込みに要する時間")]
  1126. private float m_LoadScriptTime = 3f;
  1127. [SerializeField]
  1128. [Header("初期化時にダミーキャラの位置にメイドを移動させるメイド番号スイッチ")]
  1129. public bool[] m_MoveToDummyCharaPos;
  1130. [SerializeField]
  1131. [Header("初期化時にダミーキャラのLayerをメイドに設定させるメイド番号スイッチ")]
  1132. public bool[] m_LayerChangeToDummyChara;
  1133. public Light[] m_OffScreenLight;
  1134. [SerializeField]
  1135. [Header("初期化時にメイドの視線に設定するオブジェクト対メイド番号")]
  1136. public GameObject[] m_EyeTarget;
  1137. [SerializeField]
  1138. [Header("特定メイド番号からダミーメイドへの容姿のコピー(Elementが先メイド番号/値が元メイド番号")]
  1139. public int[] m_PresetCopyToDummyChara;
  1140. [SerializeField]
  1141. [Header("途中でモーションを変えるメイド番号のファイル名リスト")]
  1142. public bool[] m_MotionCacheEnable;
  1143. [SerializeField]
  1144. [Header("途中でモーションを変える場合のファイル名リスト")]
  1145. public string[] m_MotionCacheFileName;
  1146. [SerializeField]
  1147. [Header("途中で口パクを変える場合のファイル名リスト")]
  1148. public string[] m_KuchipakuCacheFileName;
  1149. private Dictionary<string, string> m_KuchiPatternCache = new Dictionary<string, string>();
  1150. public float[] m_KuchipakuAudioStartTimeAtMaid;
  1151. [SerializeField]
  1152. [Header("自動捻りボーン(ShoulderL)(Elementがメイド番号)指定無しでON")]
  1153. public bool[] m_AutoTwistShoulderL;
  1154. [SerializeField]
  1155. [Header("自動捻りボーン(ShoulderR)(Elementがメイド番号)指定無しでON")]
  1156. public bool[] m_AutoTwistShoulderR;
  1157. [SerializeField]
  1158. [Header("自動捻りボーン(WristL)(Elementがメイド番号)指定無しでON")]
  1159. public bool[] m_AutoTwistWristL;
  1160. [SerializeField]
  1161. [Header("自動捻りボーン(WristR)(Elementがメイド番号)指定無しでON")]
  1162. public bool[] m_AutoTwistWristR;
  1163. [SerializeField]
  1164. [Header("自動捻りボーン(ThighL)(Elementがメイド番号)指定無しでON")]
  1165. public bool[] m_AutoTwistThighL;
  1166. [SerializeField]
  1167. [Header("自動捻りボーン(ThighR)(Elementがメイド番号)指定無しでON")]
  1168. public bool[] m_AutoTwistThighR;
  1169. private List<DanceMain.AnimTime> m_focePauseAnim = new List<DanceMain.AnimTime>();
  1170. private bool m_pauseBack;
  1171. private bool m_bFinished;
  1172. private float m_fNowRealTime;
  1173. private float m_fTakeStartRealTime;
  1174. private float m_fOffsetTime;
  1175. private bool m_bAudioFirst = true;
  1176. private enum Mode
  1177. {
  1178. ActiveCam,
  1179. LoadChara,
  1180. LoadAnim,
  1181. Exec,
  1182. Finish,
  1183. LoadScript
  1184. }
  1185. private class AnimTime
  1186. {
  1187. public Animation anim;
  1188. public List<DanceMain.AnimTime.StateTime> stateTimeList = new List<DanceMain.AnimTime.StateTime>();
  1189. public class StateTime
  1190. {
  1191. public AnimationState state;
  1192. public float time;
  1193. }
  1194. }
  1195. }