Esempio n. 1
0
 void Start()
 {
     GameMessage.SendCardReqDef data = new GameMessage.SendCardReqDef();
     data.cCard = 9;
     byte[] msg = XConvert.ConvertToByte(data);
     Debug.Log("===============" + msg.Length);
 }
Esempio n. 2
0
        public new bool Play(TileDef def)
        {
            if (base.Play(def))
            {
                GameMessage.SendCardReqDef data = new GameMessage.SendCardReqDef();
                data.cCard = def.Value;
#if USE_MSGPACK3
                var    serializer = MsgPack.Serialization.MessagePackSerializer.Get <GameMessage.SendCardReqDef>();
                byte[] msg        = serializer.PackSingleObject(data);
                _gsProxy.notifyMP(GameMessage.c2s_SendCardReqDef, msg);
#else
                byte[] msg = XConvert.ConvertToByte(data);
                _gsProxy.notify(GameMessage.c2s_SendCardReqDef, msg);
#endif

#if UNITY_5
                UnityEngine.Debug.Log("SendCardReqDef -> " + data.cCard);
                UnityEngine.Debug.Log("##########AFTER -> " + ToString());
#endif
                return(true);
            }

#if UNITY_5
            UnityEngine.Debug.Log("SendCardReqDef Error...");
#endif

            return(false);
        }
Esempio n. 3
0
        public byte[] encodeMP(ushort route, uint id, byte[] msg)
        {
            byte[] bytes = new byte[msg.Length + 8];

            OdaoMessageHeader omh;

            omh.identity = OdaoMessageHeaderId.IDENTIFY_VER;
            omh.encode   = OdaoMessageHeaderId.ENCODE_NONE;
            omh.length   = (ushort)(msg.Length + 8);
            omh.version  = OdaoMessageHeaderId.MESSAGE_VER;
            omh.reserve  = 0;
            omh.type     = route;

            //byte[] header = XConvert.ToByte(omh);
            byte[] header = XConvert.ConvertToByte(omh, 0);
            writeBytes(header, 0, bytes);

            short len = System.Net.IPAddress.HostToNetworkOrder((short)omh.length);

            byte[] msgLength = BitConverter.GetBytes(len);
            Array.Copy(msgLength, 0, bytes, 2, msgLength.Length);

            short type = System.Net.IPAddress.HostToNetworkOrder((short)omh.type);

            byte[] msgType = BitConverter.GetBytes(type);
            Array.Copy(msgType, 0, bytes, 6, msgType.Length);

            //Console.WriteLine("{0:x},{1:x},{2:x},{3:x},{4:x},{5:x},{6:x},{7:x}", bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7]);

            Array.Copy(msg, 0, bytes, 8, msg.Length);
            //writeBytes(msg, 8, bytes);

            return(bytes);
        }
Esempio n. 4
0
 public void Match()
 {
     GameMessage.MatchGameDef data = new GameMessage.MatchGameDef();
     data.gameType = 1;
     byte[] msg = XConvert.ConvertToByte(data);
     _gsProxy.notify(GameMessage.c2s_MatchGameDef, msg);
 }
Esempio n. 5
0
        public bool TrusteeShip(int flag)
        {
            GameMessage.TrusteeShipClientDef data = new GameMessage.TrusteeShipClientDef();
            data.flag = (byte)flag;
            byte[] msg = XConvert.ConvertToByte(data);
            _gsProxy.notify(GameMessage.c2s_TrusteeShipClientDef, msg);

            return(true);
        }
Esempio n. 6
0
        //收到0xB1发送此消息
        public void LeaveOut(sbyte leaveType)
        {
            BaseMessage.TablePlayerLeaveDef leavedef = new BaseMessage.TablePlayerLeaveDef();
            leavedef.iUserID    = Info.UserId;
            leavedef.cLeaveType = leaveType;

            byte[] msg = XConvert.ConvertToByte(leavedef);
            _gsProxy.notify(BaseMessage.TABLE_PLAYER_LEAVE_MSG, msg);
            Debug.Log("***************send LeaveOut type:" + leaveType);
        }
Esempio n. 7
0
        public void SendSpecialCardReqDef(GameMessage.SpecialCardReqDef data)
        {
#if USE_MSGPACK3
            var    serializer = MsgPack.Serialization.MessagePackSerializer.Get <GameMessage.SpecialCardReqDef>();
            byte[] msg        = serializer.PackSingleObject(data);
            _gsProxy.notifyMP(GameMessage.c2s_SpecialCardReqDef, msg);
#else
            byte[] msg = XConvert.ConvertToByte(data);
            _gsProxy.notify(GameMessage.c2s_SpecialCardReqDef, msg);
#endif
        }
Esempio n. 8
0
        //deprecated
        public void Ready(int ready)
        {
            BaseMessage.ReadyReqDef readyReqDef = new BaseMessage.ReadyReqDef();
            readyReqDef.cReady = (byte)ready;

            byte[] msg = XConvert.ConvertToByte(readyReqDef);
            _gsProxy.notify(BaseMessage.READY_REQ_MSG, msg);

#if UNITY_5
            UnityEngine.Debug.Log("Send Ready Msg");
#endif
        }
Esempio n. 9
0
        /// <summary>
        /// 原始发包功能,测试成功
        /// </summary>
        /// <param name="userid"></param>
        public void NoMsgLoginReqDef(int userid)
        {
            BaseMessage.LoginReqDef LoginReqDef = new BaseMessage.LoginReqDef();
            LoginReqDef.accountId = 10000;
            LoginReqDef.serviceId = 1;
            LoginReqDef.sourceId  = 1111;
            LoginReqDef.token     = "0123456789ABCDE";
            LoginReqDef.machine   = "ABCDEFGH";


            Info.UserId = userid;

            byte[] msg = XConvert.ConvertToByte(LoginReqDef);
            _gsProxy.notify(BaseMessage.LOGIN_REQ_MSG, msg);
        }
Esempio n. 10
0
        public override void SetLackTileKind(TileDef.Kind k)
        {
            base.SetLackTileKind(k);
            Debug.Log("SetLackTileKind:" + k);
            GameMessage.DingQueDef data = new GameMessage.DingQueDef();
            data.cCard = (byte)k;

#if USE_MSGPACK3
            var    serializer = MsgPack.Serialization.MessagePackSerializer.Get <GameMessage.DingQueDef>();
            byte[] msg        = serializer.PackSingleObject(data);
            _gsProxy.notifyMP(GameMessage.c2s_DingQueDef, msg);
#else
            byte[] msg = XConvert.ConvertToByte(data);
            _gsProxy.notify(GameMessage.c2s_DingQueDef, msg);
#endif
        }
Esempio n. 11
0
        //deprecated
        public void EnterGame()
        {
            Debug.Log("EnterGame=======================================");
            BaseMessage.SitDownReqDef sitDownReq = new BaseMessage.SitDownReqDef();
            sitDownReq.iBindUserID     = 0;
            sitDownReq.iTableNum       = 0;
            sitDownReq.usTableNumExtra = 0;
            var point = new BaseMessage.UserPointLimitDef();

            point.iMinPoint           = 0;
            point.iMaxPoint           = 0;
            sitDownReq.userPointLimit = point;

            byte[] msg = XConvert.ConvertToByte(sitDownReq);
            _gsProxy.notify(BaseMessage.SITDOWN_REQ_MSG, msg);
        }
Esempio n. 12
0
        public void StartAuth(int userid)
        {
            GameMessage.SendCardReqDef data = new GameMessage.SendCardReqDef();
            data.cCard = 9;
            byte[] arr = XConvert.ConvertToByte(data);

            BaseMessage.TestConnect t = new BaseMessage.TestConnect();
            t.b1 = 128;
            byte[] tarr = XConvert.ConvertToByte(t, 0);

            BaseMessage.AuthenReqDef authenReq = new BaseMessage.AuthenReqDef();
            authenReq.iUserID    = userid;
            authenReq.iRoomID    = 1;
            authenReq.cLoginType = BaseMessage.LoginType.USER_LOGIN_THREE;
            authenReq.szPasswd   = STRMD5.MD5Num("000000");

            Info.UserId = userid;

            //byte[] msg = XConvert.ToByte(authenReq);
            byte[] msg = XConvert.ConvertToByte(authenReq);
            _gsProxy.notify(BaseMessage.AUTHEN_REQ_MSG, msg);
        }