uGUIKaraokeSelect.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  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.isNewBodyBlock || !GameMain.Instance.CharacterMgr.GetMaid(0).IsCrcBody)
  366. {
  367. if (foodData.ID != KaraokeDataManager.FoodData.ID_BUTTON_MAID_ADDITIONAL || KaraokeDataManager.IsEnablePersonalKaraoke003(GameMain.Instance.CharacterMgr.GetMaid(0)))
  368. {
  369. if (foodData.ID != KaraokeDataManager.FoodData.ID_BUTTON_MAID_ || KaraokeDataManager.IsEnablePersonalKaraoke004(GameMain.Instance.CharacterMgr.GetMaid(0)))
  370. {
  371. list.Add(foodData);
  372. }
  373. }
  374. }
  375. }
  376. return list.ToArray();
  377. }
  378. private KaraokeDataManager.BackgroundData[] GetBackgroundDataArray()
  379. {
  380. return this.m_Manager.GetBackgroundDataArray(true);
  381. }
  382. private KaraokeDataManager.MusicData GetMusicData(int musicID)
  383. {
  384. return this.m_Manager.GetMusicData(musicID);
  385. }
  386. private KaraokeDataManager.FoodData GetFoodData(int foodID)
  387. {
  388. return this.GetFoodDataArray()[foodID];
  389. }
  390. private KaraokeDataManager.BackgroundData GetBackgroundData(int backgroundID)
  391. {
  392. return this.GetBackgroundDataArray()[backgroundID];
  393. }
  394. private int GetNowBackgroundDataIndex()
  395. {
  396. return this.m_Manager.GetNowBGIndex();
  397. }
  398. private int GetNowSelectingBackgroundDataIndex()
  399. {
  400. return this.m_Manager.GetNowSelectingBGIndex();
  401. }
  402. public void StartKaraoke()
  403. {
  404. this.m_Manager.StartKaraoke(this.m_SelectingMusicDataID);
  405. }
  406. public void EndKaraoke()
  407. {
  408. this.m_Manager.ButtonExit();
  409. }
  410. private void StartFood(int index)
  411. {
  412. this.m_Manager.SetFoodData(this.GetFoodDataArray()[index].ID);
  413. }
  414. private void SetBG(int index)
  415. {
  416. this.m_Manager.SetBGIndex(index);
  417. }
  418. [SerializeField]
  419. private KaraokeDataManager m_Manager;
  420. [SerializeField]
  421. private Button m_ButtonOK;
  422. [SerializeField]
  423. private Button m_ButtonCANCEL;
  424. [SerializeField]
  425. private Button m_ButtonStart;
  426. [SerializeField]
  427. private Button m_ButtonEnd;
  428. [SerializeField]
  429. private Toggle m_ButtonSelectMusic;
  430. [SerializeField]
  431. private Toggle m_ButtonSelectBG;
  432. [SerializeField]
  433. private Toggle m_ButtonSelectFood;
  434. [SerializeField]
  435. private RectTransform m_ParentUIListViewer;
  436. [SerializeField]
  437. private RectTransform m_UIListViewerObject;
  438. private uGUIKaraokeSelect.uGUIItemListViewer m_UIListViewer;
  439. [Space(16f)]
  440. [SerializeField]
  441. private RectTransform m_ImageLines;
  442. private GameObject m_BeforeSelectedGameObject;
  443. private int m_SelectingMusicDataID;
  444. private int m_SelectingFoodDataIndex;
  445. private const string ThumbnailPath = "SceneVRCommunication/Tablet/Karaoke/Sprite/";
  446. private class uGUIItemListViewer : MonoBehaviour
  447. {
  448. public GameObject showArea
  449. {
  450. get
  451. {
  452. return this.m_ShowArea;
  453. }
  454. set
  455. {
  456. this.m_ShowArea = value;
  457. }
  458. }
  459. public GameObject tempItem
  460. {
  461. get
  462. {
  463. return this.m_TempItem;
  464. }
  465. set
  466. {
  467. this.m_TempItem = value;
  468. }
  469. }
  470. public List<GameObject> itemList
  471. {
  472. get
  473. {
  474. return this.m_ItemList;
  475. }
  476. }
  477. public void Show(GameObject showArea, int itemCount, GameObject tempItem = null, Action<int, GameObject> eventItemSetting = null)
  478. {
  479. if (showArea)
  480. {
  481. this.m_ShowArea = showArea;
  482. }
  483. else if (!this.m_ShowArea)
  484. {
  485. this.FindShowArea();
  486. }
  487. if (!this.m_ShowArea)
  488. {
  489. return;
  490. }
  491. if (tempItem)
  492. {
  493. this.m_TempItem = tempItem;
  494. }
  495. else if (!this.m_TempItem)
  496. {
  497. this.FindItemTemplate();
  498. }
  499. if (!this.m_ShowArea || !this.m_TempItem)
  500. {
  501. return;
  502. }
  503. if (!this.m_ShowArea.activeSelf)
  504. {
  505. this.m_ShowArea.SetActive(true);
  506. }
  507. if (this.m_TempItem.activeSelf)
  508. {
  509. this.m_TempItem.SetActive(false);
  510. }
  511. this.Clear();
  512. Transform transform = this.m_ShowArea.transform;
  513. for (int i = 0; i < itemCount; i++)
  514. {
  515. GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_TempItem);
  516. gameObject.SetActive(true);
  517. gameObject.transform.SetParent(transform, false);
  518. if (eventItemSetting != null)
  519. {
  520. eventItemSetting(i, gameObject);
  521. }
  522. this.m_ItemList.Add(gameObject);
  523. }
  524. }
  525. public void Show(int itemCount, Action<int, GameObject> eventItemSetting = null)
  526. {
  527. this.Show(this.m_ShowArea, itemCount, this.m_TempItem, eventItemSetting);
  528. }
  529. public void Clear()
  530. {
  531. if (!this.m_ShowArea)
  532. {
  533. return;
  534. }
  535. if (this.m_ItemList == null)
  536. {
  537. return;
  538. }
  539. for (int i = 0; i < this.m_ItemList.Count; i++)
  540. {
  541. UnityEngine.Object.Destroy(this.m_ItemList[i]);
  542. }
  543. }
  544. private void FindItemTemplate()
  545. {
  546. if (!this.m_ShowArea)
  547. {
  548. return;
  549. }
  550. if (this.m_ShowArea.transform.childCount <= 0)
  551. {
  552. return;
  553. }
  554. Transform transform = this.FindChildDeep(this.m_ShowArea.transform, "Temp Item", true);
  555. if (!transform)
  556. {
  557. transform = this.m_ShowArea.transform.GetChild(0);
  558. }
  559. this.m_TempItem = transform.gameObject;
  560. }
  561. private void FindShowArea()
  562. {
  563. Transform transform = base.transform.parent;
  564. if (!transform)
  565. {
  566. transform = base.transform;
  567. }
  568. string text = "Content";
  569. Transform transform2 = this.FindChildDeep(transform, text, true);
  570. if (!transform2)
  571. {
  572. Debug.LogError(string.Format("[Karaoke.uGUIItemListViewer]項目を並べるエリアが見つかりませんでした\n検索名:{0}", text));
  573. return;
  574. }
  575. this.m_ShowArea = transform2.gameObject;
  576. }
  577. private Transform FindChildDeep(Component self, string name, bool includeInactive = false)
  578. {
  579. Transform[] componentsInChildren = self.GetComponentsInChildren<Transform>(includeInactive);
  580. for (int i = 0; i < componentsInChildren.Length; i++)
  581. {
  582. if (componentsInChildren[i].name == name)
  583. {
  584. return componentsInChildren[i];
  585. }
  586. }
  587. return null;
  588. }
  589. private GameObject m_ShowArea;
  590. private GameObject m_TempItem;
  591. private List<GameObject> m_ItemList = new List<GameObject>();
  592. }
  593. private class uGUIItemListButton : MonoBehaviour
  594. {
  595. public int number = -1;
  596. }
  597. }