Пример #1
0
 /// <summary>
 /// 装备的实例
 /// </summary>
 /// <param name="faceFile">装备图像地址</param>
 /// <param name="p">装备位置</param>
 /// <param name="name">装备名称</param>
 /// <param name="description">装备的描述</param>
 /// <param name="data">装备提升的属性参数</param>
 protected Equip(string faceFile, Coord p, string name, string description, AbilityArgs data)
     : base(faceFile, p, TouchMethod.StationTouch, true, name, GameIni.UnitSize)
 {
     this.Name = name;
     this.Description = description;
     this.GetAbility = data;
     this.LevelDemand = data.Level;
 }
Пример #2
0
 /// <summary>
 /// 武器的实例
 /// </summary>
 /// <param name="faceFile">武器图像地址</param>
 /// <param name="pos">武器位置</param>
 /// <param name="name">武器名称</param>
 /// <param name="description">武器的描述</param>
 /// <param name="data">武器提升的属性参数</param>
 /// <param name="skillFaceFiles">技能效果图,如果为空,则获得武器后不更新技能效果</param>
 private Weapon(string faceFile, Coord pos, string name, string description, AbilityArgs data, string[] skillFaceFiles = null)
     : base(faceFile, pos, name, description, data)
 {
     if (skillFaceFiles == null || skillFaceFiles.Length != 3)
     {
         CommonAttackFaceFile = string.Empty;
         GoodAttackFaceFile = string.Empty;
         BestAttackFaceFile = string.Empty;
     }
     else
     {
         CommonAttackFaceFile = skillFaceFiles[0];
         GoodAttackFaceFile = skillFaceFiles[1];
         BestAttackFaceFile = skillFaceFiles[2];
     }
 }
Пример #3
0
        /// <summary>
        /// 根据事件参数获取属性配置
        /// </summary>
        /// <param name="eventArgs">事件参数</param>
        /// <returns>属性配置</returns>
        public static AbilityArgs CreateFrom(XElement eventArgs)
        {
            AbilityArgs data;
            try
            {
                int level = int.Parse(eventArgs.Attribute("level").Value);
                int attack = int.Parse(eventArgs.Attribute("attack").Value);
                int defence = int.Parse(eventArgs.Attribute("defence").Value);
                int agility = int.Parse(eventArgs.Attribute("agility").Value);
                int magic = int.Parse(eventArgs.Attribute("magic").Value);
                data = new AbilityArgs(level, attack, defence, agility, magic);
            }
            catch (Exception)
            {
                throw new Exception("装备能力读取错误");
            }

            return data;
        }