RoleDataManager.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. using FairyGUI;
  2. using ET;
  3. using System.Collections.Generic;
  4. namespace GFGGame
  5. {
  6. public class RoleDataManager
  7. {
  8. public static bool powerTimeServerLock;
  9. public static long roleId;
  10. public static string roleName
  11. {
  12. get
  13. {
  14. return GameGlobal.zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRoleName();
  15. }
  16. }
  17. public static int rechargeTotalMon
  18. {
  19. get
  20. {
  21. return GameGlobal.myNumericComponent.GetAsInt(NumericType.RechargeTotaMonthly);
  22. }
  23. }
  24. public static string slogan = "";
  25. public static int headId = ConstItemID.HEADID;
  26. public static int headBorderId = ConstItemID.BORDERID;
  27. private static List<long> _photoDatas = new List<long>();
  28. public static List<long> photoDatas
  29. {
  30. get
  31. {
  32. return _photoDatas;
  33. }
  34. set
  35. {
  36. _photoDatas = value;
  37. }
  38. }
  39. // 佩戴徽章列表
  40. private static List<int> _badgeDatas = new List<int>();
  41. public static List<int> badgeDatas
  42. {
  43. get
  44. {
  45. return _badgeDatas;
  46. }
  47. set
  48. {
  49. _badgeDatas = value;
  50. }
  51. }
  52. private static int _mainBgID;
  53. public static int mainBgID
  54. {
  55. get
  56. {
  57. return _mainBgID;
  58. }
  59. set
  60. {
  61. _mainBgID = value;
  62. }
  63. }
  64. public static int power
  65. {
  66. get
  67. {
  68. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Power);
  69. }
  70. }
  71. public static int powerLimit
  72. {
  73. get
  74. {
  75. return GameGlobal.myNumericComponent.GetAsInt(NumericType.PowerLimit) + GameGlobal.myNumericComponent.GetAsInt(NumericType.MonthCardPowerLimitAdd);
  76. }
  77. }
  78. public static long gold
  79. {
  80. get
  81. {
  82. return ItemDataManager.GetItemNum(ConstItemID.GOLD); //GameGlobal.myNumericComponent.GetAsInt(NumericType.Gold);
  83. }
  84. }
  85. public static int exp
  86. {
  87. get
  88. {
  89. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Exp);
  90. }
  91. }
  92. public static int lvl
  93. {
  94. get
  95. {
  96. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
  97. }
  98. }
  99. public static long diaP
  100. {
  101. get
  102. {
  103. return ItemDataManager.GetItemNum(ConstItemID.DIAMOND_PURPLE); // GameGlobal.myNumericComponent.GetAsInt(NumericType.DiamondP);
  104. }
  105. }
  106. public static long diaR
  107. {
  108. get
  109. {
  110. return ItemDataManager.GetItemNum(ConstItemID.DIAMOND_RED); //GameGlobal.myNumericComponent.GetAsInt(NumericType.DiamondR);
  111. }
  112. }
  113. public static int vipLv
  114. {
  115. get
  116. {
  117. return GameGlobal.myNumericComponent.GetAsInt(NumericType.VipLevel);
  118. }
  119. }
  120. public static int vipExp
  121. {
  122. get
  123. {
  124. return GameGlobal.myNumericComponent.GetAsInt(NumericType.VipExp);
  125. }
  126. }
  127. public static int DailyLiveness
  128. {
  129. get
  130. {
  131. return GameGlobal.myNumericComponent.GetAsInt(NumericType.DailyLiveness);
  132. }
  133. }
  134. public static int WeeklyLiveness
  135. {
  136. get
  137. {
  138. return GameGlobal.myNumericComponent.GetAsInt(NumericType.WeeklyLiveness);
  139. }
  140. }
  141. /// <summary>
  142. /// 今日竞技场可挑战次数
  143. /// </summary>
  144. /// <value></value>
  145. public static int ArenaFightTimes
  146. {
  147. get
  148. {
  149. return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaFightTimes);
  150. }
  151. }
  152. /// <summary>
  153. /// 玩家竞技场最大挑战存储量
  154. /// </summary>
  155. /// <value></value>
  156. public static int ArenaMaxStorageNum
  157. {
  158. get
  159. {
  160. return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaMaxStorageNum);
  161. }
  162. }
  163. /// <summary>
  164. /// 今日竞技场可购买挑战的次数
  165. /// </summary>
  166. /// <value></value>
  167. public static int ArenaBuyFightTimes
  168. {
  169. get
  170. {
  171. return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaBuyFightTimes);
  172. }
  173. }
  174. /// <summary>
  175. /// 今日竞技场可刷新次数
  176. /// </summary>
  177. /// <value></value>
  178. public static int ArenaFreshTimes
  179. {
  180. get
  181. {
  182. return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaFreshTimes);
  183. }
  184. }
  185. /// <summary>
  186. /// 今日竞技场可获取特殊奖励的次数
  187. /// </summary>
  188. /// <value></value>
  189. public static int ArenaTimesBonusSpecial
  190. {
  191. get
  192. {
  193. return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaTimesBonusSpecial);
  194. }
  195. }
  196. /// <summary>
  197. ///类型一今日祈福次数
  198. /// </summary>
  199. /// <value></value>
  200. public static int LeagueType1PrayTimes
  201. {
  202. get
  203. {
  204. return GameGlobal.myNumericComponent.GetAsInt(NumericType.LeagueType1PrayTimes);
  205. }
  206. }
  207. /// <summary>
  208. ///类型二今日祈福次数
  209. /// </summary>
  210. /// <value></value>
  211. public static int LeagueType2PrayTimes
  212. {
  213. get
  214. {
  215. return GameGlobal.myNumericComponent.GetAsInt(NumericType.LeagueType2PrayTimes);
  216. }
  217. }
  218. /// <summary>
  219. ///类型三今日祈福次数
  220. /// </summary>
  221. /// <value></value>
  222. public static int LeagueType3PrayTimes
  223. {
  224. get
  225. {
  226. return GameGlobal.myNumericComponent.GetAsInt(NumericType.LeagueType3PrayTimes);
  227. }
  228. }
  229. /// <summary>
  230. /// 万水千山最大存储量
  231. /// </summary>
  232. public static int WanShuiQianShanMaxStorageCount
  233. {
  234. get { return GameGlobal.myNumericComponent.GetAsInt(NumericType.WanShuiQianShanMaxStorageCount); }
  235. }
  236. public static bool CheckPowerFull()
  237. {
  238. return RoleDataManager.power >= powerLimit;
  239. }
  240. public static void InitServerData()
  241. {
  242. roleId = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>().CurrentRoleId;
  243. }
  244. /// <summary>
  245. /// 检测是否开通指定类型月卡
  246. /// </summary>
  247. /// <returns></returns>
  248. public static bool CheckIsMonthCardOpenByType(int monthCardType)
  249. {
  250. if (monthCardType == MonthCardType.Gold)
  251. {
  252. return TimeHelper.ServerNow() < GameGlobal.myNumericComponent.GetAsLong(NumericType.MonthCardGoldEndTime);
  253. }
  254. else if (monthCardType == MonthCardType.BlackGold)
  255. {
  256. return TimeHelper.ServerNow() < GameGlobal.myNumericComponent.GetAsLong(NumericType.MonthCardBlackGoldEndTime);
  257. }
  258. return true;
  259. }
  260. public static OtherRoleInfoData GetOtherRoleInfoData(OtherRoleInfoProto otherRoleInfo)
  261. {
  262. OtherRoleInfoData otherRoleInfoData = new OtherRoleInfoData();
  263. otherRoleInfoData.roleId = otherRoleInfo.RoleId;
  264. otherRoleInfoData.headId = otherRoleInfo.HeadItemId;
  265. otherRoleInfoData.headBorderId = otherRoleInfo.HeadBorderItemId;
  266. otherRoleInfoData.roleName = otherRoleInfo.RoleName;
  267. otherRoleInfoData.roleLv = otherRoleInfo.RoleLvl;
  268. otherRoleInfoData.offlineTimeSec = otherRoleInfo.OfflineTimeSec;
  269. return otherRoleInfoData;
  270. }
  271. public static OtherRoleInfoData GetMineRoleInfoData()
  272. {
  273. OtherRoleInfoData otherRoleInfoData = new OtherRoleInfoData();
  274. otherRoleInfoData.roleId = roleId;
  275. otherRoleInfoData.headId = headId;
  276. otherRoleInfoData.headBorderId = headBorderId;
  277. otherRoleInfoData.roleName = roleName;
  278. otherRoleInfoData.roleLv = lvl;
  279. return otherRoleInfoData;
  280. }
  281. private static int oldLvValue;
  282. public static void RoleLvUp(int oldValue)
  283. {
  284. oldLvValue = oldValue;
  285. Timers.inst.Remove(CheckUpLv);
  286. Timers.inst.Remove(OpenRoleLvUpView);
  287. Timers.inst.Add(0.2f, 0, CheckUpLv);
  288. CheckUpLv(null);
  289. }
  290. private static void CheckUpLv(object param)
  291. {
  292. if (GuideDataManager.currentGuideId > 0) return;//在新手引导中不弹
  293. if (ViewManager.isViewOpen(typeof(FunctionOpenView).Name)) return;//等功能开启展示完成后再展示角色升级
  294. if (ViewManager.isViewOpen(typeof(StoryFightSingleScoreView).Name)) return;//战斗界面关闭前不弹升级
  295. if (InstanceZonesDataManager.isQuicklyFighting == true) return;//速刷中不弹
  296. if (InstanceZonesDataManager.isResultFighting == true) return;//结算中经验进度结束前不弹
  297. OpenRoleLvUpView(null);
  298. }
  299. private static void OpenRoleLvUpView(object param)
  300. {
  301. ViewManager.Show<RoleLvUpView>(oldLvValue);
  302. Timers.inst.Remove(CheckUpLv);
  303. }
  304. public static bool HaveBadge(int id)
  305. {
  306. return ItemDataManager.GetItemNum(id) > 0;
  307. }
  308. }
  309. }