/// <summary> /// 获取盈利收入信息 /// </summary> /// <param name="req"></param> public void SendGetNewPageGainInfo(SendGetGainDetail req, CallBack <PlayerRecordDetailNum> call) { NetProcess.SendRequest <SendGetGainDetail>(req, ProtoIdMap.CMD_SendGainDetail, (msg) => { SendGetGainAck ack = msg.Read <SendGetGainAck>(); if (ack.code == 1) { PlayerRecordDetailNum nums = null; if (ack.data != null) { nums = ack.data.statisticsNum; MainViewModel.Inst.UpdateGainList(req.type, req.page, ack.data.infoList); } if (call != null) { call(nums); } } else { GameUtils.ShowErrorTips(ack.code); } }); }
/// <summary> /// 更新数据界面 /// </summary> public void UpdateByNet() { SendGetGainDetail req = new SendGetGainDetail(); req.num = 10; req.page = 1; req.type = MainViewModel.Inst.mCurGainType; Global.Inst.GetController <ClubController>().SendGetClubPlayerInfoAndUpdate((data) => { SetData(data); }); }
/// <summary> /// toggle点击事件 /// </summary> /// <param name="go"></param> public void OnTogggleClick(GameObject go) { if (UIToggle.current.value) { SendGetGainDetail req = new SendGetGainDetail(); req.num = 10; req.page = 1; req.type = go.name; Global.Inst.GetController <MainController>().SendGetNewPageGainInfo(req, (num) => { ShowItems(num); }); } }
/// <summary> /// 滑动到最顶部 /// </summary> private void OnDragTopCall() { if (mPanel.clipOffset.y >= 50) { if (Time.realtimeSinceStartup < mRefreshTime)//三秒后才能刷新,避免重复执行 { return; } //请求最新的10条 SQDebug.Log("请求最新的10条"); SendGetGainDetail req = new SendGetGainDetail(); req.num = 10; req.page = 1; req.type = MainViewModel.Inst.mCurGainType; Global.Inst.GetController <ClubController>().SendGetClubPlayerInfoAndUpdate((data) => { SetData(data); }); mRefreshTime = Time.realtimeSinceStartup + 3; } }
/// <summary> /// 滑动到最顶部 /// </summary> public void OnDragTopCall() { UIPanel panel = mSingleScroll.GetComponent <UIPanel>(); if (panel.clipOffset.y >= 200) { //请求最新的10条 SQDebug.Log("请求最新的10条"); SendGetGainDetail req = new SendGetGainDetail(); req.num = 10; req.page = 1; req.type = MainViewModel.Inst.mCurGainType; Global.Inst.GetController <MainController>().SendGetNewPageGainInfo(req, (num) => { ShowItems(num); }); } 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条"); SendGetGainDetail req = new SendGetGainDetail(); req.num = 10; req.page = MainViewModel.Inst.mCurGainPage + 1; req.type = MainViewModel.Inst.mCurGainType; Global.Inst.GetController <MainController>().SendGetNewPageGainInfo(req, (num) => { InitNum(num); mSingleScroll.UpdateAllCount(MainViewModel.Inst.mCurGainList.Count); }); } }