KaraokeDataManager.cs 25 KB

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