Skip to content

Commit

Permalink
make apps quit when connection dropped
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Jul 16, 2014
1 parent 639b72b commit 11152f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion HappyFunTimes/HappyFunTimes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\..\..\Applications\Unity\Unity.app\Contents\Frameworks\Managed\UnityEngine.dll</HintPath>
<HintPath>..\..\..\..\..\Applications\Unity\Unity.app\Contents\Frameworks\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="DeJson">
<HintPath>libs\DeJson.dll</HintPath>
Expand Down
5 changes: 4 additions & 1 deletion HappyFunTimes/PlayerSpawner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -50,6 +51,8 @@ void Connected(object sender, EventArgs e)

void Disconnected(object sender, EventArgs e)
{
Debug.Log("Quitting");
Application.Quit();
}

void Cleanup()
Expand Down

0 comments on commit 11152f8

Please sign in to comment.