RoleDataManager.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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 Liveness
  97. {
  98. get
  99. {
  100. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Liveness);
  101. }
  102. }
  103. /// <summary>
  104. /// 今日竞技场可挑战次数
  105. /// </summary>
  106. /// <value></value>
  107. public static int ArenaFightTimes
  108. {
  109. get
  110. {
  111. return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaFightTimes);
  112. }
  113. }
  114. /// <summary>
  115. /// 玩家竞技场最大挑战存储量
  116. /// </summary>
  117. /// <value></value>
  118. public static int ArenaMaxStorageNum
  119. {
  120. get
  121. {
  122. return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaMaxStorageNum);
  123. }
  124. }
  125. /// <summary>
  126. /// 今日竞技场可购买挑战的次数
  127. /// </summary>
  128. /// <value></value>
  129. public static int ArenaBuyFightTimes
  130. {
  131. get
  132. {
  133. return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaBuyFightTimes);
  134. }
  135. }
  136. /// <summary>
  137. /// 今日竞技场可刷新次数
  138. /// </summary>
  139. /// <value></value>
  140. public static int ArenaFreshTimes
  141. {
  142. get
  143. {
  144. return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaFreshTimes);
  145. }
  146. }
  147. /// <summary>
  148. /// 今日竞技场可获取特殊奖励的次数
  149. /// </summary>
  150. /// <value></value>
  151. public static int ArenaTimesBonusSpecial
  152. {
  153. get
  154. {
  155. return GameGlobal.myNumericComponent.GetAsInt(NumericType.ArenaTimesBonusSpecial);
  156. }
  157. }
  158. /// <summary>
  159. ///类型一今日祈福次数
  160. /// </summary>
  161. /// <value></value>
  162. public static int LeagueType1PrayTimes
  163. {
  164. get
  165. {
  166. return GameGlobal.myNumericComponent.GetAsInt(NumericType.LeagueType1PrayTimes);
  167. }
  168. }
  169. /// <summary>
  170. ///类型二今日祈福次数
  171. /// </summary>
  172. /// <value></value>
  173. public static int LeagueType2PrayTimes
  174. {
  175. get
  176. {
  177. return GameGlobal.myNumericComponent.GetAsInt(NumericType.LeagueType2PrayTimes);
  178. }
  179. }
  180. /// <summary>
  181. ///类型三今日祈福次数
  182. /// </summary>
  183. /// <value></value>
  184. public static int LeagueType3PrayTimes
  185. {
  186. get
  187. {
  188. return GameGlobal.myNumericComponent.GetAsInt(NumericType.LeagueType3PrayTimes);
  189. }
  190. }
  191. public static bool CheckPowerFull()
  192. {
  193. return RoleDataManager.power >= powerLimit;
  194. }
  195. public static void InitServerData()
  196. {
  197. roleName = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRoleName();
  198. roleId = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>().CurrentRoleId;
  199. }
  200. /// <summary>
  201. /// 检测是否开通指定类型月卡
  202. /// </summary>
  203. /// <returns></returns>
  204. public static bool CheckIsMonthCardOpenByType(int monthCardType)
  205. {
  206. if (monthCardType == MonthCardType.Gold)
  207. {
  208. return TimeHelper.ServerNow() < GameGlobal.myNumericComponent.GetAsLong(NumericType.MonthCardGoldEndTime);
  209. }
  210. else if (monthCardType == MonthCardType.BlackGold)
  211. {
  212. return TimeHelper.ServerNow() < GameGlobal.myNumericComponent.GetAsLong(NumericType.MonthCardBlackGoldEndTime);
  213. }
  214. return true;
  215. }
  216. public static OtherRoleInfoData GetOtherRoleInfoData(OtherRoleInfoProto otherRoleInfo)
  217. {
  218. OtherRoleInfoData otherRoleInfoData = new OtherRoleInfoData();
  219. otherRoleInfoData.roleId = otherRoleInfo.RoleId;
  220. otherRoleInfoData.headId = otherRoleInfo.HeadItemId;
  221. otherRoleInfoData.headBorderId = otherRoleInfo.HeadBorderItemId;
  222. otherRoleInfoData.roleName = otherRoleInfo.RoleName;
  223. otherRoleInfoData.roleLv = otherRoleInfo.RoleLvl;
  224. otherRoleInfoData.offlineTimeSec = otherRoleInfo.OfflineTimeSec;
  225. return otherRoleInfoData;
  226. }
  227. public static OtherRoleInfoData GetMineRoleInfoData()
  228. {
  229. OtherRoleInfoData otherRoleInfoData = new OtherRoleInfoData();
  230. otherRoleInfoData.roleId = roleId;
  231. otherRoleInfoData.headId = headId;
  232. otherRoleInfoData.headBorderId = headBorderId;
  233. otherRoleInfoData.roleName = roleName;
  234. otherRoleInfoData.roleLv = lvl;
  235. return otherRoleInfoData;
  236. }
  237. private static int oldLvValue;
  238. public static void RoleLvUp(int oldValue)
  239. {
  240. oldLvValue = oldValue;
  241. Timers.inst.Remove(CheckUpLv);
  242. Timers.inst.Remove(OpenRoleLvUpView);
  243. Timers.inst.Add(0.2f, 0, CheckUpLv);
  244. CheckUpLv(null);
  245. }
  246. private static void CheckUpLv(object param)
  247. {
  248. if (GuideDataManager.currentGuideId > 0) return;
  249. if (ViewManager.isViewOpen(typeof(FunctionOpenView).Name)) return;//等功能开启展示完成后再展示角色升级
  250. if (ViewManager.isViewOpen(typeof(StoryFightSingleScoreView).Name)) return;//战斗界面关闭前不弹升级
  251. if (ViewManager.isViewOpen(typeof(StoryFightTargetScoreView).Name)) return;//战斗界面关闭前不弹升级
  252. if (InstanceZonesDataManager.isQuicklyFighting == true) return;//速刷中不弹
  253. if (InstanceZonesDataManager.isResultFighting == true) return;//结算中经验进度结束前不弹
  254. OpenRoleLvUpView(null);
  255. }
  256. private static void OpenRoleLvUpView(object param)
  257. {
  258. ViewManager.Show<RoleLvUpView>(oldLvValue);
  259. Timers.inst.Remove(CheckUpLv);
  260. }
  261. }
  262. }