Ejemplo n.º 1
0
        public void copyFrom(t_Card rhv)
        {
            qwThisID = rhv.qwThisID;
	        dwObjectID = rhv.dwObjectID;
            if (pos == null)
            {
                pos = new stObjectLocation();
            }
	        pos.copyFrom(rhv.pos);

            mpcost = rhv.mpcost;
            damage = rhv.damage;
            hp = rhv.hp;
            maxhp = rhv.maxhp;
            dur = rhv.dur;

            magicDamAdd = rhv.magicDamAdd;
            overload = rhv.overload;
            armor = rhv.armor;
            attackTimes = rhv.attackTimes;
            equipOpen = rhv.equipOpen;

            if(state == null || rhv.state.Length != state.Length)
            {
                state = new byte[((int)StateID.CARD_STATE_MAX + 7) / 8];
            }
            Array.Copy(rhv.state, 0, state, 0, rhv.state.Length);

            side = rhv.side;

            popHpValue = rhv.popHpValue;
            popDamValue = rhv.popDamValue;
        }
Ejemplo n.º 2
0
        public void copyFrom(t_Card rhv)
        {
            qwThisID   = rhv.qwThisID;
            dwObjectID = rhv.dwObjectID;
            if (pos == null)
            {
                pos = new stObjectLocation();
            }
            pos.copyFrom(rhv.pos);

            mpcost = rhv.mpcost;
            damage = rhv.damage;
            hp     = rhv.hp;
            maxhp  = rhv.maxhp;
            dur    = rhv.dur;

            magicDamAdd = rhv.magicDamAdd;
            overload    = rhv.overload;
            armor       = rhv.armor;
            attackTimes = rhv.attackTimes;
            equipOpen   = rhv.equipOpen;

            if (state == null || rhv.state.Length != state.Length)
            {
                state = new byte[((int)StateID.CARD_STATE_MAX + 7) / 8];
            }
            Array.Copy(rhv.state, 0, state, 0, rhv.state.Length);

            side = rhv.side;

            popHpValue  = rhv.popHpValue;
            popDamValue = rhv.popDamValue;
        }
Ejemplo n.º 3
0
        // 法术牌只有 MP 属性
        public override void updateCardDataChangeBySvr(t_Card svrCard_ = null)
        {
            base.updateCardDataChangeBySvr(svrCard_);

            if (svrCard_ == null)
            {
                svrCard_ = m_sceneCardItem.svrCard;
            }

            if (m_sceneCardItem != null)
            {
                if (m_sceneCardItem.cardArea == CardArea.CARDCELLTYPE_HAND)     // 手牌不同更新
                {
                    AuxLabel text = new AuxLabel();
                    text.setSelfGo(m_render.gameObject(), "UIRoot/AttText");       // 攻击
                    text.text = "";
                    text.setSelfGo(m_render.gameObject(), "UIRoot/MpText");         // Magic
                    text.text = svrCard_.mpcost.ToString();
                    text.setSelfGo(m_render.gameObject(), "UIRoot/HpText");       // HP
                    text.text = "";
                }
                if (m_sceneCardItem.cardArea == CardArea.CARDCELLTYPE_COMMON)        // 场牌更新
                {

                }
            }
        }
Ejemplo n.º 4
0
 public void copyFrom(SceneCardItem rhv)
 {
     if (m_svrCard == null)
     {
         m_svrCard = new t_Card();
     }
     m_svrCard.copyFrom(rhv.m_svrCard);
     m_cardTableItem = rhv.m_cardTableItem;
     m_playerSide    = rhv.m_playerSide;
     m_cardArea      = rhv.m_cardArea;
 }
Ejemplo n.º 5
0
 public void copyFrom(SceneCardItem rhv)
 {
     if (m_svrCard == null)
     {
         m_svrCard = new t_Card();
     }
     m_svrCard.copyFrom(rhv.m_svrCard);
     m_cardTableItem = rhv.m_cardTableItem;
     m_playerSide = rhv.m_playerSide;
     m_cardArea = rhv.m_cardArea;
 }
Ejemplo n.º 6
0
        public SceneCardItem createCardItemBySvrData(EnDZPlayer playerSide, t_Card mobject)
        {
            SceneCardItem sceneItem = null;
            sceneItem = new SceneCardItem();
            sceneItem.svrCard = mobject;
            sceneItem.cardArea = (CardArea)mobject.pos.dwLocation;
            sceneItem.playerSide = playerSide;
            sceneItem.m_cardTableItem = Ctx.m_instance.m_tableSys.getItem(TableID.TABLE_CARD, mobject.dwObjectID).m_itemBody as TableCardItemBody;

            return sceneItem;
        }
Ejemplo n.º 7
0
        public SceneCardItem createCardItemBySvrData(EnDZPlayer playerSide, t_Card mobject)
        {
            SceneCardItem sceneItem = null;

            sceneItem                 = new SceneCardItem();
            sceneItem.svrCard         = mobject;
            sceneItem.cardArea        = (CardArea)mobject.pos.dwLocation;
            sceneItem.playerSide      = playerSide;
            sceneItem.m_cardTableItem = Ctx.m_instance.m_tableSys.getItem(TableID.TABLE_CARD, mobject.dwObjectID).m_itemBody as TableCardItemBody;

            return(sceneItem);
        }
Ejemplo n.º 8
0
        // 回血判断是统一一个接口
        protected bool hasAddHp(t_Card src, t_Card dest)
        {
            if (src.hp <= dest.hp)           // HP 增加
            {
                if (src.maxhp == dest.maxhp) // 不是由于技能导致的将这两个值减少并且设置成同样的值,就是伤血
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 9
0
        // 计算是否是伤血
        protected bool hasDamageHp(t_Card src, t_Card dest)
        {
            if (src.hp > dest.hp)        // HP 减少
            {
                if (src.maxhp == dest.maxhp)         // 不是由于技能导致的将这两个值减少并且设置成同样的值,就是伤血
                {
                    return true;
                }
            }

            return false;
        }
Ejemplo n.º 10
0
        override public void updateCardDataChangeBySvr(t_Card svrCard_ = null)
        {
            base.updateCardDataChangeBySvr();

            if (svrCard_ == null)
            {
                svrCard_ = m_sceneCardItem.svrCard;
            }

            AuxLabel text = new AuxLabel();
            text.setSelfGo(m_render.gameObject(), "UIRoot/MpText");         // 消耗
            text.text = svrCard_.mpcost.ToString();
        }
Ejemplo n.º 11
0
        public SceneCardItem updateCardInfoByCardItem(t_Card card)
        {
            foreach (SceneCardItem item in m_sceneCardList)
            {
                if (item.svrCard.qwThisID == card.qwThisID)
                {
                    // item.m_svrCard = card;   // 不能直接赋值,因为很多都是保存的引用,这样就会有问题
                    item.svrCard.copyFrom(card);

                    return(item);
                }
            }

            return(null);
        }
Ejemplo n.º 12
0
        public override void derialize(ByteBuffer bu)
        {
            base.derialize(bu);

            maincard = new t_Card();
            maincard.derialize(bu);

            bu.readUnsignedInt8(ref opType);
            bu.readUnsignedInt16(ref count);

            int idx = 0;
            othercard = new t_Card[count];
            t_Card cardItem;
            for(; idx < count; ++idx)
            {
                cardItem = new t_Card();
                cardItem.derialize(bu);
                othercard[idx] = cardItem;
            }
        }
Ejemplo n.º 13
0
        public SceneCardItem updateCardInfoByCardItem(t_Card card)
        {
            foreach (SceneCardItem item in m_sceneCardList)
            {
                if (item.svrCard.qwThisID == card.qwThisID)
                {
                    // item.m_svrCard = card;   // 不能直接赋值,因为很多都是保存的引用,这样就会有问题
                    item.svrCard.copyFrom(card);

                    return item;
                }
            }

            return null;
        }
Ejemplo n.º 14
0
        override public void updateCardDataChangeBySvr(t_Card svrCard_ = null)
        {

        }
Ejemplo n.º 15
0
        // 更新卡牌属性,这个主要更改卡牌经常改变的属性,除了初始卡牌,后来服务器发送过来的卡牌数据都要从这个刷新
        public virtual void updateCardDataChangeBySvr(t_Card svrCard_ = null)
        {

        }
Ejemplo n.º 16
0
        override public void updateCardDataChangeBySvr(t_Card svrCard_ = null)
        {
            base.updateCardDataChangeBySvr(svrCard_);

            if (svrCard_ == null)
            {
                svrCard_ = m_sceneCardItem.svrCard;
            }

            AuxLabel text = new AuxLabel();

            text.setSelfGo(m_render.gameObject(), "UIRoot/AttText");        // 攻击
            text.text = svrCard_.damage.ToString();
            text.setSelfGo(m_render.gameObject(), "UIRoot/HpText");         // HP
            text.text = svrCard_.hp.ToString();

            text.setSelfGo(m_render.gameObject(), "UIRoot/ArmorText");         // Armor 护甲
            text.text = svrCard_.armor.ToString();

            updateHp();
        }
Ejemplo n.º 17
0
        public override void serialize(ByteBuffer bu)
        {
            base.serialize(bu);

            bu.writeUnsignedInt8(slot);
            bu.writeUnsignedInt8(who);
            bu.writeUnsignedInt8(byActionType);
            mobject = new t_Card();
            mobject.serialize(bu);

            //bu.writeUnsignedInt8(attackType);
            //bu.writeUnsignedInt32(pAttThisID);
            //bu.writeUnsignedInt32(pDefThisID);
        }
Ejemplo n.º 18
0
        public override void derialize(ByteBuffer bu)
        {
            base.derialize(bu);

            bu.readUnsignedInt8(ref slot);
            bu.readUnsignedInt8(ref who);
            bu.readUnsignedInt8(ref byActionType);
            mobject = new t_Card();
            mobject.derialize(bu);

            //bu.readUnsignedInt8(ref attackType);
            //bu.readUnsignedInt32(ref pAttThisID);
            //bu.readUnsignedInt32(ref pDefThisID);
        }
Ejemplo n.º 19
0
 public void updateSceneCardBySvrData(t_Card mobject)
 {
     SceneCardItem sceneItem = null;
     sceneItem = Ctx.m_instance.m_dataPlayer.m_dzData.m_playerArr[(int)m_playerSide].updateCardInfoByCardItem(mobject);
     updateSceneCardByItem(sceneItem);
 }
Ejemplo n.º 20
0
 public void derialize(ByteBuffer bu)
 {
     bu.readUnsignedInt8(ref who);
     mobject = new t_Card();
     mobject.derialize(bu);
 }
Ejemplo n.º 21
0
        public override void derialize(ByteBuffer bu)
        {
            base.derialize(bu);

            bu.readUnsignedInt32(ref dwMagicType);
            bu.readUnsignedInt8(ref type);
            bu.readUnsignedInt16(ref count);

            A_object = new t_Card();
            A_object.derialize(bu);

            if (count > 0)
            {
                defList = new t_Card[count];
                for (int idx = 0; idx < count; ++idx)
                {
                    defList[idx] = new t_Card();
                    defList[idx].derialize(bu);
                }
            }
        }
Ejemplo n.º 22
0
        public void addSceneCardBySvrData(t_Card mobject)
        {
            SceneCardItem sceneItem = null;
            // 填充数据
            sceneItem = Ctx.m_instance.m_dataPlayer.m_dzData.m_playerArr[(int)m_playerSide].createCardItemBySvrData(m_playerSide, mobject);
            Ctx.m_instance.m_dataPlayer.m_dzData.m_playerArr[(int)m_playerSide].addOneSceneCard(sceneItem);       // 添加数据

            addSceneCardByItem(sceneItem);
        }