RoleDataManager.cs 8.4 KB

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