StatusBarManager.cs 967 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using FSEvent;
  6. public class StatusBarManager : MonoBehaviour {
  7. public Text roundText;
  8. // Use this for initialization
  9. void Start () {
  10. InitEvents();
  11. }
  12. // Update is called once per frame
  13. void Update () {
  14. }
  15. /*
  16. * 初始化监听
  17. */
  18. private void InitEvents() {
  19. EventListener.Instance.RegisterEvent(EventEnum.EVENT_UPDATE_ROUND_TEXT, UpdateRoundText);
  20. }
  21. /*
  22. * 更新回合文本
  23. */
  24. private void UpdateRoundText(Dictionary<string, object> info) {
  25. // 从提供的数据中获取要更新的值
  26. if (roundText != null) {
  27. roundText.text = (string)info["remind"];
  28. Invoke("ResetRoundText", 2.0f);
  29. }
  30. }
  31. /*
  32. * 重置提醒
  33. */
  34. private void ResetRoundText() {
  35. roundText.text = "";
  36. }
  37. }