using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using EnhancedUI.EnhancedScroller; using TableConfig; using System; using Snxxz.UI; namespace Snxxz.UI { public class SkillPanel : Window { [SerializeField] Button backBtn; [SerializeField] Button leftBtn; [SerializeField] Button rightBtn; [SerializeField] FunctionButton functionButtonAccord; [SerializeField] FunctionButton functionButtonPass; [SerializeField] FunctionButton functionButtonTalent; [SerializeField] FunctionButtonGroup funcBtnGroup; [Header("拖动延迟")] [SerializeField] float m_OnDragDelay = 0.1f; SkillModel m_Model; SkillModel model { get { return m_Model ?? (m_Model = ModelCenter.Instance.GetModel()); } } protected override void BindController() { model.onDragDelay = m_OnDragDelay; } protected override void AddListeners() { backBtn.onClick.AddListener(OnClose); functionButtonAccord.onClick.AddListener(OnAccordFunc); functionButtonPass.onClick.AddListener(OnPassFunc); functionButtonTalent.onClick.AddListener(OnTalentFunc); leftBtn.onClick.AddListener(() => { funcBtnGroup.TriggerLast(); }); rightBtn.onClick.AddListener(() => { funcBtnGroup.TriggerNext(); }); } private void OnPassFunc() { CloseChild(); functionOrder = 1; if (windowState == WindowState.Opened) { WindowCenter.Instance.OpenWithoutAnimation(); } else { WindowCenter.Instance.Open(); } } private void OnTalentFunc() { CloseChild(); } private void OnAccordFunc() { CloseChild(); functionOrder = 0; if (windowState == WindowState.Opened) { WindowCenter.Instance.OpenWithoutAnimation(); } else { WindowCenter.Instance.Open(); } } protected override void OnPreOpen() { } protected override void OnActived() { base.OnActived(); functionButtonTalent.state = TitleBtnState.Locked; if (functionOrder == 0 && model.jumpToPass) { functionOrder = 1; model.jumpToPass = false; } funcBtnGroup.TriggerByOrder(functionOrder); } protected override void OnAfterOpen() { } protected override void OnPreClose() { model.jumpToPass = false; } protected override void OnAfterClose() { WindowCenter.Instance.Open(); } void OnClose() { CloseChild(); CloseImmediately(); } void CloseChild() { if (WindowCenter.Instance.CheckOpen()) { WindowCenter.Instance.CloseImmediately(); } if (WindowCenter.Instance.CheckOpen()) { WindowCenter.Instance.CloseImmediately(); } } } }