Exemplo n.º 1
0
 public void Init(ActorBase actor, int skillID)
 {
     skillConf      = DBSkillTable.GetRecord(skillID);
     this.actor     = actor;
     curAttackIndex = 0;
     curAttackConf  = skillConf.attackList[curAttackIndex];       //actor需要判断当前攻击是否释放时间
     isActive       = true;
 }
Exemplo n.º 2
0
    //获取记录,如果不存在返回null
    public static DBSkillConf GetRecord(int skillID, bool errorMsg = true)
    {
        if (attackDict == null)
        {
            Debug.LogError("DBAttackTableWrap is not init");
            return(null);
        }
        DBSkillConf record = null;

        if (attackDict.TryGetValue(skillID, out record))
        {
            return(record);
        }
        if (errorMsg)
        {
            Debug.LogError("Skill is not in DBAttackTableWrap: " + skillID);
        }
        return(null);
    }
Exemplo n.º 3
0
    public static void Init()
    {
        if (DBSkillAttackTable.instance == null)
        {
            Debug.LogError("DBAttackTable has not initalized");
            return;
        }
        if (attackDict != null)
        {
            Debug.LogError("DBAttackTableWrap has been initalized");
            return;
        }

        attackDict = new Dictionary <int, DBSkillConf>();
        DBSkillAttackConf[] recordArray = DBSkillAttackTable.instance.recordArray;
        DBSkillConf         skill;

        for (int i = 0; i < recordArray.Length; i++)
        {
            DBSkillAttackConf conf = recordArray[i];
            if (!attackDict.TryGetValue(conf.skillID, out skill))
            {
                skill         = new DBSkillConf();
                skill.skillID = conf.skillID;
                attackDict.Add(conf.skillID, skill);
            }
            skill.attackList.Add(conf);
        }

        /*log
         * foreach(DBAttackGroup g  in attackDict.Values)
         * {
         *      Debug.Log("Group " + g.attackID);
         *      for(int i = 0; i < g.childAttackList.Count; i++)
         *      {
         *              Debug.Log("   " + i + " " + g.childAttackList[i].ID);
         *      }
         * }
         * */
    }
Exemplo n.º 4
0
    public void Show(DBSkillInfoConf skillInfoConf)
    {
        nameLabel.text          = skillInfoConf.skillNameText;
        cdLabel.text            = skillInfoConf.cd + "秒";
        castTimeLabel.text      = skillInfoConf.castTime == 0 ? "瞬发" : skillInfoConf.castTime + "秒";
        castCombinKeyLabel.text = skillInfoConf.castCombianKey;
        descLabel.text          = skillInfoConf.instruction;

        DBSkillConf skillConf = DBSkillTable.GetRecord(skillInfoConf.skillID, false);

        if (skillConf == null)
        {
            //没有伤害的技能
            attributeLabel.text = "";
            return;
        }

        List <DBSkillDamageConf> damageList = new List <DBSkillDamageConf>();

        //跳过伤害为0的攻击
        for (int i = 0; i < skillConf.attackList.Count; i++)
        {
            for (int j = 0; j < skillConf.attackList[i].damages.Length; j++)
            {
                DBSkillDamageConf damageConf = DBSkillDamageTable.GetRecord(skillConf.attackList[i].damages[j]);
                if (damageConf.damagePercent > 0)
                {
                    damageList.Add(damageConf);
                }
            }
        }

        if (damageList.Count == 0)
        {
            attributeLabel.text = "";
        }
        else if (damageList.Count == 1)
        {
            attributeLabel.text = string.Format("造成{0}%攻击力的伤害", damageList[0].damagePercent);
        }
        else
        {
            string text = "";
            for (int i = 0; i < damageList.Count; i++)
            {
                DBSkillDamageConf damageConf = damageList[i];
                string            damageText = "";
                if (damageConf.times <= 1)
                {
                    damageText = string.Format("造成{0}%攻击力的伤害", damageConf.damagePercent);
                }
                else
                {
                    damageText = string.Format("每次造成{0}%攻击力的伤害", damageConf.damagePercent);
                }

                if (string.IsNullOrEmpty(damageConf.desc))
                {
                    text += string.Format(" 第{0}段,进行{1}次攻击,{2}\n", i + 1, damageConf.times, damageText);
                }
                else
                {
                    text += string.Format(" 第{0}段,{1}, 进行{2}次攻击,{3}\n", i + 1, damageConf.desc, damageConf.times, damageText);
                }
            }
            attributeLabel.text = text;
        }
    }