using System; using System.Linq; using Core.Language; using Excel2Json; using Fort23.UTool; namespace Fort23.Mono { [UIBinding(prefab = "DialogueOptionWidget")] public partial class DialogueOptionWidget : UIComponent { public EventConditionConfig eventConditionConfig; private Action callback; private void Init() { } public override void AddEvent() { } public override void DelEvent() { } public override void AddButtonEvent() { OptionWidget.onClick.AddListener(() => { callback?.Invoke(this); }); } public void CustomInit(int id, int mainOpid, Action callback) { eventConditionConfig = ConfigComponent.Instance.Get(id); var mainEventConditionConfig = ConfigComponent.Instance.Get(mainOpid); int index = mainEventConditionConfig.optionPara1.ToList().IndexOf(eventConditionConfig.ID); Text_desc.text = LanguageManager.Instance.Text(mainEventConditionConfig.optionPara2[index]); this.callback = callback; } } }