void CreateGameSession(object maxPlayers) { LogToMyConsoleMainThread("CreateGameSession"); //Request must contain either GameSessionID or FleetID, but not both var request = new CreateGameSessionRequest() { FleetId = m_targetFleet, MaximumPlayerSessionCount = (int)maxPlayers, //GameSessionId = "gsess-abc" }; CreateGameSessionResponse CGSR = null; try { CGSR = m_Client.CreateGameSession(request); } catch (Exception ex) { Handler(ex); } if (CGSR == null) { LogToMyConsoleMainThread("Can't create game session"); } else { LogToMyConsoleMainThread("Game Session Created: " + CGSR.GameSession.GameSessionId); } }
void CreateGameSession(object myCreateGameSessionData) { LogToMyConsoleMainThread("CreateGameSession"); CreateGameSessionData CGSD = (CreateGameSessionData)myCreateGameSessionData; GameProperty GP0 = new GameProperty(); GP0.Key = "BoltPro"; #if !BOLT_CLOUD GP0.Value = "true"; #endif #if BOLT_CLOUD GP0.Value = "false"; #endif List <GameProperty> GPL = new List <GameProperty>(); GPL.Add(GP0); //Request must contain either GameSessionID or FleetID, but not both var request = new CreateGameSessionRequest() { FleetId = staticData.myFleetID, MaximumPlayerSessionCount = CGSD.maxPlayers, CreatorId = UniqueID, GameSessionData = CGSD.GameSessionData, GameProperties = GPL, Name = "Test" + randomNumber //GameSessionId = "gsess-abc" }; CreateGameSessionResponse CGSR = null; try { CGSR = m_Client.CreateGameSession(request); } catch (Exception ex) { Handler(ex); } if (CGSR == null) { LogToMyConsoleMainThread("Can't create game session"); } else { LogToMyConsoleMainThread("Game Session Created: " + CGSR.GameSession.GameSessionId); } }
private void CreateSession() { GD.Print("no session found, creating new one"); CreateGameSessionRequest sessionRequest = new CreateGameSessionRequest() { MaximumPlayerSessionCount = 2, FleetId = PongServer }; try { CreateGameSessionResponse newSession = gameLiftClient.CreateGameSession(sessionRequest); GameSession session = newSession.GameSession; ConnectToSession(session); } catch (Exception e) { GD.Print(e); } }
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); } }