public override void Enter () { entity.Reset(); entity.gameUI.countDownMenu.Show(true); entity.gameUI.countDownMenu.StarCountDownAnim(); GameSoundSystem.GetInstance ().ChooseMusic (); }
void Update() { receiveButtonAvailableContent.SetActive(GameSystem.GetInstance().IsGiftAvailableNow); receiveButtonUnAvailableContent.SetActive(!GameSystem.GetInstance().IsGiftAvailableNow); if (GameSystem.GetInstance().IsGiftAvailableNow == false && Time.frameCount % 15 == 0) { UpdateNextGifTime(); } if (startAnim) { timer += Time.deltaTime; if (timer > jumpInterval) { timer = 0; if (currentTimes >= jumpTimes) { startAnim = false; SelectFinish(); } else { currentTimes++; UpdateJumpInterval(); int finalIndex = (startIndex + currentTimes) % giftItems.Length; giftItemSelector.transform.localPosition = giftItems[finalIndex].transform.localPosition; GameSoundSystem.GetInstance().PlayRandomSound(); } } } }
public void PressShopItem() { GameSoundSystem.GetInstance().PlayRandomSound(); ShopData shopData = UIEventTrigger.current.GetComponent <ShopItem>().Data; BuyItem(shopData); }
// Update is called once per frame void Update() { fsm.Update(); this.CurrentModeLogic.Update(); if (Input.GetKeyDown(KeyCode.Escape) && gameUI.vipConfirmMenu.IsActive == false && gameUI.blockConfirmMenu.IsActive == false && gameUI.rescueConfirmMenu.IsActive == false && gameUI.recommendConfirmMenu.IsActive == false) { if (fsm.GetCurrentState().StateID == GameSystem.States.GamePlay) { gameUI.confirmMenu.Show(false); gameUI.pauseMenu.ToggleShow(); } else { gameUI.confirmMenu.CloseButtonVisible = false; gameUI.confirmMenu.SetConfirmCallback(ConfirmQuitGame); gameUI.confirmMenu.SetContent(TextManager.GetText("confirm_quit_game"), null, ConfirmStyle.YesNo); gameUI.confirmMenu.SetYesButtonText(TextManager.GetText("no")); gameUI.confirmMenu.SetNoButtonText(TextManager.GetText("yes")); gameUI.confirmMenu.ToggleShow(); } GameSoundSystem.GetInstance().PlayRandomSound(); } if (isGiftAvailableNow == false) { CheckGiftTime(); } }
public void HellRankButtonOnClick() { GameSystem.GetInstance().CurrentMode = mode; GameSystem.GetInstance().CurrentModeType = GameSystem.ModeType.Hell; GameSystem.GetInstance().gameUI.rankMenu.Show(true); GameSoundSystem.GetInstance().PlayRandomSound(); }
public override void FlipCell(Cell cell, bool isRight) { if (isRight) { int number = Convert.ToInt32(cell.Text); if (number == nextCorrectNumber) { GameSystem.GetInstance().Score++; nextCorrectNumber++; if (number == currentMaxNumber) { GameSystem.GetInstance().gameCore.IsLevelWavePassed = true; GameSystem.GetInstance().ChangeState(GameSystem.States.WaveComplete); } } else { GameSoundSystem.GetInstance().StopFlipRightSound(); GameSoundSystem.GetInstance().PlayFlipWrongSound(); GameSystem.GetInstance().gameCore.IsLevelWavePassed = false; GameSystem.GetInstance().ChangeState(GameSystem.States.WaveComplete); } } else { cell.Type = Cell.CellType.Block; cell.Text = string.Empty; cell.TextureName = string.Empty; } }
public void RandomMusic() { int index = UnityEngine.Random.Range(0, GameSoundSystem.GetInstance().AvailableMusicDatas.Count); currentMusicIndex = index; currentMusicData = GameSoundSystem.GetInstance().AvailableMusicDatas[currentMusicIndex]; Debug.Log(string.Format("New Music : {0}", TextManager.GetText(string.Format("game_music_name_{0}", currentMusicData.id)))); }
public void GiftButtonOnClick() { if (GameSystem.GetInstance().CheckIsActivated()) { GameSoundSystem.GetInstance().PlayRandomSound(); GameSystem.GetInstance().gameUI.giftMenu.Show(true); } }
public void CloseButtonOnClick() { loading.SetActive(false); GameSystem.GetInstance().gameUI.mainMenu.Show(true); GameSystem.GetInstance().gameUI.mainMenu.ShowEnterAnimation(() => { this.Show(false); }); GameSoundSystem.GetInstance().PlayRandomSound(); }
public void MainButtonOnClick() { StateGameResult.IS_EXIT_TO_MAIN = true; GameSystem.GetInstance().ChangeState(GameSystem.States.GameInit); GameSystem.GetInstance().gameUI.mainMenu.ShowEnterAnimation(() => { this.Show(false); }); GameSoundSystem.GetInstance().PlayRandomSound(); }
public void CloseButtonOnClick() { if (startAnim || isSelectorScaleing) { return; } this.Close(); GameSoundSystem.GetInstance().PlayRandomSound(); }
public void HelpButtonOnClick() { string title = TextManager.GetText("help"); string content = TextManager.GetText(string.Format("mode_help_{0}", (int)(GameSystem.GetInstance().CurrentMode))); GameSystem.GetInstance().gameUI.confirmMenu.SetContent(title, content, ConfirmStyle.OnlyYes); GameSystem.GetInstance().gameUI.confirmMenu.Show(true); GameSoundSystem.GetInstance().PlayRandomSound(); }
public void CloseButtonOnClick() { this.Show(false); GameSoundSystem.GetInstance().PlayRandomSound(); if (closeCallback != null) { closeCallback(); closeCallback = null; } }
public void AboutButtonOnClick() { GameSoundSystem.GetInstance().PlayRandomSound(); string title = TextManager.GetText("about"); string content = TextManager.GetText("about_content"); GameSystem.GetInstance().gameUI.confirmMenu.SetStyle(28, NGUIText.Alignment.Left); GameSystem.GetInstance().gameUI.confirmMenu.SetContent(title, content, ConfirmStyle.OnlyYes); GameSystem.GetInstance().gameUI.confirmMenu.Show(true); }
public override void HandleAllBlockFinded() { if (result == Result.NotFinish) { GameSoundSystem.GetInstance().StopFlipRightSound(); GameSoundSystem.GetInstance().PlayFlipWrongSound(); GameSystem.GetInstance().gameCore.IsLevelWavePassed = false; GameSystem.GetInstance().ChangeState(GameSystem.States.WaveComplete); } }
public override void HandlePlaySound(Cell cell, bool isRight) { if (cell.CurrentColor == Constant.LEFT_COLOR || cell.CurrentColor == Constant.RIGHT_COLOR) { GameSoundSystem.GetInstance().PlayFlipRightSound(); } else { GameSoundSystem.GetInstance().PlayFlipWrongSound(); } }
public void SNSButtonOnClick() { if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android) { if (KTPlay.IsEnabled()) { KTPlay.Show(); } } GameSoundSystem.GetInstance().PlayRandomSound(); }
public void LoginButtonOnClick() { if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android) { if (KTPlay.IsEnabled()) { KTAccountManager.ShowLoginView(true, this, OnKTPlayLoginFinish); } } GameSoundSystem.GetInstance().PlayRandomSound(); }
public virtual void HandlePlaySound(Cell cell, bool isRight) { if (isRight) { GameSoundSystem.GetInstance().PlayFlipRightSound(); } else { GameSoundSystem.GetInstance().PlayFlipWrongSound(); } }
public void ModeButtonOnClick() { if (mode == GameSystem.Mode.Classic || GameSystem.GetInstance().CheckIsActivated()) { if (isUnlocked) { GameSoundSystem.GetInstance().PlayRandomSound(); ShowModeDetail(); } } }
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 VIPButtonOnClick() { if (GameSystem.GetInstance().CheckIsActivated()) { GameSoundSystem.GetInstance().PlayRandomSound(); string title = TextManager.GetText("confirm_buy_vip_gift_title"); string content = string.Format(TextManager.GetText("vip_gift_desc"), ShopData.GetShopData(IAPManager.IAPProduct.VIP).number); content = content.Replace('\n', ' '); //GameSystem.GetInstance().gameUI.vipConfirmMenu.SetConfirmCallback(ConfirmBuyVIPCallback); GameSystem.GetInstance().gameUI.vipConfirmMenu.SetContent(title, content); GameSystem.GetInstance().gameUI.vipConfirmMenu.Show(true); } }
public bool CheckIsActivated(Action <bool> confirmCallback = null, Action succeedCallback = null) { if (isActivated == false) { activeGameConfirmCallback = confirmCallback; activeGameSucceedCallback = succeedCallback; GameSoundSystem.GetInstance().PlayRandomSound(); gameUI.confirmMenu.SetCloseCallback(CloseActivateGameCallback); gameUI.confirmMenu.SetConfirmCallback(ConfirmActivateGameCallback); gameUI.confirmMenu.SetContent(TextManager.GetText("confirm_activate_game_title"), string.Format(TextManager.GetText("confirm_activate_game_content"), Constant.ACTIVATE_GAME_BONUS), ConfirmStyle.YesClose); gameUI.confirmMenu.Show(true); } return(isActivated); }
public void ShowCountDownSprite(int index) { foreach (GameObject countDownItem in countDownItems) { countDownItem.SetActive(false); } if (index >= 0 && index < countDownItems.Length) { GameSoundSystem.GetInstance().PlayCountDownSound(index); countDownItems[index].SetActive(true); foreach (TweenAlphaAdvance animScript in countDownAnimScripts[index]) { animScript.ResetToBeginning(); animScript.PlayForward(); } } }
public void CloseButtonOnClick() { if (nextCloseSoundAvailable) { GameSoundSystem.GetInstance().PlayRandomSound(); } else { nextCloseSoundAvailable = true; } DoShow(false); if (closeCallback != null) { closeCallback(); } if (newInstanceCalled == false) { ClearCallback(); } }
public void UnlockButtonOnClick() { if (GameSystem.GetInstance().CheckIsActivated()) { GameSoundSystem.GetInstance().PlayRandomSound(); if (mode == GameSystem.Mode.Inverse) { string tipText = string.Format(TextManager.GetText("unlock_inverse"), Constant.MODE_UNLOCK_COIN[(int)mode]); GameSystem.GetInstance().gameUI.confirmMenu.SetConfirmCallback(CannotUnlockModeCallback); GameSystem.GetInstance().gameUI.confirmMenu.DisableNextYesSound(); GameSystem.GetInstance().gameUI.confirmMenu.SetContent(tipText, null, ConfirmStyle.YesClose); GameSystem.GetInstance().gameUI.confirmMenu.SetYesButtonText(TextManager.GetText("trial")); GameSystem.GetInstance().gameUI.confirmMenu.Show(true); } else { if (canUnlock) { string tipText = string.Format(TextManager.GetText("cost_coin"), Constant.MODE_UNLOCK_COIN[(int)mode]); GameSystem.GetInstance().gameUI.blockConfirmMenu.CloseButtonVisible = true; GameSystem.GetInstance().gameUI.blockConfirmMenu.DisableNextNoSound(); GameSystem.GetInstance().gameUI.blockConfirmMenu.SetConfirmCallback(ConfirmUnlockModeWithCoinCallback); GameSystem.GetInstance().gameUI.blockConfirmMenu.SetContent(TextManager.GetText("confirm_unlock_mode_title"), tipText, ConfirmStyle.YesNoClose); GameSystem.GetInstance().gameUI.blockConfirmMenu.SetYesButtonText(TextManager.GetText("unlock")); GameSystem.GetInstance().gameUI.blockConfirmMenu.SetNoButtonText(TextManager.GetText("trial")); GameSystem.GetInstance().gameUI.blockConfirmMenu.Show(true); } else { string tipText = string.Format(TextManager.GetText("need_coin"), Constant.MODE_UNLOCK_COIN[(int)mode]); GameSystem.GetInstance().gameUI.blockConfirmMenu.CloseButtonVisible = false; GameSystem.GetInstance().gameUI.blockConfirmMenu.DisableNextYesSound(); GameSystem.GetInstance().gameUI.blockConfirmMenu.SetConfirmCallback(CannotUnlockModeCallback); GameSystem.GetInstance().gameUI.blockConfirmMenu.SetContent(TextManager.GetText("not_enough_coin"), tipText, ConfirmStyle.YesClose); GameSystem.GetInstance().gameUI.blockConfirmMenu.SetYesButtonText(TextManager.GetText("trial")); GameSystem.GetInstance().gameUI.blockConfirmMenu.Show(true); } } } }
public override void FlipCell(Cell cell, bool isRight) { if (isRight) { selectedCardNames.Add(cell.TextureName); if (OnSelectCardChanged != null) { OnSelectCardChanged(); } string cardNumberString = cell.TextureName.Substring(cell.TextureName.Length - 2, 2); int cardNumber = Convert.ToInt32(cardNumberString); int cardValue = PokerNumber2Value(cardNumber); selectedCardValues.Add(cardValue); result = GetSelectedCardResult(); if (result == Result.Win) { GameSystem.GetInstance().Score++; GameSystem.GetInstance().gameCore.IsLevelWavePassed = true; GameSystem.GetInstance().ChangeState(GameSystem.States.WaveComplete); } else if (result == Result.Lose) { GameSoundSystem.GetInstance().StopFlipRightSound(); GameSoundSystem.GetInstance().PlayFlipWrongSound(); GameSystem.GetInstance().gameCore.IsLevelWavePassed = false; GameSystem.GetInstance().ChangeState(GameSystem.States.WaveComplete); } else { GameSystem.GetInstance().Score++; } } else { cell.Type = Cell.CellType.Block; cell.Text = string.Empty; cell.TextureName = string.Empty; } }
// Update is called once per frame public void Update() { if (currentMusicData == null) { return; } if (isPause) { return; } if (power <= 0.0f) { time = (float)timeLine; return; } time += Time.deltaTime * (float)currentMusicData.speed; power -= Time.deltaTime * (float)currentMusicData.speed; if (time >= timeLine) { if (timeIndex >= currentMusicData.GetLength()) { this.Reset(); this.RandomMusic(); this.Play(); time += Time.deltaTime * (float)currentMusicData.speed; } timeLine += currentMusicData.timeLine[timeIndex]; int noteIndex = currentMusicData.notes[timeIndex]; AudioClip noteClip = null; if (noteIndex != 0) { noteClip = Resources.Load("Sounds/game/sound_" + noteIndex.ToString()) as AudioClip; //Debug.Log(string.Format("timeIndex : {0} Note : {1}", timeIndex, noteIndex)); } GameSoundSystem.GetInstance().commonSoundPlayer.PlayOneShot(noteClip); timeIndex++; } }
void Start() { coinLabel.text = string.Format("{0}", GameSystem.GetInstance().Coin); GameSystem.GetInstance().OnCoinChanged += HandleOnCoinChanged; muteButton.value = PlayerProfile.LoadMute(); EventDelegate.Add(muteButton.onChange, MuteButtonValueOnChange); GameSoundSystem.GetInstance().Mute = muteButton.value; shopButton.SetActive(Config.isStoreActive); moreGameLabel.text = Config.isMoreGameActive ? TextManager.GetText("more_game") : "..."; if (Application.platform == RuntimePlatform.IPhonePlayer) { versionLabel.text = "v" + iOSInterfaces.getAPPVersion(); foreach (GameObject modeObject in modeObjects) { if (modeObject.GetComponent <MoreModeButton>() != null) { modeObjects.Remove(modeObject); modeObject.SetActive(false); break; } } } else if (Application.platform == RuntimePlatform.Android) { versionLabel.text = "v" + AndroidInterfaces.CallGetAppVersion(); } #if UNITY_IPHONE || UNITY_ANDROID if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) { KTPlay.SetAvailabilityChangedCallback(this, KTPlayAvailabilityChanged); GA.UpdateOnlineConfig(); } #endif UpdateGiftButtonState(); RefreshVIPButtonState(); }
public void NoButtonOnClick() { if (nextNoSoundAvailable) { GameSoundSystem.GetInstance().PlayRandomSound(); } else { nextNoSoundAvailable = true; } if (nextCloseMenuAfterClickNoAvaiable) { DoShow(false); } if (confirmCallback != null) { confirmCallback(false); } if (newInstanceCalled == false) { ClearCallback(); } }