disonncet grace improved
This commit is contained in:
@@ -4,6 +4,7 @@ using DG.Tweening;
|
||||
using UnityEngine.SceneManagement;
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
using Mirror;
|
||||
public class LevelLoadManager : MonoBehaviour
|
||||
{
|
||||
public static LevelLoadManager instance;
|
||||
@@ -181,4 +182,23 @@ public class LevelLoadManager : MonoBehaviour
|
||||
p2_l10.text = $"L10 {opponentPlayer.l10_wins}-{opponentPlayer.l10_losses}";
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Leave(string levelName = "MainMenu"){
|
||||
NetManager.MarkIntentionalClientDisconnect();
|
||||
GameManager.instance.StopClient();
|
||||
|
||||
StartCoroutine(CoroutineWaitTillDisconnection(levelName));
|
||||
}
|
||||
|
||||
IEnumerator CoroutineWaitTillDisconnection(string levelName){
|
||||
Show(); //Load the UI until the level is loaded
|
||||
while(NetworkClient.isConnected){
|
||||
yield return null;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(1f); //Just to make sure
|
||||
|
||||
LoadLevel(levelName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user