public void GameEnd() { if (this.CurrentModeType == ModeType.PassLevel) { if (brokenRecord) { GameSoundSystem.GetInstance().PlayCheerSound(); } LeaderboardManager.ReportScore(this.CurrentMode, this.CurrentModeType, this.DisplayWaveNumber); } else { int bestRecord = PlayerProfile.LoadBestRecord(this.CurrentMode, this.CurrentModeType); if (this.Score > bestRecord) { brokenRecord = true; GameSoundSystem.GetInstance().PlayCheerSound(); PlayerProfile.SaveBestRecord(this.CurrentMode, this.CurrentModeType, this.Score); if (OnBestRecordChanged != null) { OnBestRecordChanged(); } } if (isActivated) { int gainedCoin = this.Score / Constant.SCORE_TO_COIN; if (isVIP) { gainedCoin *= 2; } this.Coin += gainedCoin; PlayerProfile.SaveCoin(this.Coin); UMengManager.Bonus(gainedCoin, (Umeng.GA.BonusSource)UMengManager.Bonus_Source_Pass_Level); } else { //Trick Code : 使界面刷新用 this.Coin += 0; } LeaderboardManager.ReportScore(this.CurrentMode, this.CurrentModeType, this.Score); } //友盟统计游戏结束后的数据 Dictionary <string, string> dict = new Dictionary <string, string>(); string keyString = "mode|modeType|wave|score"; string valueString = string.Format("{0}|{1}|{2}|{3}", this.CurrentMode, this.CurrentModeType, this.DisplayWaveNumber, this.Score); dict.Add(keyString, valueString); UMengManager.Event(UMengManager.Event_GameEnd, dict); }
public void CheckUnlock() { isUnlocked = PlayerProfile.LoadModeUnlock(mode); isEntered = PlayerProfile.LoadModeEntered(mode); background1.color = isUnlocked ? Constant.COLOR_WHITE : Constant.COLOR_GRAY; modeNameLabel.color = isUnlocked ? Constant.COLOR_DARK_BLACK : Constant.COLOR_LIGHT_WHITE; background2.color = background1.color; this.GetComponent <BoxCollider>().enabled = isUnlocked; if (mode == GameSystem.Mode.Inverse) { unlockWithCoinContents.gameObject.SetActive(false); unlockWithScoreContents.gameObject.SetActive(!isUnlocked); if (isUnlocked == false) { canUnlock = PlayerProfile.LoadBestRecord(GameSystem.Mode.Classic, GameSystem.ModeType.Challenge) >= Constant.MODE_UNLOCK_COIN[(int)mode]; unlockWithScoreContents.SetActive(!canUnlock); newText.SetActive(canUnlock); if (canUnlock) { PlayerProfile.SaveModeUnlock(mode, true); CheckUnlock(); //友盟统计解锁模式 UMengManager.Event(UMengManager.Event_UnlockMode, mode.ToString()); } } else { newText.SetActive(!isEntered); } } else { unlockWithScoreContents.gameObject.SetActive(false); unlockWithCoinContents.gameObject.SetActive(!isUnlocked); if (isUnlocked == false) { canUnlock = GameSystem.GetInstance().Coin >= Constant.MODE_UNLOCK_COIN[(int)mode]; unlockWithCoinContents.enabled = canUnlock; newText.SetActive(false); } else { newText.SetActive(!isEntered); } } }
void ConfirmUnlockModeWithCoinCallback(bool result) { if (result) { GameSystem.GetInstance().UnlockMode(mode); newText.SetActive(true); //友盟统计解锁模式 UMengManager.Event(UMengManager.Event_UnlockMode, mode.ToString()); } else { TrialPlay(); } }
public void EnterGame() { GameSystem.GetInstance().CurrentMode = mode; GameSystem.GetInstance().ChangeState(GameSystem.States.GameReady); if (isEntered == false) { isEntered = true; newText.SetActive(false); PlayerProfile.SaveModeEntered(mode, true); //友盟统计进入模式的次数 UMengManager.Event(UMengManager.Event_EnterMode, string.Format("{0}|{1}", mode, GameSystem.GetInstance().CurrentModeType)); } HideModeDetailImmediately(); }