DailyCtrl.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. using System;
  2. using System.Collections.Generic;
  3. using com.workman.cm3d2.button;
  4. using PlayerStatus;
  5. using Schedule;
  6. using UnityEngine;
  7. using wf;
  8. public class DailyCtrl : MonoBehaviour
  9. {
  10. public void Init(DailyMgr mgr, GameObject goPanel)
  11. {
  12. this.m_mgr = mgr;
  13. this.m_goPanel = goPanel;
  14. }
  15. public void DisplayViewer(DailyMgr.Daily daily)
  16. {
  17. if (!this.m_bInit)
  18. {
  19. this.m_bInit = true;
  20. foreach (DailyCtrl.ButtonData buttonData in this.menuButtons)
  21. {
  22. EventDelegate.Add(buttonData.button.onClick, new EventDelegate.Callback(this.m_mgr.OnClickMenuButton));
  23. }
  24. }
  25. foreach (DailyCtrl.ButtonData buttonData2 in this.menuButtons)
  26. {
  27. buttonData2.active = true;
  28. }
  29. DailyCtrl.ButtonType[] array3;
  30. if (daily == DailyMgr.Daily.Daytime)
  31. {
  32. if (DailyMgr.IsLegacy)
  33. {
  34. array3 = new DailyCtrl.ButtonType[]
  35. {
  36. DailyCtrl.ButtonType.Dance,
  37. DailyCtrl.ButtonType.FacilityManagement,
  38. DailyCtrl.ButtonType.Casino,
  39. DailyCtrl.ButtonType.Trophy,
  40. DailyCtrl.ButtonType.PhotoMode,
  41. DailyCtrl.ButtonType.DeskCustomize,
  42. DailyCtrl.ButtonType.MyRoomCustom,
  43. DailyCtrl.ButtonType.Casino,
  44. DailyCtrl.ButtonType.Shop,
  45. DailyCtrl.ButtonType.FacilityManagement,
  46. DailyCtrl.ButtonType.LegacyMode,
  47. DailyCtrl.ButtonType.Karaoke,
  48. DailyCtrl.ButtonType.EventScenario,
  49. DailyCtrl.ButtonType.ManEdit,
  50. DailyCtrl.ButtonType.Credit
  51. };
  52. }
  53. else
  54. {
  55. array3 = new DailyCtrl.ButtonType[]
  56. {
  57. DailyCtrl.ButtonType.Dance,
  58. DailyCtrl.ButtonType.Casino,
  59. DailyCtrl.ButtonType.CompetitiveShow
  60. };
  61. }
  62. }
  63. else if (DailyMgr.IsLegacy)
  64. {
  65. array3 = new DailyCtrl.ButtonType[]
  66. {
  67. DailyCtrl.ButtonType.Schedule,
  68. DailyCtrl.ButtonType.CompetitiveShow,
  69. DailyCtrl.ButtonType.Trophy,
  70. DailyCtrl.ButtonType.PhotoMode,
  71. DailyCtrl.ButtonType.DeskCustomize,
  72. DailyCtrl.ButtonType.MyRoomCustom,
  73. DailyCtrl.ButtonType.Casino,
  74. DailyCtrl.ButtonType.Shop,
  75. DailyCtrl.ButtonType.FacilityManagement,
  76. DailyCtrl.ButtonType.LegacyMode,
  77. DailyCtrl.ButtonType.Karaoke,
  78. DailyCtrl.ButtonType.EventScenario,
  79. DailyCtrl.ButtonType.ManEdit,
  80. DailyCtrl.ButtonType.Credit,
  81. DailyCtrl.ButtonType.Dance
  82. };
  83. }
  84. else
  85. {
  86. array3 = new DailyCtrl.ButtonType[]
  87. {
  88. DailyCtrl.ButtonType.Schedule,
  89. DailyCtrl.ButtonType.CompetitiveShow,
  90. DailyCtrl.ButtonType.LegacyMode
  91. };
  92. }
  93. foreach (DailyCtrl.ButtonType type in array3)
  94. {
  95. this.GetMenuButton(type).active = false;
  96. }
  97. Status status = GameMain.Instance.CharacterMgr.status;
  98. if (!status.isAvailableDance)
  99. {
  100. this.GetMenuButton(DailyCtrl.ButtonType.Dance).active = false;
  101. }
  102. if (!status.isAvailableCompetitiveShow)
  103. {
  104. this.GetMenuButton(DailyCtrl.ButtonType.CompetitiveShow).active = false;
  105. }
  106. if (!status.isAvailableShop)
  107. {
  108. this.GetMenuButton(DailyCtrl.ButtonType.Shop).active = false;
  109. }
  110. if (!KaraokeDataManager.IsExistKaraokeData(false))
  111. {
  112. this.GetMenuButton(DailyCtrl.ButtonType.Karaoke).active = false;
  113. }
  114. this.m_goPanel.SetActive(true);
  115. this.SetAllButtonEnable(true);
  116. if (!CasinoDataMgr.Instance.GetCasinoFacility(true) && !CasinoDataMgr.Instance.GetCasinoFacility(false))
  117. {
  118. this.GetMenuButton(DailyCtrl.ButtonType.Casino).button.isEnabled = false;
  119. }
  120. if (!DailyMgr.IsLegacy && daily == DailyMgr.Daily.Daytime)
  121. {
  122. UIButton button = this.GetMenuButton(DailyCtrl.ButtonType.LegacyMode).button;
  123. if (GameUty.IsEnabledCompatibilityMode && PluginData.IsEnabled("Legacy"))
  124. {
  125. EventDelegate.Add(button.onClick, new EventDelegate.Callback(this.BackUpScheduleSlot));
  126. this.GetMenuButton(DailyCtrl.ButtonType.LegacyMode).button.isEnabled = this.IsEnabledLegacyMode();
  127. }
  128. else
  129. {
  130. this.GetMenuButton(DailyCtrl.ButtonType.LegacyMode).active = false;
  131. }
  132. }
  133. foreach (UITable table in this.m_goPanel.GetComponentsInChildren<UITable>())
  134. {
  135. Utility.ResetNGUI(table);
  136. }
  137. foreach (UIGrid grid in this.m_goPanel.GetComponentsInChildren<UIGrid>())
  138. {
  139. Utility.ResetNGUI(grid);
  140. }
  141. StatusViewer component = UTY.GetChildObject(this.m_goPanel, "StatusViewer", false).GetComponent<StatusViewer>();
  142. component.isEnabledClubNameChangeButton = true;
  143. component.isEnabledMainBusinessChangeButton = false;
  144. }
  145. public DailyCtrl.ButtonData GetMenuButton(DailyCtrl.ButtonType type)
  146. {
  147. foreach (DailyCtrl.ButtonData buttonData in this.menuButtons)
  148. {
  149. if (buttonData.type == type)
  150. {
  151. return buttonData;
  152. }
  153. }
  154. return new DailyCtrl.ButtonData
  155. {
  156. button = null,
  157. type = type
  158. };
  159. }
  160. public DailyCtrl.ButtonData GetMenuButton(UIButton button)
  161. {
  162. foreach (DailyCtrl.ButtonData buttonData in this.menuButtons)
  163. {
  164. if (buttonData.button == button)
  165. {
  166. return buttonData;
  167. }
  168. }
  169. return new DailyCtrl.ButtonData
  170. {
  171. button = null,
  172. type = DailyCtrl.ButtonType.Next
  173. };
  174. }
  175. private bool IsEnabledCompetitiveShow()
  176. {
  177. return this.m_mgr.GetCurrentDaily() == DailyMgr.Daily.Daytime && GameMain.Instance.CharacterMgr.status.isAvailableCompetitiveShow;
  178. }
  179. private bool IsEnabledShop()
  180. {
  181. return GameMain.Instance.CharacterMgr.status.isAvailableShop;
  182. }
  183. private bool IsEnabledDance()
  184. {
  185. return this.m_mgr.GetCurrentDaily() == DailyMgr.Daily.Night && GameMain.Instance.CharacterMgr.status.isAvailableDance;
  186. }
  187. private bool IsEnabledVRCom()
  188. {
  189. return this.m_mgr.GetCurrentDaily() == DailyMgr.Daily.Daytime && false;
  190. }
  191. private bool IsEnabledLegacyMode()
  192. {
  193. List<Maid> stockMaidList = GameMain.Instance.CharacterMgr.GetStockMaidList();
  194. bool result = false;
  195. foreach (Maid maid in stockMaidList)
  196. {
  197. if (maid != null && maid.status.isCompatiblePersonality)
  198. {
  199. result = true;
  200. }
  201. }
  202. return result;
  203. }
  204. public void SetAllButtonEnable(bool enable)
  205. {
  206. foreach (DailyCtrl.ButtonData buttonData in this.menuButtons)
  207. {
  208. if (buttonData.button.gameObject.activeSelf)
  209. {
  210. buttonData.button.isEnabled = enable;
  211. }
  212. }
  213. }
  214. public void BackUpScheduleSlot()
  215. {
  216. ScheduleAPI.BackUpScheduleSlot();
  217. }
  218. [SerializeField]
  219. private DailyCtrl.ButtonData[] menuButtons;
  220. private DailyMgr m_mgr;
  221. private Dictionary<DailyCtrl.ButtonType, GameObject> m_dicRank;
  222. private GameObject m_goPanel;
  223. private ButtonEnable m_btnEnable;
  224. private bool m_bInit;
  225. public enum ButtonType
  226. {
  227. Dance,
  228. Schedule,
  229. MaidManagement,
  230. EventScenario,
  231. Shop,
  232. FacilityManagement,
  233. CompetitiveShow,
  234. Casino,
  235. Save,
  236. Load,
  237. Trophy,
  238. FreeMode,
  239. PhotoMode,
  240. DeskCustomize,
  241. ManEdit,
  242. LegacyMode,
  243. Karaoke,
  244. Credit,
  245. Next,
  246. MyRoomCustom
  247. }
  248. [Serializable]
  249. public class ButtonData
  250. {
  251. public bool active
  252. {
  253. get
  254. {
  255. return this.button.gameObject.activeSelf;
  256. }
  257. set
  258. {
  259. this.button.gameObject.SetActive(value);
  260. }
  261. }
  262. [SerializeField]
  263. public DailyCtrl.ButtonType type;
  264. [SerializeField]
  265. public UIButton button;
  266. }
  267. }