public void OnStop() { if (CurrentState != NetworkState.MainEntry) { UISwitchMode.ReloadLevel(GameInfo.kNetworkEntryScene, true); } }
void OnCloseRoom() { if (!GameInfo.IsGameOver()) { UIErrorPrompt.Show("Player has left.", () => { UISwitchMode.ReloadLevel(GameInfo.kNetworkEntryScene, true); }); } }
void OnDisconnect(DisconnectCause disconnectCause) { if (disconnectCause == DisconnectCause.None) { return; } UIErrorPrompt.Show("Disonnected.", () => { Debug.Log("disconnected, cause: " + disconnectCause); UISwitchMode.ReloadLevel(GameInfo.kNetworkEntryScene, true); }); }
void OnError(Consts.ErrorCode err) { switch (err) { case Consts.ErrorCode.NotCompatible: Debug.Log("game data not compatible"); UIErrorPrompt.Show("Game data not compatible.", () => { UISwitchMode.ReloadLevel(GameInfo.kNetworkEntryScene, true); }); break; } }
void Update() { if (_state == NetworkState.Connecting || _state == NetworkState.WaitingForOpponent) { PassTime += Time.deltaTime; if (PassTime > timeLimit) { _state = NetworkState.Timeout; UIErrorPrompt.Show("Timeout.", () => { UISwitchMode.ReloadLevel(GameInfo.kNetworkEntryScene, true); }); } } }
void EnterGame() { UISwitchMode.ReloadLevel(GameInfo.kMultiplayerScene, false); }
public void OnExit() { UISwitchMode.ReloadLevel(GameInfo.kMainScene, true); }