Пример #1
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);
        }
Пример #2
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());
                }
            });
        }
Пример #3
0
        private void ResquestDeviceStatus(int progress)
        {
            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 (progress != -1)
                {
                    if (response.deviceOnline)
                    {
                        if (Application.platform == RuntimePlatform.Android)
                        {
                            AndroidForUnity.CallAndroidForUpdateVol((progress).ToString("F0"));
                        }
                        else if (Application.platform == RuntimePlatform.IPhonePlayer)
                        {
                            Dictionary <string, object> param    = new Dictionary <string, object>();
                            Dictionary <string, object> subParam = new Dictionary <string, object>();
                            subParam.Add("valume", progress);
                            param.Add("method", IOSClientUtil.ExchangeDeviceVolume);
                            param.Add("params", subParam);
                            Debug.Log("params ========" + subParam);
                            IOSClientUtil.CommonMethodCallIOSClient(param.ToJson());
                        }
                    }
                    else
                    {
                        SliderDeviceVoice.Slider.value = 0;
                        TextProgress.text = string.Format("{0}%", 0);
                        CommonUtil.toast("dola未连接,请确认开机联网哦~");
                    }
                }
                if (response.deviceOnline)
                {
                    DeviceConnectStatus(true);
                }
                else
                {
                    DeviceConnectStatus(false);
                }
                UpdateDeviceBattery(response.deviceStatus.battery);
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Пример #4
0
 private void InitData()
 {
     listViewVertical.RemoveAllItems();
     mUserInfoModel = PlayerPrefsUtil.UserInfo;
     if (mUserInfoModel.IsNotNull() && mUserInfoModel.babyInfoVo.IsNotNull())
     {
         AddBabyItem();
         AddUserItem();
     }
     if (PlayerPrefsUtil.GetDeviceId().IsNullOrEmpty())
     {
         AddFamilyEmptyItem();
     }
     else
     {
         StartRequestForFindMemberInfo();
     }
 }
Пример #5
0
        void StartResquestForCheckDeviceVersion()
        {
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("deviceId", PlayerPrefsUtil.GetDeviceId());
            paramDict.Add("userId", PlayerPrefsUtil.GetUserId());
            HttpUtil.GetWithSign <DeviceModel>(UrlConst.CheckDeviceVersion, paramDict)
            .Subscribe(response =>
            {
                TextVersion.text = response.current;
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Пример #6
0
        void StartResquestForDoSetRelation()
        {
            BtnUserConfirm.enabled = false;
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("relation", mRelation);
            paramDict.Add("userId", PlayerPrefsUtil.GetUserId());
            HttpUtil.PostWithSign <UserInfoModel>(UrlConst.DoSetRelation, paramDict, "userHead.jpg", mUserHead)
            .Subscribe(response =>
            {
                BtnUserConfirm.enabled   = true;
                response.deviceId        = PlayerPrefsUtil.GetDeviceId();
                response.token           = PlayerPrefsUtil.GetToken();
                PlayerPrefsUtil.UserInfo = response;
                if (mData.IsEdit)
                {
                    SimpleEventSystem.Publish(new UpdateUserDate(true));
                    Back();
                }
                else
                {
                    if (PlayerPrefsUtil.GetDeviceId().IsNullOrEmpty())
                    {
                        UIMgr.OpenPanel <BindGuidePanel>(new BindGuidePanelData(), UITransitionType.CIRCLE, this);
                    }
                    else
                    {
                        CommonUtil.OpenCloudMain(this);
                    }
                }
            }
                       , e =>
            {
                BtnUserConfirm.enabled = true;
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Пример #7
0
        private void StartRequestForDoTransferManager()
        {
            Dictionary <string, object> param = new Dictionary <string, object>();

            param.Add("userId", mFamilyModel.id);
            param.Add("deviceId", PlayerPrefsUtil.GetDeviceId());
            HttpUtil.PostWithSign <int>(UrlConst.DoTransferManager, param)
            .Subscribe(response =>
            {
                CommonUtil.toast("转让成功");
                SimpleEventSystem.Publish(new UpdateBaseInfoDate(true));
                Back();
            }, e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Пример #8
0
 private void Awake()
 {
     if (PlayerPrefsUtil.GetDeviceId().IsNullOrEmpty())
     {
         BtnUnbind.gameObject.SetActive(true);
     }
     else
     {
         TextID.text = PlayerPrefsUtil.GetDeviceId();
         StartResquestForCheckDeviceVersion();
         StartResquestForGetDeviceStatus();
         BtnUnbind.gameObject.SetActive(true);
     }
     if (Application.platform == RuntimePlatform.Android)
     {
         NativeGallery.GetSomethingFromNative((json, action1) => { TextAppVersion.text = json; }, (int)NativeAction.Version);
     }
     else if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         NativeGallery.GetSomethingFromIPhone(res => { TextAppVersion.text = res; }, 2);
     }
     BtnUnbind.onClick.AddListener(() =>
     {
         AudioManager.PlaySound("Button_Audio");
         UIMgr.OpenPanel <TipPanel>(new TipPanelData()
         {
             action   = TipAction.Unbind,
             message  = "确定解除绑定 Dola 设备吗?\n解绑后,将删除此设备的历史学习记录",
             strTitle = "解绑提示"
         });
     });
     SimpleEventSystem.GetEvent <TipConfirmClick>()
     .Subscribe(_ =>
     {
         if (_.GetAction == TipAction.Unbind)
         {
             StartResquestForUnbind();
         }
     }).AddTo(this);
 }
Пример #9
0
        void StartResquestForUnbind()
        {
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("deviceId", PlayerPrefsUtil.GetDeviceId());
            paramDict.Add("userId", PlayerPrefsUtil.GetUserId());
            HttpUtil.PostWithSign <object>(UrlConst.Unbind, paramDict)
            .Subscribe(response =>
            {
                Log.I("解绑成功");
                CommonUtil.toast("解除绑定成功");
                CommonUtil.logout();
                UIMgr.CloseAllPanel();
                UIMgr.OpenPanel <LoginPanel>(new LoginPanelData(), UITransitionType.CIRCLE);
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }