using System; using System.Collections.Generic; using System.Text; using UnityEngine; using UnityEngine.UI; using ZXL.Excel; namespace Script.UI { public class ScrollPanel : PanelBase { [SerializeField] private Text txt_ID; [SerializeField] private Text txt_Subject; [SerializeField] private Text txt_Content; [SerializeField] private Button btn_StopGun; private StringBuilder sb = new StringBuilder(); public override void Init() { base.Init(); btn_StopGun.onClick.AddListener(ClickStopGun); } public override void Dispose() { base.Dispose(); btn_StopGun.onClick.RemoveListener(ClickStopGun); } public override void Open() { base.Open(); } public override void ResetPanelData() { base.ResetPanelData(); UpdateText(); txt_ID.text = GlobalManager.Instance.CurrentInfo.id; txt_Subject.text = GlobalManager.Instance.CurrentInfo.subject; } private void UpdateText() { List infos = new List(); for (int i = 0; i < 50; i++) { var info = ExcelManager.Instance.GetRandomA(); infos.Add(info); sb.AppendLine(info.topic); foreach (var infoOption in info.options) { sb.AppendLine(infoOption); } sb.AppendLine(""); } txt_Content.text = sb.ToString(); } private void ClickStopGun() { UIManager.Instance.OpenPanel(PanelType.Answering); Close(); } } }