Example #1
0
 private void EndLevel()
 {
     m_bgmModel.Play(m_clipHomeBase);
     PlayerPrefsUtil.SaveHighScore(m_playerStats.GetScore().Value);
     PlayerPrefsUtil.SaveLatestLevel();
     m_panelSwitcher.ShowLevelClear();
 }
Example #2
0
 private void GetWifiInfo()
 {
     if (isSendMessage)
     {
         NativeGallery.GetSomethingFromNative((json, action1) =>
         {
             isSendMessage = false;
             if (json.IsNotNullAndEmpty())
             {
                 InputFieldSSID.text = json;
                 string pwd          = PlayerPrefsUtil.GetWiFiPWD(json);
                 if (pwd.IsNotNullAndEmpty())
                 {
                     InputFieldPWD.text = pwd;
                 }
                 else
                 {
                     InputFieldPWD.text = string.Empty;
                 }
             }
             Log.I("GetSomethingFromNative: " + json);
         }, (int)NativeAction.Location);
     }
     else
     {
         CancelInvoke("GetWifiInfo");
     }
 }
Example #3
0
        /** 获取服务器版本号 */
        IEnumerator ReadServerVersionInfo()
        {
            int    isUpdateTest = PlayerPrefsUtil.GetIntSimple(PlayerPrefsKey.Setting_Update);//测试更新
            string centerName   = GameConst.CenterName;

            if (isUpdateTest == 1)
            {
                centerName = "Test";
            }


            string url = AssetManagerSetting.GetServerVersionInfoURL(GameConst.WebUrl, centerName);
            WWW    www = new WWW(url);

            yield return(www);

            if (!string.IsNullOrEmpty(www.error))
            {
                OnError("获取服务器版本号出错");
                Debug.LogErrorFormat("获取服务器版本号出错 url={0}, www.error={1}", url, www.error);
                www.Dispose();
                www = null;

                yield break;
            }

            Debug.Log(www.text);

            serverVersionInfo = JsonUtility.FromJson <VersionInfo>(www.text);
            serverVersionInfo.Set();
        }
Example #4
0
        /// <summary>
        /// checks if time has expired far enough that a new auth token needs to be issued
        /// </summary>
        /// <returns></returns>
        public static IEnumerator CheckForRefreshOfToken()
        {
            if (DateTime.Now > SpreadsheetManager.Config.gdr.nextRefreshTime)
            {
                WWWForm f = new WWWForm();
                f.AddField("client_id", SpreadsheetManager.Config.CLIENT_ID);
                f.AddField("client_secret", SpreadsheetManager.Config.CLIENT_SECRET);
                f.AddField("refresh_token", SpreadsheetManager.Config.gdr.refresh_token);
                f.AddField("grant_type", "refresh_token");
                f.AddField("scope", "");

                using (UnityWebRequest request = UnityWebRequest.Post("https://www.googleapis.com/oauth2/v4/token", f))
                {
                    yield return(request.SendWebRequest());

                    GoogleDataResponse newGdr = JsonUtility.FromJson <GoogleDataResponse>(request.downloadHandler.text);
                    SpreadsheetManager.Config.gdr.access_token    = newGdr.access_token;
                    SpreadsheetManager.Config.gdr.nextRefreshTime = DateTime.Now.AddSeconds(newGdr.expires_in);

#if UNITY_EDITOR
                    if (!Application.isPlaying)
                    {
                        EditorUtility.SetDirty(SpreadsheetManager.Config);
                        AssetDatabase.SaveAssets();
                    }
#endif

                    PlayerPrefsUtil.SetConfig(SpreadsheetManager.Config);
                }
            }
        }
        private void StartRequestForFindMemberInfo()
        {
            Dictionary <string, object> param = new Dictionary <string, object>();

            param.Add("relBabyId", PlayerPrefsUtil.UserInfo.relBabyId);
            HttpUtil.GetWithSign <List <FamilyModel> >(UrlConst.FindMemberInfo, param)
            .Subscribe(response =>
            {
                Log.I(response.ToJson());
                if (response.IsNotNull())
                {
                    foreach (var model in response)
                    {
                        if (model.id != PlayerPrefsUtil.GetUserId())
                        {
                            AddItem(model);
                        }
                    }
                }
            }, e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Example #6
0
        void StartResquestForModifyPasswd()
        {
            BtnConfirm.enabled = false;
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("mobile", InputPhone.text);
            paramDict.Add("passwd", InputPwd.text);
            HttpUtil.PostWithSign <object>(UrlConst.ModifyPasswd, paramDict)
            .Subscribe(response =>
            {
                BtnConfirm.enabled = true;
                CommonUtil.toast("新密码设置成功");
                PlayerPrefsUtil.SetPwd(InputPwd.text);
                StartResquestForDoLogin(InputPhone.text);
            }
                       , e =>
            {
                BtnConfirm.enabled = true;
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Example #7
0
        void StartResquestForDoRegister()
        {
            BtnConfirm.enabled = false;
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("mobile", InputPhone.text);
            paramDict.Add("passwd", InputPwd.text);
            HttpUtil.PostWithSign <UserInfoModel>(UrlConst.DoRegister, paramDict)
            .Subscribe(response =>
            {
                BtnConfirm.enabled = true;
                PlayerPrefsUtil.SetPhone(InputPhone.text);
                PlayerPrefsUtil.SetPwd(InputPwd.text);
                PlayerPrefsUtil.UserInfo = response;
                UIMgr.OpenPanel <BaByInfoPanel>(new BaByInfoPanelData(), UITransitionType.CIRCLE, this);
            }
                       , e =>
            {
                BtnConfirm.enabled = true;
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
    void TryInit()
    {
        DontDestroyOnLoad(gameObject);

        /*
         * CHECK USER PREFS
         */
        _muteBGM = PlayerPrefsUtil.readBoolPref(PrefKey_MuteBGM, false);                 // isIntTrue(PlayerPrefs.GetInt("muteBGM" , 0));
        _muteSFX = PlayerPrefsUtil.readBoolPref(PrefKey_MuteSFX, false);



        if (_muteSFX)
        {
            bgmVol = 0.0f;
        }
        else
        {
            bgmVol = 1.0f;
        }


        this.SetupSoundClips();
        singleton = this;
    }
Example #9
0
        void StartResquestForDoAddBaby()
        {
            if (mBabyHead.IsNullOrEmpty())
            {
                CommonUtil.toast("请选择宝宝头像");
                return;
            }
            BtnBabyConfirm.enabled = false;
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("name", InputName.text);
            paramDict.Add("sex", mSex);
            paramDict.Add("birthday", TextBirthday.text);
            paramDict.Add("creator", PlayerPrefsUtil.GetUserId());
            HttpUtil.PostWithSign <UserInfoModel>(UrlConst.DoAddBaby, paramDict, "babyHead.jpg", mBabyHead)
            .Subscribe(response =>
            {
                BtnBabyConfirm.enabled   = true;
                PlayerPrefsUtil.UserInfo = response;
                UIMgr.OpenPanel <UserInfoPanel>(new UserInfoPanelData(), UITransitionType.NULL, this);
            }
                       , e =>
            {
                BtnBabyConfirm.enabled = true;
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Example #10
0
    public static IObservable <string> GetWithSign(string url, Dictionary <string, object> param, bool showToast = true)
    {
        if (token.IsNullOrEmpty())
        {
            token = PlayerPrefsUtil.GetToken();
        }

        if (!token.IsNullOrEmpty())
        {
            param.Add("token", token);
        }

        var methodParams = SignUtil.getMethodParamStr(param);
        var sign         = SignUtil.getSign(param);

        url = url + "?" + methodParams + "&sign=" + sign + "&appid=" + AppConst.APPID;
        return(ObservableWWW.Get(url).DoOnError(e =>
        {
            LoadingManager.GetInstance().DismissLoading();
            if (showToast)
            {
                if (e is HttpException)
                {
                }
                else if (e is WWWErrorException)
                {
                    ToastManager.GetInstance().CreatToast("网络连接失败,请检查网络连接");
                }
                else
                {
                    ToastManager.GetInstance().CreatToast(e.Message);
                }
            }
        }));
    }
        void StartResquestForDoUpdatePasswd()
        {
            if (PlayerPrefsUtil.UserInfo == null || PlayerPrefsUtil.UserInfo.mobile.IsNullOrEmpty())
            {
                CommonUtil.toast("数据异常,请重新登录");
                return;
            }
            BtnConfirm.enabled = false;
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("userId", PlayerPrefsUtil.GetUserId());
            paramDict.Add("newPasswd", InputConfirm.text);
            paramDict.Add("oldPasswd", InputOld.text);
            HttpUtil.PostWithSign <object>(UrlConst.DoUpdatePasswd, paramDict)
            .Subscribe(response =>
            {
                PlayerPrefsUtil.SetPwd(InputConfirm.text);
                CommonUtil.toast("新密码设置成功");
                InputOld.text     = "";
                InputNew.text     = "";
                InputConfirm.text = "";
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Example #12
0
        void StartResquestForGetDeviceStatus()
        {
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("deviceId", PlayerPrefsUtil.GetDeviceId());
            paramDict.Add("userId", PlayerPrefsUtil.GetUserId());
            HttpUtil.GetWithSign <DeviceModel>(UrlConst.GetDeviceStatus, paramDict)
            .Subscribe(response =>
            {
                if (response.deviceOnline)
                {
                    TextWifi.text = "已连接";
                    ImgWifi.gameObject.SetActive(false);
                }
                else
                {
                    TextWifi.text = "未连接";
                    ImgWifi.gameObject.SetActive(true);
                }
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Example #13
0
    private void OnAccountLogOnResponse(byte[] buffer)
    {
        AccountLogOnResponseProto proto = AccountLogOnResponseProto.GetProto(buffer);

        if (!proto.IsSuccess)
        {
            TipsUtil.ShowTextTips(1000111);
        }
        else
        {
            //登录成功
            //TipsUtil.ShowTextTips("用户编号 = " + proto.UserId);
            if (m_LogOnWindow != null)
            {
                Stat.LogOn(proto.UserId, m_LogOnWindow.IFAccount.text);
                PlayerPrefsUtil.SetAccountID(proto.UserId);
                PlayerPrefsUtil.SetAccountUserName(m_LogOnWindow.IFAccount.text);
                PlayerPrefsUtil.SetAccountPwd(m_LogOnWindow.IFPwd.text);
                m_LogOnWindow.CloseAndOpenNext(Window.GameServerEnter);
            }
            else
            {
                Stat.Register(proto.UserId, PlayerPrefsUtil.GetAccountUserName());
                WindowManager.Instance.OpenWindow(Window.GameServerEnter);
            }
            GlobalInit.Instance.AccountId       = proto.UserId;
            GlobalInit.Instance.AccountUserName = PlayerPrefsUtil.GetAccountUserName();
        }
    }
 static void ToggleMute(string key, bool value)
 {
     PlayerPrefsUtil.SetBool(
         key,
         value
         );
 }
Example #15
0
 public static void Vibrate()
 {
     if (PlayerPrefsUtil.IsVibarationOn())
     {
         Handheld.Vibrate();
     }
 }
Example #16
0
        private void StartResquestForDelBabyAddress()
        {
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("inviteId", PlayerPrefsUtil.GetUserId());
            paramDict.Add("inviteeMobile", InputMobile.text);
            paramDict.Add("inviteeBabyRelation", relation);
            HttpUtil.PostWithSign <int>(UrlConst.DoCheckInviteValid, paramDict)
            .Subscribe(response =>
            {
                if (response == 1)
                {
                    Dictionary <string, object> message = new Dictionary <string, object>();
                    message.Add("mobile", InputMobile.text);
                    message.Add("content", "【环球少儿app】邀请你加入,快来跟我一起读绘本吧!");
                    NativeGallery.GetSomethingFromNative((json, action) =>
                    {
                    }, (int)NativeAction.SendSMS, message.ToJson());
                }
                CommonUtil.toast("邀请成功");
                SimpleEventSystem.Publish(new UpdateBaseInfoDate(true));
                Back();
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Example #17
0
        private void RequestHistoryPhotoData()
        {
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("babyId", PlayerPrefsUtil.GetBabyId());
            Debug.Log(paramDict);
            HttpUtil.GetWithSign <List <PhotoWallModel> >(UrlConst.FindPhotoWall, paramDict)
            .Subscribe(response =>
            {
                if (response.Count > 0)
                {
                    BtnHistoryPhoto.gameObject.SetActive(true);
                }
                else
                {
                    BtnHistoryPhoto.gameObject.SetActive(false);
                }
                Debug.Log("------" + response);
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
        public void OpenLog()
        {
            PlayerPrefsUtil.UseUserId = false;
            int isFlagShowPanel = PlayerPrefsUtil.GetIntSimple(PlayerPrefsKey.Setting_OpenLog);

            PlayerPrefsUtil.UseUserId = true;
            Text text = transform.FindChild("Button--OpenLog/Text").GetComponent <Text>();

            if (isFlagShowPanel == 0)
            {
                text.text = "LogEnabled:开启";
                PlayerPrefsUtil.UseUserId = false;
                PlayerPrefsUtil.SetIntSimple(PlayerPrefsKey.Setting_OpenLog, 1);
                PlayerPrefsUtil.UseUserId = true;
                Debug.logger.logEnabled   = true;
            }
            else
            {
                text.text = "LogEnabled:关闭";
                PlayerPrefsUtil.UseUserId = false;
                PlayerPrefsUtil.SetIntSimple(PlayerPrefsKey.Setting_OpenLog, 0);
                PlayerPrefsUtil.UseUserId = true;
                Debug.logger.logEnabled   = false;
            }
        }
Example #19
0
    public void CheckEnergyRecover(bool isFirst)
    {
        WealthInfo energyInfo = GetWealth((int)WealthTypeEnum.Energy);

        if (energyInfo.count < energyInfo.limit)
        {
            if (ClockModel.Instance.GetClock((int)WealthTypeEnum.Energy) == null)
            {
                int energyRestoreTime;
                if (isFirst)
                {
                    int getTime = PlayerPrefsUtil.GetInt(PlayerPrefsUtil.ENERGY_OUT_TIME);
                    if (getTime > 0)
                    {
                        energyRestoreTime = getTime;
                    }
                    else
                    {
                        energyRestoreTime = ClockModel.ConvertDateTimeInt(DateTime.Now);
                        PlayerPrefsUtil.SetInt(PlayerPrefsUtil.ENERGY_OUT_TIME, energyRestoreTime);
                    }
                    ClockModel.Instance.SetClock(new ClockInfo((int)WealthTypeEnum.Energy, 0, energyRestoreTime));
                }
                else
                {
                    energyRestoreTime = ClockModel.ConvertDateTimeInt(DateTime.Now);
                    PlayerPrefsUtil.SetInt(PlayerPrefsUtil.ENERGY_OUT_TIME, energyRestoreTime);
                    ClockModel.Instance.SetClock(new ClockInfo((int)WealthTypeEnum.Energy, 0, energyRestoreTime));
                }
            }
        }
    }
Example #20
0
        /**
         * 勋章数据
         */
        private void RequestMedalList()
        {
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("babyId", PlayerPrefsUtil.GetBabyId());
            Debug.Log(paramDict);

            HttpUtil.GetWithSign <MedalModel>(UrlConst.FindBabyAllMedalList, paramDict)
            .Subscribe(response =>
            {
                this.CreatMedalItem(response.medalList);
                this.mMedalsLiast               = response.medalList;
                this.TextMedalNum.text          = response.medalCount.ToString();
                this.TextMedalShareNum.text     = response.medalShareCount.ToString();
                this.TextMedalStudyDaysNum.text = response.totalDays.ToString();
                TextTaskShareNum.text           = response.studyShareCount.ToString();

                Debug.Log("------" + response);
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Example #21
0
    public void LoadWeaths()
    {
        if (PlayerModel.CLEAR_ALL)
        {
            PlayerPrefsUtil.RemoveData(PlayerPrefsUtil.WEALTH);
            PlayerPrefsUtil.RemoveData(PlayerPrefsUtil.ENERGY_BUY);
        }

        string WEALTH = PlayerPrefsUtil.GetString(PlayerPrefsUtil.WEALTH);

        wealths = JsonMapper.ToObject <List <WealthInfo> >(WEALTH);
        if (wealths == null)
        {
            wealths = new List <WealthInfo>();

            for (int i = 0; i < GameMgr.resourceMgr.config_wealth.data.Count; i++)
            {
                config_wealth_item config_item = GameMgr.resourceMgr.config_wealth.data[i];

                wealths.Add(CreatWealthInfo(config_item.id, config_item.firstCount, config_item.limitCount));
            }

            SaveWealths();
        }
        CheckEnergyRecover(true);
        ClockModel.Instance.clockEvent += OnClockEvent;
    }
Example #22
0
    public static void SelecteLanguage(string languageName)
    {
        PlayerPrefsUtil.SetString(PlayerPrefsUtil.LANGUAGE, languageName);
        InitLang();

        FontUtil.ChangeFont(GetTxt(10002));
    }
Example #23
0
        public void ShowAudio()
        {
            VideoScrollView.gameObject.SetActive(false);
            AudioScrollView.gameObject.SetActive(true);
            PicBookScrollView.gameObject.SetActive(false);
            if (AudioScrollView.Find("Viewport").Find("Content").childCount > 0)
            {
                NoData.gameObject.SetActive(false);
                return;
            }
            // 创建视频Item
            var index = PlayerPrefsUtil.GetBoxMonthIndex();
            // 取出该盒子下的音频列表
            var total = PlayerPrefsUtil.ContentModel.boxList[index].audioList;

            for (int i = 0; i < total.Count; i++)
            {
                var model = total[i];
                if (isCotainCheck(model))
                {
                    audioList.Add(model);
                }
            }
            DoCreateAudioItem(audioList);
        }
Example #24
0
        protected override void OnInit(QFramework.IUIData uiData)
        {
            mData = uiData as HistoricalPhotoWallPanelData ?? new HistoricalPhotoWallPanelData();

            BtnBack.OnClickAsObservable().Subscribe(_ =>
            {
                AudioManager.PlaySound("Button_Audio");
                Back();
            }).AddTo(this);
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("babyId", PlayerPrefsUtil.GetBabyId());
            Debug.Log(paramDict);
            HttpUtil.GetWithSign <List <PhotoWallModel> >(UrlConst.FindPhotoWall, paramDict)
            .Subscribe(response =>
            {
                this.CreatMedalItem(response);
                Debug.Log("------" + response);
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);

            // please add init code here
        }
        private void Awake()
        {
            string type = typeof(T).ToString();

            // Allows data to be kept over multiple sessions.
            m_ResultSize = new Vector2Int(PlayerPrefs.GetInt(type + "_RESULTSIZE_X", 512), PlayerPrefs.GetInt(type + "_RESULTSIZE_Y", 512));

            string[] boxes = PlayerPrefsUtil.GetStringArray(type + "_BOXKEYS", string.Empty);

            foreach (string box in boxes)
            {
                string    texturePath = PlayerPrefs.GetString(type + "_TEXPATH_" + box, string.Empty);
                Texture2D texture     = null;

                if (texturePath != string.Empty)
                {
                    Texture2D pathResult = AssetDatabase.LoadAssetAtPath <Texture2D>(texturePath);

                    if (pathResult != null)
                    {
                        texture = pathResult;
                    }
                }

                TextureColorContainer container = new TextureColorContainer(
                    PlayerPrefsUtil.GetBool(type + "_ISCOLOR_" + box, false),
                    texture,
                    PlayerPrefsUtil.GetColor(type + "_COLOR_" + box, Color.black));

                m_ComponentBoxes.Add(box, container);
            }

            SetSaveableValues(PlayerPrefsUtil.GetFloatArray(type + "_SAVEABLES"));
        }
Example #26
0
        protected override void OnInit(QFramework.IUIData uiData)
        {
            mData = uiData as SettingPanelData ?? new SettingPanelData();
            // please add init code here

            if (PlayerPrefsUtil.GetDeviceId().IsNullOrEmpty())
            {
                ToggleDevice.gameObject.SetActive(false);
            }
            else
            {
                ToggleDevice.gameObject.SetActive(true);
            }
            BtnBack.onClick.AddListener(() =>
            {
                AudioManager.PlaySound("Button_Audio");
                Back();
            });
            BtnLogout.onClick.AddListener(() =>
            {
                AudioManager.PlaySound("Button_Audio");
                UIMgr.OpenPanel <TipPanel>(new TipPanelData()
                {
                    action   = TipAction.Logout,
                    message  = "确定退出登录吗?",
                    strTitle = "dola提示"
                });
            });

            SimpleEventSystem.GetEvent <TipConfirmClick>()
            .Subscribe(_ =>
            {
                if (_.GetAction == TipAction.Logout)
                {
                    // 弹窗提示,确定后,清除本地用户信息、清空list,打开login
                    CommonUtil.logout();
                }
            }).AddTo(this);
            BtnShare.onClick.AddListener(() =>
            {
                AudioManager.PlaySound("Button_Audio");
                if (Application.platform == RuntimePlatform.Android)
                {
                    Dictionary <string, object> param    = new Dictionary <string, object>();
                    Dictionary <string, object> subParam = new Dictionary <string, object>();
                    param.Add("target", AppConst.Share);
                    param.Add("params", subParam);
                    AndroidForUnity.CallAndroidStartActivity(param.ToJson());
                }
                else if (Application.platform == RuntimePlatform.IPhonePlayer)
                {
                    Dictionary <string, object> paramDic = new Dictionary <string, object>();
                    Dictionary <string, object> subParam = new Dictionary <string, object>();
                    paramDic.Add("method", IOSClientUtil.SettingShare);
                    paramDic.Add("params", subParam);
                    IOSClientUtil.CommonMethodCallIOSClient(paramDic.ToJson());
                }
            });
        }
        /// <summary>
        /// Load values found inside PlayerPrefs.
        /// </summary>
        private void LoadValues()
        {
            ResolutionIndex = PlayerPrefs.GetInt("SETTINGSMANAGER_RESOLUTIONINDEX", ResolutionIndex);

            if (ResolutionIndex <= -1)
            {
                Vector2Int currentResolution = new Vector2Int(Screen.currentResolution.width, Screen.currentResolution.height);

                bool exit = false;
                foreach (KeyValuePair <AspectRatioTypes, Vector2Int[]> aspectRatio in m_ResolutionList)
                {
                    for (int i = 0; i < aspectRatio.Value.Length; i++)
                    {
                        if (currentResolution == aspectRatio.Value[i])
                        {
                            ResolutionIndex = i;
                            AspectRatio     = aspectRatio.Key;
                            exit            = true;
                            break;
                        }
                    }

                    if (exit)
                    {
                        break;
                    }
                }

                if (ResolutionIndex == -1)
                {
                    // Standard 1080p
                    ResolutionIndex = 2;
                    AspectRatio     = AspectRatioTypes.Ratio16by9;
                }
            }
            else
            {
                AspectRatio = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_ASPECTRATIO", AspectRatio);
            }

            Fullscreen  = PlayerPrefsUtil.GetBool("SETTINGSMANAGER_FULLSCREEN", Fullscreen);
            RefreshRate = PlayerPrefs.GetInt("SETTINGSMANAGER_REFRESHRATE", RefreshRate);

            PixelLightCount         = PlayerPrefs.GetInt("SETTINGSMANAGER_PIXELLIGHTCOUNT", PixelLightCount);
            TextureQuality          = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_TEXTUREQUALITYTYPE", TextureQuality);
            AnisotropicFiltering    = PlayerPrefsUtil.GetBool("SETTINGSMANAGER_ANISOTROPICFILTERING", AnisotropicFiltering);
            AntiAliasing            = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_ANTIALIASING", AntiAliasing);
            SoftParticles           = PlayerPrefsUtil.GetBool("SETTINGSMANAGER_SOFTPARTICLES", SoftParticles);
            RealtimeReflectionProbe = PlayerPrefsUtil.GetBool("SETTINGSMANAGER_REALTIMEREFLECTIONPROBE", RealtimeReflectionProbe);
            VSyncCount = PlayerPrefs.GetInt("SETTINGSMANAGER_VSYNCCOUNT", VSyncCount);

            ShadowQualityType     = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_SHADOWQUALITYTYPE", ShadowQualityType);
            ShadowResolutionType  = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_SHADOWRESOLUTIONTYPE", ShadowResolutionType);
            ShadowProjectionType  = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_SHADOWPROJECTIONTYPE", ShadowProjectionType);
            ShadowDistance        = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_SHADOWDISTANCETYPE", ShadowDistance);
            ShadowmaskModeType    = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_SHADOWMASKMODE", ShadowmaskModeType);
            ShadowNearPlaneOffset = PlayerPrefs.GetInt("SETTINGSMANAGER_SHADOWNEARPLANEOFFSET", ShadowNearPlaneOffset);
            ShadowCascadeType     = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_SHADOWCASCADETYPE", ShadowCascadeType);
        }
Example #28
0
 private void OnMusicVolumeChange()
 {
     PlayerPrefsUtil.SetFloat(PrefsConstant.KEY_MUSIC_VOLUME, mMusicVolume);
     if (mBGAudioSource != null)
     {
         mBGAudioSource.volume = MusicVolume;
     }
 }
    static int RemoveData(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        string arg0 = LuaScriptMgr.GetLuaString(L, 1);

        PlayerPrefsUtil.RemoveData(arg0);
        return(0);
    }
 private void OnGUI()
 {
     if (GUILayout.Button("DeleteAllPlayerPrefs"))
     {
         PlayerPrefsUtil.DeleteAll();
         Debug.Log("Complete Delete All PlaterPrefs");
     }
 }
Example #31
0
    private static void CacheKey(string key, object value, PlayerPrefsUtil.PlayerPrefsUtilItemType valueType)
    {
        if (CACHE_KEYS)
        {
            if (PlayerPrefsUtil._cachedValues.ContainsKey(key))
            {
                PlayerPrefsUtil._cachedValues[key] = value;
            }
            else
            {
                PlayerPrefsUtil._cachedValues.Add(key, value);
            }
        }

        LoadAllKeys();
        bool updatedKyes = false;
        if (!PlayerPrefsUtil._allKeys.ContainsKey(key))
        {
            PlayerPrefsUtil._allKeys.Add(key, valueType);
            updatedKyes = true;
        }
        else
        {
            if (valueType != PlayerPrefsUtil._allKeys[key])
            {
                PlayerPrefsUtil._allKeys[key] = valueType;
                updatedKyes = true;
            }
        }

        if (updatedKyes)
        {
            string listString = SerializeObjectToString(_allKeys);
            PlayerPrefs.SetString(ALL_KEYS, listString);
        }
    }