(client) chore:Clean code
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using Base;
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
@ -7,20 +7,20 @@ using UnityEngine.UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class ItemUI:MonoBehaviour,IPointerEnterHandler,IPointerExitHandler,IPointerClickHandler,ITick
|
||||
public class ItemUI : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler, ITick
|
||||
{
|
||||
[SerializeField] private Image textureUI;
|
||||
[SerializeField] private TMP_Text countUI;
|
||||
[SerializeField] private TMP_Text nameUI;
|
||||
[SerializeField] private GameObject selectedOutline;
|
||||
|
||||
|
||||
private Entity.InventorySlot _item;
|
||||
private float timer = 0;
|
||||
private float switchTime = 0;
|
||||
private int texturePtr = 0;
|
||||
|
||||
|
||||
public event Action OnPlayerSelect;
|
||||
|
||||
|
||||
public bool Select
|
||||
{
|
||||
get => selectedOutline.activeSelf;
|
||||
@ -29,7 +29,7 @@ namespace UI
|
||||
|
||||
public int SlotIndex { get; private set; } = -1;
|
||||
|
||||
public void Init(Entity.InventorySlot item,int index)
|
||||
public void Init(Entity.InventorySlot item, int index)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
@ -75,17 +75,17 @@ namespace UI
|
||||
{
|
||||
if (switchTime > 0)
|
||||
{
|
||||
timer+=Time.deltaTime;
|
||||
timer += Time.deltaTime;
|
||||
if (timer >= switchTime)
|
||||
{
|
||||
timer-=switchTime;
|
||||
timer -= switchTime;
|
||||
texturePtr++;
|
||||
texturePtr%=_item.Item.Icon.Count;
|
||||
textureUI.sprite=_item.Item.Icon[texturePtr];
|
||||
texturePtr %= _item.Item.Icon.Count;
|
||||
textureUI.sprite = _item.Item.Icon[texturePtr];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user