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); }
public void UpdateMonth() { SimpleEventSystem.Publish(new CanvasCanMove()); var boxMonthIndex = PlayerPrefsUtil.GetBoxMonthIndex(); BoxModel = PlayerPrefsUtil.ContentModel.boxList[boxMonthIndex]; TvTitle.text = BoxModel.name; mPlayer.GetComponent <MasterController>().SetData(BoxModel); }
public void SetData(BoxModel boxModel) { if (PlayerPrefsUtil.LockModels.Count <= PlayerPrefsUtil.GetBoxMonthIndex()) { PlayerPrefsUtil.SaveBoxMonthIndex(0); } CurrentIndex = PlayerPrefsUtil.GetUserDayPosition(boxModel); BoxMonthIndex = PlayerPrefsUtil.GetBoxMonthIndex(); BoxModel = boxModel; UnlockDays.Clear(); UpdatePosition(); UpdateItem(PlayerPrefsUtil.LockModels[BoxMonthIndex], boxModel.boxContentList); }
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); }
protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as BookDayListPanelData ?? new BookDayListPanelData(); PlayerPrefsUtil.SelectPlanId = mData.PlanId; string prefabName = "LionPrefab"; string BGMusic = "XXQG_BG_Music"; if (PlayerPrefsUtil.ContentModel.planId == 100099) { prefabName = "TongtongPrefab"; BGMusic = "XXQG_BG_Music"; } else if (PlayerPrefsUtil.ContentModel.subject == 2) { prefabName = "LionPrefab"; BGMusic = "CN_BG_Music"; } else if (PlayerPrefsUtil.ContentModel.subject == 1) { prefabName = "DinoPrefab"; BGMusic = "EN_BG_Music"; } AudioManager.SetMusicOn(); AudioManager.PlayMusic(BGMusic); if (mData.Month != 0) { PlayerPrefsUtil.SaveBoxMonthIndex(mData.Month - 1); } // 3 if (PlayerPrefsUtil.ContentModel.boxList.Count <= PlayerPrefsUtil.GetBoxMonthIndex()) { PlayerPrefsUtil.SaveBoxMonthIndex(0); } var boxMonthIndex = PlayerPrefsUtil.GetBoxMonthIndex(); Log.I("boxMonthIndex: " + boxMonthIndex); BoxModel = PlayerPrefsUtil.ContentModel.boxList[boxMonthIndex]; Log.I("BoxModel.name: " + BoxModel.name); TvTitle.text = BoxModel.name; if (prefabName.IsNullOrEmpty()) { CommonUtil.toast("prefabName为空"); } mPlayer = mResLoader.LoadSync <GameObject>(prefabName) .Instantiate() .transform .Identity() .ApplySelfTo(self => { self.GetComponent <MasterController>().SetData(BoxModel); }) .gameObject; BtnTitle.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); BookMonthObj.IsShow.Value = !BookMonthObj.IsShow.Value; }); BookMonthObj.transform.localPosition = new Vector3(0, GetFixed(Screen.height)); BtnBookMonthBack.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); BookMonthObj.IsShow.Value = !BookMonthObj.IsShow.Value; }); BtnTarget.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <TargetDetailPanel>(new TargetDetailPanelData() { BoxModel = BoxModel }, UITransitionType.CIRCLE, this); }); BtnVideo.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <ListItemPanel>(new ListItemPanelData() { FunTag = ItemType.VIDEO }, UITransitionType.CIRCLE, this); }); BtnAudio.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <ListItemPanel>(new ListItemPanelData() { FunTag = ItemType.AUDIO }, UITransitionType.CIRCLE, this); }); BtnBook.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); UIMgr.OpenPanel <ListItemPanel>(new ListItemPanelData() { FunTag = ItemType.PICBOOK }, UITransitionType.CIRCLE, this); }); SimpleEventSystem.GetEvent <CanvasAnimationFinish>().Subscribe(_ => { UIMgr.OpenPanel <BookDayPanel>(new BookDayPanelData() { BoxDayDetailModel = mPlayer.GetComponent <MasterController>().SelectDayDetailModel }, UITransitionType.CIRCLE, this); }).AddTo(this); BtnBookDayListBack.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); Back(); }); Observable.EveryUpdate().Where(_ => Input.GetKeyDown(KeyCode.Escape)) .Subscribe(_ => { if (BookMonthObj.IsShow.Value) { BookMonthObj.IsShow.Value = false; return; } Back(); }).AddTo(this); BookMonthObj.UpdateItemDate(); }
protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as BookDayPanelData ?? new BookDayPanelData(); BtnBack.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); Back(); }); ImageDownloadUtils.Instance.SetAsyncImage(mData.BoxDayDetailModel.thumbUrl, ImgDay); TvDayNum.text = "第" + mData.BoxDayDetailModel.day + "天"; TvTitle.text = mData.BoxDayDetailModel.topic; mData.BoxDayDetailModel.boxDayActionList.ForEach(DayActionModel => { mResLoader.LoadSync <GameObject>("ItemTypeAction") .Instantiate() .transform .LocalIdentity() .Parent(Content) .LocalScale(1, 1, 1) .ApplySelfTo(game => { Button button = game.Find("ItemType").GetComponent <Button>(); string actionIconName = GetActionIconName(DayActionModel.action); var texture2D = mResLoader.LoadSync <Texture2D>(actionIconName); button.GetComponent <Image>().sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); button.OnClickAsObservable().Subscribe(_ => { OnClick(game, DayActionModel); }).AddTo(this); Text actionName = game.transform.Find("Image").Find("Text").GetComponent <Text>(); actionName.text = DayActionModel.name; }) .Show(); }); BtnAttendance.onClick.AddListener(() => { AudioManager.PlaySound("Button_Audio"); if (PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList.IsNotNull() && PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList .Contains(mData.BoxDayDetailModel.day)) { UIMgr.OpenPanel <WorksWallPanel>(new WorksWallPanelData() { BoxId = mData.BoxDayDetailModel.boxId, BoxDay = mData.BoxDayDetailModel.day }, UITransitionType.CIRCLE); } else { //mData.BoxDayDetailModel UIMgr.OpenPanel <AttendanceMainPanel>(new AttendanceMainPanelData() { BoxId = mData.BoxDayDetailModel.boxId, BoxDay = mData.BoxDayDetailModel.day }, UITransitionType.CIRCLE); } }); if (PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList != null && PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList.Contains(mData.BoxDayDetailModel.day)) // 已打卡 { var texture2D = mResLoader.LoadSync <Texture2D>("btn_attendance_sel"); BtnAttendance.image.sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); } else { var texture2D = mResLoader.LoadSync <Texture2D>("btn_attendance_nor"); BtnAttendance.image.sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); } SimpleEventSystem.GetEvent <AttendanceSuccess>() .Subscribe(_ => { if (PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList != null && PlayerPrefsUtil.LockModels[PlayerPrefsUtil.GetBoxMonthIndex()].boxDayList.Contains(mData.BoxDayDetailModel.day)) // 已打卡 { var texture2D = mResLoader.LoadSync <Texture2D>("btn_attendance_sel"); BtnAttendance.image.sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); } else { var texture2D = mResLoader.LoadSync <Texture2D>("btn_attendance_nor"); BtnAttendance.image.sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f); } }).AddTo(this); }