uGUIKaraokeSelect.cs 18 KB

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