|
|
@@ -55,12 +55,11 @@ public class SocketPlayer : JC.SocketIO.SocketIOClient
|
|
|
Debug.Log("onReload");
|
|
|
}
|
|
|
public Action onDestroy_;
|
|
|
- [NonSerialized] public bool canBackHome = true;
|
|
|
public override void onDestroy()
|
|
|
{
|
|
|
Debug.Log("onDestroy");
|
|
|
onDestroy_?.Invoke();
|
|
|
- if (canBackHome && UnityEngine.SceneManagement.SceneManager.GetActiveScene().name.StartsWith("Game") && !openInGameScene) {
|
|
|
+ if (!isGameOver && UnityEngine.SceneManagement.SceneManager.GetActiveScene().name.StartsWith("Game") && !openInGameScene) {
|
|
|
PopupMgr.ins.ShowBGTip("某方退出或掉线,联机游戏终止!");
|
|
|
SceneManager.LoadScene("Home", LoadSceneMode.Single);
|
|
|
}
|
|
|
@@ -125,11 +124,14 @@ public class SocketPlayer : JC.SocketIO.SocketIOClient
|
|
|
public void JoinFriendPKRoom(int roomID) {
|
|
|
call("JoinFriendPKRoom", roomID);
|
|
|
}
|
|
|
+ //游戏结束标记
|
|
|
+ [NonSerialized] public bool isGameOver = false;
|
|
|
//再来一次
|
|
|
bool willTryAgain = false;
|
|
|
int repeatID = 0;
|
|
|
string repeatID_str = "0";
|
|
|
public void TryAgain(string sceneName) {
|
|
|
+ isGameOver = false;
|
|
|
willTryAgain = true;
|
|
|
repeatID++;
|
|
|
repeatID_str = repeatID.ToString();
|
|
|
@@ -140,6 +142,7 @@ public class SocketPlayer : JC.SocketIO.SocketIOClient
|
|
|
repeatID = int.Parse(repeatID_s);
|
|
|
repeatID_str = repeatID_s;
|
|
|
willTryAgain = true;
|
|
|
+ isGameOver = false;
|
|
|
SceneManager.LoadScene(sceneName, LoadSceneMode.Single);
|
|
|
}
|
|
|
}
|