コード例 #1
0
        public void AuthenticateFromRouteServer()
        {
            var authCommand = new PlayCommand()
            {
                Body = new Dictionary <string, object>()
                {
                    { "ua", Play.PlayVersion + "_" + Play.GameVersion },
                    { "client_id", this.ID }
                },
                Method      = "POST",
                RelativeUrl = "/authorization"
            };

            Play.RunHttpCommand(authCommand, PlayEventCode.OnAuthenticating, (req, resp) =>
            {
                this.SessionToken = resp.Body["token"] as string;
            });
        }
コード例 #2
0
        /// <summary>
        /// Get the lobby server.
        /// </summary>
        /// <param name="secure">If set to <c>true</c> secure.</param>
        /// <param name="lobbyLoaded">after lobby loaded.</param>
        public void GetLobbyServer(bool secure = true, Action <PlayGameServer> lobbyLoaded = null)
        {
            var lobbyGetCmd = new PlayCommand()
            {
                RelativeUrl   = "/router",
                UrlParameters = new Dictionary <string, object>()
                {
                    { "appId", AVClient.CurrentConfiguration.ApplicationId },
                    { "secure", secure }
                },
            };

            Play.RunHttpCommand(lobbyGetCmd, done: (request, response) =>
            {
                var gameServer = Play.GameServer = PlayGameServer.FetchFromPublicCloud(response);
                if (lobbyLoaded != null)
                {
                    lobbyLoaded(gameServer);
                }
            });
        }
コード例 #3
0
 public void Next()
 {
     if (Cursor != null)
     {
         Command.UrlParameters["cursor"] = Cursor;
     }
     if (Limit > 0)
     {
         Command.UrlParameters["limit"] = Limit;
     }
     Command.UrlParameters["client_id"] = Play.peer.ID;
     Play.RunHttpCommand(Command, PlayEventCode.None, (req, resp) =>
     {
         var t = Decoder(resp);
         Callback(t);
         if (resp.Body.ContainsKey("cursor"))
         {
             Cursor = resp.Body["cursor"] as string;
         }
     });
 }