using BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay; using BrewMonster.Scripts.Skills; using BrewMonster.UI; using System; using UnityEngine; using UnityEngine.UI; namespace BrewMonster { public class CDlgSkillAction : AUIDialog { [SerializeField] private Button uiSkillButton; [SerializeField] private SkillUI skillUI; bool m_bOpenAction; bool m_bReceivedNCPGreeting; // �Ƿ��յ���NPC��Greeting public override void Awake() { base.Awake(); uiSkillButton.onClick.RemoveAllListeners(); uiSkillButton.onClick.AddListener(OnSkillButtonClicked); EventBus.Subscribe(OnOpenSkillUIEvent); } public void OnDestroy() { EventBus.Unsubscribe(OnOpenSkillUIEvent); } private void OnOpenSkillUIEvent(OpenSkillUIEvent @event) { TryOpenDialog(false); } private void OnSkillButtonClicked() { TryOpenDialog(false); } public void TryOpenDialog(bool bAction) { if(skillUI == null) { return; } var boolll = skillUI.gameObject.activeInHierarchy; if (boolll) { skillUI.gameObject.SetActive(!boolll); return; } skillUI.gameObject.SetActive(!boolll); if (skillUI.gameObject.activeInHierarchy) if (!GetHostPlayer().IsTalkingWithNPC()) { m_bOpenAction = bAction; CECHostSkillModel.Instance.SendHelloToSkillLearnNPC(); SetReceivedNPCGreeting(false); } } public void SetReceivedNPCGreeting(bool bReceived) { m_bReceivedNCPGreeting = bReceived; } public bool IsReceivedNPCGreeting() { return m_bReceivedNCPGreeting; } } }