예제 #1
0
    void OnReqBuyItem(NetworkMessage msg)
    {
        Log.i("LanHost OnReqBuyItem", Log.Tag.Net);
        MsgItem m      = msg.ReadMessage <MsgItem> ();
        Client  client = getClient(msg.conn);

        Bag.Item it    = client.bag.addItem(m.itemId, m.count);
        MsgItem  reply = new MsgItem();

        reply.itemId = it.id;
        reply.count  = it.count;
        sendTo(msg.conn.connectionId, (short)MyMsgId.ItemChange, reply);
    }
예제 #2
0
    void OnReqPick(NetworkMessage msg)
    {
        Log.i("LanHost OnReqPick", Log.Tag.Net);
        MsgPick   m      = msg.ReadMessage <MsgPick> ();
        DropItems u      = mUnitMgr.getUnit(m.dropGuid) as DropItems;
        Client    client = getClient(msg.conn);

        if (u != null)
        {
            if (!u.pick(client.playerGUID))
            {
                return;
            }
            Bag.Item it    = client.bag.addItem(u.tid, 1);
            MsgItem  reply = new MsgItem();
            reply.itemId = it.id;
            reply.count  = it.count;
            sendTo(msg.conn.connectionId, (short)MyMsgId.ItemChange, reply);
        }
    }