RoleDataManager.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 int power
  16. {
  17. get
  18. {
  19. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Power);
  20. }
  21. }
  22. public static int gold
  23. {
  24. get
  25. {
  26. return ItemDataManager.GetItemNum(ConstItemID.GOLD); //GameGlobal.myNumericComponent.GetAsInt(NumericType.Gold);
  27. }
  28. }
  29. public static int exp
  30. {
  31. get
  32. {
  33. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Exp);
  34. }
  35. }
  36. public static int lvl
  37. {
  38. get
  39. {
  40. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
  41. }
  42. }
  43. public static int diaP
  44. {
  45. get
  46. {
  47. return ItemDataManager.GetItemNum(ConstItemID.DIAMOND_PURPLE); // GameGlobal.myNumericComponent.GetAsInt(NumericType.DiamondP);
  48. }
  49. }
  50. public static int diaR
  51. {
  52. get
  53. {
  54. return ItemDataManager.GetItemNum(ConstItemID.DIAMOND_RED); //GameGlobal.myNumericComponent.GetAsInt(NumericType.DiamondR);
  55. }
  56. }
  57. public static int Liveness
  58. {
  59. get
  60. {
  61. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Liveness);
  62. }
  63. }
  64. public static bool CheckPowerFull()
  65. {
  66. return RoleDataManager.power >= GameGlobal.myNumericComponent.GetAsInt(NumericType.PowerLimit);
  67. }
  68. public static void InitServerData()
  69. {
  70. roleName = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRoleName();
  71. }
  72. private static int oldLvValue;
  73. public static void RoleLvUp(int oldValue)
  74. {
  75. oldLvValue = oldValue;
  76. Timers.inst.Remove(CheckUpLv);
  77. Timers.inst.Remove(OpenRoleLvUpView);
  78. Timers.inst.Add(1, 0, CheckUpLv);
  79. }
  80. private static void CheckUpLv(object param)
  81. {
  82. if (GuideDataManager.currentGuideId > 0) return;
  83. if (ViewManager.isViewOpen(typeof(FunctionOpenView).Name)) return;//等功能开启展示完成后再展示角色升级
  84. if (GRoot.inst.GetTopWindow() == null)
  85. {
  86. OpenRoleLvUpView(null);
  87. Timers.inst.Remove(CheckUpLv);
  88. }
  89. if (ViewManager.isViewOpen(typeof(StroyFightResultView).Name))
  90. {
  91. Timers.inst.Add(0.2f, 1, OpenRoleLvUpView);
  92. }
  93. }
  94. private static void OpenRoleLvUpView(object param)
  95. {
  96. ViewManager.Show<RoleLvUpView>(oldLvValue);
  97. Timers.inst.Remove(CheckUpLv);
  98. }
  99. }
  100. }