Represents the returned data in response to a request action.
Inheritance: Amazon.Runtime.AmazonWebServiceResponse
コード例 #1
0
 public Amazon.GameLift.Model.GameSession SearchGameSessions()
 {
     try
     {
         var sgsreq = new Amazon.GameLift.Model.SearchGameSessionsRequest();
         sgsreq.AliasId          = aliasId;                           // only our game
         sgsreq.FilterExpression = "hasAvailablePlayerSessions=true"; // only ones we can join
         sgsreq.SortExpression   = "creationTimeMillis ASC";          // return oldest first
         sgsreq.Limit            = 1;                                 // only one session even if there are other valid ones
         Amazon.GameLift.Model.SearchGameSessionsResponse sgsres = aglc.SearchGameSessions(sgsreq);
         Debug.Log((int)sgsres.HttpStatusCode + " GAME SESSION SEARCH FOUND " + sgsres.GameSessions.Count + " SESSIONS (on " + aliasId + ")");
         if (sgsres.GameSessions.Count > 0)
         {
             return(sgsres.GameSessions[0]);
         }
         return(null);
     }
     catch (Amazon.GameLift.Model.InvalidRequestException e)
     {
         // EXCEPTION HERE? Your alias does not point to a valid fleet, possibly.
         Debug.Log(e.StatusCode.ToString() + " :( SEARCHGAMESESSIONS FAILED. InvalidRequestException " + e.Message +
                   Environment.NewLine + "Game alias " + aliasId + " may not point to a valid fleet" + Environment.NewLine);
         return(null);
     }
 }
コード例 #2
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>  
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            SearchGameSessionsResponse response = new SearchGameSessionsResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;
            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("GameSessions", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller<GameSession, GameSessionUnmarshaller>(GameSessionUnmarshaller.Instance);
                    response.GameSessions = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("NextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return response;
        }