A game about forced loneliness, made by TACStudios
1using System;
2using NUnit.Framework.Interfaces;
3using UnityEngine.Networking.PlayerConnection;
4using UnityEngine.TestRunner.TestLaunchers;
5
6namespace UnityEngine.TestTools.TestRunner.Callbacks
7{
8 internal class PlayerQuitHandler : MonoBehaviour, ITestRunnerListener
9 {
10 public void Start()
11 {
12 PlayerConnection.instance.Register(PlayerConnectionMessageIds.quitPlayerMessageId, ProcessPlayerQuiteMessage);
13 }
14
15 private void ProcessPlayerQuiteMessage(MessageEventArgs arg0)
16 {
17 //Some platforms don't quit, so we need to disconnect to make sure they will not connect to another editor instance automatically.
18 PlayerConnection.instance.DisconnectAll();
19
20#if !UNITY_2021_1_OR_NEWER
21 //XBOX has an error when quitting
22 if (Application.platform == RuntimePlatform.XboxOne)
23 {
24 return;
25 }
26#endif
27 Application.Quit();
28 }
29
30 public void RunStarted(ITest testsToRun)
31 {
32 }
33
34 public void RunFinished(ITestResult testResults)
35 {
36 }
37
38 public void TestStarted(ITest test)
39 {
40 }
41
42 public void TestFinished(ITestResult result)
43 {
44 }
45 }
46}