RoleDataManager.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 powerTimeLock;
  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 GameGlobal.myNumericComponent.GetAsInt(NumericType.Gold);
  27. }
  28. }
  29. private static int _exp = 0;
  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 GameGlobal.myNumericComponent.GetAsInt(NumericType.DiamondP);
  49. }
  50. set
  51. {
  52. }
  53. }
  54. public static int diaR
  55. {
  56. get
  57. {
  58. return GameGlobal.myNumericComponent.GetAsInt(NumericType.DiamondR);
  59. }
  60. }
  61. private static string _lastRandomName = null;
  62. public static string RandomRoleName()
  63. {
  64. string randomName = null;
  65. while (_lastRandomName == randomName || randomName == null)
  66. {
  67. int len = GameConst.ROLE_NAME_LIST.Length;
  68. System.Random random = new System.Random();
  69. int i = random.Next(len);
  70. randomName = GameConst.ROLE_NAME_LIST[i];
  71. }
  72. _lastRandomName = randomName;
  73. return randomName;
  74. }
  75. public static bool CheckPowerFull()
  76. {
  77. return GameGlobal.myNumericComponent.GetAsInt(NumericType.Power) >= GameConst.MAX_POWER_AUTO_REGAIN;
  78. }
  79. public static void InitServerData()
  80. {
  81. //roleId = roleInfo.id;
  82. roleName = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRoleName();
  83. //rechargeTotal = roleInfo.rechargeTotal;
  84. //rechargeTotalMon = roleInfo.rechargeTotalMon;
  85. //_gold = roleInfo.gold;
  86. //_exp = roleInfo.exp;
  87. //_lvl = roleInfo.lvl;
  88. //_diaP = roleInfo.diaP;
  89. //_diaR = roleInfo.diaR;
  90. }
  91. }
  92. }