RoleDataManager.cs 9.1 KB

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