Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        private void StartResquestForBind(String deviceId)
        {
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("deviceId", deviceId);
            paramDict.Add("userId", PlayerPrefsUtil.GetUserId());
            HttpUtil.PostWithSign <BindResultModel>(UrlConst.Bind, paramDict)
            .Subscribe(response =>
            {
                if (response.bindRelation == 1)
                {
                    UIMgr.OpenPanel <TipPanel>(new TipPanelData()
                    {
                        action             = TipAction.BindDevice,
                        message            = "该账号已绑定其他设备,\n如需绑定当前设备,需解绑后重新绑定",
                        isHideCancelButton = true,
                        strConfirm         = "知道了"
                    });
                    StopAllCoroutines();
                }
                else
                {
                    ConnectResult(true);
                    StopAllCoroutines();
                }

                /**
                 * 停止播放音频
                 */
                if (Application.platform == RuntimePlatform.IPhonePlayer)
                {
                    IOSClientUtil.StopBindDevice("");
                }
                else if (Application.platform == RuntimePlatform.Android)
                {
                    AndroidForUnity.CallAndroidForStopDeviceConnect();
                }
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    ConnectResult(false);
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Ejemplo n.º 8
0
        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())
                {
                    int adminId = 0;
                    foreach (var model in response)
                    {
                        if (model.isManager == 1)
                        {
                            adminId = model.id;
                            break;
                        }
                    }
                    if (adminId == PlayerPrefsUtil.GetUserId() && response.Count > 1)
                    {
                        AddFamilyTitleItem(true);
                    }
                    else
                    {
                        AddFamilyTitleItem(false);
                    }
                    foreach (var model in response)
                    {
                        AddItem(model);
                    }
                }
                else
                {
                    AddFamilyTitleItem(false);
                }
            }, e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Ejemplo n.º 9
0
        /**
         * 获取随便听听地址
         */
        private void StartRequestForGetResourcePageUrl()
        {
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("userId", PlayerPrefsUtil.GetUserId());
            if (Application.platform == RuntimePlatform.Android)
            {
                paramDict.Add("client", "android");
            }
            else
            {
                paramDict.Add("client", "ios");
            }
            HttpUtil.GetWithSign <string>(UrlConst.GetResourcePageUrl, paramDict)
            .Subscribe(response =>
            {
                if (Application.platform == RuntimePlatform.Android)
                {
                    Dictionary <string, object> param = new Dictionary <string, object>();
                    param.Add("target", AppConst.WEBVIEW);
                    Dictionary <string, object> subParam = new Dictionary <string, object>();
                    subParam.Add("url", response);
                    subParam.Add("title", "随便听听");
                    param.Add("params", subParam);
                    AndroidForUnity.CallAndroidStartActivityForAnim(param.ToJson(), AppConst.ANIM_CLOUD);
                }
                else if (Application.platform == RuntimePlatform.IPhonePlayer)
                {
                    Dictionary <string, object> param = new Dictionary <string, object>();
                    param.Add("target", AppConst.WKWEBVIEW_IOS);
                    Dictionary <string, object> subParam = new Dictionary <string, object>();
                    subParam.Add("webUrl", response);
                    subParam.Add("title", "随便听听");
                    param.Add("params", subParam);
                    IOSClientUtil.CallIOSClient(param.ToJson());
                }
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Ejemplo n.º 10
0
        void StartResquestForAddFeedBack(String version, int build, string station)
        {
            BtnConfirm.enabled = false;
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("userId", PlayerPrefsUtil.GetUserId());
            if (PlayerPrefsUtil.UserInfo != null && PlayerPrefsUtil.UserInfo.babyInfoVo != null)
            {
                paramDict.Add("userName", PlayerPrefsUtil.UserInfo.babyInfoVo.name);
            }
            else
            {
                paramDict.Add("userName", "未知");
            }
            paramDict.Add("content", InputContent.text);
            paramDict.Add("version", version);
            paramDict.Add("build", build);
            paramDict.Add("station", station);
            if (PlayerPrefsUtil.UserInfo != null)
            {
                paramDict.Add("userAccount", PlayerPrefsUtil.UserInfo.mobile);
            }
            else
            {
                paramDict.Add("userAccount", "未知");
            }
            HttpUtil.PostWithSign <object>(UrlConst.AddFeedBack, paramDict, "feedback.jpg", mPhotoPath)
            .Subscribe(response =>
            {
                CommonUtil.toast("反馈成功");
                BtnConfirm.enabled = true;
                InputContent.text  = "";
                mPhotoPath         = "";
                ImgPhoto.sprite    = Sprite.Create(texture2DAddPhoto, new Rect(0, 0, texture2DAddPhoto.width, texture2DAddPhoto.height), Vector2.one * 0.5f);
                BtnDel.gameObject.SetActive(false);
            }
                       , e =>
            {
                BtnConfirm.enabled = true;
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                }
            }).AddTo(this);
        }
Ejemplo n.º 11
0
        private void RequestDeviceID(bool isLast)
        {
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("userId", PlayerPrefsUtil.GetUserId());
            HttpUtil.GetWithSign <string>(UrlConst.DeviceIdByUserId, paramDict)
            .Subscribe(response =>
            {
                if (response.IsNotNullAndEmpty())
                {
                    StartResquestForBind(response);
                }
                else
                {
                    if (isLast)
                    {
                        if (Application.platform == RuntimePlatform.Android)
                        {
                            AndroidForUnity.CallAndroidForStopDeviceConnect();
                        }

                        if (Application.platform == RuntimePlatform.IPhonePlayer)
                        {
                            IOSClientUtil.StopBindDevice("");
                        }
                        Log.I("配网超时 的失败");
                        ConnectResult(false);
                    }
                }
            }, e =>
            {
                if (e is HttpException)
                {
                    if (isLast)
                    {
                        ConnectResult(false);
                    }
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                    CommonUtil.toast(http.Message);
                }
            }).AddTo(this);
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
0
        void StartResquestForGetUserInfo()
        {
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("userId", PlayerPrefsUtil.GetUserId());
            HttpUtil.GetWithSign <UserInfoModel>(UrlConst.GetUserInfo, paramDict)
            .Subscribe(response =>
            {
                PlayerPrefsUtil.UserInfo = response;
                setUserInfoData();
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    UIMgr.OpenPanel <LoginPanel>(new LoginPanelData(), UITransitionType.CLOUD);
                }
            }).AddTo(this);
        }
Ejemplo n.º 14
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);
        }
Ejemplo n.º 15
0
        /**
         * 签到
         */
        private void RequestAttendance()
        {
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("relBabyId", PlayerPrefsUtil.GetBabyId());
            paramDict.Add("creator", PlayerPrefsUtil.GetUserId());
            Debug.Log(paramDict);

            HttpUtil.PostWithSign <MedalModel>(UrlConst.AttendanceAdd, paramDict)
            .Subscribe(response =>
            {
                RequestDailyTask();
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Ejemplo n.º 16
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);
        }
Ejemplo n.º 17
0
        protected override void OnInit(QFramework.IUIData uiData)
        {
            mData = uiData as ConnectDevicePanelData ?? new ConnectDevicePanelData();
            Meteors.transform.DOLocalMoveX(-2370, 5f).SetLoops(-1, LoopType.Restart);
            Meteors.transform.DOLocalMoveY(-470, 5f).SetLoops(-1, LoopType.Restart);

            Dictionary <string, object> param = new Dictionary <string, object>();

            param.Add("ssid", mData.SSIDStr);
            param.Add("password", mData.SSIDPWD);
            param.Add("token", PlayerPrefsUtil.GetToken());
            param.Add("userId", PlayerPrefsUtil.GetUserId());
            if (Application.platform == RuntimePlatform.Android)
            {
                AndroidForUnity.CallAndroidForStartDeviceConnect(mData.SSIDStr, mData.SSIDPWD);
            }
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                IOSClientUtil.StartBindDevice(param.ToJson());
            }

            StartCoroutine(CountDown());

            BtnBack.OnClickAsObservable().Subscribe(_ =>
            {
                UIMgr.OpenPanel <TipPanel>(new TipPanelData()
                {
                    action     = TipAction.BindingBack,
                    message    = "返回后联网将不在继续,确认终止操作?",
                    strConfirm = "确定",
                    strCancel  = "继续等待",
                    strTitle   = "终止配网",
                });
            }).AddTo(this);

            BtnCheckWiFi.OnClickAsObservable().Subscribe(_ =>
            {
                UIMgr.OpenPanel <BindCheckWIFIPanel>(new BindCheckWIFIPanelData(), UITransitionType.NULL);
            }).AddTo(this);

            SimpleEventSystem.GetEvent <BindDeviceResult>().Subscribe(res =>
            {
                BindDeviceModel model = res.Model;

                if (Application.platform == RuntimePlatform.Android)
                {
                    if (model.status == 1)
                    {
                        StartResquestForBind(model.deviceId);
                    }
                    else
                    {
                        ConnectResult(false);
                    }
                }
                else if (Application.platform == RuntimePlatform.IPhonePlayer)
                {
                    if (model.requestTag == 2 && model.deviceId.IsNotNullAndEmpty())
                    {
                        StartResquestForBind(model.deviceId);
                    }

                    if (model.requestTag == 1)
                    {
                        CommonUtil.toast("获取音频接口出错");
                    }
                }
            }).AddTo(this);

            SimpleEventSystem.GetEvent <TipConfirmClick>()
            .Subscribe(_ =>
            {
                if (_.GetAction == TipAction.BindDevice)
                {
                    ShowMainPanel();
                }
                else if (_.GetAction == TipAction.BindingBack)
                {
                    StopAllCoroutines();
                    if (Application.platform == RuntimePlatform.IPhonePlayer)
                    {
                        IOSClientUtil.StopBindDevice("");
                    }
                    else if (Application.platform == RuntimePlatform.Android)
                    {
                        AndroidForUnity.CallAndroidForStopDeviceConnect();
                    }
                    Back();
                }
            }).AddTo(this);
        }
Ejemplo n.º 18
0
    public void SetContent(FamilyModel familyModel)
    {
        this.mFamilyModel     = familyModel;
        mTexture2DFather      = mResLoader.LoadSync <Texture2D>("ic_head_father");
        mTexture2DMother      = mResLoader.LoadSync <Texture2D>("ic_head_mother");
        mTexture2DGrandFather = mResLoader.LoadSync <Texture2D>("ic_head_grand_father");
        mTexture2DGrandMother = mResLoader.LoadSync <Texture2D>("ic_head_grand_mother");
        mTexture2DBrother     = mResLoader.LoadSync <Texture2D>("ic_head_brother");
        mTexture2DSister      = mResLoader.LoadSync <Texture2D>("ic_head_sister");
        if (familyModel.logoUrl.IsNotNullAndEmpty())
        {
            ImageDownloadUtils.Instance.SetAsyncImage(familyModel.logoUrl, ImgHead);
        }
        else if (familyModel.babyRelation.Equals("父亲"))
        {
            ImgHead.sprite = Sprite.Create(mTexture2DFather,
                                           new Rect(0, 0, mTexture2DFather.width, mTexture2DFather.height), Vector2.one * 0.5f);
        }
        else if (familyModel.babyRelation.Equals("母亲"))
        {
            ImgHead.sprite = Sprite.Create(mTexture2DMother,
                                           new Rect(0, 0, mTexture2DMother.width, mTexture2DMother.height), Vector2.one * 0.5f);
        }
        else if (familyModel.babyRelation.Equals("祖父"))
        {
            ImgHead.sprite = Sprite.Create(mTexture2DGrandFather,
                                           new Rect(0, 0, mTexture2DGrandFather.width, mTexture2DGrandFather.height), Vector2.one * 0.5f);
        }
        else if (familyModel.babyRelation.Equals("祖母"))
        {
            ImgHead.sprite = Sprite.Create(mTexture2DGrandMother,
                                           new Rect(0, 0, mTexture2DGrandMother.width, mTexture2DGrandMother.height), Vector2.one * 0.5f);
        }
        else if (familyModel.babyRelation.Equals("哥哥"))
        {
            ImgHead.sprite = Sprite.Create(mTexture2DBrother,
                                           new Rect(0, 0, mTexture2DBrother.width, mTexture2DBrother.height), Vector2.one * 0.5f);
        }
        else if (familyModel.babyRelation.Equals("姐姐"))
        {
            ImgHead.sprite = Sprite.Create(mTexture2DSister,
                                           new Rect(0, 0, mTexture2DSister.width, mTexture2DSister.height), Vector2.one * 0.5f);
        }

        TextMobile.text = familyModel.mobile;
        if (familyModel.id == PlayerPrefsUtil.GetUserId())
        {
            TextRelation.text = "我";
        }
        else
        {
            TextRelation.text = mFamilyModel.babyRelation;
        }
        if (familyModel.isManager == 1)
        {
            ImgAdmin.gameObject.SetActive(true);
        }
        else
        {
            ImgAdmin.gameObject.SetActive(false);
        }
    }
Ejemplo n.º 19
0
    public void SetContent(FamilyModel familyModel, int type)
    {
        this.mFamilyModel     = familyModel;
        mTexture2DTransfer    = mResLoader.LoadSync <Texture2D>("toggle_transfer_sel");
        mTexture2DSubtract    = mResLoader.LoadSync <Texture2D>("toggle_subtract_sel");
        mTexture2DFather      = mResLoader.LoadSync <Texture2D>("ic_head_father");
        mTexture2DMother      = mResLoader.LoadSync <Texture2D>("ic_head_mother");
        mTexture2DGrandFather = mResLoader.LoadSync <Texture2D>("ic_head_grand_father");
        mTexture2DGrandMother = mResLoader.LoadSync <Texture2D>("ic_head_grand_mother");
        mTexture2DBrother     = mResLoader.LoadSync <Texture2D>("ic_head_brother");
        mTexture2DSister      = mResLoader.LoadSync <Texture2D>("ic_head_sister");

        if (familyModel.logoUrl.IsNotNullAndEmpty())
        {
            ImageDownloadUtils.Instance.SetAsyncImage(familyModel.logoUrl, ImgHead);
        }
        else if (familyModel.babyRelation.Equals("父亲"))
        {
            ImgHead.sprite = Sprite.Create(mTexture2DFather,
                                           new Rect(0, 0, mTexture2DFather.width, mTexture2DFather.height), Vector2.one * 0.5f);
        }
        else if (familyModel.babyRelation.Equals("母亲"))
        {
            ImgHead.sprite = Sprite.Create(mTexture2DMother,
                                           new Rect(0, 0, mTexture2DMother.width, mTexture2DMother.height), Vector2.one * 0.5f);
        }
        else if (familyModel.babyRelation.Equals("祖父"))
        {
            ImgHead.sprite = Sprite.Create(mTexture2DGrandFather,
                                           new Rect(0, 0, mTexture2DGrandFather.width, mTexture2DGrandFather.height), Vector2.one * 0.5f);
        }
        else if (familyModel.babyRelation.Equals("祖母"))
        {
            ImgHead.sprite = Sprite.Create(mTexture2DGrandMother,
                                           new Rect(0, 0, mTexture2DGrandMother.width, mTexture2DGrandMother.height), Vector2.one * 0.5f);
        }
        else if (familyModel.babyRelation.Equals("哥哥"))
        {
            ImgHead.sprite = Sprite.Create(mTexture2DBrother,
                                           new Rect(0, 0, mTexture2DBrother.width, mTexture2DBrother.height), Vector2.one * 0.5f);
        }
        else if (familyModel.babyRelation.Equals("姐姐"))
        {
            ImgHead.sprite = Sprite.Create(mTexture2DSister,
                                           new Rect(0, 0, mTexture2DSister.width, mTexture2DSister.height), Vector2.one * 0.5f);
        }

        TextMobile.text = familyModel.mobile;
        if (familyModel.id == PlayerPrefsUtil.GetUserId())
        {
            TextRelation.text = "我";
        }
        else
        {
            TextRelation.text = mFamilyModel.babyRelation;
        }
        //0:移除,1:转让
        if (type == 0)
        {
            Checkmark.sprite = Sprite.Create(mTexture2DSubtract,
                                             new Rect(0, 0, mTexture2DSubtract.width, mTexture2DSubtract.height), Vector2.one * 0.5f);
        }
        else
        {
            Checkmark.sprite = Sprite.Create(mTexture2DTransfer,
                                             new Rect(0, 0, mTexture2DTransfer.width, mTexture2DTransfer.height), Vector2.one * 0.5f);
        }
    }