public override void Execute() { var adsEnabled = adsEnabledModel.AreAdsEnabled; HPlayerPrefs.DeleteAll(); adsEnabledModel.EnableAds(adsEnabled); }
public void SetCustom <T>(T obj) { var rawCustom = JsonUtility.ToJson(obj); var path = GetSavePath <T>(); HPlayerPrefs.SetString(path, rawCustom); }
public void SetSfxEnabled(bool value, bool save) { sfxEnabled = value; if (save) { HPlayerPrefs.SetBool(SFX_PLAYER_PREF, value); } }
public void SetMusicEnabled(bool value, bool save) { musicEnabled = value; if (save) { HPlayerPrefs.SetBool(MUSIC_PLAYER_PREF, value); } }
public T GetCustom <T>() where T : new() { var path = GetSavePath <T>(); if (HPlayerPrefs.HasKey(path)) { var rawCustom = HPlayerPrefs.GetString(path); return(JsonUtility.FromJson <T>(rawCustom)); } return(new T()); }
private void LoseGame() { #if !TEST_MODE HApi.Gameplay.LoseGame(); HPlayerPrefs.SetInt(ScoreIndicator.LastScoreSaveKey, _currentScore); int allTimeScore = HPlayerPrefs.GetInt(ScoreIndicator.LifeTimePlayerScoreSaveKey); HPlayerPrefs.SetInt(ScoreIndicator.LifeTimePlayerScoreSaveKey, allTimeScore + _currentScore); #endif _gameLost = true; _touchDown = false; _playerBehaviour.Enable(false); }
void InitializeSave() { if (HPlayerPrefs.HasKey(GetCustomizationItemsSaveKey())) { var rawSave = HPlayerPrefs.GetString(GetCustomizationItemsSaveKey()); CustomizationSave = JsonUtility.FromJson <CustomizationItemsSave>(rawSave); } else { CustomizationSave = new CustomizationItemsSave(); } }
public void Init() { Debug.Log("[Profile] Initializing..."); if (!HPlayerPrefs.HasKey(NICKNAME_KEY)) { Nickname = config.GetConfig <NicknamesConfig>().GetRandomNickname(); } if (!HPlayerPrefs.HasKey(AVATAR_KEY)) { Avatar = Random.Range(0, avatarsFactory.AvatarsCount); } }
void LoadFromCache() { Debug.LogFormat("[Utils] Loading texture from path: '{0}'.", path); var image = LoadLocalImage(path); if (image == null) { HPlayerPrefs.DeleteKey(url); DispatchError(); } else { sprite = Utils.GetSprite(image); DispatchSuccess(); } }
private void UpdateTouchAction() { if (_gamePaused) { return; } if (!_gameStarted && !_waitingForUserAction) { #if !TEST_MODE HApi.Gameplay.StartGame(); shouldShowArrow = false; bool tutorialPassed = HPlayerPrefs.GetBool(TutorialPassedKey); if (!tutorialPassed) { TutorialStarted.Invoke(); } #endif _gameStarted = true; _idleJetpackActive = false; _waitingForUserAction = false; GameStarted.Invoke(); _tutorial.SetHandActive(false); _playerBehaviour.SetIdleJetpackActive(false); _playerBehaviour.KickOff(); _playerBehaviour.ShowHud(); } else if (_waitingForUserAction) { _waitingForUserAction = false; _gameStarted = true; _gameLost = false; _idleJetpackActive = false; _playerBehaviour.SetIdleJetpackActive(false); _playerBehaviour.KickOff(); _tutorial.SetHandActive(false); GameContinuedAfterRestart.Invoke(_currentScore); } else { _playerBehaviour.OnTouchDown(); } }
private void Start() { _isInTutorial = !HPlayerPrefs.GetBool(GameplayController.TutorialPassedKey); GameplayController.GameStarted.AddListener(Setup); GameplayController.GameContinuedAfterRestart.AddListener(SetupAfterRestart); GameplayController.GameRestarted.AddListener(OnGameRestart); GameplayController.NewScoreReached.AddListener(OnNewScoreReached); _chunkPresets = ChunkController.Instance.ChunkPresets.ChunkPresets; _schemeQueue = new Queue <ChunkScheme>(); _shuffledSchemes = new List <ChunkScheme>(); _currentPreset = GetMatchingPreset(0); ReloadLevelSettings(_currentPreset); }
private void InitializeIndicators(int currentScore) { _highScore = HApi.Gameplay.GetBestScore(); if (_highScore <= 0) { return; } _baseScore = (int)Camera.main.transform.position.y - currentScore; PlaceIndicator(_scoreIndicator, _baseScore + _highScore, _highScoreColor, HighScoreText + _highScore); if (HApi.Utils.GetGamesPlayedCount() == 0) { return; } _avgScore = HPlayerPrefs.GetInt(LifeTimePlayerScoreSaveKey) / HApi.Utils.GetGamesPlayedCount(); if (_avgScore != _highScore) { PlaceIndicator(_scoreIndicator, _baseScore + _avgScore, _avgScoreColor, AvgScoreText + _avgScore); } }
internal static void SetCachedPath(string url, string path) { HPlayerPrefs.SetString(url, path); }
static string GetCachedPath(string url) { return(HPlayerPrefs.GetString(url, string.Empty)); }
protected override float GetValue() { return(HPlayerPrefs.GetFloat(key, defaultValue)); }
protected override int GetValue() { return(HPlayerPrefs.GetInt(key, defaultValue)); }
static bool HasNextBonusInitialized() { return(HPlayerPrefs.HasKey(CACHED_BONUS_ID_KEY) && HPlayerPrefs.HasKey(COLLECTING_TIMESTAMP_KEY)); }
static void Init() { HPlayerPrefs.DeleteAll(); }
protected override string GetValue() { return(HPlayerPrefs.GetString(key, defaultValue)); }
protected override void SetValue(string value) { HPlayerPrefs.SetString(key, value); }
public void OnTouchDown() { if (_gamePaused) { return; } if (!IsOnCooldown()) { if (_infiniteAmmo || _currentClipSize > 0) { bool isInPerfectPosition = _playerPresenter.IsInPerfectPosition(_movement.PerfectShootDeviation * (_isInTutorial ? 4.0f : 1.0f)); if (_isInTutorial) { if (!isInPerfectPosition) { return; } _tutorialShots++; GameplayController.ShowTutorialHand.Invoke(false); if (_tutorialShots >= _shotsRequiredToPassTutorial) { _isInTutorial = false; HPlayerPrefs.SetBool(GameplayController.TutorialPassedKey, true); Time.timeScale = 1.0f; Time.fixedDeltaTime = 0.02f * Time.timeScale; } } float verticalPower = _movement.VerticalDrawbackStrength; if (isInPerfectPosition) { PerfectShoot.Invoke(); verticalPower *= _movement.PerfectShootStrengthMultiplier; } _playerPresenter.FireBullet(_settings.Bullet); _playerPresenter.AddForce( _movement.HorizontalDrawbackStrength, verticalPower, _world.UpSideDownForceAdjustment); _playerPresenter.TweakRotationDirection(_movement.RotationSpeed); _currentClipSize--; _ammoPresenter.PopAmmo(_currentClipSize); _ammoPresenter.ToggleBlinking(_currentClipSize <= 3); PlayerShoot.Invoke(); _lastFireTime = Time.time; } else if (_currentClipSize <= 0 && _lastFireAttemptTime + FireAttemptCooldown < Time.time) { ShootAttapemtFailed.Invoke(); AudioController.Instance.PlaySound(SoundType.AmptyClip); _lastFireAttemptTime = Time.time; } } }
protected override bool GetValue() { return(HPlayerPrefs.GetBool(key)); }
protected override void SetValue(int value) { HPlayerPrefs.SetInt(key, value); }
protected override long GetValue() { return(HPlayerPrefs.GetLong(key)); }
public AudioSwitch() { sfxEnabled = HPlayerPrefs.GetBool(SFX_PLAYER_PREF, true); musicEnabled = HPlayerPrefs.GetBool(MUSIC_PLAYER_PREF, true); }
protected override void SetValue(float value) { HPlayerPrefs.SetFloat(key, value); }
protected override void SetValue(long value) { HPlayerPrefs.SetLong(key, value); }
protected override uint GetValue() { return(HPlayerPrefs.GetUInt(key)); }
static void ResetNextBonus() { HPlayerPrefs.DeleteKey(CACHED_BONUS_ID_KEY); HPlayerPrefs.DeleteKey(COLLECTING_TIMESTAMP_KEY); }
void SaveMyCusotomizationItems() { HPlayerPrefs.SetString(GetCustomizationItemsSaveKey(), JsonUtility.ToJson(CustomizationSave)); }