123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using Bitsplash.DatePicker;
- using LitJson;
- using UnityEngine;
- using UnityEngine.UI;
- public class CaoZuoRizhi : MonoBehaviour
- {
- public PageBtnControl pbt;
- public UIScrollScript uiScroll;
-
- public List<GameObject> list = new List<GameObject>();
- long startl;
- long sendl;
- public DatePickerDropDown ds1;
- public DatePickerDropDown ds2;
- public void chooseA()
- {
-
- StartCoroutine(chooseYanChi(ds1.Label,(l)=> {
- startl=l;
- }));
- }
- public void chooseB()
- {
- StartCoroutine(chooseYanChi(ds2.Label, (l) => {
- sendl=l+86400;
- }));
- }
- IEnumerator chooseYanChi(Text t,Action<long> callback)
- {
- yield return null;
- string dateString = t.text;
- Debug.Log("chooseYanChi===>"+ds1.Label.text);
- DateTime dateTime = DateTime.Parse(dateString);
- long timestamp = ((DateTimeOffset)dateTime).ToUnixTimeSeconds();
- Debug.Log("Timestamp: " + timestamp);
- callback.Invoke(timestamp);
- }
- public void sousuo()
- {
- page(1);
- }
- void OnEnable()
- {
- startl = 0;
- sendl =((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds();
- pbt.curretPage =1;
- page(1);
- ds1.Label.text ="选择日期";
- ds2.Label.text ="选择日期";
- }
- int total =1;
- public void page(int i)
- {
- JsonData d =new JsonData();
- d["start_time"] =startl;
- d["end_time"] =sendl;
- d["page"] =i;
- d["size"] =MaxLiebiao;
- Debug.Log("initPage"+i);
- StartCoroutine(DataManager.Instance.GetRePort(d,(msg)=>{
- JsonData jd =JsonMapper.ToObject(msg);
- total = int.Parse( jd["data"]["page"]["total_page"].ToString());
- if( pbt.allPage!=total)
- {
- pbt.allPage = total;
- pbt.InitData();
- }
- Debug.Log("总共"+int.Parse( jd["data"]["page"]["total_count"].ToString()));
- for (int i = 0; i < MaxLiebiao; i++)
- {
- if(jd["data"]["list"].ToString()!="[]"&&jd["data"]["list"].Count> i)
- {
- list[i].GetComponent<RiZhiItem>().init(jd["data"]["list"][i]);
- list[i].SetActive(true);
- }else
- {
- list[i].SetActive(false);
- }
- }
- }));
- }
- private void Awake() {
-
- }
- int MaxLiebiao=10;
- }
|