12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using Bitsplash.DatePicker;
- using LitJson;
- using UnityEngine;
- using UnityEngine.UI;
- public class JieKouDiaoYongRiZhi : MonoBehaviour
- {
- public PageBtnControl pbt;
-
- 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.GetqueryThirdParty(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<JieKouRiZhiItem>().init(jd["data"]["list"][i]);
- list[i].SetActive(true);
- }else
- {
- list[i].SetActive(false);
- }
- }
- }));
- }
- private void Awake() {
-
- }
- int MaxLiebiao=5;
- }
|