Пример #1
0
 internal void SetData(RelicBase relicBase)
 {
     _relicBase = relicBase;
     _template  = RelicTemplateData.GetData(relicBase.tplId);
     if (_template == null)
     {
         return;
     }
     imgRelic.url = ResPath.GetUiImagePath(PackageName.RELIC, _template.szImg);
 }
Пример #2
0
    public static RelicTemplate GetData(uint nId, object className = null)
    {
        if (!Data.ContainsKey(nId))
        {
            if (className != null)
            {
                UnityEngine.Debug.LogError(string.Format("RelicTemplate is null, Id = {0} @ {1}", "nId=" + nId, className));
            }
            return(null);
        }
        RelicTemplate template = Data[nId];

        return(template);
    }
Пример #3
0
    public override void OnCharBoutEnd(object obj)
    {
        FighterData charData = obj as FighterData;

        if (0 == charData.armor)
        {
            //获得护甲
            BattleModel   battleModel = BattleModel.Inst;
            RelicTemplate relicTplt   = RelicTemplateData.GetData(this.tplId);
            if (relicTplt != null)
            {
                battleModel.AddArmor(battleModel.selfData, relicTplt.nVal);
            }
        }

        return;
    }
Пример #4
0
    public static void Init(XmlNode xml)
    {
        foreach (XmlElement element in xml.ChildNodes)
        {
            RelicTemplate template = new RelicTemplate();
            template.nId = element["nId"] != null?uint.Parse(element["nId"].InnerText) : 0;             //法宝ID enum RelicId

            template.nType = element["nType"] != null?uint.Parse(element["nType"].InnerText) : 0;       //法宝类型 enum RelicType

            template.nVal = element["nVal"] != null?int.Parse(element["nVal"].InnerText) : 0;           //效果值

            template.nVal2 = element["nVal2"] != null?int.Parse(element["nVal2"].InnerText) : 0;        //效果值2

            template.szName = element["szName"] != null ? element["szName"].InnerText : "";             //名字
            template.szDesc = element["szDesc"] != null ? element["szDesc"].InnerText : "";             //描述
            template.szImg  = element["szImg"] != null ? element["szImg"].InnerText : "";               //图片名

            Data.Add(template.nId, template);
        }
    }