|
|
@@ -43,9 +43,11 @@ public class PKMatchingView : MonoBehaviour
|
|
|
};
|
|
|
socketPlayer.onAgreeStartGame = () => {
|
|
|
DontDestroyOnLoad(socketPlayer);
|
|
|
- if (GlobalData.matchRoomType == 0) {
|
|
|
- GameMgr.gameType = 9;
|
|
|
- SceneManager.LoadScene("Game", LoadSceneMode.Single);
|
|
|
+ toLoadGame = true;
|
|
|
+ };
|
|
|
+ socketPlayer.onDestroy_ += () => {
|
|
|
+ if (this && this.gameObject) {
|
|
|
+ DestroyImmediate(this.gameObject);
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
@@ -70,11 +72,24 @@ public class PKMatchingView : MonoBehaviour
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ bool toLoadGame = false;
|
|
|
+ float loadGameSceneCountdown = 1;
|
|
|
void Update() {
|
|
|
if (waitingTime >= 0) {
|
|
|
waitingTime += Time.deltaTime;
|
|
|
this.transform.Find("BoxRight/TimeBG").GetComponentInChildren<Text>().text = TimeUtil.GetTimeStr(waitingTime, false);
|
|
|
}
|
|
|
+ if (toLoadGame) {
|
|
|
+ loadGameSceneCountdown -= Time.deltaTime;
|
|
|
+ if (loadGameSceneCountdown <= 0) {
|
|
|
+ toLoadGame = false;
|
|
|
+ //loadscene
|
|
|
+ if (GlobalData.matchRoomType == 0) {
|
|
|
+ GameMgr.gameType = 9;
|
|
|
+ SceneManager.LoadScene("Game", LoadSceneMode.Single);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void PauseWaitingTime() {
|