Files
test/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillAction.cs
T

71 lines
2.0 KiB
C#

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; // ǷյNPCGreeting
public override void Awake()
{
base.Awake();
uiSkillButton.onClick.RemoveAllListeners();
uiSkillButton.onClick.AddListener(OnSkillButtonClicked);
EventBus.Subscribe<OpenSkillUIEvent>(OnOpenSkillUIEvent);
}
public void OnDestroy()
{
EventBus.Unsubscribe<OpenSkillUIEvent>(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;
}
}
}