public void OnRestoreToPrevState() { if (!(HasEnoughCoin(ItemType.UNDO) || GameManager.instance.debug) || _snapshots.Count <= 0 || GameManager.instance.transition != GameManager.Transition.None) { SoundManager.Instance.PlayUISoundInstance( GameConstants.UIFX_TOUCH_LOCKED_BUTTON_ITEM ); return; } SoundManager.Instance.PlayUISoundInstance( GameConstants.UIFX_TOUCH_BUTTON_ITEM ); BoardSnapshot snapshot = _snapshots[_snapshots.Count - 1]; _snapshots.Remove(snapshot); _scoreCounter.Setup(snapshot.score); _savings = snapshot.savings; GameManager.instance.RestoreToPrevState(snapshot); }
void UpdateCoin() { if (_coinCounter.value == DataManager.Instance.UserData.Coin) { return; } _coinCounter.Setup(DataManager.Instance.UserData.Coin, 0.2f); UpdateItemButtons(); }
void UpdateScore() { DataManager manager = DataManager.Instance; _highscoreCounter.Setup(Mathf.Max(_scoreCounter.value, manager.UserData.Score)); if (_missionCheckCoroutine != null) { return; } _missionCheckCoroutine = StartCoroutine(ProcessCheckMission()); }
IEnumerator ProcessOnReplay() { if (GameManager.instance.replayInterstitialEnabled) { bool closed = false; Action <bool> onClosed = state => { closed = true; if (state) { GameManager.instance.ResetReplayInterstitialTime(); } }; NetworkManager.Instance.ShowInterstitialAd( GameConstants.ADUNIT_INTERSTITIAL_GAMEEND_REPLAY, onClosed ); while (!closed) { yield return(new WaitForEndOfFrame()); } } UICounter coinCounter = GetParam <UICounter>(PARAM_COIN_COUNTER, null); if (coinCounter != null) { coinCounter.Setup(DataManager.Instance.UserData.Coin); while (coinCounter.nowCounting) { yield return(new WaitForEndOfFrame()); } yield return(new WaitForSeconds(1.0f)); } NetworkManager.Instance.UnLoadRewardVideoAd(GameConstants.ADUNIT_REWARD); StateManager.instance.OpenStateForced(GameConstants.STATENAME_INGAME); }