/** * 勋章数据 */ 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); }
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); }
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 RequestDailyTask() { Dictionary <string, object> signInParamDict = new Dictionary <string, object>(); signInParamDict.Add("babyId", PlayerPrefsUtil.GetBabyId()); HttpUtil.GetWithSign <ChechSignInModel>(UrlConst.ChechIsSignIn, signInParamDict) .Subscribe(response => { TextAttendanceScoreConfig.text = String.Format("x{0}", response.attendanceScoreConfig.ToString()); TextPunchScoreConfig.text = String.Format("x{0}", response.punchScoreConfig.ToString()); TextPunchScoreShareConfig.text = String.Format("x{0}", response.punchShareScoreConfig.ToString()); TextSignInDayNum.text = response.attendanceCount.ToString(); TextClockNum.text = response.punchCount.ToString(); TextIntegralNum.text = response.totalScore.ToString(); Debug.Log("------" + response); isAttendance = response.isAttendance; var btnText = BtnAttendance.transform.Find("Text").GetComponent <Text>(); Color BtnTextColor; // var texture2D = mResLoader.LoadSync<Texture2D>("ic_dailyClocksBtn"); if (isAttendance == 0) { ColorUtility.TryParseHtmlString("#FFFFFF", out BtnTextColor); // texture2D = mResLoader.LoadSync<Texture2D>("ic_dailyClocksBtn"); btnText.text = "签到"; ImageAttendanceDone.gameObject.SetActive(false); } else { ColorUtility.TryParseHtmlString("#4A4A4A", out BtnTextColor); // texture2D = mResLoader.LoadSync<Texture2D>("ic_dailyClocksBtn"); btnText.text = "已签到"; ImageAttendanceDone.gameObject.SetActive(true); } btnText.color = BtnTextColor; // BtnAttendance.image.sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); } , e => { if (e is HttpException) { HttpException http = e as HttpException; Log.E("弹吐司" + http.Message); } }).AddTo(this); }
/** * 检查是否有未领取的勋章 */ private void RequestBabyMedalFindList() { Dictionary <string, object> paramDict = new Dictionary <string, object>(); paramDict.Add("babyId", PlayerPrefsUtil.GetBabyId()); HttpUtil.GetWithSign <List <MedalModel.MedalBean> >(UrlConst.FindBabyMedalList, paramDict) .Subscribe(result => { mMedalList = result; if (mMedalList.Count > 0) { ShowMedalAnimationPanel(); } }, exception => { }).AddTo(this); }
void StartRequestForPunch(string filePath) { Dictionary <string, object> paramDict = new Dictionary <string, object>(); paramDict.Add("babyId", PlayerPrefsUtil.GetBabyId()); paramDict.Add("relBoxId", mData.BoxId); paramDict.Add("boxDay", mData.BoxDay); if (mData.Action == AttendanceAdd.Audio) { paramDict.Add("duration", (int)(MicrophoneManager.GetInstance().GetClipLength() * 1000)); } paramDict.Add("punchText", InputContent.text); paramDict.Add("punchType", (int)mData.Action); paramDict.Add("punchPath", filePath); HttpUtil.PostWithSign <AttendanceModel>(UrlConst.Punch, paramDict) .Subscribe(response => { LoadingManager.GetInstance().DismissLoading(); if (PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList.IsNull()) { PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList = new List <int>(); } if (PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList .Contains(mData.BoxDay)) { PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList.Remove(mData.BoxDay); } PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList.Add(mData.BoxDay); Log.I("发布:" + mData.Action); BtnPush.enabled = true; SimpleEventSystem.Publish(new AttendanceSuccess(true)); UIMgr.OpenPanel <AttendanceSharePanel>(new AttendanceSharePanelData() { AttendanceModel = response }, UITransitionType.CIRCLE); Close(); } , e => { BtnPush.enabled = true; if (e is HttpException) { HttpException http = e as HttpException; } }).AddTo(this); }
private void StartRequestForDrawPowerSpecialPlan() { Dictionary <string, object> paramDict = new Dictionary <string, object>(); paramDict.Add("babyId", PlayerPrefsUtil.GetBabyId()); paramDict.Add("isNew", 1); HttpUtil.PostWithSign <QRCodeModel>(UrlConst.DrawPowerSpecialPlan, paramDict) .Subscribe(response => { StartRequestForGetPlanInfo(response.planId, 0); } , e => { if (e is HttpException) { HttpException http = e as HttpException; Log.E("弹吐司" + http.Message); } }).AddTo(this); }
private void RequestDrawMedal() { Dictionary <string, object> paramDict = new Dictionary <string, object>(); paramDict.Add("babyId", PlayerPrefsUtil.GetBabyId()); paramDict.Add("medalGrade", mData.medalModel.medalGrade); HttpUtil.PostWithSign <object>(UrlConst.DrawMedal, paramDict) .Subscribe(result => { UIMgr.OpenPanel <MedalSharePanel>(new MedalSharePanelData() { medalModel = mData.medalModel, }, UITransitionType.CLOUD); Back(); SimpleEventSystem.Publish(new MedalDrawSuccess()); }, exception => { }).AddTo(this); }
private void StartResquestForAddRecord() { Dictionary <string, object> paramDict = new Dictionary <string, object>(); paramDict.Add("relBabyId", PlayerPrefsUtil.GetBabyId()); paramDict.Add("shareType", 2); paramDict.Add("medalGrade", mData.medalModel.medalGrade); HttpUtil.PostWithSign <object>(UrlConst.AddRecord, paramDict) .Subscribe(response => { } , e => { if (e is HttpException) { HttpException http = e as HttpException; Log.E("弹吐司" + http.Message); } }).AddTo(this); }
/** * 积分列表数据 */ private void RequestGoodList() { Dictionary <string, object> paramDict = new Dictionary <string, object>(); paramDict.Add("babyId", PlayerPrefsUtil.GetBabyId()); Debug.Log(paramDict); HttpUtil.GetWithSign <List <GoodMedal> >(UrlConst.GoodsList, paramDict) .Subscribe(response => { CreatGoodsItem(response); Debug.Log("------" + response); } , e => { if (e is HttpException) { HttpException http = e as HttpException; Log.E("弹吐司" + http.Message); } }).AddTo(this); }
/** * 签到 */ 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); }
/** * 积分列表数据 * type 积分类型(3:兑换明细;1:获取明细) */ private void RequestGoodList(int type) { Dictionary <string, object> paramDict = new Dictionary <string, object>(); paramDict.Add("babyId", PlayerPrefsUtil.GetBabyId()); paramDict.Add("type", type); paramDict.Add("pageNum", 1); paramDict.Add("pageSize", 9999); Debug.Log(paramDict); HttpUtil.GetWithSign <BabyScoreExchangeModel>(UrlConst.BabyScore, paramDict) .Subscribe(response => { Debug.Log("------" + response); if (type == 3) { CreatExchangeListItem(response.records); } else if (type == 1) { CreatIntegralGetItem(response.records); } else { } } , e => { if (e is HttpException) { HttpException http = e as HttpException; Log.E("弹吐司" + http.Message); } }).AddTo(this); }
private void StartRequestForScanQR(string scanQR) { Dictionary <string, object> paramDict = new Dictionary <string, object>(); paramDict.Add("content", scanQR); paramDict.Add("babyId", PlayerPrefsUtil.GetBabyId()); HttpUtil.GetWithSign <QRCodeModel>(UrlConst.ScanQR, paramDict) .Subscribe(response => { int content = response.content; if (content == 1) { StartResquestForGetUserInfo(); StartRequestForBabyStudyLockInfo(); ScanQrCodePlanId = response.planId; ScanQrCodeMonth = response.month; UIMgr.OpenPanel <CollectGiftBoxPanel>(new CollectGiftBoxPanelData() { Type = response.subject == 1 ? CollectGiftBoxType.EnglishLearningPlan : CollectGiftBoxType.ChineseLearningPlan }); } else if (content == 3) { if (Application.platform == RuntimePlatform.Android) { Dictionary <string, object> param = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); subParam.Add("resourceId", response.id); subParam.Add("subject", response.subject); param.Add("target", AppConst.AUDIO_ANDROID); param.Add("params", subParam); Debug.Log("params ========" + subParam); AndroidForUnity.CallAndroidStartActivityForAnim(param.ToJson(), AppConst.ANIM_CIRCLE); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { Dictionary <string, object> param = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); subParam.Add("resourceId", response.id); subParam.Add("path", response.path); subParam.Add("subject", response.subject); subParam.Add("resourcePath", response.resourcePath); subParam.Add("resourceTitle", response.resourceTitle); subParam.Add("id", response.id); param.Add("target", AppConst.AUDIO_IOS); param.Add("method", IOSClientUtil.AudioPlay); param.Add("params", subParam); Debug.Log("params ========" + subParam); IOSClientUtil.CommonMethodCallIOSClient(param.ToJson()); } } } , e => { if (e is HttpException) { HttpException http = e as HttpException; Log.E("弹吐司" + http.Message); } }).AddTo(this); }
// Update is called once per frame public void SetData(WorksWall data) { float workWallItemHeight = 0; if (data.babyId == PlayerPrefsUtil.GetBabyId()) { BtnShare.gameObject.SetActive(true); } else { BtnShare.gameObject.SetActive(false); } // 分享事件 BtnShare.onClick.AddListener(() => { AttendanceModel model = new AttendanceModel(); model.boxDay = data.boxDay; model.punchPath = data.punchPathUrl; model.punchText = data.punchText; model.punchType = data.punchType; model.shareScore = data.shareScore; model.finishPunchNum = data.finishPunchNum; model.relBoxId = data.relBoxId; model.id = data.id; model.subject = data.subject; UIMgr.OpenPanel <AttendanceSharePanel>(new AttendanceSharePanelData() { AttendanceModel = model, isWall = true }, UITransitionType.CIRCLE); }); // 查看我的打卡 图片or 视频 BtnImgPreview.onClick.AddListener(() => { if (data.punchType == 0) //图文 { if (Application.platform == RuntimePlatform.Android) { AndroidForUnity.CallAndroidForShowPic(data.punchPathUrl); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { UIMgr.OpenPanel <PhotoBrowserPanel>(new PhotoBrowserPanelData() { ImageUrl = data.punchPathUrl, }, UITransitionType.NULL); } } else if (data.punchType == 2) //视频 { if (Application.platform == RuntimePlatform.Android) { AndroidForUnity.CallAndroidForPlayVideo(data.punchPathUrl); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { Dictionary <string, object> paramDic = new Dictionary <string, object>(); Dictionary <string, object> subParam = new Dictionary <string, object>(); subParam.Add("url", data.punchPathUrl); paramDic.Add("target", AppConst.VIDEO_IOS); paramDic.Add("method", IOSClientUtil.VideoMediaPlay); paramDic.Add("params", subParam); IOSClientUtil.CommonMethodCallIOSClient(paramDic.ToJson()); } } }); TextShareContent.text = StringUtil.Emoji(data.punchText); TextAge.text = data.age; TextName.text = StringUtil.Emoji(data.name); TextTimeLine.text = data.createTime; IsAudioPreviewPlaying.Subscribe(isPlaying => { Texture2D soundOnTexture = mResLoader.LoadSync <Texture2D>(isPlaying ? "ic_works_wall_audio_pause" : "ic_works_wall_audio_start"); ImgAudio.sprite = Sprite.Create(soundOnTexture, new Rect(0, 0, soundOnTexture.width, soundOnTexture.height), Vector2.one * 0.5f); }).AddTo(this); IsAudioContenPlaying.Subscribe(isPlaying => { Texture2D soundOnTexture = mResLoader.LoadSync <Texture2D>(isPlaying ? "ic_audio_playing" : "ic_audiio_pause"); ImgPlayState.sprite = Sprite.Create(soundOnTexture, new Rect(0, 0, soundOnTexture.width, soundOnTexture.height), Vector2.one * 0.5f); }).AddTo(this); AudioContenPlayingTime.Subscribe(time => { if (time == 0) { TextTime.text = AudioContenTotleTime.Value + "\""; } else { TextTime.text = time + "\"" + "/" + AudioContenTotleTime.Value + "\""; } }).AddTo(this); // 用户头像,没有传头像 使用默认的 Texture2D mTexture2DHBoy = mResLoader.LoadSync <Texture2D>("ic_head_boy"); Texture2D mTexture2DHGirl = mResLoader.LoadSync <Texture2D>("ic_head_girl"); if (PlayerPrefsUtil.UserInfo.babyInfoVo.babyLogoUrl.IsNotNullAndEmpty()) { ImageDownloadUtils.Instance.SetAsyncImage(data.logoRelativePathUrl, ImageUserIcon); } else if (PlayerPrefsUtil.UserInfo.babyInfoVo.sex == 1) { ImageUserIcon.sprite = Sprite.Create(mTexture2DHBoy, new Rect(0, 0, mTexture2DHBoy.width, mTexture2DHBoy.height), Vector2.one * 0.5f); } else if (PlayerPrefsUtil.UserInfo.babyInfoVo.sex == 2) { ImageUserIcon.sprite = Sprite.Create(mTexture2DHGirl, new Rect(0, 0, mTexture2DHGirl.width, mTexture2DHGirl.height), Vector2.one * 0.5f); } // 0-图文打卡 1-音频打卡 2-视频打卡 if (data.punchType == 0) { ImgSharePreview.SetActive(true); ImgAudioPreview.SetActive(false); ImageDownloadUtils.Instance.SetAsyncImage(data.punchPathUrl, ImageThumIcon); ImagePunchType.gameObject.SetActive(false); } else if (data.punchType == 1) { ImgSharePreview.SetActive(false); ImgAudioPreview.SetActive(true); BtnAudioPreview.onClick.AddListener(() => { if (AudioContentAudioSource.isPlaying) { AudioContentAudioSource.Pause(); } Log.I("data.punchPathUrl==" + data.punchPathUrl); if (AudioPreviewAudioSource.isPlaying) { AudioPreviewAudioSource.Pause(); } else { StartCoroutine(SetAudioClip(data.punchPathUrl, AudioPreviewAudioSource)); } }); ImagePunchType.gameObject.SetActive(false); } else if (data.punchType == 2) { ImgSharePreview.SetActive(true); ImgAudioPreview.SetActive(false); ImageDownloadUtils.Instance.SetAsyncImage(data.thumbnailPath, ImageThumIcon); ImagePunchType.gameObject.SetActive(true); } if (data.comments.IsNotNull() && data.comments.Count > 0) { Line.SetActive(true); TextReply.gameObject.SetActive(true); TextReplyContent.gameObject.SetActive(data.comments[0].commentContent.IsNotNullAndEmpty()); TextReplyContent.text = StringUtil.Emoji(data.comments[0].commentContent); if (data.comments[0].commentPathUrl.IsNotNullAndEmpty()) { AudioContent.SetActive(true); TextTime.text = data.comments[0].duration / 1000 + "\""; BtnPlayState.onClick.AddListener(() => { if (AudioPreviewAudioSource.isPlaying) { AudioPreviewAudioSource.Pause(); } if (AudioContentAudioSource.isPlaying) { AudioContentAudioSource.Pause(); } else { StartCoroutine(SetAudioClip(data.comments[0].commentPathUrl, AudioContentAudioSource)); } }); } else { AudioContent.SetActive(false); } } else { Line.SetActive(false); TextReply.gameObject.SetActive(false); TextReplyContent.gameObject.SetActive(false); AudioContent.SetActive(false); } LayoutRebuilder.ForceRebuildLayoutImmediate(MidPanelTransform); int height = (int)(Mathf.Abs(MidPanelTransform.rect.height) + 168); Debug.Log("MidPanelTransform 的高度 是 " + MidPanelTransform.rect.height); Debug.Log("TextShareContent 的高度 是 " + (TextShareContent.rectTransform.rect.height)); workWallItemHeight += TextName.rectTransform.rect.height; // 名称 workWallItemHeight += 10; // spacing workWallItemHeight += TextTimeLine.rectTransform.rect.height; // 发布时间 workWallItemHeight += 10; // spacing workWallItemHeight += TextShareContent.rectTransform.rect.height; // 发布的内容 workWallItemHeight += 10; // spacing if (data.comments.Count > 0) { workWallItemHeight += TextReply.rectTransform.rect.height; // 老师回复 workWallItemHeight += 10; // spacing workWallItemHeight += TextReplyContent.rectTransform.rect.height; // 点评的内容 if (data.comments[0].commentPathUrl.IsNotNullAndEmpty()) { workWallItemHeight += 44; // 回复音频高度 workWallItemHeight += 10; // spacing } } workWallItemHeight += (34 + 60); // spacing if (workWallItemHeight < 312) { workWallItemHeight = 312; } transform.GetComponent <RectTransform>().sizeDelta = new Vector2(940, workWallItemHeight); }
private void StartResquestForSharePoster(ShareAction shareAction) { Dictionary <string, object> paramDict = new Dictionary <string, object>(); paramDict.Add("babyId", PlayerPrefsUtil.GetBabyId()); paramDict.Add("shareType", 2); paramDict.Add("medalGrade", mData.medalModel.medalGrade); HttpUtil.PostWithSign <string>(UrlConst.SharePoster, paramDict) .Subscribe(response => { Log.I("图片地址: " + response); if (shareAction == ShareAction.Save) { if (Application.platform == RuntimePlatform.Android) { NativeGallery.RequestPermission((result, action) => { if (result == (int)NativeGallery.Permission.Granted) { AndroidForUnity.CallAndroidForSavePicToAlbum(response); CommonUtil.toast("保存成功"); } }, (int)NativeAction.Album); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { IOSClientUtil.SaveImageToAlubmCallIOSClient(response); } } else if (shareAction == ShareAction.Wechat) { if (Application.platform == RuntimePlatform.Android) { ShareModel shareModel = new ShareModel(); shareModel.imageUrl = response; shareModel.platformName = AppConst.SHARE_WECHAT; shareModel.type = AppConst.SHARE_IMAGE_TYPE; shareModel.title = AppConst.SHARE_TITLE; if (mData.medalModel.isShare == 0) { shareModel.toastMessage = "分享成功+" + mData.medalModel.medalShareScore + "积分"; } AndroidForUnity.CallAndroidForShare(SerializeHelper.ToJson(shareModel)); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { Dictionary <string, object> sharParmsDic = new Dictionary <string, object>(); sharParmsDic.Add("platformType", "WechatSession"); sharParmsDic.Add("shareType", "image"); sharParmsDic.Add("image", response); if (mData.medalModel.isShare == 0) { string shareToastMessage = "分享成功+" + mData.medalModel.medalShareScore + "积分"; sharParmsDic.Add("shareToastMsg", shareToastMessage); } IOSClientUtil.ShareObjectCallIOSClient(SerializeHelper.ToJson(sharParmsDic)); } } else if (shareAction == ShareAction.WechatMoments) { if (Application.platform == RuntimePlatform.Android) { ShareModel shareModel = new ShareModel(); shareModel.imageUrl = response; shareModel.platformName = AppConst.SHARE_WECHAT_MOMENTS; shareModel.type = AppConst.SHARE_IMAGE_TYPE; shareModel.title = AppConst.SHARE_TITLE; if (mData.medalModel.isShare == 0) { shareModel.toastMessage = "分享成功+" + mData.medalModel.medalShareScore + "积分"; } AndroidForUnity.CallAndroidForShare(SerializeHelper.ToJson(shareModel)); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { Dictionary <string, object> sharParmsDic = new Dictionary <string, object>(); sharParmsDic.Add("platformType", "WechatTimeLine"); sharParmsDic.Add("shareType", "image"); sharParmsDic.Add("image", response); if (mData.medalModel.isShare == 0) { string shareToastMessage = "分享成功+" + mData.medalModel.medalShareScore + "积分"; sharParmsDic.Add("shareToastMsg", shareToastMessage); } IOSClientUtil.ShareObjectCallIOSClient(SerializeHelper.ToJson(sharParmsDic)); } } } , e => { if (e is HttpException) { HttpException http = e as HttpException; Log.E("弹吐司" + http.Message); } }).AddTo(this); }