예제 #1
0
 private void SaveData()
 {
     PlayerPrefsUtils.SetBool(RandomColorKey, _randomColorOnStart);
     PlayerPrefsUtils.SetColor(ColorKey, _ballColor);
     PlayerPrefs.SetInt(BestScoreKey, _bestScore);
     PlayerPrefsUtils.SetEnum(ControlTypeKey, _controlType);
 }
예제 #2
0
 private void LoadData()
 {
     _randomColorOnStart = PlayerPrefsUtils.GetBool(RandomColorKey, true);
     _ballColor          = PlayerPrefsUtils.GetColor(ColorKey, Color.white);
     _bestScore          = PlayerPrefs.GetInt(BestScoreKey, 0);
     _controlType        = PlayerPrefsUtils.GetEnum(ControlTypeKey, ControlType.ControlPanels);
 }
    public IEnumerator TaskbarNotificationBadgeHasCorrectValue()
    {
        PlayerPrefsUtils.SetInt(FriendsHUDController.PLAYER_PREFS_SEEN_FRIEND_COUNT, 0);

        var friendsRequestBadge = GetBadge("NotificationBadge_FriendsRequestTab");
        var friendsTaskbarBadge = GetBadge("NotificationBadge_FriendsButton");

        controller.SetVisibility(false);

        yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-1"));

        yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-2"));

        yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-3"));

        yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-4"));

        yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-5", FriendshipAction.REQUESTED_FROM));

        Assert.AreEqual(1, friendsRequestBadge.finalValue);
        Assert.AreEqual(5, friendsTaskbarBadge.finalValue);

        controller.SetVisibility(true);

        Assert.AreEqual(1, friendsRequestBadge.finalValue);
        Assert.AreEqual(1, friendsTaskbarBadge.finalValue);

        yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-5", FriendshipAction.APPROVED));

        yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, "friend-6", FriendshipAction.REQUESTED_FROM));

        Assert.AreEqual(1, friendsRequestBadge.finalValue);
        Assert.AreEqual(1, friendsTaskbarBadge.finalValue);
    }
    private void UpdateNotificationsCounter()
    {
        //NOTE(Brian): If friends tab is already active, update and save this value instantly
        if (view.friendsList.gameObject.activeInHierarchy)
        {
            PlayerPrefsUtils.SetInt(PLAYER_PREFS_SEEN_FRIEND_COUNT, friendsController.friendCount);
            PlayerPrefsUtils.Save();
        }

        var pendingFriendRequestsSO = NotificationScriptableObjects.pendingFriendRequests;
        int receivedRequestsCount   = view.friendRequestsList.receivedRequestsList.Count();

        if (pendingFriendRequestsSO != null)
        {
            pendingFriendRequestsSO.Set(receivedRequestsCount);
        }

        int seenFriendsCount = PlayerPrefs.GetInt(PLAYER_PREFS_SEEN_FRIEND_COUNT, 0);
        int friendsCount     = friendsController.friendCount;

        int newFriends = friendsCount - seenFriendsCount;

        //NOTE(Brian): If someone deletes you, don't show badge notification
        if (newFriends < 0)
        {
            newFriends = 0;
        }

        var newApprovedFriendsSO = NotificationScriptableObjects.newApprovedFriends;

        if (newApprovedFriendsSO != null)
        {
            newApprovedFriendsSO.Set(newFriends);
        }
    }
예제 #5
0
 private void UpdateSettings()
 {
     MatchDuration.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.MatchDuration,
                                              Properties.PlayerPrefsDefault.MatchDuration);
     HealthPoints.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.HealthPoints,
                                             Properties.PlayerPrefsDefault.HealthPoints);
     CanonDamage.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.CanonDamage,
                                            Properties.PlayerPrefsDefault.CanonDamage);
     CanonPower.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.CanonPower,
                                           Properties.PlayerPrefsDefault.CanonPower);
     TurretSpeed.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.TurretSpeed,
                                            Properties.PlayerPrefsDefault.TurretSpeed);
     ReloadTime.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.ReloadTime,
                                           Properties.PlayerPrefsDefault.ReloadTime);
     WaypointSeekRadius.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.WaypointSeekRadius,
                                                   Properties.PlayerPrefsDefault.WaypointSeekRadius);
     ExplosionDamage.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.ExplosionDamage,
                                                Properties.PlayerPrefsDefault.ExplosionDamage);
     ExplosionRadius.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.ExplosionRadius,
                                                Properties.PlayerPrefsDefault.ExplosionRadius);
     ExplosionCreateBustedTank.isOn = PlayerPrefsUtils.GetBool(Properties.PlayerPrefs.ExplosionCreateBustedTank,
                                                               Properties.PlayerPrefsDefault.ExplosionCreateBustedTank);
     SecondsBetweenRefresh.Value = PlayerPrefs.GetFloat(Properties.PlayerPrefs.SecondsBetweenRefresh,
                                                        Properties.PlayerPrefsDefault.SecondsBetweenRefresh);
     AlwaysPickBestChoice.isOn = PlayerPrefsUtils.GetBool(Properties.PlayerPrefs.AlwaysPickBestChoice,
                                                          Properties.PlayerPrefsDefault.AlwaysPickBestChoice);
     GridGap.Value = PlayerPrefs.GetFloat(Properties.PlayerPrefs.GridGap,
                                          Properties.PlayerPrefsDefault.GridGap);
     BonusPerSpawnNumber.Value = PlayerPrefs.GetFloat(Properties.PlayerPrefs.BonusPerSpawnNumber,
                                                      Properties.PlayerPrefsDefault.BonusPerSpawnNumber);
     BonusPerSpawnFrequency.Value = PlayerPrefs.GetFloat(Properties.PlayerPrefs.BonusPerSpawnFrequency,
                                                         Properties.PlayerPrefsDefault.BonusPerSpawnFrequency);
 }
예제 #6
0
    public void SaveCurrentRank(LevelRank rank)
    {
        userData.ranks[currentLevel] = (int)rank;

        PlayerPrefsUtils.SetObject(USER_DATA_KEY, userData);
        PlayerPrefs.Save();
    }
예제 #7
0
        public void ReadSettingDataFromPlayerPrefs()
        {
            SettingDataToPlayerPrefs settingData = PlayerPrefsUtils.GetValueFromPlayerPrefs <SettingDataToPlayerPrefs>("SettingData" + GetPlayerId());

            musicChoose          = settingData.musicChoose == 0 ? 1 : settingData.musicChoose;
            soundChoose          = settingData.soundChoose == 0 ? 1 : settingData.soundChoose;
            damageNumChoose      = settingData.damageNumChoose == 0 ? 1 : settingData.damageNumChoose;
            displayBarChoose     = settingData.displayBarChoose == 0 ? 1 : settingData.displayBarChoose;
            languageIndex        = settingData.languageIndex == 0 ? 1 : settingData.languageIndex;
            camareViewChoose     = settingData.camareViewChoose == 0 ? 2 : settingData.camareViewChoose;
            qualitySettingChoose = settingData.qualitySettingChoose == 0 ? 2 : settingData.qualitySettingChoose;
            recordScreenChoose   = settingData.recordScreenChoose == 0 ? 1 : settingData.recordScreenChoose;
            unitOperationChoose  = settingData.unitOperationChoose == 0 ? 1 : settingData.unitOperationChoose;

            MessageDispatcher.PostMessage(MessageType.SoundVolume, soundChoose == 2 ? 0f : 1f);
            MessageDispatcher.PostMessage(MessageType.MusicVolume, musicChoose == 2 ? 0f : 1f);

            switch ((UI.QualitySettingType)qualitySettingChoose)
            {
            case UI.QualitySettingType.High:
                UnityEngine.QualitySettings.SetQualityLevel(GameConstants.QUALITY_HIGH_VALUE);
                break;

            case UI.QualitySettingType.Middle:
                UnityEngine.QualitySettings.SetQualityLevel(GameConstants.QUALITY_MIDDLE_VALUE);
                break;

            case UI.QualitySettingType.Low:
                UnityEngine.QualitySettings.SetQualityLevel(GameConstants.QUALITY_LOW_VALUE);
                break;
            }
        }
    private void LoadLatestReadWorldChatMessagesStatus()
    {
        CommonScriptableObjects.lastReadWorldChatMessages.Set(0);
        string storedLastReadWorldChatMessagesString = PlayerPrefsUtils.GetString(PLAYER_PREFS_LAST_READ_WORLD_CHAT_MESSAGES);

        CommonScriptableObjects.lastReadWorldChatMessages.Set(System.Convert.ToInt64(string.IsNullOrEmpty(storedLastReadWorldChatMessagesString) ? 0 : System.Convert.ToInt64(storedLastReadWorldChatMessagesString)));
    }
예제 #9
0
 void OnApplicationQuit()
 {
     PlayerPrefs.SetInt("いいね", nowIine);
     PlayerPrefs.SetInt("お金", chara.Money);
     PlayerPrefs.SetString("職業", chara.NowJob.Name);
     PlayerPrefsUtils.SaveList("アイテム", chara.itemNames);
     PlayerPrefs.Save();
 }
예제 #10
0
        public List <string> itemNames; //持っているアイテム

        // Use this for initialization
        void Start()
        {
            Money     = PlayerPrefs.GetInt("お金", 0);
            itemNames = PlayerPrefsUtils.LoadList <string>("アイテム");
            NowJob    = JobDataBase.GetJob(PlayerPrefs.GetString("職業", "赤ちゃん"));
            mySprite  = GetComponent <SpriteRenderer>();

            SetJobSprite();
        }
    private static void SavePersistentCache()
    {
        lastTimeSavedPersistentCache = DCLTime.realtimeSinceStartup;

        //NOTE(Brian): Use JsonConvert because unity JsonUtility doesn't support dictionaries
        string cacheJson = JsonConvert.SerializeObject(dependenciesMap);

        PlayerPrefsUtils.SetString(PERSISTENT_CACHE_KEY, cacheJson);
    }
예제 #12
0
 public void LoadUserData()
 {
     userData = PlayerPrefsUtils.GetObject <UserData>(USER_DATA_KEY);
     if (userData == null)
     {
         userData = new UserData();
         userData.InitializeUserData();
     }
     else if (userData.ranks.Count == 0)
     {
         userData = new UserData();
         userData.InitializeUserData();
     }
 }
예제 #13
0
    public void EndGame(bool win)
    {
        bool newHighScore = PlayerPrefsUtils.AddHighScore(score);

        if (win)
        {
        }
        else
        {
            gameOverPanel.SetActive(true);
            gameOverScoreText.text     = score.ToString();
            gameOverHighScoreText.text = newHighScore ? "New high score!" : "High: " + PlayerPrefs.GetInt(Globals.PP_HIGH_SCORES [0]).ToString();
        }
    }
예제 #14
0
        public override void OnStepFinished()
        {
            base.OnStepFinished();

            // TODO (Santi): This a TEMPORAL fix. It will be removed when we refactorize the tutorial system in order to make it compatible with incremental features.
            PlayerPrefsUtils.SetInt(PLAYER_PREFS_VOICE_CHAT_FEATURE_SHOWED, 1);

            if (tutorialController != null &&
                tutorialController.hudController != null &&
                tutorialController.hudController.usersAroundListHud != null)
            {
                tutorialController.hudController.usersAroundListHud.OnOpen -= UsersAroundListHud_OnOpen;
            }
        }
예제 #15
0
 private void Start()
 {
     MatchDuration.OnValueChanged.AddListener(delegate(float value) {
         PlayerPrefs.SetInt(Properties.PlayerPrefs.MatchDuration, (int)value);
     });
     HealthPoints.OnValueChanged.AddListener(delegate(float value) {
         PlayerPrefs.SetInt(Properties.PlayerPrefs.HealthPoints, (int)value);
     });
     CanonDamage.OnValueChanged.AddListener(delegate(float value) {
         PlayerPrefs.SetInt(Properties.PlayerPrefs.CanonDamage, (int)value);
     });
     CanonPower.OnValueChanged.AddListener(delegate(float value) {
         PlayerPrefs.SetInt(Properties.PlayerPrefs.CanonPower, (int)value);
     });
     TurretSpeed.OnValueChanged.AddListener(delegate(float value) {
         PlayerPrefs.SetInt(Properties.PlayerPrefs.TurretSpeed, (int)value);
     });
     ReloadTime.OnValueChanged.AddListener(delegate(float value) {
         PlayerPrefs.SetInt(Properties.PlayerPrefs.ReloadTime, (int)value);
     });
     WaypointSeekRadius.OnValueChanged.AddListener(delegate(float value) {
         PlayerPrefs.SetInt(Properties.PlayerPrefs.WaypointSeekRadius, (int)value);
     });
     ExplosionDamage.OnValueChanged.AddListener(delegate(float value) {
         PlayerPrefs.SetInt(Properties.PlayerPrefs.ExplosionDamage, (int)value);
     });
     ExplosionRadius.OnValueChanged.AddListener(delegate(float value) {
         PlayerPrefs.SetInt(Properties.PlayerPrefs.ExplosionRadius, (int)value);
     });
     ExplosionCreateBustedTank.onValueChanged.AddListener(delegate(bool value) {
         PlayerPrefsUtils.SetBool(Properties.PlayerPrefs.ExplosionCreateBustedTank, value);
     });
     SecondsBetweenRefresh.OnValueChanged.AddListener(delegate(float value) {
         PlayerPrefs.SetInt(Properties.PlayerPrefs.SecondsBetweenRefresh, (int)value);
     });
     AlwaysPickBestChoice.onValueChanged.AddListener(delegate(bool value) {
         PlayerPrefsUtils.SetBool(Properties.PlayerPrefs.AlwaysPickBestChoice, value);
     });
     GridGap.OnValueChanged.AddListener(delegate(float value) {
         PlayerPrefs.SetInt(Properties.PlayerPrefs.GridGap, (int)value);
     });
     BonusPerSpawnNumber.OnValueChanged.AddListener(delegate(float value) {
         PlayerPrefs.SetInt(Properties.PlayerPrefs.BonusPerSpawnNumber, (int)value);
     });
     BonusPerSpawnFrequency.OnValueChanged.AddListener(delegate(float value) {
         PlayerPrefs.SetInt(Properties.PlayerPrefs.BonusPerSpawnFrequency, (int)value);
     });
     UpdateSettings();
 }
    private void SaveLatestReadChatMessagesStatus()
    {
        List <KeyValuePair <string, long> > lastReadChatMessagesList = new List <KeyValuePair <string, long> >();

        using (var iterator = CommonScriptableObjects.lastReadChatMessages.GetEnumerator())
        {
            while (iterator.MoveNext())
            {
                lastReadChatMessagesList.Add(new KeyValuePair <string, long>(iterator.Current.Key, iterator.Current.Value));
            }
        }

        PlayerPrefsUtils.SetString(PLAYER_PREFS_LAST_READ_CHAT_MESSAGES, JsonConvert.SerializeObject(lastReadChatMessagesList));
        PlayerPrefsUtils.Save();
    }
예제 #17
0
        public int unitOperationChoose  = 0; //1 is modeOne , 2 is modeTwo , 3 is modeThree

        public void SaveSettingDataToPlayerPrefs()
        {
            SettingDataToPlayerPrefs settingData = new SettingDataToPlayerPrefs();

            settingData.soundChoose          = soundChoose;
            settingData.musicChoose          = musicChoose;
            settingData.damageNumChoose      = damageNumChoose;
            settingData.displayBarChoose     = displayBarChoose;
            settingData.languageIndex        = languageIndex;
            settingData.camareViewChoose     = camareViewChoose;
            settingData.qualitySettingChoose = qualitySettingChoose;
            settingData.recordScreenChoose   = recordScreenChoose;
            settingData.unitOperationChoose  = unitOperationChoose;

            PlayerPrefsUtils.SaveToPlayerPrefs("SettingData" + GetPlayerId(), settingData);
        }
    private void UpdateQuality(int newQualityIndex)
    {
        if (newQualityIndex == currentQualityIndex)
        {
            return;
        }

        if (newQualityIndex <= 0 || newQualityIndex >= qualitySettings.Length)
        {
            return;
        }

        PlayerPrefsUtils.SetInt(LAST_QUALITY_INDEX, currentQualityIndex);
        currentQualityIndex = newQualityIndex;
        Settings.i.ApplyAutoQualitySettings(currentQualityIndex);
    }
예제 #19
0
        private void LoadGeneralSettings()
        {
            currentGeneralSettings = GetDefaultGeneralSettings();

            if (PlayerPrefsUtils.HasKey(GENERAL_SETTINGS_KEY))
            {
                try
                {
                    object currentSetting = currentGeneralSettings;
                    JsonUtility.FromJsonOverwrite(PlayerPrefsUtils.GetString(GENERAL_SETTINGS_KEY), currentSetting);
                    currentGeneralSettings = (SettingsData.GeneralSettings)currentSetting;
                }
                catch (Exception e)
                {
                    Debug.Log(e.Message);
                }
            }
        }
    void Start()
    {
        if (autoQualityEnabled == null || qualitySettings == null || qualitySettings.Length == 0)
        {
            return;
        }

        currentQualityIndex = PlayerPrefsUtils.GetInt(LAST_QUALITY_INDEX, (qualitySettings.Length - 1) / 2);

        controller = new AutoQualityUncappedFPSController(currentQualityIndex, qualitySettings);

        Settings.i.OnQualitySettingsChanged += OnQualitySettingsChanged;
        autoQualityEnabled.OnChange         += SetAutoSettings;

        fpsCapped = !Settings.i.currentQualitySettings.fpsCap;
        OnQualitySettingsChanged(Settings.i.qualitySettings);
        SetAutoSettings(autoQualityEnabled.Get(), !autoQualityEnabled.Get());
    }
예제 #21
0
    // データを生成
    void CreateData()
    {
        // データを削除
        if (isDestoryData)
        {
            PlayerPrefsUtils.Reload <DATA>(KEY);
        }

        // 前回のセーブデータを格納
        this.Data = PlayerPrefsUtils.GetObject <DATA>(KEY);

        // 前回のセーブデータがなければ新しくデータを生成する
        if (Data == null)
        {
            Debug.LogError("データがありませんでした。データを生成します。");
            Data = new DATA();
            PlayerPrefsUtils.SetObject <DATA>(KEY, Data);
        }
    }
예제 #22
0
        private void Die(TankEntity killer)
        {
            if (killer.Team == Team)
            {
                CurrentMatchReference.Value.TeamStats[Team].TeamKill++;
            }
            else
            {
                CurrentMatchReference.Value.TeamStats[killer.Team].KillCount++;
            }
            CurrentMatchReference.Value.TeamStats[Team].LossCount++;
            CurrentMatchReference.Value.TeamStats[Team].TankLeft--;
            if (CurrentMatchReference.Value.TeamStats[Team].TankLeft == 0)
            {
                CurrentMatchReference.Value.TeamStats[Team].IsDefeated = true;
            }
            if (CurrentMatchReference.Value.TeamInMatch.Count() == 1)
            {
                OnMatchFinished.Raise();
            }
            // Explosion
            Instantiate(TankExplosionPrefab, transform.position, TankExplosionPrefab.transform.rotation);
            int size = Physics.OverlapSphereNonAlloc(transform.position, ExplosionRadius, _hitColliders);

            for (int i = 0; i < size; i++)
            {
                TankEntity tankEntity = _hitColliders[i].GetComponent <TankEntity>();
                if (tankEntity && tankEntity != this)
                {
                    tankEntity.DamageByExplosion(this);
                }
            }
            // Wreck
            if (PlayerPrefsUtils.GetBool(Properties.PlayerPrefs.ExplosionCreateBustedTank,
                                         Properties.PlayerPrefsDefault.ExplosionCreateBustedTank))
            {
                Instantiate(BustedTankPrefab, transform.position, transform.rotation);
            }
            // Remove from list
            TanksReference.Value.Remove(gameObject);
            // Destroy
            Destroy(gameObject);
        }
예제 #23
0
        private void LoadQualitySettings()
        {
            bool isQualitySettingsSet = false;

            if (PlayerPrefsUtils.HasKey(QUALITY_SETTINGS_KEY))
            {
                try
                {
                    currentQualitySettings = JsonUtility.FromJson <SettingsData.QualitySettings>(PlayerPrefsUtils.GetString(QUALITY_SETTINGS_KEY));
                    isQualitySettingsSet   = true;
                }
                catch (Exception e)
                {
                    Debug.Log(e.Message);
                }
            }
            if (!isQualitySettingsSet)
            {
                currentQualitySettings = qualitySettingsPreset.defaultPreset;
            }
        }
예제 #24
0
    public void CheckLanguage()
    {
        if (PlayerPrefsUtils.HasKey(LocalDataName.CURRENTLANGUAGETYPEKEY) == true)
        {
            m_currentLanguageType = (LanguageType)PlayerPrefsUtils.GetInt(LocalDataName.CURRENTLANGUAGETYPEKEY);
            Debug.Log("CheckLanguage ---->_type=" + m_currentLanguageType);
            return;
        }

        LanguageType _type = LanguageType.English;

        switch (Application.systemLanguage)
        {
        case SystemLanguage.English:
            _type = LanguageType.English;
            break;

        case SystemLanguage.Spanish:
            _type = LanguageType.Spanish;
            break;

        case SystemLanguage.Japanese:
            _type = LanguageType.Japanese;
            break;

        case SystemLanguage.French:
            _type = LanguageType.French;
            break;

        case SystemLanguage.German:
            _type = LanguageType.German;
            break;

        case SystemLanguage.Italian:
            _type = LanguageType.Italian;
            break;

        case SystemLanguage.Dutch:
            _type = LanguageType.Dutch;
            break;

        case SystemLanguage.Russian:
            _type = LanguageType.Russian;
            break;

        case SystemLanguage.Arabic:
            _type = LanguageType.Arabic;
            break;

        case SystemLanguage.Korean:
            _type = LanguageType.Korean;
            break;

        case SystemLanguage.Chinese:
        case SystemLanguage.ChineseSimplified:
            _type = LanguageType.ChineseSimplified;
            break;

        case SystemLanguage.ChineseTraditional:
            _type = LanguageType.ChineseTraditional;
            break;

        default:
            _type = LanguageType.English;
            break;
        }
        GameApp.Event.DispatchNow((int)LocalMessageName.CC_REFRESH_LANGUAGE, _type);
        Debug.Log("CheckLanguage---->_type =" + _type + " ,system = " + Application.systemLanguage);
    }
예제 #25
0
 private void RefreshLanguageHandle(int type, object eventObject)
 {
     m_currentLanguageType = (LanguageType)eventObject;
     Debug.Log("RefreshLanguageHandle ---->" + m_currentLanguageType);
     PlayerPrefsUtils.SetInt(LocalDataName.CURRENTLANGUAGETYPEKEY, (int)m_currentLanguageType);
 }
예제 #26
0
 public void LoadSettings()
 {
     PlayerPrefsUtils.Fill(this);
 }
예제 #27
0
 public void SaveSettings()
 {
     PlayerPrefsUtils.Save(this);
 }
예제 #28
0
 protected override void Dismiss()
 {
     PlayerPrefsUtils.SetInt(DONT_SHOW_GRAPHIC_CARD_POPUP_KEY, dontShowAgain.isOn ? 1 : 0);
     base.Dismiss();
 }
 private void SaveLatestReadWorldChatMessagesStatus()
 {
     PlayerPrefsUtils.SetString(PLAYER_PREFS_LAST_READ_WORLD_CHAT_MESSAGES, CommonScriptableObjects.lastReadWorldChatMessages.Get().ToString());
     PlayerPrefsUtils.Save();
 }
예제 #30
0
 // アプリケーション終了時に呼ばれる
 void OnApplicationQuit()
 {
     // データを保存する
     PlayerPrefsUtils.SetObject <DATA>(KEY, Data);
 }