RoleDataManager.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 roleLastLv;//上次的角色等级,用于升级界面展示用
  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 GameGlobal.myNumericComponent.GetAsInt(NumericType.Gold);
  28. }
  29. }
  30. private static int _exp = 0;
  31. public static int exp
  32. {
  33. get
  34. {
  35. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Exp);
  36. }
  37. }
  38. public static int lvl
  39. {
  40. get
  41. {
  42. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
  43. }
  44. }
  45. public static int diaP
  46. {
  47. get
  48. {
  49. return GameGlobal.myNumericComponent.GetAsInt(NumericType.DiamondP);
  50. }
  51. }
  52. public static int diaR
  53. {
  54. get
  55. {
  56. return GameGlobal.myNumericComponent.GetAsInt(NumericType.DiamondR);
  57. }
  58. }
  59. private static string _lastRandomName = null;
  60. public static string RandomRoleName()
  61. {
  62. string randomName = null;
  63. while (_lastRandomName == randomName || randomName == null)
  64. {
  65. int len = GameConst.ROLE_NAME_LIST.Length;
  66. System.Random random = new System.Random();
  67. int i = random.Next(len);
  68. randomName = GameConst.ROLE_NAME_LIST[i];
  69. }
  70. _lastRandomName = randomName;
  71. return randomName;
  72. }
  73. public static bool CheckPowerFull()
  74. {
  75. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Power) >= GameConst.MAX_POWER_AUTO_REGAIN;
  76. }
  77. public static void InitServerData()
  78. {
  79. //roleId = roleInfo.id;
  80. roleName = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRoleName();
  81. //rechargeTotal = roleInfo.rechargeTotal;
  82. //rechargeTotalMon = roleInfo.rechargeTotalMon;
  83. //_gold = roleInfo.gold;
  84. //_exp = roleInfo.exp;
  85. //_lvl = roleInfo.lvl;
  86. //_diaP = roleInfo.diaP;
  87. //_diaR = roleInfo.diaR;
  88. }
  89. public static void ShowRoleLvUpView()
  90. {
  91. Timers.inst.Remove(CheckUpLv);
  92. Timers.inst.Add(1, 0, CheckUpLv);
  93. }
  94. private static void CheckUpLv(object param)
  95. {
  96. }
  97. }
  98. }