Exemplo n.º 1
0
    public string GetEffect(BaseAttribute _attribute)
    {
        List <string> obj = new List <string>();

        for (int i = 0; i < effectType.Length; i++)
        {
            BuffModel _buff = null;
            if (buff.Count > 0)
            {
                //TODO  先只有一个buff
                _buff = Manage.Instance.Data.GetObj <BuffModel>(buff[0].data[1]);
            }
            switch (effectType[i])
            {
            case 1:
                int[] damage = GetDamage(_attribute);
                obj.Add(damage[0].ToString());
                obj.Add(damage[1].ToString());
                break;

            case 2:
                obj.Add(DataName.GetColor(_buff.name, _buff.name));
                break;

            case 3:
                obj.Add(DataName.GetColor(_buff.name, buff[0].data[2].ToString()));
                break;

            case 4:
                obj.Add(_buff.GetEffect(_attribute));
                break;

            case 5:
                for (int j = 0; j < startValue.Length; j++)
                {
                    obj.Add(startValue[j].ToString());
                }
                break;

            case 6:
                for (int j = 0; j < additionalAttribute.data.Count; j++)
                {
                    string str = additionalAttribute.data[j].GetValue().ToString();
                    if (additionalAttribute.data[j].ratio)
                    {
                        str += "%";
                    }
                    obj.Add(str);
                }
                for (int j = 0; j < additionalAttribute.attribute.Count; j++)
                {
                    string str = additionalAttribute.data[j].GetValue().ToString();
                    if (additionalAttribute.data[j].ratio)
                    {
                        str += "%";
                    }
                    obj.Add(str);
                }
                for (int j = 0; j < additionalAttribute.resistance.Count; j++)
                {
                    string str = additionalAttribute.data[j].GetValue().ToString();
                    if (additionalAttribute.data[j].ratio)
                    {
                        str += "%";
                    }
                    obj.Add(str);
                }
                for (int j = 0; j < additionalAttribute.skill.Count; j++)
                {
                    string str = additionalAttribute.data[j].GetValue().ToString();
                    if (additionalAttribute.data[j].ratio)
                    {
                        str += "%";
                    }
                    obj.Add(str);
                }
                break;
            }
        }
        try
        {
            string[] str = obj.ToArray();
            effect = effect.Replace("~", ",");
            return(string.Format(effect, str));
        }
        catch
        {
            string s = effect;
            return("");
        }
    }