using System.Collections; using System.Collections.Generic; using System.IO; using TMPro; using UnityEngine; using UnityEngine.UI; public class UI_StepsPanel : BasePanel { /// /// 步骤预制体父物体 /// public RectTransform StepsContent; /// /// 步骤滑动条 /// public ScrollRect scrollRect; public UI_StepsPanelItem StepsItem; public PptFilesData data = new PptFilesData(); public string jsonFileName = "StepsConfig"; // JSON文件名 protected override void Awake() { data = JsonManager.LoadData(jsonFileName); foreach (var pptFile in data.pptFiles) { if (StepsItem == null || StepsContent == null) { Debug.LogError("按钮预制体或父对象未设置"); return; } // 实例化按钮 var item = Instantiate(StepsItem, StepsContent); item.Init(pptFile.fileName); var buttonText = item.GetComponentInChildren(); Button button = item.GetComponentInChildren