Esempio n. 1
0
        public void SavePreferenceState(PlayerPreferenceState preferenceState)
        {
            JsonMapper.RegisterImporter((double value) => Convert.ToSingle(value));
            JsonMapper.RegisterExporter <float>((value, writer) => writer.Write(Convert.ToDouble(value)));

            string playerPreferencesJson = JsonMapper.ToJson(preferenceState);

            PlayerPrefs.SetString(UNITY_PREF_KEY_NAME, playerPreferencesJson);
        }
        public PlayerPreferenceManager(IPreferenceStateProvider stateProvider)
        {
            this.stateProvider = stateProvider;

            state = stateProvider.GetPreferenceState();
        }