uGUIKaraokeSelect.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.EventSystems;
  5. using UnityEngine.UI;
  6. public class uGUIKaraokeSelect : MonoBehaviour
  7. {
  8. private uGUIKaraokeSelect.uGUIItemListViewer UIListViewer
  9. {
  10. get
  11. {
  12. if (!this.m_UIListViewer)
  13. {
  14. this.m_UIListViewer = this.m_UIListViewerObject.GetOrAddComponent<uGUIKaraokeSelect.uGUIItemListViewer>();
  15. }
  16. return this.m_UIListViewer;
  17. }
  18. }
  19. private void Start()
  20. {
  21. this.m_UIListViewerObject.gameObject.AddComponent<uGUIKaraokeSelect.uGUIItemListViewer>();
  22. this.HideListViewer();
  23. this.SetButtonActive(this.m_ButtonOK, false);
  24. this.SetButtonActive(this.m_ButtonCANCEL, false);
  25. this.SetButtonActive(this.m_ButtonStart, true);
  26. this.SetButtonActive(this.m_ButtonEnd, true);
  27. this.SetButtonInteractable(this.m_ButtonOK, false);
  28. this.SetButtonInteractable(this.m_ButtonCANCEL, false);
  29. this.SetButtonInteractable(this.m_ButtonStart, true);
  30. this.SetButtonInteractable(this.m_ButtonEnd, true);
  31. KaraokeDataManager.MusicData[] musicDataArray = this.GetMusicDataArray();
  32. string arg = string.Empty;
  33. if (musicDataArray.Length > 0)
  34. {
  35. arg = musicDataArray[0].strThumbnailName;
  36. this.m_SelectingMusicDataID = musicDataArray[0].ID;
  37. }
  38. this.m_ButtonSelectMusic.image.sprite = Resources.Load<Sprite>(string.Format("{0}{1}", "SceneVRCommunication/Tablet/Karaoke/Sprite/", arg));
  39. KaraokeDataManager.BackgroundData backgroundData = this.GetBackgroundData(this.GetNowBackgroundDataIndex());
  40. this.m_ButtonSelectBG.image.sprite = Resources.Load<Sprite>(string.Format("{0}{1}", "SceneVRCommunication/Tablet/Karaoke/Sprite/", backgroundData.strThumbnailName));
  41. if (SceneVRCommunication.Instance && !SceneVRCommunication.Instance.KaraokeMode)
  42. {
  43. this.m_ButtonSelectBG.interactable = false;
  44. }
  45. if (this.GetFoodDataArray().Length <= 0)
  46. {
  47. this.m_ButtonSelectFood.interactable = false;
  48. }
  49. }
  50. public void OpenListSelectMusic(bool isOn)
  51. {
  52. uGUIKaraokeSelect.<OpenListSelectMusic>c__AnonStorey0 <OpenListSelectMusic>c__AnonStorey = new uGUIKaraokeSelect.<OpenListSelectMusic>c__AnonStorey0();
  53. <OpenListSelectMusic>c__AnonStorey.$this = this;
  54. this.SetButtonActive(this.m_ButtonOK, true);
  55. this.SetButtonActive(this.m_ButtonCANCEL, true);
  56. this.SetButtonActive(this.m_ButtonStart, false);
  57. this.SetButtonActive(this.m_ButtonEnd, false);
  58. this.SetButtonInteractable(this.m_ButtonOK, true);
  59. this.SetButtonInteractable(this.m_ButtonCANCEL, true);
  60. this.ShowListViewer();
  61. <OpenListSelectMusic>c__AnonStorey.musicArray = this.GetMusicDataArray();
  62. this.m_BeforeSelectedGameObject = null;
  63. this.UIListViewer.Show(<OpenListSelectMusic>c__AnonStorey.musicArray.Length, delegate(int index, GameObject item)
  64. {
  65. Toggle component = item.GetComponent<Toggle>();
  66. uGUIKaraokeSelect.uGUIItemListButton itemNumber = item.AddComponent<uGUIKaraokeSelect.uGUIItemListButton>();
  67. itemNumber.number = <OpenListSelectMusic>c__AnonStorey.musicArray[index].ID;
  68. if (<OpenListSelectMusic>c__AnonStorey.$this.m_SelectingMusicDataID == itemNumber.number)
  69. {
  70. component.isOn = true;
  71. }
  72. component.image.sprite = <OpenListSelectMusic>c__AnonStorey.$this.GetResource<Sprite>(string.Format("{0}{1}", "SceneVRCommunication/Tablet/Karaoke/Sprite/", <OpenListSelectMusic>c__AnonStorey.musicArray[index].strThumbnailName));
  73. component.onValueChanged.AddListener(delegate(bool value)
  74. {
  75. if (!value)
  76. {
  77. return;
  78. }
  79. int number = itemNumber.number;
  80. if (<OpenListSelectMusic>c__AnonStorey.IsAlreadySelected(item))
  81. {
  82. <OpenListSelectMusic>c__AnonStorey.ButtonEventSetMusic(number);
  83. }
  84. });
  85. });
  86. this.m_ButtonOK.onClick.RemoveAllListeners();
  87. this.m_ButtonOK.onClick.AddListener(delegate()
  88. {
  89. int indexMusic = <OpenListSelectMusic>c__AnonStorey.$this.m_SelectingMusicDataID;
  90. if (<OpenListSelectMusic>c__AnonStorey.$this.m_BeforeSelectedGameObject)
  91. {
  92. indexMusic = <OpenListSelectMusic>c__AnonStorey.$this.m_BeforeSelectedGameObject.GetComponent<uGUIKaraokeSelect.uGUIItemListButton>().number;
  93. }
  94. <OpenListSelectMusic>c__AnonStorey.$this.ButtonEventSetMusic(indexMusic);
  95. });
  96. this.m_ButtonCANCEL.onClick.RemoveAllListeners();
  97. this.m_ButtonCANCEL.onClick.AddListener(delegate()
  98. {
  99. <OpenListSelectMusic>c__AnonStorey.$this.SetButtonActive(<OpenListSelectMusic>c__AnonStorey.$this.m_ButtonOK, false);
  100. <OpenListSelectMusic>c__AnonStorey.$this.SetButtonActive(<OpenListSelectMusic>c__AnonStorey.$this.m_ButtonCANCEL, false);
  101. <OpenListSelectMusic>c__AnonStorey.$this.SetButtonActive(<OpenListSelectMusic>c__AnonStorey.$this.m_ButtonStart, true);
  102. <OpenListSelectMusic>c__AnonStorey.$this.SetButtonActive(<OpenListSelectMusic>c__AnonStorey.$this.m_ButtonEnd, true);
  103. <OpenListSelectMusic>c__AnonStorey.$this.SetButtonInteractable(<OpenListSelectMusic>c__AnonStorey.$this.m_ButtonStart, <OpenListSelectMusic>c__AnonStorey.$this.IsSelectingMusicDataExist());
  104. <OpenListSelectMusic>c__AnonStorey.$this.SetButtonInteractable(<OpenListSelectMusic>c__AnonStorey.$this.m_ButtonEnd, true);
  105. <OpenListSelectMusic>c__AnonStorey.$this.HideListViewer();
  106. });
  107. }
  108. public void OpenListSelectBG(bool isOn)
  109. {
  110. uGUIKaraokeSelect.<OpenListSelectBG>c__AnonStorey2 <OpenListSelectBG>c__AnonStorey = new uGUIKaraokeSelect.<OpenListSelectBG>c__AnonStorey2();
  111. <OpenListSelectBG>c__AnonStorey.$this = this;
  112. this.SetButtonActive(this.m_ButtonOK, true);
  113. this.SetButtonActive(this.m_ButtonCANCEL, true);
  114. this.SetButtonActive(this.m_ButtonStart, false);
  115. this.SetButtonActive(this.m_ButtonEnd, false);
  116. this.SetButtonInteractable(this.m_ButtonOK, true);
  117. this.SetButtonInteractable(this.m_ButtonCANCEL, true);
  118. this.ShowListViewer();
  119. <OpenListSelectBG>c__AnonStorey.backgroundArray = this.GetBackgroundDataArray();
  120. this.m_BeforeSelectedGameObject = null;
  121. this.UIListViewer.Show(<OpenListSelectBG>c__AnonStorey.backgroundArray.Length, delegate(int index, GameObject item)
  122. {
  123. Toggle component = item.GetComponent<Toggle>();
  124. item.AddComponent<uGUIKaraokeSelect.uGUIItemListButton>().number = index;
  125. if (<OpenListSelectBG>c__AnonStorey.$this.GetNowSelectingBackgroundDataIndex() == index)
  126. {
  127. component.isOn = true;
  128. }
  129. component.image.sprite = <OpenListSelectBG>c__AnonStorey.$this.GetResource<Sprite>(string.Format("{0}{1}", "SceneVRCommunication/Tablet/Karaoke/Sprite/", <OpenListSelectBG>c__AnonStorey.backgroundArray[index].strThumbnailName));
  130. component.onValueChanged.AddListener(delegate(bool value)
  131. {
  132. if (!value)
  133. {
  134. return;
  135. }
  136. <OpenListSelectBG>c__AnonStorey.SetButtonInteractable(<OpenListSelectBG>c__AnonStorey.m_ButtonOK, true);
  137. if (<OpenListSelectBG>c__AnonStorey.IsAlreadySelected(item))
  138. {
  139. <OpenListSelectBG>c__AnonStorey.ButtonEventSetBG(index);
  140. }
  141. });
  142. });
  143. this.m_ButtonOK.onClick.RemoveAllListeners();
  144. this.m_ButtonOK.onClick.AddListener(delegate()
  145. {
  146. int indexBG = <OpenListSelectBG>c__AnonStorey.$this.GetNowSelectingBackgroundDataIndex();
  147. if (<OpenListSelectBG>c__AnonStorey.$this.m_BeforeSelectedGameObject)
  148. {
  149. indexBG = <OpenListSelectBG>c__AnonStorey.$this.m_BeforeSelectedGameObject.GetComponent<uGUIKaraokeSelect.uGUIItemListButton>().number;
  150. }
  151. <OpenListSelectBG>c__AnonStorey.$this.ButtonEventSetBG(indexBG);
  152. });
  153. this.m_ButtonCANCEL.onClick.RemoveAllListeners();
  154. this.m_ButtonCANCEL.onClick.AddListener(delegate()
  155. {
  156. <OpenListSelectBG>c__AnonStorey.$this.SetButtonActive(<OpenListSelectBG>c__AnonStorey.$this.m_ButtonOK, false);
  157. <OpenListSelectBG>c__AnonStorey.$this.SetButtonActive(<OpenListSelectBG>c__AnonStorey.$this.m_ButtonCANCEL, false);
  158. <OpenListSelectBG>c__AnonStorey.$this.SetButtonActive(<OpenListSelectBG>c__AnonStorey.$this.m_ButtonStart, true);
  159. <OpenListSelectBG>c__AnonStorey.$this.SetButtonActive(<OpenListSelectBG>c__AnonStorey.$this.m_ButtonEnd, true);
  160. <OpenListSelectBG>c__AnonStorey.$this.SetButtonInteractable(<OpenListSelectBG>c__AnonStorey.$this.m_ButtonStart, <OpenListSelectBG>c__AnonStorey.$this.IsSelectingMusicDataExist());
  161. <OpenListSelectBG>c__AnonStorey.$this.SetButtonInteractable(<OpenListSelectBG>c__AnonStorey.$this.m_ButtonEnd, true);
  162. <OpenListSelectBG>c__AnonStorey.$this.HideListViewer();
  163. });
  164. }
  165. public void OpenListSelectFood(bool isOn)
  166. {
  167. uGUIKaraokeSelect.<OpenListSelectFood>c__AnonStorey4 <OpenListSelectFood>c__AnonStorey = new uGUIKaraokeSelect.<OpenListSelectFood>c__AnonStorey4();
  168. <OpenListSelectFood>c__AnonStorey.$this = this;
  169. if (!isOn)
  170. {
  171. return;
  172. }
  173. if (this.IsMaidAddCallFlag())
  174. {
  175. this.OnEventMaidAddCalled();
  176. return;
  177. }
  178. this.SetButtonActive(this.m_ButtonOK, true);
  179. this.SetButtonActive(this.m_ButtonCANCEL, true);
  180. this.SetButtonActive(this.m_ButtonStart, false);
  181. this.SetButtonActive(this.m_ButtonEnd, false);
  182. this.SetButtonInteractable(this.m_ButtonOK, true);
  183. this.SetButtonInteractable(this.m_ButtonCANCEL, true);
  184. this.ShowListViewer();
  185. <OpenListSelectFood>c__AnonStorey.foodArray = this.GetFoodDataArray();
  186. this.m_BeforeSelectedGameObject = null;
  187. this.UIListViewer.Show(<OpenListSelectFood>c__AnonStorey.foodArray.Length, delegate(int index, GameObject item)
  188. {
  189. Toggle component = item.GetComponent<Toggle>();
  190. item.AddComponent<uGUIKaraokeSelect.uGUIItemListButton>().number = index;
  191. if (<OpenListSelectFood>c__AnonStorey.$this.m_SelectingFoodDataIndex == index)
  192. {
  193. component.isOn = true;
  194. }
  195. component.image.sprite = <OpenListSelectFood>c__AnonStorey.$this.GetResource<Sprite>(string.Format("{0}{1}", "SceneVRCommunication/Tablet/Karaoke/Sprite/", <OpenListSelectFood>c__AnonStorey.foodArray[index].strThumbnailName));
  196. component.onValueChanged.AddListener(delegate(bool value)
  197. {
  198. if (!value)
  199. {
  200. return;
  201. }
  202. <OpenListSelectFood>c__AnonStorey.SetButtonInteractable(<OpenListSelectFood>c__AnonStorey.m_ButtonOK, true);
  203. if (<OpenListSelectFood>c__AnonStorey.IsAlreadySelected(item))
  204. {
  205. <OpenListSelectFood>c__AnonStorey.ButtonEventSetFood(index);
  206. }
  207. });
  208. });
  209. this.m_ButtonOK.onClick.RemoveAllListeners();
  210. this.m_ButtonOK.onClick.AddListener(delegate()
  211. {
  212. int indexFood = <OpenListSelectFood>c__AnonStorey.$this.m_SelectingFoodDataIndex;
  213. if (<OpenListSelectFood>c__AnonStorey.$this.m_BeforeSelectedGameObject)
  214. {
  215. indexFood = <OpenListSelectFood>c__AnonStorey.$this.m_BeforeSelectedGameObject.GetComponent<uGUIKaraokeSelect.uGUIItemListButton>().number;
  216. }
  217. <OpenListSelectFood>c__AnonStorey.$this.ButtonEventSetFood(indexFood);
  218. });
  219. this.m_ButtonCANCEL.onClick.RemoveAllListeners();
  220. this.m_ButtonCANCEL.onClick.AddListener(delegate()
  221. {
  222. <OpenListSelectFood>c__AnonStorey.$this.SetButtonActive(<OpenListSelectFood>c__AnonStorey.$this.m_ButtonOK, false);
  223. <OpenListSelectFood>c__AnonStorey.$this.SetButtonActive(<OpenListSelectFood>c__AnonStorey.$this.m_ButtonCANCEL, false);
  224. <OpenListSelectFood>c__AnonStorey.$this.SetButtonActive(<OpenListSelectFood>c__AnonStorey.$this.m_ButtonStart, true);
  225. <OpenListSelectFood>c__AnonStorey.$this.SetButtonActive(<OpenListSelectFood>c__AnonStorey.$this.m_ButtonEnd, true);
  226. <OpenListSelectFood>c__AnonStorey.$this.SetButtonInteractable(<OpenListSelectFood>c__AnonStorey.$this.m_ButtonStart, <OpenListSelectFood>c__AnonStorey.$this.IsSelectingMusicDataExist());
  227. <OpenListSelectFood>c__AnonStorey.$this.SetButtonInteractable(<OpenListSelectFood>c__AnonStorey.$this.m_ButtonEnd, true);
  228. <OpenListSelectFood>c__AnonStorey.$this.HideListViewer();
  229. });
  230. }
  231. private void ButtonEventSetMusic(int indexMusic)
  232. {
  233. this.m_SelectingMusicDataID = indexMusic;
  234. this.SetButtonActive(this.m_ButtonOK, false);
  235. this.SetButtonActive(this.m_ButtonCANCEL, false);
  236. this.SetButtonActive(this.m_ButtonStart, true);
  237. this.SetButtonActive(this.m_ButtonEnd, true);
  238. this.SetButtonInteractable(this.m_ButtonStart, this.IsSelectingMusicDataExist());
  239. this.SetButtonInteractable(this.m_ButtonEnd, true);
  240. this.HideListViewer();
  241. this.m_ButtonSelectMusic.image.sprite = Resources.Load<Sprite>(string.Format("{0}{1}", "SceneVRCommunication/Tablet/Karaoke/Sprite/", this.GetMusicData(indexMusic).strThumbnailName));
  242. }
  243. private void ButtonEventSetBG(int indexBG)
  244. {
  245. this.SetBG(indexBG);
  246. Debug.Log(string.Format("[Karaoke]背景が選択された\n選択した背景インデックス:{0}", indexBG));
  247. this.SetButtonActive(this.m_ButtonOK, false);
  248. this.SetButtonActive(this.m_ButtonCANCEL, false);
  249. this.SetButtonActive(this.m_ButtonStart, true);
  250. this.SetButtonActive(this.m_ButtonEnd, true);
  251. this.SetButtonInteractable(this.m_ButtonStart, this.IsSelectingMusicDataExist());
  252. this.SetButtonInteractable(this.m_ButtonEnd, true);
  253. this.HideListViewer();
  254. this.m_ButtonSelectBG.image.sprite = Resources.Load<Sprite>(string.Format("{0}{1}", "SceneVRCommunication/Tablet/Karaoke/Sprite/", this.GetBackgroundData(indexBG).strThumbnailName));
  255. }
  256. private void ButtonEventSetFood(int indexFood)
  257. {
  258. this.m_SelectingFoodDataIndex = indexFood;
  259. Debug.Log(string.Format("[Karaoke]飲食物が選択された\n選択した飲食物インデックス:{0}", indexFood));
  260. this.SetButtonActive(this.m_ButtonOK, false);
  261. this.SetButtonActive(this.m_ButtonCANCEL, false);
  262. this.SetButtonActive(this.m_ButtonStart, true);
  263. this.SetButtonActive(this.m_ButtonEnd, true);
  264. this.SetButtonInteractable(this.m_ButtonStart, this.IsSelectingMusicDataExist());
  265. this.SetButtonInteractable(this.m_ButtonEnd, true);
  266. this.HideListViewer();
  267. this.StartFood(indexFood);
  268. this.m_ButtonSelectFood.image.sprite = Resources.Load<Sprite>(string.Format("{0}{1}", "SceneVRCommunication/Tablet/Karaoke/Sprite/", this.GetFoodData(indexFood).strThumbnailName));
  269. this.UpdateOrderButtonImage();
  270. }
  271. private void ShowListViewer()
  272. {
  273. if (!this.m_ParentUIListViewer.gameObject.activeSelf)
  274. {
  275. UICanvasFade component = this.m_ParentUIListViewer.GetComponent<UICanvasFade>();
  276. component.FadeIn(component.fadeTime, component.isTimeScaling, null);
  277. }
  278. this.UpdateOrderButtonImage();
  279. }
  280. private void HideListViewer()
  281. {
  282. if (this.m_ParentUIListViewer.gameObject.activeSelf)
  283. {
  284. UICanvasFade component = this.m_ParentUIListViewer.GetComponent<UICanvasFade>();
  285. component.FadeOut(component.fadeTime, component.isTimeScaling, delegate()
  286. {
  287. this.m_ParentUIListViewer.gameObject.SetActive(false);
  288. });
  289. }
  290. this.UpdateOrderButtonImage();
  291. }
  292. private void UpdateOrderButtonImage()
  293. {
  294. if (this.IsMaidAddCallFlag())
  295. {
  296. this.m_ButtonSelectFood.image.sprite = this.GetResource<Sprite>("SceneVRCommunication/Tablet/Karaoke/Sprite/kp_event");
  297. Debug.Log("[カラオケ]\u3000メイド二人目呼び出しのフラグがtrue");
  298. }
  299. else
  300. {
  301. Debug.Log("[カラオケ]\u3000メイド二人目はまだ呼ばれていない。");
  302. }
  303. }
  304. private bool IsAlreadySelected(GameObject selectableObject)
  305. {
  306. GameObject currentSelectedGameObject = EventSystem.current.currentSelectedGameObject;
  307. bool result = this.m_BeforeSelectedGameObject == selectableObject;
  308. this.m_BeforeSelectedGameObject = currentSelectedGameObject;
  309. return result;
  310. }
  311. private void SetButtonActive(Button button, bool active)
  312. {
  313. if (button.gameObject.activeSelf != active)
  314. {
  315. button.gameObject.SetActive(active);
  316. }
  317. }
  318. private void SetButtonInteractable(Button button, bool interactable)
  319. {
  320. if (button.interactable != interactable)
  321. {
  322. button.interactable = interactable;
  323. }
  324. }
  325. private bool IsSelectingMusicDataExist()
  326. {
  327. Debug.Log(string.Format("[Karaoke]選択している楽曲インデックス:{0}", this.m_SelectingMusicDataID));
  328. return this.m_Manager.IsExistMusicData(this.m_SelectingMusicDataID);
  329. }
  330. private T GetResource<T>(string path) where T : UnityEngine.Object
  331. {
  332. if (string.IsNullOrEmpty(path))
  333. {
  334. Debug.LogWarning("[Karaoke]リソースのパスが空です");
  335. return (T)((object)null);
  336. }
  337. T t = Resources.Load<T>(path);
  338. if (!t)
  339. {
  340. Debug.LogWarning(string.Format("[Karaoke]リソースの取得に失敗しました\nパス:「{0}」", path));
  341. }
  342. return t;
  343. }
  344. private bool IsMaidAddCallFlag()
  345. {
  346. int tmpGenericFlag = GameMain.Instance.CMSystem.GetTmpGenericFlag("カラオケメイド追加");
  347. return tmpGenericFlag == 1;
  348. }
  349. private void OnEventMaidAddCalled()
  350. {
  351. string file_name = "karaoke_comevent_main.ks";
  352. GameMain.Instance.ScriptMgr.adv_kag.LoadScriptFile(file_name, string.Empty);
  353. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  354. }
  355. private KaraokeDataManager.MusicData[] GetMusicDataArray()
  356. {
  357. return this.m_Manager.GetMusicDataArray(true);
  358. }
  359. private KaraokeDataManager.FoodData[] GetFoodDataArray()
  360. {
  361. KaraokeDataManager.FoodData[] foodDataArray = this.m_Manager.GetFoodDataArray(true);
  362. List<KaraokeDataManager.FoodData> list = new List<KaraokeDataManager.FoodData>();
  363. foreach (KaraokeDataManager.FoodData foodData in foodDataArray)
  364. {
  365. if (foodData.ID != KaraokeDataManager.FoodData.ID_BUTTON_MAID_ADDITIONAL || KaraokeDataManager.IsEnablePersonalKaraoke003(GameMain.Instance.CharacterMgr.GetMaid(0)))
  366. {
  367. if (foodData.ID != KaraokeDataManager.FoodData.ID_BUTTON_MAID_ || KaraokeDataManager.IsEnablePersonalKaraoke004(GameMain.Instance.CharacterMgr.GetMaid(0)))
  368. {
  369. list.Add(foodData);
  370. }
  371. }
  372. }
  373. return list.ToArray();
  374. }
  375. private KaraokeDataManager.BackgroundData[] GetBackgroundDataArray()
  376. {
  377. return this.m_Manager.GetBackgroundDataArray(true);
  378. }
  379. private KaraokeDataManager.MusicData GetMusicData(int musicID)
  380. {
  381. return this.m_Manager.GetMusicData(musicID);
  382. }
  383. private KaraokeDataManager.FoodData GetFoodData(int foodID)
  384. {
  385. return this.GetFoodDataArray()[foodID];
  386. }
  387. private KaraokeDataManager.BackgroundData GetBackgroundData(int backgroundID)
  388. {
  389. return this.GetBackgroundDataArray()[backgroundID];
  390. }
  391. private int GetNowBackgroundDataIndex()
  392. {
  393. return this.m_Manager.GetNowBGIndex();
  394. }
  395. private int GetNowSelectingBackgroundDataIndex()
  396. {
  397. return this.m_Manager.GetNowSelectingBGIndex();
  398. }
  399. public void StartKaraoke()
  400. {
  401. this.m_Manager.StartKaraoke(this.m_SelectingMusicDataID);
  402. }
  403. public void EndKaraoke()
  404. {
  405. this.m_Manager.ButtonExit();
  406. }
  407. private void StartFood(int index)
  408. {
  409. this.m_Manager.SetFoodData(this.GetFoodDataArray()[index].ID);
  410. }
  411. private void SetBG(int index)
  412. {
  413. this.m_Manager.SetBGIndex(index);
  414. }
  415. [SerializeField]
  416. private KaraokeDataManager m_Manager;
  417. [SerializeField]
  418. private Button m_ButtonOK;
  419. [SerializeField]
  420. private Button m_ButtonCANCEL;
  421. [SerializeField]
  422. private Button m_ButtonStart;
  423. [SerializeField]
  424. private Button m_ButtonEnd;
  425. [SerializeField]
  426. private Toggle m_ButtonSelectMusic;
  427. [SerializeField]
  428. private Toggle m_ButtonSelectBG;
  429. [SerializeField]
  430. private Toggle m_ButtonSelectFood;
  431. [SerializeField]
  432. private RectTransform m_ParentUIListViewer;
  433. [SerializeField]
  434. private RectTransform m_UIListViewerObject;
  435. private uGUIKaraokeSelect.uGUIItemListViewer m_UIListViewer;
  436. [Space(16f)]
  437. [SerializeField]
  438. private RectTransform m_ImageLines;
  439. private GameObject m_BeforeSelectedGameObject;
  440. private int m_SelectingMusicDataID;
  441. private int m_SelectingFoodDataIndex;
  442. private const string ThumbnailPath = "SceneVRCommunication/Tablet/Karaoke/Sprite/";
  443. private class uGUIItemListViewer : MonoBehaviour
  444. {
  445. public GameObject showArea
  446. {
  447. get
  448. {
  449. return this.m_ShowArea;
  450. }
  451. set
  452. {
  453. this.m_ShowArea = value;
  454. }
  455. }
  456. public GameObject tempItem
  457. {
  458. get
  459. {
  460. return this.m_TempItem;
  461. }
  462. set
  463. {
  464. this.m_TempItem = value;
  465. }
  466. }
  467. public List<GameObject> itemList
  468. {
  469. get
  470. {
  471. return this.m_ItemList;
  472. }
  473. }
  474. public void Show(GameObject showArea, int itemCount, GameObject tempItem = null, Action<int, GameObject> eventItemSetting = null)
  475. {
  476. if (showArea)
  477. {
  478. this.m_ShowArea = showArea;
  479. }
  480. else if (!this.m_ShowArea)
  481. {
  482. this.FindShowArea();
  483. }
  484. if (!this.m_ShowArea)
  485. {
  486. return;
  487. }
  488. if (tempItem)
  489. {
  490. this.m_TempItem = tempItem;
  491. }
  492. else if (!this.m_TempItem)
  493. {
  494. this.FindItemTemplate();
  495. }
  496. if (!this.m_ShowArea || !this.m_TempItem)
  497. {
  498. return;
  499. }
  500. if (!this.m_ShowArea.activeSelf)
  501. {
  502. this.m_ShowArea.SetActive(true);
  503. }
  504. if (this.m_TempItem.activeSelf)
  505. {
  506. this.m_TempItem.SetActive(false);
  507. }
  508. this.Clear();
  509. Transform transform = this.m_ShowArea.transform;
  510. for (int i = 0; i < itemCount; i++)
  511. {
  512. GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_TempItem);
  513. gameObject.SetActive(true);
  514. gameObject.transform.SetParent(transform, false);
  515. if (eventItemSetting != null)
  516. {
  517. eventItemSetting(i, gameObject);
  518. }
  519. this.m_ItemList.Add(gameObject);
  520. }
  521. }
  522. public void Show(int itemCount, Action<int, GameObject> eventItemSetting = null)
  523. {
  524. this.Show(this.m_ShowArea, itemCount, this.m_TempItem, eventItemSetting);
  525. }
  526. public void Clear()
  527. {
  528. if (!this.m_ShowArea)
  529. {
  530. return;
  531. }
  532. if (this.m_ItemList == null)
  533. {
  534. return;
  535. }
  536. for (int i = 0; i < this.m_ItemList.Count; i++)
  537. {
  538. UnityEngine.Object.Destroy(this.m_ItemList[i]);
  539. }
  540. }
  541. private void FindItemTemplate()
  542. {
  543. if (!this.m_ShowArea)
  544. {
  545. return;
  546. }
  547. if (this.m_ShowArea.transform.childCount <= 0)
  548. {
  549. return;
  550. }
  551. Transform transform = this.FindChildDeep(this.m_ShowArea.transform, "Temp Item", true);
  552. if (!transform)
  553. {
  554. transform = this.m_ShowArea.transform.GetChild(0);
  555. }
  556. this.m_TempItem = transform.gameObject;
  557. }
  558. private void FindShowArea()
  559. {
  560. Transform transform = base.transform.parent;
  561. if (!transform)
  562. {
  563. transform = base.transform;
  564. }
  565. string text = "Content";
  566. Transform transform2 = this.FindChildDeep(transform, text, true);
  567. if (!transform2)
  568. {
  569. Debug.LogError(string.Format("[Karaoke.uGUIItemListViewer]項目を並べるエリアが見つかりませんでした\n検索名:{0}", text));
  570. return;
  571. }
  572. this.m_ShowArea = transform2.gameObject;
  573. }
  574. private Transform FindChildDeep(Component self, string name, bool includeInactive = false)
  575. {
  576. Transform[] componentsInChildren = self.GetComponentsInChildren<Transform>(includeInactive);
  577. for (int i = 0; i < componentsInChildren.Length; i++)
  578. {
  579. if (componentsInChildren[i].name == name)
  580. {
  581. return componentsInChildren[i];
  582. }
  583. }
  584. return null;
  585. }
  586. private GameObject m_ShowArea;
  587. private GameObject m_TempItem;
  588. private List<GameObject> m_ItemList = new List<GameObject>();
  589. }
  590. private class uGUIItemListButton : MonoBehaviour
  591. {
  592. public int number = -1;
  593. }
  594. }