hch
2 天以前 a19acb609721b89419fe55785643a0d4f1959368
Main/Config/PartialConfigs/SkillConfig.Partial.cs
@@ -9,14 +9,24 @@
using System;
using UnityEngine;
using LitJson;
using System.Linq;
public partial class SkillConfig : ConfigBase<int, SkillConfig>
{
//增益: 3 5
// 减益: 4 6 14
   public static readonly int[] GainSkillType = new int[] { 3, 5 }; // 1-普通攻击 2-被动技能 3-专属技能
   public static readonly int[] DebuffSkillType = new int[] { 4, 6, 14 };
   public SkillType skillType;
   public SkillCastMode castMode;
   public SkillEffectType effectType;
   //技能类型:技能等级:技能
   static Dictionary<int, Dictionary<int, SkillConfig>> skillDics = new Dictionary<int, Dictionary<int, SkillConfig>>();
   protected override void OnConfigParseCompleted()
   {
      base.OnConfigParseCompleted();
@@ -24,10 +34,71 @@
      skillType = (SkillType)SkillType;
      castMode = (SkillCastMode)CastPosition;
      effectType = (SkillEffectType)EffectType;
      // #if UNITY_EDITOR
      //       if (Launch.Instance.isOpenBattleDebug)
      //       {
      //          if (castMode == SkillCastMode.None)
      //          {
      //             castMode = SkillCastMode.Target;
      //          }
      //       }
      // #endif
      Dictionary<int, SkillConfig> tempDic = null;
      if (!skillDics.TryGetValue((int)skillType, out tempDic))
      {
         tempDic = new Dictionary<int, SkillConfig>();
         skillDics.Add((int)skillType, tempDic);
      }
      tempDic[SkillLV] = this;
   }
   public bool IsGainBuff()
    {
        return Array.Exists(GainSkillType, type => type == (int)skillType);
    }
   public bool IsDebuff()
    {
        return Array.Exists(DebuffSkillType, type => type == (int)skillType);
    }
   public MotionName GetMotionName()
   {
      return Enum.Parse<MotionName>(SkillMotionName);
   }
   public static SkillConfig GetSkillConfig(int skillType, int skillLv)
   {
      Dictionary<int, SkillConfig> tempDic = null;
      if (!skillDics.TryGetValue(skillType, out tempDic))
      {
         return null;
      }
      SkillConfig config = null;
      tempDic.TryGetValue(skillLv, out config);
      return config;
   }
   public List<int> GetDamageDivide(int _hitIndex)
   {
      List<int> damageDivide = new List<int>();
      if (_hitIndex == 0 && DamageDivide.Length <= 0)
      {
         damageDivide.Add(10000);
      }
      else
      {
         if (DamageDivide.Length <= _hitIndex)
         {
            Debug.LogError("技能伤害分布配置错误 skillId: " + SkillID + " hitIndex: " + _hitIndex);
            damageDivide.Add(10000);
         }
         else
         {
            damageDivide = DamageDivide[_hitIndex].ToList();
         }
      }
      return damageDivide;
    }
}