Пример #1
0
        public override void FromXml(XmlElement xml)
        {
            XmlRead.Attr(xml, "id", ref id);
            XmlRead.Attr(xml, "default_name", ref default_name);
            XmlRead.Attr(xml, "description", ref description);
            XmlRead.Attr(xml, "resource_id", ref resource_id);
            XmlRead.Attr(xml, "scale", ref scale);
            XmlRead.Attr(xml, "walk_speed_x", ref walk_speed_x);
            XmlRead.Attr(xml, "walk_speed_y", ref walk_speed_y);
            XmlRead.Attr(xml, "low_fire_angle", ref low_fire_angle);
            XmlRead.Attr(xml, "high_fire_angle", ref high_fire_angle);
            XmlRead.Attr(xml, "fire_range", ref fire_range);
            int weapon_pos_x = 0;

            XmlRead.Attr(xml, "weapon_pos_x", ref weapon_pos_x);
            int weapon_pos_y = 0;

            XmlRead.Attr(xml, "weapon_pos_y", ref weapon_pos_y);
            WeaponPosition = new Vector2(weapon_pos_x, weapon_pos_y);

            XmlRead.Attr(xml, "be_attack_box_min_x", ref be_attack_box_min_x);
            XmlRead.Attr(xml, "be_attack_box_min_y", ref be_attack_box_min_y);
            XmlRead.Attr(xml, "be_attack_box_max_x", ref be_attack_box_max_x);
            XmlRead.Attr(xml, "be_attack_box_max_y", ref be_attack_box_max_y);
            XmlRead.Attr(xml, "self_skill", ref self_skill);
            XmlRead.Attr(xml, "m_iHP", ref m_iHP);
            XmlRead.Attr(xml, "m_iMoveEnergy", ref m_iMoveEnergy);
            XmlRead.Attr(xml, "m_iAddEnergy", ref m_iAddEnergy);

            XmlNodeList xmlList = xml.GetElementsByTagName("state");

            foreach (XmlNode node in xmlList)
            {
                XmlElement         ele   = node as XmlElement;
                CharacterStateData pData = DataBase.CreateInstance <CharacterStateData>();
                pData.FromXml(ele);
                CharacterStateType eType = CharacterStateType.UNDEFINE;
                XmlRead.AttrEnum <CharacterStateType>(ele, "state_type", ref eType);
                if (Actions.ContainsKey(eType))
                {
                    LOG.Error("repeat state[" + eType.ToString() + "] in same instruction[" + id + "]");
                }
                else
                {
                    Actions[eType] = pData;
                }
            }
        }
Пример #2
0
        public override void FromXml(XmlElement xml)
        {
            XmlRead.Attr(xml, "animation_name", ref animation_name);
            XmlRead.Attr(xml, "total_frame", ref total_frame);

            XmlNodeList xmlList = xml.GetElementsByTagName("attack");
            int         frame   = -1;

            foreach (XmlNode node in xmlList)
            {
                XmlElement          ele   = node as XmlElement;
                CharacterAttackType eType = CharacterAttackType.NONE;

                XmlRead.AttrEnum <CharacterAttackType>(ele, "attack_type", ref eType);
                XmlRead.Attr(ele, "frame_index", ref frame);

                AttackBaseData pData = AttackBaseData.CreateInstance(eType);
                pData.FromXml(ele);
                AttackData[frame]      = pData;
                Network.attackbasedata = pData;
            }
        }