RoleDataManager.cs 8.2 KB

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