コード例 #1
0
ファイル: PlayerItem.cs プロジェクト: dream-young-soul/soul
        //穿戴装备
        public void Equip(uint id, uint postion)
        {
            if (!mDicItem.ContainsKey(id)) return;

            //等级不够啊--
            GameStruct.RoleItemInfo newEquip = mDicItem[id];
            //如果该未知有装备..就发回到包裹
            GameStruct.RoleItemInfo oldequip = GetEquipByPostion((byte)postion);
            if (oldequip != null)
            {
                UnEquip(oldequip.id, 0, false);
            }

            newEquip.postion = (ushort)postion;
            NetMsg.MsgOperateEquip send = new NetMsg.MsgOperateEquip();
            send.SetTagEquip();
            send.Create(null, play.GetGamePackKeyEx());
            send.equipid = newEquip.id;
            send.postion = (int)postion;
            play.SendData(send.GetBuffer());
            newEquip.postion = (ushort)postion;
            CalcEquipLook(newEquip);
        }
コード例 #2
0
ファイル: PlayerItem.cs プロジェクト: dream-young-soul/soul
        //脱下装备
        //参数: id: 要脱下的装备id
        // oldpostion :要脱下的装备位置
        public void UnEquip(uint id, uint oldpostion,bool isChangeLook = true)
        {
            if (!mDicItem.ContainsKey(id)) return;
            if (IsItemFull()) return; //包裹已满。。脱不下了
            GameStruct.RoleItemInfo info = mDicItem[id];
               // if (info.postion != oldpostion) return;
            //如果是时装- 就放到衣柜 2015.10.3
            if (info.postion == NetMsg.MsgItemInfo.ITEMPOSITION_FASHION
                )
            {
                info.postion = NetMsg.MsgItemInfo.ITEMPOSITION_CHEST;
            }
            //幻魂武器放到衣柜 2015.10.14
            else if(info.postion == NetMsg.MsgItemInfo.ITEMPOSTION_WEPON_SOUL)
            {
                info.postion = NetMsg.MsgItemInfo.ITEMPOSITION_CHEST_SOUL;
            }
            else
            {
                info.postion = NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK;
            }

            NetMsg.MsgOperateEquip send = new NetMsg.MsgOperateEquip();
            send.SetTagUnEquip();
            send.Create(null, play.GetGamePackKeyEx());
            send.equipid = info.id;
            send.postion = (int)oldpostion;
            play.SendData(send.GetBuffer());
            if(isChangeLook)CalcEquipLook(info);
        }