/// <summary> /// toggle点击事件 /// </summary> /// <param name="go"></param> public void OnTogggleClick(GameObject go) { if (UIToggle.current.value) { SendGetUserBRDetail req = new SendGetUserBRDetail(); req.num = 10; req.page = 1; req.type = go.name; Global.Inst.GetController <MainController>().SendGetNewPageUserBRInfo(req, () => { ShowItems(); }); } }
/// <summary> /// 滑动到最顶部 /// </summary> public void OnDragTopCall() { UIPanel panel = mSingleScroll.GetComponent <UIPanel>(); if (panel.clipOffset.y >= 200) { //请求最新的10条 SQDebug.Log("请求最新的10条"); SendGetUserBRDetail req = new SendGetUserBRDetail(); req.num = 10; req.page = 1; req.type = MainViewModel.Inst.mCurUserType; Global.Inst.GetController <MainController>().SendGetNewPageUserBRInfo(req, () => { ShowItems(); }); } if (panel.baseClipRegion.w < NGUIMath.CalculateRelativeWidgetBounds(mSingleScroll.transform).size.y) { OnDragDownCall(); } }
/// <summary> /// 滑动到最底部 /// </summary> public void OnDragDownCall() { UIPanel panel = mSingleScroll.GetComponent <UIPanel>(); SQDebug.Log(panel.transform.localPosition.y - mSingleScroll.GetNextDownPos()); SQDebug.Log(mSingleScroll.GetMaxIndex() >= mAllIndex - 1); if (panel.transform.localPosition.y - mSingleScroll.GetNextDownPos() >= 200 && mSingleScroll.GetMaxIndex() >= mAllIndex - 1) { //请求以前的10条 SQDebug.Log("请求以前的10条"); SendGetUserBRDetail req = new SendGetUserBRDetail(); req.num = 10; req.page = MainViewModel.Inst.mCurUserPage + 1; req.type = MainViewModel.Inst.mCurUserType; Global.Inst.GetController <MainController>().SendGetNewPageUserBRInfo(req, () => { mSingleScroll.UpdateAllCount(MainViewModel.Inst.mCurUserList.Count); }); } }
/// <summary> /// 获取玩家接入打赏纪律 /// </summary> /// <param name="req"></param> public void SendGetNewPageUserBRInfo(SendGetUserBRDetail req, CallBack call) { NetProcess.SendRequest <SendGetUserBRDetail>(req, ProtoIdMap.CMD_SendGetUserBRRecord, (msg) => { SendGetUserBRAck ack = msg.Read <SendGetUserBRAck>(); if (ack.code == 1) { if (ack.data != null) { MainViewModel.Inst.UpdateUserList(req.type, req.page, ack.data.infoList); } if (call != null) { call(); } } else { GameUtils.ShowErrorTips(ack.code); } }); }