Example #1
0
        public object this[UserConfigType t]
        {
            set
            {
                switch (t)
                {
                case UserConfigType.motionShowType:
                {
                    if (motionShowType != (byte)value)
                    {
                        motionShowType = (byte)value;
                    }
                }
                break;

                case UserConfigType.music_itemMode: music_itemMode = (bool)value; break;
                }
                Write();
            }
            get
            {
                Read();
                switch (t)
                {
                case UserConfigType.motionShowType: return(motionShowType);

                case UserConfigType.music_itemMode: return(music_itemMode);
                }
                return(null);
            }
        }
Example #2
0
        public void Read()
        {
            string key = SharedUserConfig.Key_UserConfig + SharedUserConfig.Inst[SharedUserConfig.Key_Account];

            if (!UnityEngine.PlayerPrefs.HasKey(key))
            {
                return;
            }
            string config = UnityEngine.PlayerPrefs.GetString(key);

            string[] configStrs = config.Split("#".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < configStrs.Length; ++i)
            {
                UserConfigType uct = (UserConfigType)i;
                switch (uct)
                {
                case UserConfigType.motionShowType: byte.TryParse(configStrs[i], out motionShowType); break;

                case UserConfigType.music_itemMode: bool.TryParse(configStrs[i], out music_itemMode); break;
                }
            }
        }