Files
ZHGD_Web/Assets/Script/Tool/TableUpdateTool.cs

33 lines
762 B
C#
Raw Permalink Normal View History

2025-07-13 23:16:20 +08:00
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();
}
/// <summary>
/// 数据刷新函数
/// </summary>
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);
});
}
}