using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
namespace Snxxz.UI
|
{
|
public class BattleHint : Singleton<BattleHint>
|
{
|
public BattleHint()
|
{
|
StageManager.Instance.onStageLoadFinish += OnStageLoadFinish;
|
}
|
|
private void OnStageLoadFinish()
|
{
|
Clear();
|
}
|
|
public event Action battleHintUpdate;
|
|
Queue<string> battleHints = new Queue<string>();
|
|
public void Receive(string msg)
|
{
|
if (!(StageManager.Instance.CurrentStage is DungeonStage))
|
{
|
return;
|
}
|
battleHints.Enqueue(msg);
|
if (StageManager.Instance.isLoading)
|
{
|
return;
|
}
|
if (!WindowCenter.Instance.CheckOpen<BattleHintWin>())
|
{
|
WindowCenter.Instance.Open<BattleHintWin>();
|
}
|
else
|
{
|
if (battleHintUpdate != null)
|
{
|
battleHintUpdate();
|
}
|
}
|
}
|
|
public bool TryGetBattleHint(out string msg)
|
{
|
msg = string.Empty;
|
if (battleHints.Count > 0)
|
{
|
msg = battleHints.Dequeue();
|
return true;
|
}
|
return false;
|
}
|
|
public void Clear()
|
{
|
battleHints.Clear();
|
}
|
}
|
}
|