RoleDataManager.cs 9.2 KB

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