using System.Collections;
using HotUpdate.Gameplay;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace HotUpdate.UI
{
/// Walks the camp guide over the camp painting and speaks only after a tap.
public sealed class HomeExplorerPresenter : MonoBehaviour
{
const int Layer = 31;
static readonly string[] Lines =
{
"喷泉今天的水声很好听。",
"芽芽他们在营地里等你。",
"想再去弹珠台转转吗?",
"这条石路是我每天散步的地方。",
"花开得正好,要不要一起看看?",
"下一关的路上好像有新朋友。",
"训练之后,大家都会更有精神。",
"我在这儿看着营地,你去冒险吧。"
};
UiPrefabLoader _loader;
GameObject _stage;
Camera _camera;
RenderTexture _texture;
RawImage _image;
bool _booting;
Transform _actor;
RectTransform _button;
RectTransform _bubble;
TextMeshProUGUI _line;
float _hideAt;
int _last = -1;
bool _hooked;
Vector3 _wander;
public bool Ready => _actor != null;
public bool Talking => _bubble != null && _bubble.gameObject.activeSelf;
public string Line => _line != null ? _line.text : "";
void OnEnable()
{
_image = GetComponent();
if (_image != null) _image.enabled = _camera != null;
if (_camera != null) _camera.enabled = true;
else if (!_booting) StartCoroutine(Boot());
}
void OnDisable()
{
if (_camera != null) _camera.enabled = false;
if (_image != null) _image.enabled = false;
if (_bubble != null) _bubble.gameObject.SetActive(false);
}
void OnDestroy()
{
if (_button != null) _button.GetComponent