57 lines
1.8 KiB
C#
57 lines
1.8 KiB
C#
using System;
|
|
using AibisDream.Framework;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
namespace AibisDream.FixSystem
|
|
{
|
|
public class WhackMoleLog : MonoBehaviour
|
|
{
|
|
private TMP_Text _countDownText;
|
|
private TMP_Text _stateText;
|
|
private TMP_Text _resText;
|
|
|
|
private void Awake()
|
|
{
|
|
_countDownText = transform.Find("倒计时").GetComponent<TMP_Text>();
|
|
_stateText = transform.Find("当前状态").GetComponent<TMP_Text>();
|
|
_resText = transform.Find("结果").GetComponent<TMP_Text>();
|
|
|
|
EnumEventSystem.Global.Register(WhackMoleState.BeforePlug, OnBeforePlug);
|
|
EnumEventSystem.Global.Register<WhackMoleState, float>(WhackMoleState.WaitPlug, OnWaitPlug);
|
|
EnumEventSystem.Global.Register(WhackMoleState.AfterPlug, OnAfterPlug);
|
|
}
|
|
|
|
public void Init()
|
|
{
|
|
_countDownText.text = "倒计时:等待";
|
|
_stateText.text = "当前状态:开始";
|
|
_resText.text = "结果:等待";
|
|
}
|
|
|
|
private void OnBeforePlug()
|
|
{
|
|
_stateText.text = "当前状态:前置效果";
|
|
_countDownText.text = "倒计时:0";
|
|
}
|
|
|
|
private void OnWaitPlug(float time)
|
|
{
|
|
_stateText.text = "当前状态:插线倒计时";
|
|
_countDownText.text = $"倒计时:{time:F}";
|
|
}
|
|
|
|
private void OnAfterPlug()
|
|
{
|
|
_stateText.text = "当前状态:后置效果";
|
|
_countDownText.text = "倒计时:0";
|
|
}
|
|
|
|
public void OnGameEnd(bool isSuccess)
|
|
{
|
|
_stateText.text = "当前状态:游戏结束";
|
|
_countDownText.text = "倒计时:0";
|
|
_resText.text = "结果:" + (isSuccess ? "成功" : "失败");
|
|
}
|
|
}
|
|
} |