using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; public class TableUpdateTool : MonoBehaviour { public string Url; public Transform parent; public GameObject prefab; void Start() { TableUpdateController.Inst.DataAction += DataUpdate; // 注册刷新事件 DataUpdate(); } /// /// 数据刷新函数 /// void DataUpdate() { for (int i = 0; i < parent.childCount; i++) { Destroy(parent.GetChild(i).gameObject); } WebRequsetTool.Inst.Get(Application.streamingAssetsPath + Url, (string data) => { TableUpdateController.Inst.DataUpdate(parent, prefab, data); }); } }