Esempio n. 1
0
    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);
        }
    }
Esempio n. 2
0
        private void Update()
        {
            var colors = button.colors;

            colors.colorMultiplier = PlayerPrefsExt.GetStringArray("mods", new string[0]).Contains(Mod) ? 1f : 0.5f;
            button.colors          = colors;
        }
Esempio n. 3
0
 public void AutoHoover(bool on)
 {
     autoHooverOn = on;
     autoHooverOff.SetActive(!autoHooverOn);
     PlayerPrefsExt.SetBool(SaveStrings.sAutoHoover, autoHooverOn);
     autoHooveDialog.SetActive(false);
 }
Esempio n. 4
0
    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.##") + "%";
        }
    }
Esempio n. 7
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");
        }
    }
Esempio n. 9
0
    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);
        }
    }
Esempio n. 10
0
 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);
     }
 }
Esempio n. 11
0
    // Start is called before the first frame update
    void Start()
    {
        bool sfxTogglePrefs = PlayerPrefsExt.GetBool("SFXToggle");

        sfx.SetActive(sfxTogglePrefs);
        checkmark.SetActive(sfxTogglePrefs);
        clicked = !clicked;
    }
Esempio n. 12
0
 private void Start()
 {
     if (!PlayerPrefsExt.GetBool("show_scanner", defaultValue: true))
     {
         spriteRenderer.enabled = false;
     }
     spriteRenderer.sortingOrder = 30100;
 }
Esempio n. 13
0
    // Start is called before the first frame update
    void Start()
    {
		bool musicTogglePrefs = PlayerPrefsExt.GetBool("MusicToggle");
		AudioSourceToggle(musicTogglePrefs);
		checkmark.SetActive(musicTogglePrefs);
		clicked = musicTogglePrefs;
		CheckMarkToggle();
	}
Esempio n. 14
0
 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);
     }
 }
Esempio n. 16
0
    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);
        }
    }
Esempio n. 17
0
 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);
 }
Esempio n. 18
0
 static public TimeSpan GetTimeSpanEncrypted(string key, TimeSpan defaultValue)
 {
     try {
         string stringRep = PlayerPrefsExt.GetStringEncrypted(key, "NoValue");
         return(new TimeSpan(Convert.ToInt64(stringRep)));
     }
     catch {
         return(defaultValue);
     }
 }
Esempio n. 19
0
 static public long GetLongEncrypted(string key, long defaultValue = 0)
 {
     try {
         string stringRep = PlayerPrefsExt.GetStringEncrypted(key, "NoValue");
         return(Convert.ToInt64(stringRep));
     }
     catch {
         return(defaultValue);
     }
 }
Esempio n. 20
0
 static public float GetFloatEncrypted(string key, float defaultValue = 0)
 {
     try {
         string stringRep = PlayerPrefsExt.GetStringEncrypted(key, "NoValue");
         return(Convert.ToSingle(stringRep));
     }
     catch {
         return(defaultValue);
     }
 }
Esempio n. 21
0
 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) => {});
     }
 }
Esempio n. 22
0
        private void Awake()
        {
            toggle = GetComponentInChildren <Toggle>();
            toggle.onValueChanged.AddListener(OnValueChanged);
            if (!PlayerPrefs.HasKey(Key))
            {
                PlayerPrefsExt.SetBool(Key, toggle.isOn);
            }

            toggle.isOn = PlayerPrefsExt.GetBool(Key);
        }
Esempio n. 23
0
 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) => {});
     }
 }
Esempio n. 24
0
    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;
        }
    }
Esempio n. 25
0
 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);
         }
     }
 }
Esempio n. 26
0
        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();
     });
 }
Esempio n. 28
0
 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";
    }
Esempio n. 30
0
 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);
     }
 }