您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
833 B
33 行
833 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Localization.Components;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.Events;
|
|
public class UIItemForAnimation : MonoBehaviour
|
|
{
|
|
[SerializeField] private LocalizeSpriteEvent _bgLocalizedImage = default;
|
|
[SerializeField] private Image _itemPreviewImage = default;
|
|
[SerializeField] private Image _bgImage = default;
|
|
|
|
public UnityAction AnimationEnded;
|
|
public void SetItem(ItemSO item)
|
|
{
|
|
if (item.IsLocalized)
|
|
{
|
|
_bgLocalizedImage.enabled = true;
|
|
_bgLocalizedImage.AssetReference = item.LocalizePreviewImage;
|
|
}
|
|
else
|
|
{
|
|
_bgLocalizedImage.enabled = false;
|
|
_itemPreviewImage.sprite = item.PreviewImage;
|
|
}
|
|
_bgImage.color = item.ItemType.TypeColor;
|
|
}
|
|
public void OnAnimationEnded()
|
|
{
|
|
AnimationEnded.Invoke();
|
|
|
|
}
|
|
}
|