コード例 #1
0
 // should be called when the server determines the game is over
 // and needs to signal Gamelift to terminate this instance
 public void TerminateSession()
 {
     Debug.Log("** TerminateSession Requested **");
     if (isGameliftServer)
     {
         GameLiftServerAPI.TerminateGameSession();
         GameLiftServerAPI.ProcessEnding();
     }
     Debug.Log("** Process Exit **");
     Application.Quit();
 }
コード例 #2
0
        public API()
        {
            Get["/end"] = _ =>
            {
                GameLiftServerAPI.TerminateGameSession();
                Console.WriteLine("DESTROYING SESSION");

                return(200);
            };

            Get["/shutdown"] = _ =>
            {
                GameLiftServerAPI.Destroy();
                return(200);
            };

            Post["/start"] = _ =>
            {
                try
                {
                    var    body   = this.Request.Body;
                    int    length = (int)body.Length;                  // this is a dynamic variable
                    byte[] data   = new byte[length];
                    body.Read(data, 0, length);
                    PlayerType json = this.Bind <PlayerType>();

                    Console.WriteLine(json.session_id);

                    var acceptPlayerSessionOutcome = GameLiftServerAPI.AcceptPlayerSession(json.session_id);

                    return(200);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
                return(200);
            };
        }
 // should be called when the server determines the game is over
 // and needs to signal Gamelift to terminate this instance
 public void TerminateSession()
 {
     Debug.Log("** TerminateSession Requested **");
     GameLiftServerAPI.TerminateGameSession();
     GameLiftServerAPI.ProcessEnding();
 }
コード例 #4
0
 static void EndGame()
 {
     Logger.RemoveGame();
     GameLiftServerAPI.TerminateGameSession();
 }