SkillDataManager.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. namespace GFGGame
  4. {
  5. public class SkillDataManager : SingletonBase<SkillDataManager>
  6. {
  7. public const int MINE = 0;
  8. public const int NPC = 1;
  9. public const string SKILL_ADD = "add";
  10. public const string SKILL_MINUS = "minus";
  11. public const string SKILL_BREAK = "break";
  12. public const string SKILL_SHIELD = "shield";
  13. public Dictionary<int, SkillData> skillData = new Dictionary<int, SkillData>();
  14. public void Clear()
  15. {
  16. skillData.Clear();
  17. }
  18. public void InitServerData(List<SkillData> skillDatas)
  19. {
  20. skillData.Clear();
  21. if (skillDatas != null && skillDatas.Count > 0)
  22. {
  23. foreach (SkillData skillData in skillDatas)
  24. {
  25. this.skillData.Add(skillData.id, skillData);
  26. }
  27. }
  28. }
  29. public void UpSkill(int skillId)
  30. {
  31. if (!skillData.ContainsKey(skillId))
  32. {
  33. SkillData skillData = new SkillData();
  34. skillData.id = skillId;
  35. skillData.lv = 1;
  36. this.skillData.Add(skillId, skillData);
  37. }
  38. skillData[skillId].lv += 1;
  39. }
  40. // public BuffData mineBuffData = new BuffData();
  41. // public BuffData npcBuffData = new BuffData();
  42. // //更新对战主动技能数据
  43. // public void UpdateTargetFightSkillValue(RoleSkillCfg cfg, int role, double mineScore)
  44. // {
  45. // int score = 0;
  46. // int targetScore = 0;
  47. // BuffData buffData;
  48. // BuffData targetBuffData;
  49. // if (role == MINE)
  50. // {
  51. // score = EquipDataCache.cacher.totalScore;
  52. // targetScore = EquipDataCache.cacher.npcTotalScore;
  53. // buffData = mineBuffData;
  54. // targetBuffData = npcBuffData;
  55. // }
  56. // else
  57. // {
  58. // score = EquipDataCache.cacher.npcTotalScore;
  59. // targetScore = EquipDataCache.cacher.totalScore;
  60. // buffData = npcBuffData;
  61. // targetBuffData = mineBuffData;
  62. // }
  63. // switch (cfg.buff)
  64. // {
  65. // case SKILL_ADD:
  66. // if (buffData.addCount >= cfg.limiteCount) return;
  67. // buffData.addCount++;
  68. // score += (int)mineScore * cfg.value / 100;
  69. // break;
  70. // case SKILL_MINUS:
  71. // if (buffData.minusCount >= cfg.limiteCount) return;
  72. // buffData.minusCount++;
  73. // if (targetBuffData.isShield)
  74. // {
  75. // targetBuffData.isShield = false;
  76. // return;
  77. // }
  78. // targetScore -= (int)mineScore * cfg.value / 100;
  79. // break;
  80. // case SKILL_BREAK:
  81. // if (buffData.breakCount >= cfg.limiteCount) return;
  82. // buffData.breakCount++;
  83. // break;
  84. // case SKILL_SHIELD:
  85. // if (buffData.shieldCount >= cfg.limiteCount) return;
  86. // buffData.shieldCount++;
  87. // buffData.isShield = true;
  88. // break;
  89. // }
  90. // }
  91. //获取npc释放技能顺序
  92. public Dictionary<int, RoleSkillCfg> GetNpcSkill()
  93. {
  94. Dictionary<int, RoleSkillCfg> npcSkillDic = new Dictionary<int, RoleSkillCfg>();
  95. RoleSkillCfg[] roleSkillCfgs = RoleSkillCfgArray.Instance.dataArray;
  96. List<int> arr = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7 };
  97. for (int i = 0; i < roleSkillCfgs.Length; i++)
  98. {
  99. int partIndex = Random.Range(0, arr.Count);
  100. npcSkillDic.Add(arr[partIndex], roleSkillCfgs[i]);
  101. arr.RemoveAt(partIndex);
  102. }
  103. return npcSkillDic;
  104. }
  105. }
  106. }