• 大小: 9.99MB
    文件类型: .zip
    金币: 2
    下载: 0 次
    发布日期: 2024-01-25
  • 语言: 其他
  • 标签: unity3d  

资源简介

里面的WebXMLScene代表第一个网站,里面的dataCmaScene代表第二个网站(中央气象局数据网国家权威网站)

资源截图

代码片段和文件信息

using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
using LitJson;
public class dataCmaScene : MonoBehaviour
{
    //public string url = “http://api.data.cma.cn:8090/api?userId=519438409426jzNmg&pwd=SwFUcOr&dataFormat=json&interfaceId=getSurfEleByTimeRangeAndStaID&dataCode=SURF_CHN_MUL_HOR&timeRange=[2018022309174720180224101747]&staIDs=54823&elements=Station_Id_CYearMonDayHourTEM“;
    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    void OnGUI()
    {
        if (GUILayout.Button(“Click“))
        {
            StartCoroutine(getWeather());

        }

    }

    private IEnumerator getWeather()
    {
        //using (WWW www = new WWW(url))
        using (WWW www = new WWW(“http://api.data.cma.cn:8090/api?userId=519438409426jzNmg&pwd=SwFUcOr&dataFormat=json&interfaceId=getSurfEleByTimeRangeAndStaID&dataCode=SURF_CHN_MUL_HOR&timeRange=[2018030206100020180302100000]&staIDs=54823&elements=Station_Id_CYearMonDayHourTEMTEM_MaxTEM_MinWEP_NowPRSPRE_1hWIN_D_INST_MaxWIN_S_MaxWIN_D_S_MaxWIN_S_Avg_2miWIN_D_Avg_2miWIN_S_Inst_Max“))
        {yield return www;
            if (www.responseHeaders.Count > 0)
            {
                #region MyRegion
                //foreach (KeyValuePair entry in www.responseHeaders)
                //{
                //    Debug.Log(entry.Value+“=“+entry.Key);
                //}
                /*
                 {
                  “returnCode“: “0“
                  “returnMessage“: “Query Succeed“
                  “rowCount“: “2“
                  “colCount“: “6“
                  “requestParams“: “datacode=SURF_CHN_MUL_HOR&staids=54823&timerange=[2018022309174720180223111747]&elements=Station_Id_CYearMonDayHourTEM“
                  “requestTime“: “2018-02-24 10:01:24“
                  “responseTime“: “2018-02-24 10:01:24“
                  “takeTime“: “0.023“
                  “fieldNames“: “区站号(字符) 年 月 日 时 温度/气温“
                  “fieldUnits“: “- 年 月 日 时 摄氏度(℃)“
                  “DS“: [
                    {
                      “Station_Id_C“: “54823“
                      “Year“: “2018“
                      “Mon“: “2“
                      “Day“: “23“
                      “Hour“: “10“
                      “TEM“: “13.9000“
                    }
                    {
                      “Station_Id_C“: “54823“
                      “Year“: “2018“
                      “Mon“: “2“
                      “Day“: “23“
                      “Hour“: “11“
                      “TEM“: “11.5000“
                    }
                  ]
                }
                 */
                #endregion
                print(“www:“ + www.text);//Save(“dataCmaTest.txt“ www.text);//将LitJson.dll放在assets目录下的plugins文件下,如果没有plugins文件就手动创建一个
         

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-03-05 13:56  U3DWebService\
     目录           0  2018-02-06 10:24  U3DWebService\.vs\
     目录           0  2018-02-06 10:24  U3DWebService\.vs\U3DWebService\
     目录           0  2018-02-06 10:27  U3DWebService\.vs\U3DWebService\v14\
     文件       99840  2018-03-02 16:06  U3DWebService\.vs\U3DWebService\v14\.suo
     目录           0  2018-02-24 18:55  U3DWebService\Assets\
     文件        5434  2018-02-24 18:55  U3DWebService\Assets\dataCmaScene.unity
     文件         197  2018-02-06 17:52  U3DWebService\Assets\dataCmaScene.unity.meta
     目录           0  2018-02-07 17:24  U3DWebService\Assets\Materials\
     文件         191  2016-11-08 10:59  U3DWebService\Assets\Materials.meta
     文件      374263  2016-11-08 12:56  U3DWebService\Assets\Materials\bg.psd
     文件        1261  2016-11-08 12:57  U3DWebService\Assets\Materials\bg.psd.meta
     文件       20088  2016-11-08 13:01  U3DWebService\Assets\Materials\yun_01.png
     文件        1261  2016-11-08 13:43  U3DWebService\Assets\Materials\yun_01.png.meta
     文件       33165  2016-11-08 13:02  U3DWebService\Assets\Materials\yun_02.png
     文件        1261  2016-11-08 13:43  U3DWebService\Assets\Materials\yun_02.png.meta
     文件       23281  2016-11-08 13:37  U3DWebService\Assets\Materials\yun_03.png
     文件        1261  2016-11-08 13:43  U3DWebService\Assets\Materials\yun_03.png.meta
     文件       22666  2016-11-08 13:37  U3DWebService\Assets\Materials\yun_04.png
     文件        1261  2016-11-08 13:43  U3DWebService\Assets\Materials\yun_04.png.meta
     目录           0  2018-02-24 18:21  U3DWebService\Assets\plugins\
     文件         214  2018-02-24 18:19  U3DWebService\Assets\plugins.meta
     文件       49664  2011-11-08 11:32  U3DWebService\Assets\plugins\LitJson.dll
     文件         611  2018-02-24 18:21  U3DWebService\Assets\plugins\LitJson.dll.meta
     目录           0  2018-02-07 17:24  U3DWebService\Assets\Resources\
     文件         191  2016-11-08 15:18  U3DWebService\Assets\Resources.meta
     文件        1589  2007-03-23 18:23  U3DWebService\Assets\Resources\a_0.gif
     文件        1261  2016-11-09 09:28  U3DWebService\Assets\Resources\a_0.gif.meta
     文件        1713  2007-03-23 13:23  U3DWebService\Assets\Resources\a_1.gif
     文件        1261  2016-11-09 09:28  U3DWebService\Assets\Resources\a_1.gif.meta
     文件        1721  2007-03-23 23:56  U3DWebService\Assets\Resources\a_10.gif
............此处省略1486个文件信息

评论

共有 条评论