1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- 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 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(AccountFileInfo.EventLinkData eventLinkData, int id, int mainOpid, Action<DialogueOptionWidget> callback)
- {
- type = 1;
- eventConditionConfig = ConfigComponent.Instance.Get<EventLinkConfig>(id);
- var mainEventConditionConfig = ConfigComponent.Instance.Get<EventLinkConfig>(mainOpid);
- int index = mainEventConditionConfig.optionPara1.ToList().IndexOf(eventConditionConfig.ID);
- Text_desc.text = LanguageManager.Instance.Text(mainEventConditionConfig.optionPara2[index]);
- this.callback = callback;
- // bool isUlock = true;
- // foreach (var eventConditionData in eventLinkData.eventConditions)
- // {
- // if (!EventSystemManager.Instance.CeekEventGroupComplete(eventLinkData.eventConditions))
- // {
- // onCancel?.Invoke();
- // return;
- // }
- // if (!EventSystemManager.Instance.IsEvenkLinkComplete(eventConditionData))
- // {
- // isUlock = false;
- // }
- // }
- 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);
- }
- }
- }
|