Пример #1
0
        public void ExecuteCommand(GameSession session, ProtobufRequestInfo requestInfo)
        {
            var             gameOperation = SendGetRoomCard.ParseFrom(requestInfo.Body);
            RedisLoginModel olduser       = RedisUtility.Get <RedisLoginModel>(RedisUtility.GetKey(GameInformationBase.COMMUNITYUSERLIST, gameOperation.Openid, gameOperation.Unionid));

            if (olduser == null)
            {
                return;
            }
            var info = Gongyong.userlist.First(w => w.openid.Equals(olduser.Openid));

            if (info == null)
            {
                return;
            }
            if (info.Type == 0)
            {
                var msg = ReturnGetRoomCard.CreateBuilder().SetUserRoomCard(RoomCardUtility.GetRoomCard(gameOperation.UserID)).Build().ToByteArray();
                session.TrySend(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1023, msg.Length, requestInfo.MessageNum, msg)));
            }
            else
            {
                var msg = ReturnGetRoomCard.CreateBuilder().SetUserRoomCard(RoomCardUtility.GetLongBaoNumber(info.unionid)).Build().ToByteArray();
                session.TrySend(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1023, msg.Length, requestInfo.MessageNum, msg)));
            }
        }
Пример #2
0
    void SendGetRoomCard()
    {
        SendGetRoomCard sendGetRoomCard = new SendGetRoomCard();

        sendGetRoomCard.UserID  = GameInfo.userID;
        sendGetRoomCard.openid  = GameInfo.OpenID;
        sendGetRoomCard.unionid = GameInfo.unionid;
        byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendGetRoomCard);
        byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1022, body.Length, 0, body);
        GameInfo.cs.Send(data);
    }