Exemplo n.º 1
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonGameLiftConfig config = new AmazonGameLiftConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonGameLiftClient client = new AmazonGameLiftClient(creds, config);

            DescribeGameSessionsResponse resp = new DescribeGameSessionsResponse();

            do
            {
                DescribeGameSessionsRequest req = new DescribeGameSessionsRequest
                {
                    NextToken = resp.NextToken
                    ,
                    Limit = maxItems
                };

                resp = client.DescribeGameSessions(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.GameSessions)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Exemplo n.º 2
0
    public void DescribeGameSessions(object GameSessionID)
    {
        if (clientInit == false)
        {
            LogToMyConsoleMainThread("Need to Initialize Client");
            return;
        }


        //Request must contain either GameSessionID or FleetID, but not both
        var request = new DescribeGameSessionsRequest();

        string myGameSessionID = (string)GameSessionID;

        if (myGameSessionID != null)
        {
            request.GameSessionId = myGameSessionID;
            LogToMyConsoleMainThread("DescribeGameSession " + myGameSessionID);
        }
        else if (localMode == false)
        {
            request.FleetId = staticData.myFleetID;
            LogToMyConsoleMainThread("DescribeGameSessions for fleet " + staticData.myFleetID);
        }
        else
        {
            request.GameSessionId = "gsess-abc";
            LogToMyConsoleMainThread("Local Mode: describing default session");
            LogToMyConsoleMainThread("DescribeGameSession " + myGameSessionID);
        }

        gameSessionlist = null;
        try
        {
            gameSessionlist = m_Client.DescribeGameSessions(request);
        }
        catch (Exception ex)
        {
            Handler(ex);
        }
        if (gameSessionlist == null)
        {
            LogToMyConsoleMainThread("Unable to describe Game Sessions... What now?");
        }
        else
        {
            LogToMyConsoleMainThread("Number of Game Sessions: " + gameSessionlist.GameSessions.Count);

            foreach (GameSession GS in gameSessionlist.GameSessions)
            {
                LogToMyConsoleMainThread("Game Session ID: " + GS.GameSessionId
                                         + " Game Session Status: " + GS.Status.ToString()
                                         + " Game Session Endpoint: " + GS.IpAddress + ":" + GS.Port
                                         + " Game Session Players: " + GS.CurrentPlayerSessionCount + "/" + GS.MaximumPlayerSessionCount

                                         );
            }
        }
    }
Exemplo n.º 3
0
    public void DescribeGameSessions()
    {
        if (clientInit == false)
        {
            LogToMyConsoleMainThread("Need to Initialize Client");
            return;
        }

        LogToMyConsoleMainThread("DescribeGameSessions");

        //Request must contain either GameSessionID or FleetID, but not both
        var request = new DescribeGameSessionsRequest();

        if (localMode == false)
        {
            request.FleetId = m_targetFleet;
        }
        else
        {
            request.GameSessionId = "gsess-abc";
        }


        DescribeGameSessionsResponse gameSessionlist = null;

        try
        {
            gameSessionlist = m_Client.DescribeGameSessions(request);
        }
        catch (Exception ex)
        {
            Handler(ex);
        }
        if (gameSessionlist == null)
        {
            LogToMyConsoleMainThread("Unable to describe Game Sessions... What now?");
        }
        else
        {
            myName          = gameSessionlist.GameSessions[0].Name;
            myGameSessionID = gameSessionlist.GameSessions[0].GameSessionId;
            myPort          = gameSessionlist.GameSessions[0].Port;

            LogToMyConsoleMainThread("Number of Game Sessions: " + gameSessionlist.GameSessions.Count);

            foreach (GameSession GS in gameSessionlist.GameSessions)
            {
                LogToMyConsoleMainThread("Game Session ID: + " + GS.GameSessionId
                                         + " Game Session Status: " + GS.StatusReason + " " + GS.StatusReason
                                         + " Game Session Endpoint: " + GS.IpAddress + ":" + GS.Port
                                         + " Game Session Players: " + GS.CurrentPlayerSessionCount + "/" + GS.MaximumPlayerSessionCount

                                         );
            }
        }
    }