KaraokeDataManager.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using UnityEngine;
  5. using UnityEngine.EventSystems;
  6. public class KaraokeDataManager : MonoBehaviour
  7. {
  8. public static bool IsExistKaraokeData(bool isFileSystemOld)
  9. {
  10. string format = "karaoke_music_enable_list_{0:000}.nei";
  11. if (!isFileSystemOld)
  12. {
  13. for (int i = 1; i < 101; i++)
  14. {
  15. if (GameUty.FileSystem.IsExistentFile(string.Format(format, i)))
  16. {
  17. return true;
  18. }
  19. }
  20. }
  21. else
  22. {
  23. for (int j = 1; j < 101; j++)
  24. {
  25. if (GameUty.FileSystemOld.IsExistentFile(string.Format(format, j)))
  26. {
  27. return true;
  28. }
  29. }
  30. }
  31. return false;
  32. }
  33. private static bool IsExistKaraokeCSV(int number)
  34. {
  35. string format = "karaoke_music_enable_list_{0:000}.nei";
  36. return GameUty.FileSystem.IsExistentFile(string.Format(format, number));
  37. }
  38. private void ReadCSV(string fileName, Action<CsvParser> callback)
  39. {
  40. if (!GameUty.FileSystem.FileOpen(fileName).IsValid())
  41. {
  42. return;
  43. }
  44. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(fileName))
  45. {
  46. using (CsvParser csvParser = new CsvParser())
  47. {
  48. bool condition = csvParser.Open(afileBase);
  49. NDebug.Assert(condition, fileName + "\nopen failed.");
  50. callback(csvParser);
  51. }
  52. }
  53. Debug.Log(string.Format("[KaraokeManager]csvファイル「{0}」読み込み完了", fileName));
  54. }
  55. private CsvParser GetCSV(string fileName)
  56. {
  57. CsvParser csvParser = new CsvParser();
  58. if (!GameUty.FileSystem.FileOpen(fileName).IsValid())
  59. {
  60. return null;
  61. }
  62. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(fileName))
  63. {
  64. using (csvParser)
  65. {
  66. bool condition = csvParser.Open(afileBase);
  67. NDebug.Assert(condition, fileName + "\nopen failed.");
  68. }
  69. }
  70. return csvParser;
  71. }
  72. private void LoadFoodData()
  73. {
  74. Dictionary<int, string> enableIDList = new Dictionary<int, string>();
  75. for (int i = 0; i < 100; i++)
  76. {
  77. this.ReadCSV(string.Format("karaoke_food_enable_list_{0:000}.nei", i + 1), delegate(CsvParser csv)
  78. {
  79. for (int j = 1; j < csv.max_cell_y; j++)
  80. {
  81. if (csv.IsCellToExistData(0, j))
  82. {
  83. int cellAsInteger = csv.GetCellAsInteger(0, j);
  84. string cellAsString = csv.GetCellAsString(1, j);
  85. if (!enableIDList.ContainsKey(cellAsInteger))
  86. {
  87. enableIDList.Add(cellAsInteger, cellAsString);
  88. }
  89. else
  90. {
  91. enableIDList[cellAsInteger] = cellAsString;
  92. }
  93. }
  94. }
  95. });
  96. }
  97. this.ReadCSV("karaoke_food.nei", delegate(CsvParser csv)
  98. {
  99. for (int j = 3; j < csv.max_cell_y; j++)
  100. {
  101. if (csv.IsCellToExistData(0, j))
  102. {
  103. KaraokeDataManager.FoodData foodData = new KaraokeDataManager.FoodData(csv, enableIDList, j);
  104. this.m_FoodDataArray.Add(foodData.ID, foodData);
  105. if (!string.IsNullOrEmpty(foodData.strTempFlagName1) && !this.m_FoodDataTempFlagArray.Contains(foodData.strTempFlagName1))
  106. {
  107. this.m_FoodDataTempFlagArray.Add(foodData.strTempFlagName1);
  108. }
  109. if (!string.IsNullOrEmpty(foodData.strTempFlagName2) && !this.m_FoodDataTempFlagArray.Contains(foodData.strTempFlagName2))
  110. {
  111. this.m_FoodDataTempFlagArray.Add(foodData.strTempFlagName2);
  112. }
  113. if (!string.IsNullOrEmpty(foodData.strTempFlagName3) && !this.m_FoodDataTempFlagArray.Contains(foodData.strTempFlagName3))
  114. {
  115. this.m_FoodDataTempFlagArray.Add(foodData.strTempFlagName3);
  116. }
  117. }
  118. }
  119. });
  120. }
  121. private void LoadMusicData()
  122. {
  123. Dictionary<int, string> enableIDList = new Dictionary<int, string>();
  124. for (int i = 0; i < 100; i++)
  125. {
  126. this.ReadCSV(string.Format("karaoke_music_enable_list_{0:000}.nei", i + 1), delegate(CsvParser csv)
  127. {
  128. for (int j = 1; j < csv.max_cell_y; j++)
  129. {
  130. if (csv.IsCellToExistData(0, j))
  131. {
  132. int cellAsInteger = csv.GetCellAsInteger(0, j);
  133. string cellAsString = csv.GetCellAsString(1, j);
  134. if (!enableIDList.ContainsKey(cellAsInteger))
  135. {
  136. enableIDList.Add(cellAsInteger, cellAsString);
  137. }
  138. else
  139. {
  140. enableIDList[cellAsInteger] = cellAsString;
  141. }
  142. }
  143. }
  144. });
  145. }
  146. this.ReadCSV("karaoke_music.nei", delegate(CsvParser csv)
  147. {
  148. for (int j = 1; j < csv.max_cell_y; j++)
  149. {
  150. if (csv.IsCellToExistData(0, j))
  151. {
  152. KaraokeDataManager.MusicData musicData = new KaraokeDataManager.MusicData(csv, enableIDList, j);
  153. this.m_MusicDataArray.Add(musicData.ID, musicData);
  154. }
  155. }
  156. });
  157. }
  158. private void LoadBackgroundData()
  159. {
  160. Dictionary<int, string> enableIDList = new Dictionary<int, string>();
  161. for (int i = 0; i < 100; i++)
  162. {
  163. this.ReadCSV(string.Format("karaoke_back_ground_enable_list_{0:000}.nei", i + 1), delegate(CsvParser csv)
  164. {
  165. for (int j = 1; j < csv.max_cell_y; j++)
  166. {
  167. if (csv.IsCellToExistData(0, j))
  168. {
  169. int cellAsInteger = csv.GetCellAsInteger(0, j);
  170. string cellAsString = csv.GetCellAsString(1, j);
  171. if (!enableIDList.ContainsKey(cellAsInteger))
  172. {
  173. enableIDList.Add(cellAsInteger, cellAsString);
  174. }
  175. else
  176. {
  177. enableIDList[cellAsInteger] = cellAsString;
  178. }
  179. }
  180. }
  181. });
  182. }
  183. this.ReadCSV("karaoke_back_ground.nei", delegate(CsvParser csv)
  184. {
  185. for (int j = 1; j < csv.max_cell_y; j++)
  186. {
  187. if (csv.IsCellToExistData(0, j))
  188. {
  189. KaraokeDataManager.BackgroundData backgroundData = new KaraokeDataManager.BackgroundData(csv, enableIDList, j);
  190. this.m_BackgroundDataArray.Add(backgroundData.ID, backgroundData);
  191. }
  192. }
  193. });
  194. }
  195. private void Awake()
  196. {
  197. this.LoadMusicData();
  198. this.LoadFoodData();
  199. this.LoadBackgroundData();
  200. if (SceneVRCommunication.Instance && !SceneVRCommunication.Instance.KaraokeMode)
  201. {
  202. this.m_NowBGIndex = 1;
  203. this.m_NowSelectingBGIndex = 1;
  204. }
  205. }
  206. private void Start()
  207. {
  208. Action<GameObject, Camera> action = delegate(GameObject targetCanvasObj, Camera targetCamera)
  209. {
  210. Canvas component2 = targetCanvasObj.GetComponent<Canvas>();
  211. if (component2 == null)
  212. {
  213. return;
  214. }
  215. component2.worldCamera = targetCamera;
  216. };
  217. Camera componentInChildren = EventSystem.current.gameObject.GetComponentInChildren<Camera>();
  218. action(this.m_CanvasVRConfig.gameObject, componentInChildren);
  219. action(this.m_CanvasKaraokeMainMenu.gameObject, componentInChildren);
  220. if (VRDialogMenu.CreateDialog())
  221. {
  222. action(VRDialogMenu.CreateDialog().gameObject, componentInChildren);
  223. }
  224. if (VRSelectorMenu.CreateSelector())
  225. {
  226. action(VRSelectorMenu.CreateSelector().gameObject, componentInChildren);
  227. }
  228. action(this.m_CanvasDialogMenu.gameObject, componentInChildren);
  229. action(this.m_CanvasSelectorMenu.gameObject, componentInChildren);
  230. VRCanvasManagerMini component = VRCanvasManager.Instance.GetComponent<VRCanvasManagerMini>();
  231. if (component)
  232. {
  233. component.AddCanvas(this.m_CanvasKaraokeMainMenu.GetComponent<Canvas>());
  234. component.AddCanvas(this.m_CanvasVRConfig.GetComponent<Canvas>());
  235. }
  236. }
  237. public KaraokeDataManager.FoodData[] GetFoodDataArray(bool enableDataOnly = true)
  238. {
  239. List<KaraokeDataManager.FoodData> list = new List<KaraokeDataManager.FoodData>(this.m_FoodDataArray.Values);
  240. if (!enableDataOnly)
  241. {
  242. return list.ToArray();
  243. }
  244. List<KaraokeDataManager.FoodData> list2 = new List<KaraokeDataManager.FoodData>();
  245. for (int i = 0; i < list.Count; i++)
  246. {
  247. if (list[i].IsEnable)
  248. {
  249. list2.Add(list[i]);
  250. }
  251. }
  252. return list2.ToArray();
  253. }
  254. public KaraokeDataManager.MusicData[] GetMusicDataArray(bool enableDataOnly = true)
  255. {
  256. List<KaraokeDataManager.MusicData> list = new List<KaraokeDataManager.MusicData>(this.m_MusicDataArray.Values);
  257. if (!enableDataOnly)
  258. {
  259. return list.ToArray();
  260. }
  261. List<KaraokeDataManager.MusicData> list2 = new List<KaraokeDataManager.MusicData>();
  262. for (int i = 0; i < list.Count; i++)
  263. {
  264. if (list[i].IsEnable)
  265. {
  266. list2.Add(list[i]);
  267. }
  268. }
  269. return list2.ToArray();
  270. }
  271. public KaraokeDataManager.BackgroundData[] GetBackgroundDataArray(bool enableDataOnly = true)
  272. {
  273. List<KaraokeDataManager.BackgroundData> list = new List<KaraokeDataManager.BackgroundData>(this.m_BackgroundDataArray.Values);
  274. if (!enableDataOnly)
  275. {
  276. return list.ToArray();
  277. }
  278. List<KaraokeDataManager.BackgroundData> list2 = new List<KaraokeDataManager.BackgroundData>();
  279. for (int i = 0; i < list.Count; i++)
  280. {
  281. if (list[i].IsEnable)
  282. {
  283. list2.Add(list[i]);
  284. }
  285. }
  286. return list2.ToArray();
  287. }
  288. public KaraokeDataManager.MusicData GetMusicData(int id)
  289. {
  290. if (!this.m_MusicDataArray.ContainsKey(id))
  291. {
  292. return null;
  293. }
  294. return this.m_MusicDataArray[id];
  295. }
  296. public bool IsExistMusicData(int musicID)
  297. {
  298. return this.m_MusicDataArray.ContainsKey(musicID);
  299. }
  300. public void StartKaraoke(int musicID)
  301. {
  302. if (this.IsExistMusicData(musicID))
  303. {
  304. KaraokeDataManager.MusicData musicData = this.m_MusicDataArray[musicID];
  305. Debug.Log(string.Format("[KaraokeManager]選択された楽曲の情報\r\n楽曲サムネイル:{0}\r\n楽曲シーン名:{1}\r\n音声ファイル名:{2}\r\n", musicData.strThumbnailName, musicData.strSceneName, musicData.strFileNameOgg));
  306. GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
  307. {
  308. ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
  309. KaraokeDataManager.BackgroundData backgroundData = this.GetBackgroundDataArray(true)[this.m_NowSelectingBGIndex];
  310. if (backgroundData != null)
  311. {
  312. string bgname = GameMain.Instance.BgMgr.GetBGName();
  313. string text = GameMain.Instance.BgMgr.GetBGName();
  314. if (SceneVRCommunication.Instance.GetNowTime() == SceneVRCommunication.VR_TIME.NIGHT)
  315. {
  316. text = backgroundData.strFileNameNight;
  317. }
  318. else
  319. {
  320. text = backgroundData.strFileName;
  321. }
  322. if (bgname != text)
  323. {
  324. GameMain.Instance.BgMgr.ChangeBg(text);
  325. }
  326. this.m_NowBGIndex = this.m_NowSelectingBGIndex;
  327. this.SetTempFlag(backgroundData.strFlagName, backgroundData.flagValue);
  328. }
  329. KaraokeDataManager.FoodData foodData = null;
  330. if (this.m_FoodDataArray.ContainsKey(this.m_BeforeSelectedFoodIndex))
  331. {
  332. foodData = this.m_FoodDataArray[this.m_BeforeSelectedFoodIndex];
  333. }
  334. if (foodData != null)
  335. {
  336. this.SetTempFlag(foodData.strTempFlagName4, foodData.tempFlagValue4);
  337. this.SetTempFlag(foodData.strTempFlagName5, foodData.tempFlagValue5);
  338. this.SetTempFlag(foodData.strTempFlagName6, foodData.tempFlagValue6);
  339. }
  340. this.SetTempFlag("VRカラオケ曲番号", musicData.ID);
  341. scriptMgr.EvalScript("global.__karaoke_music_file_name = '" + musicData.strFileNameOgg + "';");
  342. scriptMgr.EvalScript("global.__karaoke_scene_file_name = '" + musicData.strSceneName + "';");
  343. scriptMgr.LoadAdvScenarioScript("karaoke_start_9999.ks", "*karaoke_start");
  344. scriptMgr.adv_kag.Exec();
  345. }, true, default(Color));
  346. }
  347. else
  348. {
  349. Debug.Log(string.Format("[KaraokeDataManager]カラオケのデータが見つからない\n楽曲データのインデックス:{0}", musicID));
  350. }
  351. }
  352. public void SetBGIndex(int index)
  353. {
  354. this.m_NowSelectingBGIndex = index;
  355. }
  356. public int GetNowBGIndex()
  357. {
  358. return this.m_NowBGIndex;
  359. }
  360. public int GetNowSelectingBGIndex()
  361. {
  362. return this.m_NowSelectingBGIndex;
  363. }
  364. public void SetFoodData(int index)
  365. {
  366. KaraokeDataManager.FoodData foodData = this.m_FoodDataArray[index];
  367. this.AddTempFlag(foodData.strTempFlagName1);
  368. this.AddTempFlag(foodData.strTempFlagName2);
  369. this.AddTempFlag(foodData.strTempFlagName3);
  370. this.ResetTempFlag(new string[]
  371. {
  372. foodData.strTempFlagName1,
  373. foodData.strTempFlagName2,
  374. foodData.strTempFlagName3
  375. });
  376. KaraokeDataManager.BackgroundData backgroundData = this.GetBackgroundDataArray(true)[this.m_NowBGIndex];
  377. if (backgroundData != null)
  378. {
  379. this.SetTempFlag(backgroundData.strFlagName, backgroundData.flagValue);
  380. }
  381. else
  382. {
  383. this.SetTempFlag("カラオケ_背景", 0);
  384. Debug.LogWarning("[KaraokeDatamanager]背景が「KaraokeRoom」「Villa」のどちらでもなかったので、「KaraokeRoom」の値に設定します");
  385. }
  386. KaraokeDataManager.FoodData foodData2 = null;
  387. if (this.m_FoodDataArray.ContainsKey(this.m_BeforeSelectedFoodIndex))
  388. {
  389. foodData2 = this.m_FoodDataArray[this.m_BeforeSelectedFoodIndex];
  390. }
  391. if (foodData2 != null)
  392. {
  393. this.SetTempFlag(foodData2.strTempFlagName4, foodData2.tempFlagValue4);
  394. this.SetTempFlag(foodData2.strTempFlagName5, foodData2.tempFlagValue5);
  395. this.SetTempFlag(foodData2.strTempFlagName6, foodData2.tempFlagValue6);
  396. }
  397. this.m_BeforeSelectedFoodIndex = index;
  398. string str = this.ReplacePersonal(foodData.strScenarioFile);
  399. if (string.IsNullOrEmpty(foodData.strScenarioLabel))
  400. {
  401. GameMain.Instance.ScriptMgr.LoadAdvScenarioScript(str + ".ks", string.Empty);
  402. }
  403. else
  404. {
  405. GameMain.Instance.ScriptMgr.LoadAdvScenarioScript(str + ".ks", "*" + foodData.strScenarioLabel);
  406. }
  407. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  408. StringBuilder stringBuilder = new StringBuilder();
  409. stringBuilder.Append("[KaraokeDataManager]現在のフラグ\n");
  410. for (int i = 0; i < this.m_FoodDataTempFlagArray.Count; i++)
  411. {
  412. string text = this.m_FoodDataTempFlagArray[i];
  413. int tmpGenericFlag = GameMain.Instance.CMSystem.GetTmpGenericFlag(text);
  414. stringBuilder.Append(string.Format("{0}, {1}\n", text, tmpGenericFlag));
  415. }
  416. stringBuilder.Append(string.Format("前回の料理, {0}\n", GameMain.Instance.CMSystem.GetTmpGenericFlag("前回の料理")));
  417. Debug.Log(stringBuilder.ToString());
  418. }
  419. public void ButtonExit()
  420. {
  421. UICanvasFade mainMenu = this.m_CanvasKaraokeMainMenu;
  422. mainMenu.FadeOut(mainMenu.fadeTime, mainMenu.isTimeScaling, delegate
  423. {
  424. VRDialogMenu dialog = VRDialogMenu.CreateDialog();
  425. if (dialog)
  426. {
  427. dialog.GetComponent<UICanvasFade>().FadeIn();
  428. dialog.OpenDialog("カラオケモードを終了しますか?", (VRDialogMenu.TYPE_STYLE)3, delegate(VRDialogMenu.TYPE_STYLE type)
  429. {
  430. dialog.CloseDialog();
  431. if (type != VRDialogMenu.TYPE_STYLE.YES)
  432. {
  433. mainMenu.FadeIn();
  434. return;
  435. }
  436. VRCanvasManager instance = VRCanvasManager.Instance;
  437. if (!instance)
  438. {
  439. Debug.LogWarning("[KaraokeDataManager]VRCanvasManagerが見つからなかった");
  440. return;
  441. }
  442. instance.EndKaraokeMode();
  443. GameMain.Instance.CMSystem.SetTmpGenericFlag("カラオケメイド追加", 0);
  444. });
  445. }
  446. });
  447. }
  448. private void AddTempFlag(string tempFlagName)
  449. {
  450. if (string.IsNullOrEmpty(tempFlagName))
  451. {
  452. return;
  453. }
  454. int tmpGenericFlag = GameMain.Instance.CMSystem.GetTmpGenericFlag(tempFlagName);
  455. GameMain.Instance.CMSystem.SetTmpGenericFlag(tempFlagName, tmpGenericFlag + 1);
  456. }
  457. private void SetTempFlag(string tempFlagName, int value)
  458. {
  459. if (string.IsNullOrEmpty(tempFlagName))
  460. {
  461. return;
  462. }
  463. GameMain.Instance.CMSystem.SetTmpGenericFlag(tempFlagName, value);
  464. }
  465. private void ResetTempFlag(params string[] exclusionTempFlagName)
  466. {
  467. for (int i = 0; i < this.m_FoodDataTempFlagArray.Count; i++)
  468. {
  469. string text = this.m_FoodDataTempFlagArray[i];
  470. bool flag = false;
  471. for (int j = 0; j < exclusionTempFlagName.Length; j++)
  472. {
  473. if (!(text != exclusionTempFlagName[j]))
  474. {
  475. flag = true;
  476. break;
  477. }
  478. }
  479. if (!flag)
  480. {
  481. GameMain.Instance.CMSystem.SetTmpGenericFlag(text, 0);
  482. }
  483. }
  484. }
  485. private void Update()
  486. {
  487. CanvasGroup component = base.GetComponent<CanvasGroup>();
  488. CanvasGroup parentCanvas = this.m_ParentCanvas;
  489. if (!GameMain.Instance.OvrMgr.OvrCamera.IsUIShow)
  490. {
  491. parentCanvas.interactable = false;
  492. parentCanvas.blocksRaycasts = false;
  493. parentCanvas.alpha = 0f;
  494. component.interactable = false;
  495. component.blocksRaycasts = false;
  496. component.alpha = 0f;
  497. return;
  498. }
  499. parentCanvas.alpha = 1f;
  500. component.alpha = 1f;
  501. bool isFallThrough = GameMain.Instance.OvrMgr.OvrCamera.IsFallThrough;
  502. if (isFallThrough)
  503. {
  504. parentCanvas.interactable = true;
  505. parentCanvas.blocksRaycasts = true;
  506. component.interactable = true;
  507. component.blocksRaycasts = true;
  508. }
  509. else
  510. {
  511. parentCanvas.interactable = false;
  512. parentCanvas.blocksRaycasts = false;
  513. component.interactable = false;
  514. component.blocksRaycasts = false;
  515. }
  516. bool isRotDown = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.IsRotDown;
  517. bool isSideBack = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.IsSideBack;
  518. Vector3 zero = Vector3.zero;
  519. zero.z = ((!isRotDown) ? 0f : 180f);
  520. zero.y = ((!isSideBack) ? 0f : 180f);
  521. zero.x = ((!isSideBack) ? 90f : -90f);
  522. base.transform.localEulerAngles = zero;
  523. }
  524. private void LateUpdate()
  525. {
  526. bool isUIShow = GameMain.Instance.OvrMgr.OvrCamera.IsUIShow;
  527. bool isFreeMode = SceneVRCommunication.Instance.IsFreeMode;
  528. bool uiNoHomeMode = SceneVRCommunication.Instance.UiNoHomeMode;
  529. bool flag = GameMain.Instance.MainCamera.IsFadeProc();
  530. bool flag2 = GameMain.Instance.MainCamera.IsFadeOut();
  531. bool isEnableSkip = SceneVRCommunication.Instance.IsEnableSkip;
  532. CanvasGroup parentCanvas = this.m_ParentCanvas;
  533. if (isUIShow)
  534. {
  535. if (uiNoHomeMode)
  536. {
  537. parentCanvas.blocksRaycasts = false;
  538. parentCanvas.alpha = 0f;
  539. }
  540. else
  541. {
  542. parentCanvas.alpha = 1f;
  543. }
  544. }
  545. if (!isFreeMode || !isUIShow)
  546. {
  547. parentCanvas.interactable = false;
  548. parentCanvas.blocksRaycasts = false;
  549. parentCanvas.alpha = 0f;
  550. }
  551. else
  552. {
  553. parentCanvas.interactable = true;
  554. parentCanvas.blocksRaycasts = true;
  555. parentCanvas.alpha = 1f;
  556. }
  557. if (flag || flag2)
  558. {
  559. parentCanvas.blocksRaycasts = false;
  560. }
  561. }
  562. public void ButtonEventOpenVRConfig()
  563. {
  564. UICanvasFade canvasKaraokeMainMenu = this.m_CanvasKaraokeMainMenu;
  565. canvasKaraokeMainMenu.FadeOut(canvasKaraokeMainMenu.fadeTime, canvasKaraokeMainMenu.isTimeScaling, delegate
  566. {
  567. this.m_CanvasVRConfig.FadeIn();
  568. });
  569. }
  570. public void ButtonEventOpenKaraokeMainMenu()
  571. {
  572. UICanvasFade canvasVRConfig = this.m_CanvasVRConfig;
  573. canvasVRConfig.FadeOut(canvasVRConfig.fadeTime, canvasVRConfig.isTimeScaling, delegate
  574. {
  575. this.m_CanvasKaraokeMainMenu.FadeIn();
  576. });
  577. }
  578. private string ReplacePersonal(string fileName)
  579. {
  580. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
  581. fileName = ((!(maid == null)) ? ScriptManager.ReplacePersonal(maid, fileName) : fileName);
  582. return fileName;
  583. }
  584. public const string STR_MAID_ADD_CALL_FLAG = "カラオケメイド追加";
  585. private Dictionary<int, KaraokeDataManager.MusicData> m_MusicDataArray = new Dictionary<int, KaraokeDataManager.MusicData>();
  586. private Dictionary<int, KaraokeDataManager.BackgroundData> m_BackgroundDataArray = new Dictionary<int, KaraokeDataManager.BackgroundData>();
  587. private Dictionary<int, KaraokeDataManager.FoodData> m_FoodDataArray = new Dictionary<int, KaraokeDataManager.FoodData>();
  588. private List<string> m_FoodDataTempFlagArray = new List<string>();
  589. private int m_BeforeSelectedFoodIndex = -1;
  590. private int m_NowSelectingBGIndex;
  591. private int m_NowBGIndex;
  592. [SerializeField]
  593. private CanvasGroup m_ParentCanvas;
  594. [SerializeField]
  595. private UICanvasFade m_CanvasVRConfig;
  596. [SerializeField]
  597. private UICanvasFade m_CanvasKaraokeMainMenu;
  598. [SerializeField]
  599. private VRDialogMenu m_CanvasDialogMenu;
  600. [SerializeField]
  601. private VRSelectorMenu m_CanvasSelectorMenu;
  602. public class FoodData
  603. {
  604. public FoodData(CsvParser csv, Dictionary<int, string> enable_list, int y)
  605. {
  606. int num = 0;
  607. this.ID = csv.GetCellAsInteger(num++, y);
  608. num++;
  609. this.strThumbnailName = csv.GetCellAsString(num++, y);
  610. this.strScenarioFile = csv.GetCellAsString(num++, y);
  611. this.strScenarioLabel = csv.GetCellAsString(num++, y);
  612. this.strTempFlagName1 = csv.GetCellAsString(num++, y);
  613. this.strTempFlagName2 = csv.GetCellAsString(num++, y);
  614. this.strTempFlagName3 = csv.GetCellAsString(num++, y);
  615. this.GetFlagAndValue(csv.GetCellAsString(num++, y), ref this.strTempFlagName4, ref this.tempFlagValue4);
  616. this.GetFlagAndValue(csv.GetCellAsString(num++, y), ref this.strTempFlagName5, ref this.tempFlagValue5);
  617. this.GetFlagAndValue(csv.GetCellAsString(num++, y), ref this.strTempFlagName6, ref this.tempFlagValue6);
  618. this.isEnableID = enable_list.ContainsKey(this.ID);
  619. string text = string.Empty;
  620. if (this.isEnableID)
  621. {
  622. text = enable_list[this.ID];
  623. }
  624. if (!string.IsNullOrEmpty(text))
  625. {
  626. this.pluginType = text.ToLower();
  627. }
  628. }
  629. private void GetFlagAndValue(string strCellData, ref string strFlag, ref int value)
  630. {
  631. if (string.IsNullOrEmpty(strCellData))
  632. {
  633. return;
  634. }
  635. string[] array = strCellData.Split(new char[]
  636. {
  637. ','
  638. });
  639. strFlag = array[0];
  640. value = int.Parse(array[1]);
  641. }
  642. public bool IsEnable
  643. {
  644. get
  645. {
  646. bool flag = string.IsNullOrEmpty(this.pluginType) || PluginData.IsEnabled(this.pluginType);
  647. if (this.pluginType == "karaoke002" && this.isEnableID && !flag)
  648. {
  649. flag = KaraokeDataManager.IsExistKaraokeCSV(2);
  650. Debug.Log("カラオケパック002\u3000新ファイルシステム:" + flag);
  651. }
  652. return this.isEnableID && flag;
  653. }
  654. }
  655. public int ID;
  656. public string strThumbnailName = string.Empty;
  657. public string strScenarioFile = string.Empty;
  658. public string strScenarioLabel = string.Empty;
  659. public string strTempFlagName1 = string.Empty;
  660. public string strTempFlagName2 = string.Empty;
  661. public string strTempFlagName3 = string.Empty;
  662. public string strTempFlagName4 = string.Empty;
  663. public string strTempFlagName5 = string.Empty;
  664. public string strTempFlagName6 = string.Empty;
  665. public int tempFlagValue4;
  666. public int tempFlagValue5;
  667. public int tempFlagValue6;
  668. public string pluginType = string.Empty;
  669. private bool isEnableID;
  670. }
  671. public class MusicData
  672. {
  673. public MusicData(CsvParser csv_default, Dictionary<int, string> enable_list, int y)
  674. {
  675. int num = 0;
  676. this.ID = csv_default.GetCellAsInteger(num++, y);
  677. num++;
  678. this.strThumbnailName = csv_default.GetCellAsString(num++, y);
  679. num++;
  680. this.strSceneName = csv_default.GetCellAsString(num++, y);
  681. this.strFileNameOgg = csv_default.GetCellAsString(num++, y);
  682. this.isEnableID = enable_list.ContainsKey(this.ID);
  683. string text = string.Empty;
  684. if (this.isEnableID)
  685. {
  686. text = enable_list[this.ID];
  687. }
  688. if (!string.IsNullOrEmpty(text))
  689. {
  690. this.pluginType = text.ToLower();
  691. }
  692. }
  693. public bool IsEnable
  694. {
  695. get
  696. {
  697. bool flag = string.IsNullOrEmpty(this.pluginType) || PluginData.IsEnabled(this.pluginType);
  698. if (this.pluginType == "karaoke002" && this.isEnableID && !flag)
  699. {
  700. flag = KaraokeDataManager.IsExistKaraokeCSV(2);
  701. Debug.Log("カラオケパック002\u3000新ファイルシステム:" + flag);
  702. }
  703. return this.isEnableID && flag;
  704. }
  705. }
  706. public int ID;
  707. public string strThumbnailName = string.Empty;
  708. public string strSceneName = string.Empty;
  709. public string strFileNameOgg = string.Empty;
  710. public string pluginType = string.Empty;
  711. private bool isEnableID;
  712. }
  713. public class BackgroundData
  714. {
  715. public BackgroundData(CsvParser csv, Dictionary<int, string> enable_list, int y)
  716. {
  717. int num = 0;
  718. this.ID = csv.GetCellAsInteger(num++, y);
  719. this.strThumbnailName = csv.GetCellAsString(num++, y);
  720. this.strFileName = csv.GetCellAsString(num++, y);
  721. this.strFileNameNight = csv.GetCellAsString(num++, y);
  722. this.strFlagName = csv.GetCellAsString(num++, y);
  723. this.flagValue = csv.GetCellAsInteger(num++, y);
  724. this.isEnableID = enable_list.ContainsKey(this.ID);
  725. string text = string.Empty;
  726. if (this.isEnableID)
  727. {
  728. text = enable_list[this.ID];
  729. }
  730. if (!string.IsNullOrEmpty(text))
  731. {
  732. this.pluginType = text.ToLower();
  733. }
  734. }
  735. public bool IsEnable
  736. {
  737. get
  738. {
  739. bool flag = string.IsNullOrEmpty(this.pluginType) || PluginData.IsEnabled(this.pluginType);
  740. if (this.pluginType == "karaoke002" && this.isEnableID && !flag)
  741. {
  742. flag = KaraokeDataManager.IsExistKaraokeCSV(2);
  743. Debug.Log("カラオケパック002\u3000新ファイルシステム:" + flag);
  744. }
  745. return this.isEnableID && flag;
  746. }
  747. }
  748. public int ID;
  749. public string strThumbnailName = string.Empty;
  750. public string strFileName = string.Empty;
  751. public string strFileNameNight = string.Empty;
  752. public string strFlagName = string.Empty;
  753. public int flagValue = -1;
  754. public string pluginType = string.Empty;
  755. private bool isEnableID;
  756. }
  757. }