void Awake() { instance = this; DontDestroyOnLoad(gameObject); //Set music on or off if (PlayerPrefs.HasKey(SaveStrings.sMusic)) { musicMuted = PlayerPrefsExt.GetBool(SaveStrings.sMusic); } else { musicMuted = false; PlayerPrefsExt.SetBool(SaveStrings.sMusic, musicMuted); } //Set sounds on or off if (PlayerPrefs.HasKey(SaveStrings.sSounds)) { soundMuted = PlayerPrefsExt.GetBool(SaveStrings.sSounds); } else { soundMuted = false; PlayerPrefsExt.SetBool(SaveStrings.sSounds, soundMuted); } }
private void Update() { var colors = button.colors; colors.colorMultiplier = PlayerPrefsExt.GetStringArray("mods", new string[0]).Contains(Mod) ? 1f : 0.5f; button.colors = colors; }
public void AutoHoover(bool on) { autoHooverOn = on; autoHooverOff.SetActive(!autoHooverOn); PlayerPrefsExt.SetBool(SaveStrings.sAutoHoover, autoHooverOn); autoHooveDialog.SetActive(false); }
public virtual void Clear(NoteGrade grade) { if (IsCleared || grade == NoteGrade.Undetermined) { return; } IsCleared = true; Game.OnClear(this); View.OnClear(grade); if (!(Game.Instance is StoryboardGame)) { StartCoroutine(DestroyLater()); } if (TimeUntilEnd > -5) // Prevent storyboard seeking { EventKit.Broadcast("note clear", this); } // Hit sound if (grade != NoteGrade.Miss && (!(this is HoldNote) || !PlayerPrefsExt.GetBool("early hit sounds"))) { PlayHitSound(); } // gameObject.GetComponent<SpriteRenderer> ().material.SetFloat("_HRate", 1.0f); // Animation speed = 1.0f; }
public void SwitchRankedMode() { if (isLoggingIn) { Popup.Make(this, "Now signing in, please wait..."); return; } if (LocalProfile.Exists()) { var ranked = PlayerPrefsExt.GetBool(PreferenceKeys.RankedMode(), false); ranked = !ranked; PlayerPrefsExt.SetBool(PreferenceKeys.RankedMode(), ranked); rankStatusText.text = ranked ? "On" : "Off"; UpdateBestText(); if (ranked && !PlayerPrefsExt.GetBool("dont_show_what_is_ranked_mode_again", false)) { UIManager.ShowUiElement("WhatIsRankedModeBackground", "MusicSelection"); UIManager.ShowUiElement("WhatIsRankedModeRoot", "MusicSelection"); } } else { UIManager.ShowUiElement("LoginRoot", "MusicSelection"); UIManager.ShowUiElement("LoginBackground", "MusicSelection"); } }
public void UpdateBestText() { if (LoadedLevel == null) { return; } bool ranked = PlayerPrefsExt.GetBool(PreferenceKeys.RankedMode()); if (Math.Abs(ZPlayerPrefs.GetFloat( PreferenceKeys.BestScore(LoadedLevel, CytoidApplication.CurrentChartType, ranked), defaultValue: -1) - (-1)) < 0.000001) { bestText.text = "NO HIGH SCORE YET"; } else { bestText.text = (ranked ? "R score" : "Score") + " " + Mathf.CeilToInt(ZPlayerPrefs.GetFloat( PreferenceKeys.BestScore(LoadedLevel, CytoidApplication.CurrentChartType, ranked), 0)).ToString("D6") + " " + (ranked ? "R acc." : "Acc.") + " " + ZPlayerPrefs.GetFloat( PreferenceKeys.BestAccuracy(LoadedLevel, CytoidApplication.CurrentChartType, ranked), 0).ToString("0.##") + "%"; } }
// Use this for initialization protected virtual void Awake() { levelManager = GameObject.FindObjectOfType <LevelManager>(); gameManager = GameObject.FindObjectOfType <GameManager>(); unlocked = PlayerPrefsExt.GetBool(copterName + "Unlocked") || unlocked; UpdateMethod = NormalUpdate; copterSprite = GetComponent <SpriteRenderer>().sprite; copterUpgrades = new Dictionary <string, Upgradable>(); AddUpgradables(); input = new CopterInput(); RegisterListeners(); input.InputUpdate += HandleInput; input.TouchStart += TouchStarted; input.TouchEnd += TouchEnded; input.IdleUpdate += IdleInput; copterBody = GetComponent <Rigidbody2D>(); copterScale = transform.localScale.x; SaveCopter(); }
public void SwitchRankedMode() { if (isLoggingIn) { Popup.Make(this, "Now signing in, please wait..."); return; } if (OnlinePlayer.Authenticated) { var ranked = PlayerPrefsExt.GetBool("ranked", false); ranked = !ranked; PlayerPrefsExt.SetBool("ranked", ranked); rankStatusText.text = ranked ? "On" : "Off"; UpdateBestText(); if (ranked && !PlayerPrefsExt.GetBool("dont_show_what_is_ranked_mode_again", false)) { UIManager.ShowUiElement("WhatIsRankedModeBackground", "MusicSelection"); UIManager.ShowUiElement("WhatIsRankedModeRoot", "MusicSelection"); } if (ranked) { EventKit.Broadcast("reload rankings"); } } else { UIManager.ShowUiElement("LoginRoot", "MusicSelection"); UIManager.ShowUiElement("LoginBackground", "MusicSelection"); } }
void OnLevelWasLoaded(int level) { if (GameObject.Find("LoadImage") != null) { GameObject.Find("LoadImage").transform.localScale = new Vector3(1f, 0f, 1f); } if (GameObject.Find("EventSystem") != null) { GameObject.Find("EventSystem").GetComponent <EventSystem>().pixelDragThreshold = (int)(pixelDragThresholdMultiplier * ((float)Screen.width / (float)Screen.height)); } //Quit the game when player press back button if (level == 1) { EventManager.StartListening(SaveStrings.eEscape, Application.Quit); } else { EventManager.StopListening(SaveStrings.eEscape, Application.Quit); } Time.timeScale = 1; if (level == 1 && !PlayerPrefs.HasKey("FirstLogin")) { PlayerPrefsExt.SetBool("FirstLogin", true); GameManager.LoadLevel("GameStory"); return; } if (level == 1 && showLevelEnd) { GameObject.Find("LevelEnd").GetComponent <LevelEndManager>().UpdateLevelEnd(this); SaveLoad.SaveWallet(wallet); } }
public void SetChannelMaskOn(int channel, bool isOn) { if (this.ChannelMaskOnList.ContainsKey(channel)) { this.ChannelMaskOnList.set_Item(channel, isOn); PlayerPrefsExt.SetBool("CHANNEL_MASK_TAG" + channel, isOn); } }
// Start is called before the first frame update void Start() { bool sfxTogglePrefs = PlayerPrefsExt.GetBool("SFXToggle"); sfx.SetActive(sfxTogglePrefs); checkmark.SetActive(sfxTogglePrefs); clicked = !clicked; }
private void Start() { if (!PlayerPrefsExt.GetBool("show_scanner", defaultValue: true)) { spriteRenderer.enabled = false; } spriteRenderer.sortingOrder = 30100; }
// Start is called before the first frame update void Start() { bool musicTogglePrefs = PlayerPrefsExt.GetBool("MusicToggle"); AudioSourceToggle(musicTogglePrefs); checkmark.SetActive(musicTogglePrefs); clicked = musicTogglePrefs; CheckMarkToggle(); }
public static void Save(Level level) { PlayerPrefsExt.SetBool(level.name + "Star1", level.star1); PlayerPrefsExt.SetBool(level.name + "Star2", level.star2); PlayerPrefsExt.SetBool(level.name + "Star3", level.star3); PlayerPrefsExt.SetBool(level.name + "Ruby", level.rubyFound); PlayerPrefsExt.SetBool(level.name + "Unlocked", level.unlocked); PlayerPrefs.SetFloat(level.name + "BestTime", level.bestTime); }
public void SetBulletCurtainOn(int channel, bool isOn) { if (this.IsBulletCurtainOnList.ContainsKey(channel)) { this.IsBulletCurtainOnList.set_Item(channel, isOn); PlayerPrefsExt.SetBool("IsBulletCurtainOn" + channel, isOn); this.ShowBulletCurtainUnits(channel, isOn); } }
public void LoadInfo() { if (PlayerPrefs.HasKey(name + "Star1")) { star1 = PlayerPrefsExt.GetBool(name + "Star1"); } else { PlayerPrefsExt.SetBool(name + "Star1", false); } if (PlayerPrefs.HasKey(name + "Star2")) { star2 = PlayerPrefsExt.GetBool(name + "Star2"); } else { PlayerPrefsExt.SetBool(name + "Star2", false); } if (PlayerPrefs.HasKey(name + "Star3")) { star3 = PlayerPrefsExt.GetBool(name + "Star3"); } else { PlayerPrefsExt.SetBool(name + "Star3", false); } if (PlayerPrefs.HasKey(name + "Ruby")) { rubyFound = PlayerPrefsExt.GetBool(name + "Ruby"); } else { PlayerPrefsExt.SetBool(name + "Ruby", false); } if (PlayerPrefs.HasKey(name + "Unlocked")) { unlocked = PlayerPrefsExt.GetBool(name + "Unlocked"); } else { PlayerPrefsExt.SetBool(name + "Unlocked", false); } if (PlayerPrefs.HasKey(name + "BestTime")) { bestTime = PlayerPrefs.GetFloat(name + "BestTime"); } else { PlayerPrefs.SetFloat(name + "BestTime", 999f); } }
public static void MuteSounds(bool mute) { instance.soundMuted = mute; SoundObject[] so = GameObject.FindObjectsOfType <SoundObject>(); foreach (SoundObject s in so) { s.Mute(mute); } PlayerPrefsExt.SetBool(SaveStrings.sSounds, mute); }
static public TimeSpan GetTimeSpanEncrypted(string key, TimeSpan defaultValue) { try { string stringRep = PlayerPrefsExt.GetStringEncrypted(key, "NoValue"); return(new TimeSpan(Convert.ToInt64(stringRep))); } catch { return(defaultValue); } }
static public long GetLongEncrypted(string key, long defaultValue = 0) { try { string stringRep = PlayerPrefsExt.GetStringEncrypted(key, "NoValue"); return(Convert.ToInt64(stringRep)); } catch { return(defaultValue); } }
static public float GetFloatEncrypted(string key, float defaultValue = 0) { try { string stringRep = PlayerPrefsExt.GetStringEncrypted(key, "NoValue"); return(Convert.ToSingle(stringRep)); } catch { return(defaultValue); } }
void SaveRecord() { // In playerprefs PlayerPrefsExt.SetTimeSpanEncrypted(TIME_TRIAL_RECORD_PLAYERPREF_ID, _curRecord); // In google play services if active if (Social.localUser.authenticated) { long miliseconds = _curRecord.Ticks / TimeSpan.TicksPerMillisecond; Social.ReportScore(miliseconds, TIME_TRIAL_LEADERBOARD_ID, (bool success) => {}); } }
private void Awake() { toggle = GetComponentInChildren <Toggle>(); toggle.onValueChanged.AddListener(OnValueChanged); if (!PlayerPrefs.HasKey(Key)) { PlayerPrefsExt.SetBool(Key, toggle.isOn); } toggle.isOn = PlayerPrefsExt.GetBool(Key); }
void SaveRecord() { // In playerprefs PlayerPrefsExt.SetFloatEncrypted(AREA_ATTACK_RECORD_PLAYERPREF_ID, _curRecord); // In google play services if active if (Social.localUser.authenticated) { long threeDecimals = FloatToLongThreeDecimal(_curRecord); Social.ReportScore(threeDecimals, AREA_ATTACK_LEADERBOARD_ID, (bool success) => {}); } }
public IEnumerator LoginCoroutine() { if (OnlinePlayer.Authenticated || !PlayerPrefs.HasKey(PreferenceKeys.LastUsername()) || !PlayerPrefs.HasKey(PreferenceKeys.LastPassword())) { isLoggingIn = false; yield break; } // If not logged in previously yield return(OnlinePlayer.Authenticate()); CloseLoginWindows(); isLoggingIn = false; var authenticationResult = OnlinePlayer.LastAuthenticationResult; switch (authenticationResult.status) { case 0: Popup.Make(this, "Signed in."); rankStatusText.text = PlayerPrefsExt.GetBool("ranked") ? "On" : "Off"; StartCoroutine(LoadAvatarCoroutine()); if (PlayerPrefsExt.GetBool("ranked")) { EventKit.Broadcast("reload rankings"); } BestScoreText.WillInvalidate = true; break; case -1: LoadedAvatar = true; Popup.Make(this, "Could not fetch player data."); break; case 1: // User not exist LoadedAvatar = true; Popup.Make(this, authenticationResult.message); PlayerPrefs.DeleteKey(PreferenceKeys.LastUsername()); PlayerPrefs.DeleteKey(PreferenceKeys.LastPassword()); usernameInput.text = ""; passwordInput.text = ""; break; case 2: // Incorrect password LoadedAvatar = true; Popup.Make(this, authenticationResult.message); PlayerPrefs.DeleteKey(PreferenceKeys.LastPassword()); passwordInput.text = ""; break; } }
public void SetChannelTipOn(int channel, bool isOn) { if (this.ChannelTipOnList.ContainsKey(channel)) { this.ChannelTipOnList.set_Item(channel, isOn); PlayerPrefsExt.SetBool("CHANNEL_TIP_TAG" + channel, isOn); if (channel == 4 && !isOn) { ChatManager.Instance.SetChannelPrivateTip(false); } } }
private void ReloadRankings() { if (!OnlinePlayer.Authenticated || !PlayerPrefsExt.GetBool("ranked")) { return; } if (reloadCoroutine != null) { StopCoroutine(reloadCoroutine); } reloadCoroutine = StartCoroutine(ReloadRankingsCoroutine()); }
private BulletCurtainManager() { this.IsBulletCurtainOnList.set_Item(1, PlayerPrefsExt.GetBool("IsBulletCurtainOn" + 1, false)); this.IsBulletCurtainOnList.set_Item(2, PlayerPrefsExt.GetBool("IsBulletCurtainOn" + 2, false)); this.IsBulletCurtainOnList.set_Item(32, PlayerPrefsExt.GetBool("IsBulletCurtainOn" + 32, true)); this.IsBulletCurtainOnList.set_Item(128, PlayerPrefsExt.GetBool("IsBulletCurtainOn" + 128, false)); this.IsBulletCurtainOnList.set_Item(4, PlayerPrefsExt.GetBool("IsBulletCurtainOn" + 4, true)); BulletCurtainManager.CreatePools(); TimerHeap.AddTimer(0u, 1000, delegate { this.CheckStack(); }); }
private ChatManager() { this.ChannelTipOnList.set_Item(4, PlayerPrefsExt.GetBool("CHANNEL_TIP_TAG" + 4, true)); this.ChannelMaskOnList.set_Item(1, PlayerPrefsExt.GetBool("CHANNEL_TIP_TAG" + 1, false)); this.ChannelMaskOnList.set_Item(2, PlayerPrefsExt.GetBool("CHANNEL_TIP_TAG" + 2, false)); this.ChannelMaskOnList.set_Item(32, PlayerPrefsExt.GetBool("CHANNEL_TIP_TAG" + 32, false)); this.ChannelMaskOnList.set_Item(128, PlayerPrefsExt.GetBool("CHANNEL_TIP_TAG" + 128, false)); BulletCurtainManager.Instance.Init(); ChatManager.CreatePools(); this.InitChatQueues(); this.m_talkTime = int.Parse(GameDataUtils.SplitString4Dot0(DataReader <GlobalParams> .Get("talkTime").value)); this.m_talkRepeatNum = int.Parse(GameDataUtils.SplitString4Dot0(DataReader <GlobalParams> .Get("talkRepeatNum").value)); }
public void Logout() { CancelLogin(); PlayerPrefs.DeleteKey(PreferenceKeys.LastUsername()); PlayerPrefs.DeleteKey(PreferenceKeys.LastPassword()); CloseProfileWindows(); avatarImage.overrideSprite = null; LocalProfile.reset(); Popup.Make(this, "Signed out."); PlayerPrefsExt.SetBool(PreferenceKeys.RankedMode(), false); rankStatusText.text = "Off"; }
public void TrySendCacheOrderToPHP() { if (SDKManager.Instance.IsAndroidYSDK()) { string stringPrefs = PlayerPrefsExt.GetStringPrefs("YSDK_ORDER_RECORD"); Debug.Log("TrySendCacheOrderToPHP: URL = " + stringPrefs); if (string.IsNullOrEmpty(stringPrefs)) { return; } this.SubmitExtendData(null, SDKManager.SubmitTypeURLToPHP, stringPrefs); PlayerPrefsExt.SetStringPrefs("YSDK_ORDER_RECORD", string.Empty); } }