/// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>  
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            CreateGameSessionResponse response = new CreateGameSessionResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;
            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("GameSession", targetDepth))
                {
                    var unmarshaller = GameSessionUnmarshaller.Instance;
                    response.GameSession = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return response;
        }
示例#2
0
 public Amazon.GameLift.Model.GameSession CreateGameSession()
 {
     try
     {
         var cgsreq = new Amazon.GameLift.Model.CreateGameSessionRequest();
         cgsreq.AliasId   = aliasId;
         cgsreq.CreatorId = playerId;
         cgsreq.MaximumPlayerSessionCount = 100;
         Amazon.GameLift.Model.CreateGameSessionResponse cgsres = aglc.CreateGameSession(cgsreq);
         string gsid = cgsres.GameSession != null ? cgsres.GameSession.GameSessionId : "N/A";
         Debug.Log((int)cgsres.HttpStatusCode + " GAME SESSION CREATED: " + gsid);
         return(cgsres.GameSession);
     }
     catch (Amazon.GameLift.Model.FleetCapacityExceededException e)
     {
         Debug.Log(e.StatusCode.ToString() + " FleetCapacityExceededException: " + e.Message);
         return(null);
     }
     catch (Amazon.GameLift.Model.InvalidRequestException e)
     {
         Debug.Log(e.StatusCode.ToString() + " InvalidRequestException: " + e.Message);
         return(null);
     }
 }