public virtual void ResponseListGameServer(byte[] buffer)
    {
        try
        {
            ProtoGateServer.ListGameServer responseListGameServer = ProtoHelper.ToProto <ProtoGateServer.ListGameServer>(buffer);

            mErrorCode = responseListGameServer.err;

            if (mErrorCode == ProtoGateServer.ERROR_CODE.ERR_NONE)
            {
                if (onResponseListGameServer != null)
                {
                    onResponseListGameServer(responseListGameServer);
                }
            }
            else
            {
                if (onResponseError != null)
                {
                    onResponseError(mErrorCode);
                }
            }
        }
        catch (Exception)
        {
        }
    }
Exemplo n.º 2
0
    static void OnResponseListGameServer(ProtoGateServer.ListGameServer responseListGameServer)
    {
        mGameServerList.Clear();

        for (int indexGameServer = 0; indexGameServer < responseListGameServer.servers.Count; indexGameServer++)
        {
            Console.WriteLine(string.Format(
                                  "GameServer{0}:{1}:{2} {3}/{4}",
                                  mGameServerList.Count,
                                  responseListGameServer.servers[indexGameServer].ip,
                                  responseListGameServer.servers[indexGameServer].port,
                                  responseListGameServer.servers[indexGameServer].curGames,
                                  responseListGameServer.servers[indexGameServer].maxGames));

            GameServerAddress address = new GameServerAddress();
            address.ip   = responseListGameServer.servers[indexGameServer].ip;
            address.port = responseListGameServer.servers[indexGameServer].port;
            mGameServerList.Add(address);
        }
    }