123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- using System.Collections.Generic;
- using UnityEngine;
- namespace GFGGame
- {
- public class SkillDataManager : SingletonBase<SkillDataManager>
- {
- public const int MINE = 0;
- public const int NPC = 1;
- public const string SKILL_ADD = "add";
- public const string SKILL_MINUS = "minus";
- public const string SKILL_BREAK = "break";
- public const string SKILL_SHIELD = "shield";
- public Dictionary<int, SkillData> skillData = new Dictionary<int, SkillData>();
- public void Clear()
- {
- skillData.Clear();
- }
- public void InitServerData(List<SkillData> skillDatas)
- {
- skillData.Clear();
- if (skillDatas != null && skillDatas.Count > 0)
- {
- foreach (SkillData skillData in skillDatas)
- {
- this.skillData.Add(skillData.id, skillData);
- }
- }
- }
- public void UpSkill(int skillId)
- {
- if (!skillData.ContainsKey(skillId))
- {
- SkillData skillData = new SkillData();
- skillData.id = skillId;
- skillData.lv = 1;
- this.skillData.Add(skillId, skillData);
- }
- skillData[skillId].lv += 1;
- }
- // public BuffData mineBuffData = new BuffData();
- // public BuffData npcBuffData = new BuffData();
- // //更新对战主动技能数据
- // public void UpdateTargetFightSkillValue(RoleSkillCfg cfg, int role, double mineScore)
- // {
- // int score = 0;
- // int targetScore = 0;
- // BuffData buffData;
- // BuffData targetBuffData;
- // if (role == MINE)
- // {
- // score = EquipDataCache.cacher.totalScore;
- // targetScore = EquipDataCache.cacher.npcTotalScore;
- // buffData = mineBuffData;
- // targetBuffData = npcBuffData;
- // }
- // else
- // {
- // score = EquipDataCache.cacher.npcTotalScore;
- // targetScore = EquipDataCache.cacher.totalScore;
- // buffData = npcBuffData;
- // targetBuffData = mineBuffData;
- // }
- // switch (cfg.buff)
- // {
- // case SKILL_ADD:
- // if (buffData.addCount >= cfg.limiteCount) return;
- // buffData.addCount++;
- // score += (int)mineScore * cfg.value / 100;
- // break;
- // case SKILL_MINUS:
- // if (buffData.minusCount >= cfg.limiteCount) return;
- // buffData.minusCount++;
- // if (targetBuffData.isShield)
- // {
- // targetBuffData.isShield = false;
- // return;
- // }
- // targetScore -= (int)mineScore * cfg.value / 100;
- // break;
- // case SKILL_BREAK:
- // if (buffData.breakCount >= cfg.limiteCount) return;
- // buffData.breakCount++;
- // break;
- // case SKILL_SHIELD:
- // if (buffData.shieldCount >= cfg.limiteCount) return;
- // buffData.shieldCount++;
- // buffData.isShield = true;
- // break;
- // }
- // }
- //获取npc释放技能顺序
- public Dictionary<int, RoleSkillCfg> GetNpcSkill()
- {
- Dictionary<int, RoleSkillCfg> npcSkillDic = new Dictionary<int, RoleSkillCfg>();
- RoleSkillCfg[] roleSkillCfgs = RoleSkillCfgArray.Instance.dataArray;
- List<int> arr = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7 };
- for (int i = 0; i < roleSkillCfgs.Length; i++)
- {
- int partIndex = Random.Range(0, arr.Count);
- npcSkillDic.Add(arr[partIndex], roleSkillCfgs[i]);
- arr.RemoveAt(partIndex);
- }
- return npcSkillDic;
- }
- }
- }
|