Exemplo n.º 1
0
        //比赛列表
        bool onSocketListMatch(byte[] data, int size)
        {
            tagGameMatch tempStruct = new tagGameMatch();
            int          itemSize   = Marshal.SizeOf(tempStruct);

            if (size % itemSize != 0)
            {
                return(false);
            }

            //变量定义
            ushort wItemCount = (ushort)(size / itemSize);

            var buf = new byte[itemSize];

            tagGameMatch[] pGameMatch = new tagGameMatch[wItemCount];

            //获取对象
            CGameServerItem pGameServerItem = null;

            for (int i = 0; i < wItemCount; i++)
            {
                Buffer.BlockCopy(data, i * itemSize, buf, 0, itemSize);
                pGameMatch[i] = (tagGameMatch)StructConverterByteArray.BytesToStruct(buf, typeof(tagGameMatch));

                //更新数据
                pGameServerItem = CServerListData.shared().SearchGameServer(pGameMatch[i].wServerID);
                if (pGameServerItem != null)
                {
                    pGameServerItem.m_GameMatch = (tagGameMatch)StructConverterByteArray.BytesToStruct(buf, typeof(tagGameMatch));
                    //memcpy(&pGameServerItem.m_GameMatch, pGameMatch++, sizeof(pGameServerItem.m_GameMatch));
                }
            }

            return(true);
        }
 public void onGPNoticeResult(tagGameMatch pGameMatchInfo, bool bSucess, byte[] pStr)
 {
     Debug.Log(pStr);
 }