Exemplo n.º 1
0
    // 删除物品
    private void OnDeleteItem(UserToken token, SocketModel model)
    {
        ReqDeleteItem req = SerializeUtil.Deserialize <ReqDeleteItem>(model.message);

        // 应答
        RespDeleteItem resp = new RespDeleteItem();

        if (req.deleteType == DeleteType.Equip)
        {
            EquipData equipData = CacheManager.instance.GetEquipData(token.characterid, req.slot);
            equipData.itemid = -1;
            resp.dto         = EquipData.GetInvDTO(equipData);
            resp.deleteType  = DeleteType.Equip;

            equipData = CacheManager.instance.GetEquipData(token.characterid, req.slot);
        }
        else
        {
            // 获取背包栏位物品数据
            InventoryData invData = CacheManager.instance.GetInvData(token.characterid, req.slot);
            invData.itemid  = -1;
            invData.num     = 0;
            resp.dto        = InventoryData.GetInvDTO(invData);
            resp.deleteType = DeleteType.Inv;
        }

        NetworkManager.Send(token, (int)MsgID.INV_Delete_Item_SRES, resp);
    }
Exemplo n.º 2
0
    private void OnClickDelete()
    {
        ReqDeleteItem req = new ReqDeleteItem();

        req.slot       = dto.slot;
        req.deleteType = _deleteType;
        Net.instance.Send((int)MsgID.INV_Delete_Item_CREQ, req);
    }