KaraokeDataManager.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969
  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 IsEnablePersonalKaraoke004(Maid maid)
  201. {
  202. return KaraokeDataManager.IsEnablePersonalKaraoke004(maid.status.personal.uniqueName);
  203. }
  204. public static bool IsEnablePersonalKaraoke003(string personalUniqueName)
  205. {
  206. List<string> list = new List<string>
  207. {
  208. "Muku",
  209. "Majime",
  210. "Rindere",
  211. "Pure",
  212. "Cool",
  213. "Pride"
  214. };
  215. return list.Contains(personalUniqueName);
  216. }
  217. public static bool IsEnablePersonalKaraoke004(string personalUniqueName)
  218. {
  219. List<string> list = new List<string>
  220. {
  221. "Muku",
  222. "Majime",
  223. "Rindere",
  224. "Pure",
  225. "Cool",
  226. "Pride"
  227. };
  228. return list.Contains(personalUniqueName);
  229. }
  230. public static void GetMaidListAdditional(List<Maid> draw_list)
  231. {
  232. List<Maid> list = new List<Maid>();
  233. List<Maid> list2 = new List<Maid>();
  234. CharacterSelectManager.DefaultMaidList(list2);
  235. for (int i = 0; i < list2.Count; i++)
  236. {
  237. Maid maid = list2[i];
  238. if (maid.status.heroineType != HeroineType.Sub)
  239. {
  240. if (maid.ActiveSlotNo == -1)
  241. {
  242. if (KaraokeDataManager.IsEnablePersonalKaraoke003(maid))
  243. {
  244. list.Add(maid);
  245. }
  246. }
  247. }
  248. }
  249. draw_list.Clear();
  250. draw_list.AddRange(list);
  251. }
  252. public static void GetMaidListKaraoke(List<Maid> draw_list)
  253. {
  254. List<string> list = new List<string>
  255. {
  256. "Pure",
  257. "Cool",
  258. "Pride",
  259. "Yandere",
  260. "Anesan",
  261. "Genki",
  262. "Sadist",
  263. "Muku",
  264. "Majime",
  265. "Rindere"
  266. };
  267. if (GameMain.Instance.CMSystem.GetTmpGenericFlag("Silent_KARAOKE") == 1)
  268. {
  269. list.Add("Silent");
  270. }
  271. if (GameMain.Instance.CMSystem.GetTmpGenericFlag("Devilish_KARAOKE") == 1)
  272. {
  273. list.Add("Devilish");
  274. }
  275. if (GameMain.Instance.CMSystem.GetTmpGenericFlag("Ladylike_KARAOKE") == 1)
  276. {
  277. list.Add("Ladylike");
  278. }
  279. if (GameMain.Instance.CMSystem.GetTmpGenericFlag("Secretary_KARAOKE") == 1)
  280. {
  281. list.Add("Secretary");
  282. }
  283. if (GameMain.Instance.CMSystem.GetTmpGenericFlag("Sister_KARAOKE") == 1)
  284. {
  285. list.Add("Sister");
  286. }
  287. if (GameMain.Instance.CMSystem.GetTmpGenericFlag("Curtness_KARAOKE") == 1)
  288. {
  289. list.Add("Curtness");
  290. }
  291. List<Maid> list2 = new List<Maid>();
  292. List<Maid> list3 = new List<Maid>();
  293. CharacterSelectManager.DefaultMaidList(list3);
  294. for (int i = 0; i < list3.Count; i++)
  295. {
  296. Maid maid = list3[i];
  297. if (maid.status.heroineType != HeroineType.Sub)
  298. {
  299. if (list.Contains(maid.status.personal.uniqueName))
  300. {
  301. list2.Add(maid);
  302. }
  303. }
  304. }
  305. draw_list.Clear();
  306. draw_list.AddRange(list2);
  307. }
  308. private void Awake()
  309. {
  310. this.LoadMusicData();
  311. this.LoadFoodData();
  312. this.LoadBackgroundData();
  313. if (SceneVRCommunication.Instance && !SceneVRCommunication.Instance.KaraokeMode)
  314. {
  315. this.m_NowBGIndex = 1;
  316. this.m_NowSelectingBGIndex = 1;
  317. }
  318. }
  319. private void Start()
  320. {
  321. Action<GameObject, Camera> action = delegate(GameObject targetCanvasObj, Camera targetCamera)
  322. {
  323. Canvas component2 = targetCanvasObj.GetComponent<Canvas>();
  324. if (component2 == null)
  325. {
  326. return;
  327. }
  328. component2.worldCamera = targetCamera;
  329. };
  330. Camera componentInChildren = EventSystem.current.gameObject.GetComponentInChildren<Camera>();
  331. action(this.m_CanvasVRConfig.gameObject, componentInChildren);
  332. action(this.m_CanvasKaraokeMainMenu.gameObject, componentInChildren);
  333. if (VRDialogMenu.CreateDialog())
  334. {
  335. action(VRDialogMenu.CreateDialog().gameObject, componentInChildren);
  336. }
  337. if (VRSelectorMenu.CreateSelector())
  338. {
  339. action(VRSelectorMenu.CreateSelector().gameObject, componentInChildren);
  340. }
  341. action(this.m_CanvasDialogMenu.gameObject, componentInChildren);
  342. action(this.m_CanvasSelectorMenu.gameObject, componentInChildren);
  343. VRCanvasManagerMini component = VRCanvasManager.Instance.GetComponent<VRCanvasManagerMini>();
  344. if (component)
  345. {
  346. component.AddCanvas(this.m_CanvasKaraokeMainMenu.GetComponent<Canvas>());
  347. component.AddCanvas(this.m_CanvasVRConfig.GetComponent<Canvas>());
  348. }
  349. }
  350. public KaraokeDataManager.FoodData[] GetFoodDataArray(bool enableDataOnly = true)
  351. {
  352. List<KaraokeDataManager.FoodData> list = new List<KaraokeDataManager.FoodData>(this.m_FoodDataArray.Values);
  353. if (!enableDataOnly)
  354. {
  355. return list.ToArray();
  356. }
  357. List<KaraokeDataManager.FoodData> list2 = new List<KaraokeDataManager.FoodData>();
  358. for (int i = 0; i < list.Count; i++)
  359. {
  360. if (list[i].IsEnable)
  361. {
  362. list2.Add(list[i]);
  363. }
  364. }
  365. return list2.ToArray();
  366. }
  367. public KaraokeDataManager.MusicData[] GetMusicDataArray(bool enableDataOnly = true)
  368. {
  369. List<KaraokeDataManager.MusicData> list = new List<KaraokeDataManager.MusicData>(this.m_MusicDataArray.Values);
  370. if (!enableDataOnly)
  371. {
  372. return list.ToArray();
  373. }
  374. List<KaraokeDataManager.MusicData> list2 = new List<KaraokeDataManager.MusicData>();
  375. for (int i = 0; i < list.Count; i++)
  376. {
  377. if (list[i].IsEnable)
  378. {
  379. list2.Add(list[i]);
  380. }
  381. }
  382. return list2.ToArray();
  383. }
  384. public KaraokeDataManager.BackgroundData[] GetBackgroundDataArray(bool enableDataOnly = true)
  385. {
  386. List<KaraokeDataManager.BackgroundData> list = new List<KaraokeDataManager.BackgroundData>(this.m_BackgroundDataArray.Values);
  387. if (!enableDataOnly)
  388. {
  389. return list.ToArray();
  390. }
  391. List<KaraokeDataManager.BackgroundData> list2 = new List<KaraokeDataManager.BackgroundData>();
  392. for (int i = 0; i < list.Count; i++)
  393. {
  394. if (list[i].IsEnable)
  395. {
  396. list2.Add(list[i]);
  397. }
  398. }
  399. return list2.ToArray();
  400. }
  401. public KaraokeDataManager.MusicData GetMusicData(int id)
  402. {
  403. if (!this.m_MusicDataArray.ContainsKey(id))
  404. {
  405. return null;
  406. }
  407. return this.m_MusicDataArray[id];
  408. }
  409. public bool IsExistMusicData(int musicID)
  410. {
  411. return this.m_MusicDataArray.ContainsKey(musicID);
  412. }
  413. public void StartKaraoke(int musicID)
  414. {
  415. if (this.IsExistMusicData(musicID))
  416. {
  417. KaraokeDataManager.MusicData musicData = this.m_MusicDataArray[musicID];
  418. Debug.Log(string.Format("[KaraokeManager]選択された楽曲の情報\r\n楽曲サムネイル:{0}\r\n楽曲シーン名:{1}\r\n音声ファイル名:{2}\r\n", musicData.strThumbnailName, musicData.strSceneName, musicData.strFileNameOgg));
  419. GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
  420. {
  421. ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
  422. KaraokeDataManager.BackgroundData backgroundData = this.GetBackgroundDataArray(true)[this.m_NowSelectingBGIndex];
  423. if (backgroundData != null)
  424. {
  425. string bgname = GameMain.Instance.BgMgr.GetBGName();
  426. string text = GameMain.Instance.BgMgr.GetBGName();
  427. if (SceneVRCommunication.Instance.GetNowTime() == SceneVRCommunication.VR_TIME.NIGHT)
  428. {
  429. text = backgroundData.strFileNameNight;
  430. }
  431. else
  432. {
  433. text = backgroundData.strFileName;
  434. }
  435. if (bgname != text)
  436. {
  437. GameMain.Instance.BgMgr.ChangeBg(text);
  438. }
  439. this.m_NowBGIndex = this.m_NowSelectingBGIndex;
  440. this.SetTempFlag(backgroundData.strFlagName, backgroundData.flagValue);
  441. }
  442. KaraokeDataManager.FoodData foodData = null;
  443. if (this.m_FoodDataArray.ContainsKey(this.m_BeforeSelectedFoodIndex))
  444. {
  445. foodData = this.m_FoodDataArray[this.m_BeforeSelectedFoodIndex];
  446. }
  447. if (foodData != null)
  448. {
  449. this.SetTempFlag(foodData.strTempFlagName4, foodData.tempFlagValue4);
  450. this.SetTempFlag(foodData.strTempFlagName5, foodData.tempFlagValue5);
  451. this.SetTempFlag(foodData.strTempFlagName6, foodData.tempFlagValue6);
  452. }
  453. this.SetTempFlag("VRカラオケ曲番号", musicData.ID);
  454. scriptMgr.EvalScript("global.__karaoke_music_file_name = '" + musicData.strFileNameOgg + "';");
  455. scriptMgr.EvalScript("global.__karaoke_scene_file_name = '" + musicData.strSceneName + "';");
  456. scriptMgr.LoadAdvScenarioScript("karaoke_start_9999.ks", "*karaoke_start");
  457. scriptMgr.adv_kag.Exec();
  458. }, true, default(Color));
  459. }
  460. else
  461. {
  462. Debug.Log(string.Format("[KaraokeDataManager]カラオケのデータが見つからない\n楽曲データのインデックス:{0}", musicID));
  463. }
  464. }
  465. public void SetBGIndex(int index)
  466. {
  467. this.m_NowSelectingBGIndex = index;
  468. }
  469. public int GetNowBGIndex()
  470. {
  471. return this.m_NowBGIndex;
  472. }
  473. public int GetNowSelectingBGIndex()
  474. {
  475. return this.m_NowSelectingBGIndex;
  476. }
  477. public void SetFoodData(int index)
  478. {
  479. KaraokeDataManager.FoodData foodData = this.m_FoodDataArray[index];
  480. this.AddTempFlag(foodData.strTempFlagName1);
  481. this.AddTempFlag(foodData.strTempFlagName2);
  482. this.AddTempFlag(foodData.strTempFlagName3);
  483. this.ResetTempFlag(new string[]
  484. {
  485. foodData.strTempFlagName1,
  486. foodData.strTempFlagName2,
  487. foodData.strTempFlagName3
  488. });
  489. KaraokeDataManager.BackgroundData backgroundData = this.GetBackgroundDataArray(true)[this.m_NowBGIndex];
  490. if (backgroundData != null)
  491. {
  492. this.SetTempFlag(backgroundData.strFlagName, backgroundData.flagValue);
  493. }
  494. else
  495. {
  496. this.SetTempFlag("カラオケ_背景", 0);
  497. Debug.LogWarning("[KaraokeDatamanager]背景が「KaraokeRoom」「Villa」のどちらでもなかったので、「KaraokeRoom」の値に設定します");
  498. }
  499. KaraokeDataManager.FoodData foodData2 = null;
  500. if (this.m_FoodDataArray.ContainsKey(this.m_BeforeSelectedFoodIndex))
  501. {
  502. foodData2 = this.m_FoodDataArray[this.m_BeforeSelectedFoodIndex];
  503. }
  504. if (foodData2 != null)
  505. {
  506. this.SetTempFlag(foodData2.strTempFlagName4, foodData2.tempFlagValue4);
  507. this.SetTempFlag(foodData2.strTempFlagName5, foodData2.tempFlagValue5);
  508. this.SetTempFlag(foodData2.strTempFlagName6, foodData2.tempFlagValue6);
  509. }
  510. this.m_BeforeSelectedFoodIndex = index;
  511. string str = this.ReplacePersonal(foodData.strScenarioFile);
  512. if (string.IsNullOrEmpty(foodData.strScenarioLabel))
  513. {
  514. GameMain.Instance.ScriptMgr.LoadAdvScenarioScript(str + ".ks", string.Empty);
  515. }
  516. else
  517. {
  518. GameMain.Instance.ScriptMgr.LoadAdvScenarioScript(str + ".ks", "*" + foodData.strScenarioLabel);
  519. }
  520. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  521. StringBuilder stringBuilder = new StringBuilder();
  522. stringBuilder.Append("[KaraokeDataManager]現在のフラグ\n");
  523. for (int i = 0; i < this.m_FoodDataTempFlagArray.Count; i++)
  524. {
  525. string text = this.m_FoodDataTempFlagArray[i];
  526. int tmpGenericFlag = GameMain.Instance.CMSystem.GetTmpGenericFlag(text);
  527. stringBuilder.Append(string.Format("{0}, {1}\n", text, tmpGenericFlag));
  528. }
  529. stringBuilder.Append(string.Format("前回の料理, {0}\n", GameMain.Instance.CMSystem.GetTmpGenericFlag("前回の料理")));
  530. Debug.Log(stringBuilder.ToString());
  531. }
  532. public void ButtonExit()
  533. {
  534. UICanvasFade mainMenu = this.m_CanvasKaraokeMainMenu;
  535. mainMenu.FadeOut(mainMenu.fadeTime, mainMenu.isTimeScaling, delegate()
  536. {
  537. VRDialogMenu dialog = VRDialogMenu.CreateDialog();
  538. if (dialog)
  539. {
  540. dialog.GetComponent<UICanvasFade>().FadeIn();
  541. dialog.OpenDialog("カラオケモードを終了しますか?", (VRDialogMenu.TYPE_STYLE)3, delegate(VRDialogMenu.TYPE_STYLE type)
  542. {
  543. dialog.CloseDialog();
  544. if (type != VRDialogMenu.TYPE_STYLE.YES)
  545. {
  546. mainMenu.FadeIn();
  547. return;
  548. }
  549. VRCanvasManager instance = VRCanvasManager.Instance;
  550. if (!instance)
  551. {
  552. Debug.LogWarning("[KaraokeDataManager]VRCanvasManagerが見つからなかった");
  553. return;
  554. }
  555. instance.EndKaraokeMode();
  556. GameMain.Instance.CMSystem.SetTmpGenericFlag("カラオケメイド追加", 0);
  557. });
  558. }
  559. });
  560. }
  561. private void AddTempFlag(string tempFlagName)
  562. {
  563. if (string.IsNullOrEmpty(tempFlagName))
  564. {
  565. return;
  566. }
  567. int tmpGenericFlag = GameMain.Instance.CMSystem.GetTmpGenericFlag(tempFlagName);
  568. GameMain.Instance.CMSystem.SetTmpGenericFlag(tempFlagName, tmpGenericFlag + 1);
  569. }
  570. private void SetTempFlag(string tempFlagName, int value)
  571. {
  572. if (string.IsNullOrEmpty(tempFlagName))
  573. {
  574. return;
  575. }
  576. GameMain.Instance.CMSystem.SetTmpGenericFlag(tempFlagName, value);
  577. }
  578. private void ResetTempFlag(params string[] exclusionTempFlagName)
  579. {
  580. for (int i = 0; i < this.m_FoodDataTempFlagArray.Count; i++)
  581. {
  582. string text = this.m_FoodDataTempFlagArray[i];
  583. bool flag = false;
  584. for (int j = 0; j < exclusionTempFlagName.Length; j++)
  585. {
  586. if (!(text != exclusionTempFlagName[j]))
  587. {
  588. flag = true;
  589. break;
  590. }
  591. }
  592. if (!flag)
  593. {
  594. GameMain.Instance.CMSystem.SetTmpGenericFlag(text, 0);
  595. }
  596. }
  597. }
  598. private void Update()
  599. {
  600. CanvasGroup component = base.GetComponent<CanvasGroup>();
  601. CanvasGroup parentCanvas = this.m_ParentCanvas;
  602. if (!GameMain.Instance.OvrMgr.OvrCamera.IsUIShow)
  603. {
  604. parentCanvas.interactable = false;
  605. parentCanvas.blocksRaycasts = false;
  606. parentCanvas.alpha = 0f;
  607. component.interactable = false;
  608. component.blocksRaycasts = false;
  609. component.alpha = 0f;
  610. return;
  611. }
  612. parentCanvas.alpha = 1f;
  613. component.alpha = 1f;
  614. bool isFallThrough = GameMain.Instance.OvrMgr.OvrCamera.IsFallThrough;
  615. if (isFallThrough)
  616. {
  617. parentCanvas.interactable = true;
  618. parentCanvas.blocksRaycasts = true;
  619. component.interactable = true;
  620. component.blocksRaycasts = true;
  621. }
  622. else
  623. {
  624. parentCanvas.interactable = false;
  625. parentCanvas.blocksRaycasts = false;
  626. component.interactable = false;
  627. component.blocksRaycasts = false;
  628. }
  629. bool isRotDown = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.IsRotDown;
  630. bool isSideBack = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.IsSideBack;
  631. Vector3 zero = Vector3.zero;
  632. zero.z = ((!isRotDown) ? 0f : 180f);
  633. zero.y = ((!isSideBack) ? 0f : 180f);
  634. zero.x = ((!isSideBack) ? 90f : -90f);
  635. base.transform.localEulerAngles = zero;
  636. }
  637. private void LateUpdate()
  638. {
  639. bool isUIShow = GameMain.Instance.OvrMgr.OvrCamera.IsUIShow;
  640. bool isFreeMode = SceneVRCommunication.Instance.IsFreeMode;
  641. bool uiNoHomeMode = SceneVRCommunication.Instance.UiNoHomeMode;
  642. bool flag = GameMain.Instance.MainCamera.IsFadeProc();
  643. bool flag2 = GameMain.Instance.MainCamera.IsFadeOut();
  644. bool isEnableSkip = SceneVRCommunication.Instance.IsEnableSkip;
  645. CanvasGroup parentCanvas = this.m_ParentCanvas;
  646. if (isUIShow)
  647. {
  648. if (uiNoHomeMode)
  649. {
  650. parentCanvas.blocksRaycasts = false;
  651. parentCanvas.alpha = 0f;
  652. }
  653. else
  654. {
  655. parentCanvas.alpha = 1f;
  656. }
  657. }
  658. if (!isFreeMode || !isUIShow)
  659. {
  660. parentCanvas.interactable = false;
  661. parentCanvas.blocksRaycasts = false;
  662. parentCanvas.alpha = 0f;
  663. }
  664. else if (!uiNoHomeMode)
  665. {
  666. parentCanvas.interactable = true;
  667. parentCanvas.blocksRaycasts = true;
  668. parentCanvas.alpha = 1f;
  669. }
  670. if (flag || flag2)
  671. {
  672. parentCanvas.blocksRaycasts = false;
  673. }
  674. }
  675. public void ButtonEventOpenVRConfig()
  676. {
  677. UICanvasFade canvasKaraokeMainMenu = this.m_CanvasKaraokeMainMenu;
  678. canvasKaraokeMainMenu.FadeOut(canvasKaraokeMainMenu.fadeTime, canvasKaraokeMainMenu.isTimeScaling, delegate()
  679. {
  680. this.m_CanvasVRConfig.FadeIn();
  681. });
  682. }
  683. public void ButtonEventOpenKaraokeMainMenu()
  684. {
  685. UICanvasFade canvasVRConfig = this.m_CanvasVRConfig;
  686. canvasVRConfig.FadeOut(canvasVRConfig.fadeTime, canvasVRConfig.isTimeScaling, delegate()
  687. {
  688. this.m_CanvasKaraokeMainMenu.FadeIn();
  689. });
  690. }
  691. private string ReplacePersonal(string fileName)
  692. {
  693. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
  694. fileName = ((!(maid == null)) ? ScriptManager.ReplacePersonal(maid, fileName) : fileName);
  695. return fileName;
  696. }
  697. public const string STR_MAID_ADD_CALL_FLAG = "カラオケメイド追加";
  698. public const string STR_PERSONAL_SILENT_ENABLED_FLAG = "Silent_KARAOKE";
  699. public const string STR_PERSONAL_DEVILISH_ENABLED_FLAG = "Devilish_KARAOKE";
  700. public const string STR_PERSONAL_LADYLIKE_ENABLED_FLAG = "Ladylike_KARAOKE";
  701. public const string STR_PERSONAL_SECRETARY_ENABLED_FLAG = "Secretary_KARAOKE";
  702. public const string STR_PERSONAL_SISTER_ENABLED_FLAG = "Sister_KARAOKE";
  703. public const string STR_PERSONAL_CURTNESS_ENABLED_FLAG = "Curtness_KARAOKE";
  704. private Dictionary<int, KaraokeDataManager.MusicData> m_MusicDataArray = new Dictionary<int, KaraokeDataManager.MusicData>();
  705. private Dictionary<int, KaraokeDataManager.BackgroundData> m_BackgroundDataArray = new Dictionary<int, KaraokeDataManager.BackgroundData>();
  706. private Dictionary<int, KaraokeDataManager.FoodData> m_FoodDataArray = new Dictionary<int, KaraokeDataManager.FoodData>();
  707. private List<string> m_FoodDataTempFlagArray = new List<string>();
  708. private int m_BeforeSelectedFoodIndex = -1;
  709. private int m_NowSelectingBGIndex;
  710. private int m_NowBGIndex;
  711. [SerializeField]
  712. private CanvasGroup m_ParentCanvas;
  713. [SerializeField]
  714. private UICanvasFade m_CanvasVRConfig;
  715. [SerializeField]
  716. private UICanvasFade m_CanvasKaraokeMainMenu;
  717. [SerializeField]
  718. private VRDialogMenu m_CanvasDialogMenu;
  719. [SerializeField]
  720. private VRSelectorMenu m_CanvasSelectorMenu;
  721. public class FoodData
  722. {
  723. public FoodData(CsvParser csv, Dictionary<int, string> enable_list, int y)
  724. {
  725. int num = 0;
  726. this.ID = csv.GetCellAsInteger(num++, y);
  727. num++;
  728. this.strThumbnailName = csv.GetCellAsString(num++, y);
  729. this.strScenarioFile = csv.GetCellAsString(num++, y);
  730. this.strScenarioLabel = csv.GetCellAsString(num++, y);
  731. this.strTempFlagName1 = csv.GetCellAsString(num++, y);
  732. this.strTempFlagName2 = csv.GetCellAsString(num++, y);
  733. this.strTempFlagName3 = csv.GetCellAsString(num++, y);
  734. this.GetFlagAndValue(csv.GetCellAsString(num++, y), ref this.strTempFlagName4, ref this.tempFlagValue4);
  735. this.GetFlagAndValue(csv.GetCellAsString(num++, y), ref this.strTempFlagName5, ref this.tempFlagValue5);
  736. this.GetFlagAndValue(csv.GetCellAsString(num++, y), ref this.strTempFlagName6, ref this.tempFlagValue6);
  737. this.isEnableID = enable_list.ContainsKey(this.ID);
  738. string text = string.Empty;
  739. if (this.isEnableID)
  740. {
  741. text = enable_list[this.ID];
  742. }
  743. if (!string.IsNullOrEmpty(text))
  744. {
  745. this.pluginType = text.ToLower();
  746. }
  747. }
  748. private void GetFlagAndValue(string strCellData, ref string strFlag, ref int value)
  749. {
  750. if (string.IsNullOrEmpty(strCellData))
  751. {
  752. return;
  753. }
  754. string[] array = strCellData.Split(new char[]
  755. {
  756. ','
  757. });
  758. strFlag = array[0];
  759. value = int.Parse(array[1]);
  760. }
  761. public bool IsEnable
  762. {
  763. get
  764. {
  765. bool flag = string.IsNullOrEmpty(this.pluginType) || PluginData.IsEnabled(this.pluginType);
  766. if (this.pluginType == "karaoke002" && this.isEnableID && !flag)
  767. {
  768. flag = KaraokeDataManager.IsExistKaraokeCSV(2);
  769. Debug.Log("カラオケパック002\u3000新ファイルシステム:" + flag);
  770. }
  771. return this.isEnableID && flag;
  772. }
  773. }
  774. public int ID;
  775. public string strThumbnailName = string.Empty;
  776. public string strScenarioFile = string.Empty;
  777. public string strScenarioLabel = string.Empty;
  778. public string strTempFlagName1 = string.Empty;
  779. public string strTempFlagName2 = string.Empty;
  780. public string strTempFlagName3 = string.Empty;
  781. public string strTempFlagName4 = string.Empty;
  782. public string strTempFlagName5 = string.Empty;
  783. public string strTempFlagName6 = string.Empty;
  784. public int tempFlagValue4;
  785. public int tempFlagValue5;
  786. public int tempFlagValue6;
  787. public string pluginType = string.Empty;
  788. private bool isEnableID;
  789. public static readonly int ID_BUTTON_MAID_ADDITIONAL = 140;
  790. public static readonly int ID_BUTTON_MAID_ = 150;
  791. }
  792. public class MusicData
  793. {
  794. public MusicData(CsvParser csv_default, Dictionary<int, string> enable_list, int y)
  795. {
  796. int num = 0;
  797. this.ID = csv_default.GetCellAsInteger(num++, y);
  798. num++;
  799. this.strThumbnailName = csv_default.GetCellAsString(num++, y);
  800. num++;
  801. this.strSceneName = csv_default.GetCellAsString(num++, y);
  802. this.strFileNameOgg = csv_default.GetCellAsString(num++, y);
  803. this.isEnableID = enable_list.ContainsKey(this.ID);
  804. string text = string.Empty;
  805. if (this.isEnableID)
  806. {
  807. text = enable_list[this.ID];
  808. }
  809. if (!string.IsNullOrEmpty(text))
  810. {
  811. this.pluginType = text.ToLower();
  812. }
  813. }
  814. public bool IsEnable
  815. {
  816. get
  817. {
  818. bool flag = string.IsNullOrEmpty(this.pluginType) || PluginData.IsEnabled(this.pluginType);
  819. if (this.pluginType == "karaoke002" && this.isEnableID && !flag)
  820. {
  821. flag = KaraokeDataManager.IsExistKaraokeCSV(2);
  822. Debug.Log("カラオケパック002\u3000新ファイルシステム:" + flag);
  823. }
  824. return this.isEnableID && flag;
  825. }
  826. }
  827. public int ID;
  828. public string strThumbnailName = string.Empty;
  829. public string strSceneName = string.Empty;
  830. public string strFileNameOgg = string.Empty;
  831. public string pluginType = string.Empty;
  832. private bool isEnableID;
  833. }
  834. public class BackgroundData
  835. {
  836. public BackgroundData(CsvParser csv, Dictionary<int, string> enable_list, int y)
  837. {
  838. int num = 0;
  839. this.ID = csv.GetCellAsInteger(num++, y);
  840. this.strThumbnailName = csv.GetCellAsString(num++, y);
  841. this.strFileName = csv.GetCellAsString(num++, y);
  842. this.strFileNameNight = csv.GetCellAsString(num++, y);
  843. this.strFlagName = csv.GetCellAsString(num++, y);
  844. this.flagValue = csv.GetCellAsInteger(num++, y);
  845. this.isEnableID = enable_list.ContainsKey(this.ID);
  846. string text = string.Empty;
  847. if (this.isEnableID)
  848. {
  849. text = enable_list[this.ID];
  850. }
  851. if (!string.IsNullOrEmpty(text))
  852. {
  853. this.pluginType = text.ToLower();
  854. }
  855. }
  856. public bool IsEnable
  857. {
  858. get
  859. {
  860. bool flag = string.IsNullOrEmpty(this.pluginType) || PluginData.IsEnabled(this.pluginType);
  861. if (this.pluginType == "karaoke002" && this.isEnableID && !flag)
  862. {
  863. flag = KaraokeDataManager.IsExistKaraokeCSV(2);
  864. Debug.Log("カラオケパック002\u3000新ファイルシステム:" + flag);
  865. }
  866. return this.isEnableID && flag;
  867. }
  868. }
  869. public int ID;
  870. public string strThumbnailName = string.Empty;
  871. public string strFileName = string.Empty;
  872. public string strFileNameNight = string.Empty;
  873. public string strFlagName = string.Empty;
  874. public int flagValue = -1;
  875. public string pluginType = string.Empty;
  876. private bool isEnableID;
  877. }
  878. }