Exemple #1
0
        /// <summary>
        /// Запрос на получение информации о игре
        /// </summary>
        /// <param name="aData"></param>
        /// <param name="aDataOffset"></param>
        /// <param name="aDataSize"></param>
        protected override void OnGameInfo(ushort aMessageID, byte[] aData, int aDataOffset, int aDataSize)
        {
            DataReader dataReader = new DataReader(aData, 0, aDataSize);
            byte       aType      = 0;

            if (!dataReader.Read(ref aType))
            {
                this.OnReceivingError(RECEIVE_FATAL_ERROR, "Server OnGameInfo dataReader.Read(ref type)");
                return;
            }

            if (aType != inQuery)
            {
                this.OnReceivingError(RECEIVE_FATAL_ERROR, "Server OnGameInfo type != inQuery");
                return;
            }

            DataBuffer dataBuffer   = new DataBuffer();
            bool       bMyFirstMove = !context.gameCtrl.IsMyFirstMove();
            bool       bMyMove      = !context.gameCtrl.IsMyMove();

            dataBuffer.Add(outConfirmation);
            dataBuffer.Add(bMyFirstMove);
            dataBuffer.Add(bMyMove);
            dataBuffer.Add(context.game.GetRowCellCount());
            dataBuffer.Add((ushort)context.gameCtrl.NumberToWin);
            dataBuffer.AddASCII(context.gameCtrl.GetGameState().DataString);

            SendData(outGameInfo, aMessageID, dataBuffer.GetBuffer(), (ushort)dataBuffer.GetBufferSize());
        }
 public HttpConnection(string url, string data)
 {
     Url  = url;
     Data = new DataBuffer();
     Data.AddASCII(data);
     Init();
 }
        public void SendQueryInfo()
        {
            DataBuffer dataBuffer = new DataBuffer();

            dataBuffer.Add(outQuery);
#if FOR_JAVA
            dataBuffer.AddASCII(context.gameCtrl.UserName);
            dataBuffer.Add((byte)1);
            bool bMyFirstMove = context.gameCtrl.IsMyFirstMove();
            bool bMyMove      = context.gameCtrl.IsMyMove();
            dataBuffer.Add(bMyFirstMove);
            dataBuffer.Add(context.game.GetRowCellCount());
            dataBuffer.Add((ushort)context.gameCtrl.NumberToWin);
#endif
            SendData(outGameInfo, messageID, dataBuffer.GetBuffer(), (ushort)dataBuffer.GetBufferSize());
        }