RoleDataManager.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using System;
  2. using UnityEngine;
  3. using FairyGUI;
  4. using ET;
  5. using System.Collections.Generic;
  6. namespace GFGGame
  7. {
  8. public class RoleDataManager
  9. {
  10. public static bool powerTimeServerLock;
  11. public static long roleId;
  12. public static string roleName;
  13. public static int rechargeTotal;
  14. public static int rechargeTotalMon;
  15. public static string slogan;
  16. public static int power
  17. {
  18. get
  19. {
  20. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Power);
  21. }
  22. }
  23. public static int gold
  24. {
  25. get
  26. {
  27. return ItemDataManager.GetItemNum(ConstItemID.GOLD); //GameGlobal.myNumericComponent.GetAsInt(NumericType.Gold);
  28. }
  29. }
  30. public static int exp
  31. {
  32. get
  33. {
  34. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Exp);
  35. }
  36. }
  37. public static int lvl
  38. {
  39. get
  40. {
  41. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
  42. }
  43. }
  44. public static int diaP
  45. {
  46. get
  47. {
  48. return ItemDataManager.GetItemNum(ConstItemID.DIAMOND_PURPLE); // GameGlobal.myNumericComponent.GetAsInt(NumericType.DiamondP);
  49. }
  50. }
  51. public static int diaR
  52. {
  53. get
  54. {
  55. return ItemDataManager.GetItemNum(ConstItemID.DIAMOND_RED); //GameGlobal.myNumericComponent.GetAsInt(NumericType.DiamondR);
  56. }
  57. }
  58. public static int Liveness
  59. {
  60. get
  61. {
  62. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Liveness);
  63. }
  64. }
  65. public static bool CheckPowerFull()
  66. {
  67. return RoleDataManager.power >= GameGlobal.myNumericComponent.GetAsInt(NumericType.PowerLimit);
  68. }
  69. public static void InitServerData()
  70. {
  71. roleName = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRoleName();
  72. }
  73. private static int oldLvValue;
  74. public static void RoleLvUp(int oldValue)
  75. {
  76. oldLvValue = oldValue;
  77. Timers.inst.Remove(CheckUpLv);
  78. Timers.inst.Remove(OpenRoleLvUpView);
  79. Timers.inst.Add(0.2f, 0, CheckUpLv);
  80. CheckUpLv(null);
  81. }
  82. private static void CheckUpLv(object param)
  83. {
  84. if (GuideDataManager.currentGuideId > 0) return;
  85. if (ViewManager.isViewOpen(typeof(FunctionOpenView).Name)) return;//等功能开启展示完成后再展示角色升级
  86. if (ViewManager.isViewOpen(typeof(StoryFightSingleScoreView).Name)) return;//战斗界面关闭前不弹升级
  87. if (ViewManager.isViewOpen(typeof(StoryFightTargetScoreView).Name)) return;//战斗界面关闭前不弹升级
  88. if (InstanceZonesDataManager.isQuicklyFighting == true) return;//速刷中不弹
  89. if (InstanceZonesDataManager.isResultFighting == true) return;//结算中经验进度结束前不弹
  90. OpenRoleLvUpView(null);
  91. }
  92. private static void OpenRoleLvUpView(object param)
  93. {
  94. ViewManager.Show<RoleLvUpView>(oldLvValue);
  95. Timers.inst.Remove(CheckUpLv);
  96. }
  97. }
  98. }