using System; using System.Collections.Generic; using System.Text; using UnityEngine.Networking; namespace Calendar { public class Calendar { public int status { get; set; } public List data { get; set; } } public class CalendarData { //public Holiday holiday { get; set; } public List holiday { get; set; } } public class Holiday { //public string desc { get; set; } public string festival { get; set; } public List list { get; set; } public string name { get; set; } //public string rest { get; set; } } public class HolidayItem { public string date { get; set; } /// /// 1休息2上班 /// public int status { get; set; } public string remark { get { return status == 1 ? "休假" : "上班"; } } } public class CalendarUtil { public static System.Collections.IEnumerator CheckIsHoliday(DateTime time, Action callback) { var date = time.ToString("yyyyMMdd"); var url = $"https://tool.bitefu.net/jiari/?d={date}"; UnityWebRequest webRequest = UnityWebRequest.Get(url); yield return webRequest.SendWebRequest(); if (webRequest.isNetworkError || webRequest.isHttpError) { callback(false); yield break; } var data = webRequest.downloadHandler.text; callback(data != "0"); } } }