SlotBase.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. using System;
  2. using MaidStatus;
  3. using TextureBank;
  4. using UnityEngine;
  5. namespace Schedule
  6. {
  7. public class SlotBase
  8. {
  9. public Maid maid
  10. {
  11. get
  12. {
  13. if (GameMain.Instance.CharacterMgr.status.GetScheduleSlot(this.slotId) != this._maid)
  14. {
  15. this.Update();
  16. }
  17. return this._maid;
  18. }
  19. set
  20. {
  21. if (this._maid != value)
  22. {
  23. if (value == null)
  24. {
  25. GameMain.Instance.CharacterMgr.status.scheduleSlot[this.slotId].maid_guid = string.Empty;
  26. }
  27. else
  28. {
  29. GameMain.Instance.CharacterMgr.status.scheduleSlot[this.slotId].maid_guid = value.status.guid;
  30. }
  31. this._maid = value;
  32. this.Update();
  33. }
  34. }
  35. }
  36. public int slotId
  37. {
  38. get
  39. {
  40. return this._slotId;
  41. }
  42. }
  43. public int noonWorkId
  44. {
  45. get
  46. {
  47. return this.maid.status.noonWorkId;
  48. }
  49. set
  50. {
  51. this.maid.status.noonWorkId = value;
  52. }
  53. }
  54. public int nightWorkId
  55. {
  56. get
  57. {
  58. return this.maid.status.nightWorkId;
  59. }
  60. set
  61. {
  62. this.maid.status.nightWorkId = value;
  63. }
  64. }
  65. public bool noonCommuFlag
  66. {
  67. get
  68. {
  69. return this.maid.status.noonCommu;
  70. }
  71. set
  72. {
  73. this.maid.status.noonCommu = value;
  74. }
  75. }
  76. public int popular_rank
  77. {
  78. get
  79. {
  80. return this.maid.status.popularRank;
  81. }
  82. }
  83. public bool nightCommuFlag
  84. {
  85. get
  86. {
  87. return this.maid.status.nightCommu;
  88. }
  89. set
  90. {
  91. this.maid.status.nightCommu = value;
  92. }
  93. }
  94. public Texture2D popular_rank_icon
  95. {
  96. get
  97. {
  98. return this._popular_rank_icon;
  99. }
  100. }
  101. public Texture2D icon
  102. {
  103. get
  104. {
  105. return this.maid.GetThumIcon();
  106. }
  107. }
  108. public bool leader
  109. {
  110. get
  111. {
  112. return this.maid.status.leader;
  113. }
  114. }
  115. public string last_name
  116. {
  117. get
  118. {
  119. return this.maid.status.charaName.name1;
  120. }
  121. }
  122. public string first_name
  123. {
  124. get
  125. {
  126. return this.maid.status.charaName.name2;
  127. }
  128. }
  129. public Contract contract_type
  130. {
  131. get
  132. {
  133. return this.maid.status.contract;
  134. }
  135. }
  136. public string contract_type_name
  137. {
  138. get
  139. {
  140. string result = string.Empty;
  141. if (this.maid.status.heroineType == HeroineType.Sub)
  142. {
  143. result = this.maid.status.subCharaStatus.contractText;
  144. }
  145. else
  146. {
  147. result = EnumConvert.GetString(this.maid.status.contract);
  148. }
  149. return result;
  150. }
  151. }
  152. public string contract_type_name_term
  153. {
  154. get
  155. {
  156. string result = string.Empty;
  157. if (this.maid.status.heroineType == HeroineType.Sub)
  158. {
  159. result = this.maid.status.subCharaStatus.contractTextTerm;
  160. }
  161. else
  162. {
  163. result = EnumConvert.GetTerm(this.maid.status.contract);
  164. }
  165. return result;
  166. }
  167. }
  168. public string personal_name
  169. {
  170. get
  171. {
  172. if (this.maid.status.heroineType == HeroineType.Sub && this.maid.status.subCharaStatus != null)
  173. {
  174. return this.maid.status.subCharaStatus.personalText;
  175. }
  176. return this.maid.status.personal.drawName;
  177. }
  178. }
  179. public string personal_name_term
  180. {
  181. get
  182. {
  183. if (this.maid.status.heroineType == HeroineType.Sub && this.maid.status.subCharaStatus != null)
  184. {
  185. return this.maid.status.subCharaStatus.personalTextTerm;
  186. }
  187. return this.maid.status.personal.termName;
  188. }
  189. }
  190. public Texture2D noon_icon
  191. {
  192. get
  193. {
  194. if (this.noon_icon_name == null)
  195. {
  196. return null;
  197. }
  198. return this.textureBank.GetTexture(this.noon_icon_name);
  199. }
  200. }
  201. public string noon_icon_name
  202. {
  203. get
  204. {
  205. if (!ScheduleCSVData.AllData.ContainsKey(this.maid.status.noonWorkId))
  206. {
  207. return null;
  208. }
  209. return ScheduleCSVData.AllData[this.maid.status.noonWorkId].icon;
  210. }
  211. }
  212. public Texture2D night_icon
  213. {
  214. get
  215. {
  216. if (this.night_icon_name == null)
  217. {
  218. return null;
  219. }
  220. return this.textureBank.GetTexture(this.night_icon_name);
  221. }
  222. }
  223. public string night_icon_name
  224. {
  225. get
  226. {
  227. if (!ScheduleCSVData.AllData.ContainsKey(this.maid.status.nightWorkId))
  228. {
  229. return null;
  230. }
  231. return ScheduleCSVData.AllData[this.maid.status.nightWorkId].icon;
  232. }
  233. }
  234. public Maid Maid
  235. {
  236. get
  237. {
  238. return this.maid;
  239. }
  240. }
  241. public virtual void Update()
  242. {
  243. this._maid = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(this.slotId);
  244. this.UpdateRankIcon();
  245. }
  246. protected void UpdateRankIcon()
  247. {
  248. this._popular_rank_icon = null;
  249. if (this._maid != null && this.textureBank != null)
  250. {
  251. int popular_rank = this.popular_rank;
  252. if (popular_rank != 1)
  253. {
  254. if (popular_rank != 2)
  255. {
  256. if (popular_rank == 3)
  257. {
  258. this._popular_rank_icon = this.textureBank.GetTexture("cm3d2_management_crown_bronze");
  259. }
  260. }
  261. else
  262. {
  263. this._popular_rank_icon = this.textureBank.GetTexture("cm3d2_management_crown_silver");
  264. }
  265. }
  266. else
  267. {
  268. this._popular_rank_icon = this.textureBank.GetTexture("cm3d2_management_crown_gold");
  269. }
  270. }
  271. }
  272. protected Maid _maid;
  273. protected int _slotId;
  274. protected Texture2D _popular_rank_icon;
  275. public TextureBank textureBank;
  276. private const string POPULAR_RANK_ICON_1 = "cm3d2_management_crown_gold";
  277. private const string POPULAR_RANK_ICON_2 = "cm3d2_management_crown_silver";
  278. private const string POPULAR_RANK_ICON_3 = "cm3d2_management_crown_bronze";
  279. }
  280. }