29 lines
839 B
C#
29 lines
839 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class MonumentPreview : MonoBehaviour
|
|
{
|
|
[SerializeField] private Image _image;
|
|
[SerializeField] private UITextShow _UITextShow;
|
|
[SerializeField] private TextAutoscroll _textAutoscroll;
|
|
[SerializeField] private UIFader _UIFader;
|
|
[SerializeField] private TMPro.TextMeshProUGUI _nameText;
|
|
|
|
private static UIFader lastPreview;
|
|
|
|
public void ShowInfo(string name, Sprite image, string text, float time)
|
|
{
|
|
if (lastPreview != null)
|
|
lastPreview.HidePanel();
|
|
|
|
lastPreview = _UIFader;
|
|
|
|
_nameText.SetText(name);
|
|
_image.sprite = image;
|
|
_UITextShow.SetText(text, time, _UIFader.ShowPanel, _UIFader.HidePanel);
|
|
_textAutoscroll.Scroll(time - 1);
|
|
}
|
|
}
|