2023-10-02 19:12:35 +03:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
public class MonumentPreview : MonoBehaviour
|
|
|
|
{
|
|
|
|
[SerializeField] private Image _image;
|
|
|
|
[SerializeField] private UITextShow _UITextShow;
|
2023-10-25 13:46:39 +03:00
|
|
|
[SerializeField] private TextAutoscroll _textAutoscroll;
|
2023-10-11 15:44:05 +03:00
|
|
|
[SerializeField] private UIFader _UIFader;
|
2023-10-18 13:57:36 +03:00
|
|
|
[SerializeField] private TMPro.TextMeshProUGUI _nameText;
|
|
|
|
|
2023-10-30 13:54:38 +03:00
|
|
|
private static UIFader lastPreview;
|
|
|
|
|
2023-10-25 13:46:39 +03:00
|
|
|
public void ShowInfo(string name, Sprite image, string text, float time)
|
2023-10-18 13:57:36 +03:00
|
|
|
{
|
2023-10-30 13:54:38 +03:00
|
|
|
if (lastPreview != null)
|
|
|
|
lastPreview.HidePanel();
|
|
|
|
|
|
|
|
lastPreview = _UIFader;
|
|
|
|
|
2023-10-24 14:34:33 +03:00
|
|
|
_nameText.SetText(name);
|
|
|
|
_image.sprite = image;
|
2023-10-25 13:46:39 +03:00
|
|
|
_UITextShow.SetText(text, time, _UIFader.ShowPanel, _UIFader.HidePanel);
|
|
|
|
_textAutoscroll.Scroll(time - 1);
|
2023-10-02 19:12:35 +03:00
|
|
|
}
|
|
|
|
}
|