From 11152f8c11e32661040c97bc24e2df25f82fbf64 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Tue, 15 Jul 2014 18:19:11 -0700 Subject: [PATCH] make apps quit when connection dropped --- HappyFunTimes/HappyFunTimes.csproj | 2 +- HappyFunTimes/PlayerSpawner.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/HappyFunTimes/HappyFunTimes.csproj b/HappyFunTimes/HappyFunTimes.csproj index 3abb84c..e470725 100644 --- a/HappyFunTimes/HappyFunTimes.csproj +++ b/HappyFunTimes/HappyFunTimes.csproj @@ -32,7 +32,7 @@ - ..\..\..\..\..\..\Applications\Unity\Unity.app\Contents\Frameworks\Managed\UnityEngine.dll + ..\..\..\..\..\Applications\Unity\Unity.app\Contents\Frameworks\Managed\UnityEngine.dll libs\DeJson.dll diff --git a/HappyFunTimes/PlayerSpawner.cs b/HappyFunTimes/PlayerSpawner.cs index 9f4b7cd..081b539 100644 --- a/HappyFunTimes/PlayerSpawner.cs +++ b/HappyFunTimes/PlayerSpawner.cs @@ -23,11 +23,12 @@ void StartConnection() { options.gameId = gameId; m_server = new GameServer(options, gameObject); - m_server.Init(); m_server.OnPlayerConnect += StartNewPlayer; m_server.OnConnect += Connected; m_server.OnDisconnect += Disconnected; + + m_server.Init(); } void StartNewPlayer(object sender, PlayerConnectMessageArgs e) @@ -50,6 +51,8 @@ void Connected(object sender, EventArgs e) void Disconnected(object sender, EventArgs e) { + Debug.Log("Quitting"); + Application.Quit(); } void Cleanup()