//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Save Preference //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected void SavePreference() { if (m_bSavePreference) { SavedPreferenceTool.SaveInt(m_sSavedKeyPreference, SelectedIndex); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Start //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void Start() { if (m_bUseSavedOption) { SetValue(SavedPreferenceTool.GetFloat(m_sSavedOptionKey, m_fDefaultValue)); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: On Disable //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected override void OnDisable() { base.OnDisable(); m_rSettingsMenuManager.gameObject.SetActive(true); float newTambSize = 0.731f; m_rInstrumentZoomHandler.SetValue(SavedPreferenceTool.GetFloat("SizePreference", newTambSize)); m_rTextBoxTransitionEffect.m_aRevealAnimationEffect[0].m_vEndPosition = m_vSavedOriginalTextBoxPosition; if (m_oRedTambourineAreaInfo.instrumentHighlight != null) { m_oRedTambourineAreaInfo.instrumentHighlight.gameObject.SetActive(false); } if (m_oBlueTambourineAreaInfo.instrumentHighlight != null) { m_oBlueTambourineAreaInfo.instrumentHighlight.gameObject.SetActive(false); } if (m_oGreenTambourineAreaInfo.instrumentHighlight != null) { m_oGreenTambourineAreaInfo.instrumentHighlight.gameObject.SetActive(false); } if (m_oTambourineJingleInfo.instrumentHighlight != null) { m_oTambourineJingleInfo.instrumentHighlight.gameObject.SetActive(false); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: On Challenge Finish //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void OnChallengeFinish() { // Show Results? bool bShowResults = m_eChallengeActivity == ChallengeActivity.CHALLENGE_MODE; // Was Challenge Mode? Then we can update the feathers as needed if (bShowResults && !TutorialManager_Base.TutorialOpened) { ChallengeGameScoreManager.ScoreResult eScoreResult = ChallengeGameScoreManager.GetScoreResult(Mathf.CeilToInt(sm_fScore * 100.0f)); int iChallengeScore = (eScoreResult == ChallengeGameScoreManager.ScoreResult.TERRIBLE) ? 0 : (eScoreResult == ChallengeGameScoreManager.ScoreResult.OKAY) ? 1 : (eScoreResult == ChallengeGameScoreManager.ScoreResult.GOOD) ? 2 : 3; int iCompletionCount = SavedPreferenceTool.GetInt(m_ePlaylistTrack.ToString() + "_FeatherCount", 0); if (iChallengeScore > iCompletionCount) { ChallengeFeathersInfo.NewlyObtainedFeathers = (iChallengeScore - iCompletionCount); SavedPreferenceTool.SaveInt(m_ePlaylistTrack.ToString() + "_FeatherCount", iChallengeScore); // Save to the Challenge itself, now you'll see these feathers light up when in the challenge select! ChallengeFeathersInfo.AccumulatedFeathers += ChallengeFeathersInfo.NewlyObtainedFeathers; // Add to the total accumulated Feathers } else { ChallengeFeathersInfo.NewlyObtainedFeathers = 0; } } // Stop Active Challenge! m_rGameManager.StopChallenge(bShowResults); StopBackingTrack(); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Set Instrument Mode //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void SetInstrumentMode(InstrumentMode eMode) { if (m_eCurrentInstrumentMode != eMode) { // Disable Currently Active Instrument DisableInstrument(m_eCurrentInstrumentMode); bool bActivateTargets = m_arTambourineTargets[(int)m_eCurrentInstrumentMode].Visible; // Make the switch, saving to memory so that the app uses this same instrument next time app is loaded m_eCurrentInstrumentMode = eMode; SavedPreferenceTool.SaveInt("InstrumentMode", (int)eMode); // Activate next instrument and put it into the normal display state ActivateInstrument(eMode); ShowNormalInstrumentState(); if (bActivateTargets) { m_arTambourineTargets[(int)eMode].ShowTargets(); } else { m_arTambourineTargets[(int)eMode].HideTargets(); } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: On Release //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected override void OnRelease() { base.OnRelease(); if (m_bSaveOption) { SavedPreferenceTool.SaveFloat(m_sSavedOptionKey, GetPercentage()); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived method: On Enable //---------------------------------------------------- // : Checks to make sure that the slider is still in // the correct position //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected override void OnEnable() { base.OnEnable(); // Place into correct area of slider if (m_bSaveOption) { SetPosition(SavedPreferenceTool.GetFloat(m_sSavedOptionKey, GetPercentage())); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Start //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected override void Start() { base.Start(); KeepPressedEvenWithNoContact = true; // If saving the slider into an external save system if (m_bSaveOption) { SetPosition(SavedPreferenceTool.GetFloat(m_sSavedOptionKey, GetPercentage())); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Load Saved Preference //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected void LoadSavedPreference() { if (m_bSavePreference) { int newIndex = SavedPreferenceTool.GetInt(m_sSavedKeyPreference, m_iSelectedIndex); if (newIndex != m_iSelectedIndex) { int previousIndex = m_iSelectedIndex; m_iSelectedIndex = newIndex; OnLoadSavedIndex(previousIndex); } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Awake //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void Awake() { // Switch to the appropriate instrument type, saved during the last game. Can only change Instruments permanently in full version of app~ InstrumentMode eSavedInstrumentMode = m_eCurrentInstrumentMode; //if(GameManager.IsFullVersion) eSavedInstrumentMode = (InstrumentMode)SavedPreferenceTool.GetInt("InstrumentMode", (int)InstrumentMode.RIQ_TAMBOURINE); if (eSavedInstrumentMode != m_eCurrentInstrumentMode) { SetInstrumentMode(eSavedInstrumentMode); } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: On Enable //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected override void OnEnable() { base.OnEnable(); float newTambSize = 0.731f; m_bPriorTambTargetsVisible = m_rInstrumentManager.InstrumentColoursManager.Visible; m_ePriorInstrumentMode = (InstrumentManager.InstrumentMode)SavedPreferenceTool.GetInt("InstrumentMode"); m_fPriorShakeSensitivity = SavedPreferenceTool.GetFloat("SensitivityPreference", 1.0f); m_fPriorInstrumentSize = SavedPreferenceTool.GetFloat("SizePreference", newTambSize); m_rInstrumentManager.CurrentInstrumentMode = InstrumentManager.InstrumentMode.RIQ_TAMBOURINE; m_rShakeDetector.ShakeSensitivity = 1.0f; m_rTambourineZoomHandler.SetValue(newTambSize); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Toggle Awarded Feathers //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void ToggleAwardedFeathers() { int completionCount = SavedPreferenceTool.GetInt(m_eChallengeID.ToString() + "_FeatherCount", 0); for (int i = 0; i < m_arAwardedFeathersNotifier.Length; ++i) { if (i < completionCount) { m_arAwardedFeathersNotifier[i].ShowActiveFeather(); } else { m_arAwardedFeathersNotifier[i].ShowInactiveFeather(); } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Activate Game //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void ActivateGame() { SavedPreferenceTool.SaveInt("SeenTitleIntroSequence", 1); ButtonManager.ToggleAllButtons(true); if (m_agoGameActivationObjectsToEnable != null && m_agoGameActivationObjectsToEnable.Length > 0) { foreach (GameObject Obj in m_agoGameActivationObjectsToEnable) { if (Obj != null) { Obj.SetActive(true); } } } ProceedToNextPhase(); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Start //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected override void Start() { base.Start(); if (SavedPreferenceTool.GetInt("SeenTitleIntroSequence", 0) == 0) { this.gameObject.SetActive(false); } else { for (int i = 0; i < m_arDisplayAnimation.Length; ++i) { m_arDisplayAnimation[i].Setup(this.transform); } for (int i = 0; i < m_arTextDisplayAnimation.Length; ++i) { m_arTextDisplayAnimation[i].Setup(TextRenderer.transform); } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Exit Tutorial //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected virtual void ExitTutorial() { TutorialOpened = false; StartCoroutine(FadeoutTutorial()); SavedPreferenceTool.SaveBool(m_sPlayerPrefsID, true); // Completed Tutorial; save that so that it doesn't start automatically again next time }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Start //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void Start() { ToggleNewSelection(SavedPreferenceTool.GetInt("SelectedChallengeDifficulty", 0)); }