forked from zxl/LaboratoryProtection
36 lines
714 B
C#
36 lines
714 B
C#
using PMaker.Extension;
|
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
[ExecuteAlways]
|
|
public partial class UILoadingSetter : BaseBehaviour
|
|
{
|
|
#if UNITY_EDITOR
|
|
[Title("----Editor----", titleAlignment: TitleAlignments.Centered)]
|
|
public Sprite[] sprites;
|
|
public Image bg;
|
|
|
|
public int max;
|
|
[PropertyRange(0, "max")]
|
|
public int index;
|
|
|
|
[ExecuteAlways]
|
|
private void Update()
|
|
{
|
|
if (this.sprites == null)
|
|
{
|
|
return;
|
|
}
|
|
if (this.bg.sprite == sprites[index])
|
|
{
|
|
return;
|
|
}
|
|
max = this.sprites.Length - 1;
|
|
bg.sprite = this.sprites?[index];
|
|
bg.SetDirty();
|
|
}
|
|
#endif
|
|
} |