| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 | using System;using System.Linq;using Core.Language;using Excel2Json;using Fort23.UTool;using UnityEngine;using UnityEngine.UI;namespace Fort23.Mono{    [UIBinding(prefab = "DialogueOptionWidget")]    public partial class DialogueOptionWidget : UIComponent    {        public AccountFileInfo.EventLinkData eventLinkData;        public EventLinkConfig eventConditionConfig;        private Action<DialogueOptionWidget> callback;        public int type;        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 selectIndex, AccountFileInfo.EventList CurrentEventList, int id, int mainOpid, Action<DialogueOptionWidget> callback)        {            type = 1;            eventConditionConfig = ConfigComponent.Instance.Get<EventLinkConfig>(id);            eventLinkData = CurrentEventList.eventLinks.FirstOrDefault(l => l.eventLinkId == id);            var mainEventConditionConfig = ConfigComponent.Instance.Get<EventLinkConfig>(mainOpid);            // int index = mainEventConditionConfig.optionPara1.ToList().IndexOf(eventConditionConfig.ID);            Text_desc.text = LanguageManager.Instance.Text(mainEventConditionConfig.optionPara2[selectIndex]);            this.callback = callback;                        if (!EventSystemManager.Instance.CeekEventGroupComplete(eventLinkData.eventConditions))            {                transform.Gray();            }            else            {                transform.RecoverColor();            }            LayoutRebuilder.ForceRebuildLayoutImmediate(Text_desc.GetComponent<RectTransform>());            LayoutRebuilder.ForceRebuildLayoutImmediate(transform);        }        public void CustomInit(Action<DialogueOptionWidget> callback)        {            type = 2;            Text_desc.text = "取消事件";            this.callback = callback;            transform.RecoverColor();            LayoutRebuilder.ForceRebuildLayoutImmediate(Text_desc.GetComponent<RectTransform>());            LayoutRebuilder.ForceRebuildLayoutImmediate(transform);        }    }}
 |