UI HUGE UPDATE
This commit is contained in:
@@ -15,6 +15,7 @@ public class equipItemPrefab : MonoBehaviour, IBeginDragHandler, IDragHandler, I
|
||||
[Header("info")]
|
||||
public Image itemBtm;
|
||||
public Color[] itemBtmColors;
|
||||
public Sprite[] itemBtmSprites;
|
||||
public Image itemProfileIcon;
|
||||
public string itemType;
|
||||
public string itemName;
|
||||
@@ -74,7 +75,7 @@ public class equipItemPrefab : MonoBehaviour, IBeginDragHandler, IDragHandler, I
|
||||
if (itemSO == null)
|
||||
{
|
||||
ApplyProfileSprite(null);
|
||||
ApplyBottomColor(0);
|
||||
ApplyBottomVisual(0);
|
||||
ApplyEquipperProfile(null);
|
||||
return;
|
||||
}
|
||||
@@ -82,7 +83,7 @@ public class equipItemPrefab : MonoBehaviour, IBeginDragHandler, IDragHandler, I
|
||||
equipmentSO.EquipmentTierPresentation presentation = itemSO.GetVisualTierPresentation();
|
||||
Sprite displaySprite = presentation != null ? presentation.equipmentSprite : null;
|
||||
ApplyProfileSprite(displaySprite);
|
||||
ApplyBottomColor(itemSO.GetVisualQualityColorIndex());
|
||||
ApplyBottomVisual(itemSO.GetVisualQualityColorIndex());
|
||||
ApplyEquipperProfile(FindEquipper(itemSO));
|
||||
}
|
||||
|
||||
@@ -602,21 +603,38 @@ public class equipItemPrefab : MonoBehaviour, IBeginDragHandler, IDragHandler, I
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyBottomColor(int colorIndex)
|
||||
private void ApplyBottomVisual(int colorIndex)
|
||||
{
|
||||
if (itemBtm == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Color color = Color.white;
|
||||
if (itemBtmColors != null && itemBtmColors.Length > 0)
|
||||
itemBtm.sprite = GetBottomSpriteByVisualIndex(colorIndex);
|
||||
itemBtm.color = Color.white;
|
||||
itemBtm.enabled = itemBtm.sprite != null;
|
||||
}
|
||||
|
||||
public Sprite GetBottomSpriteByVisualIndex(int visualIndex)
|
||||
{
|
||||
if (itemBtmSprites == null || itemBtmSprites.Length == 0)
|
||||
{
|
||||
int safeIndex = Mathf.Clamp(colorIndex, 0, itemBtmColors.Length - 1);
|
||||
color = itemBtmColors[safeIndex];
|
||||
return null;
|
||||
}
|
||||
|
||||
itemBtm.color = color;
|
||||
int safeSpriteIndex = Mathf.Clamp(visualIndex, 0, itemBtmSprites.Length - 1);
|
||||
return itemBtmSprites[safeSpriteIndex];
|
||||
}
|
||||
|
||||
public Color GetAccentColorByVisualIndex(int visualIndex)
|
||||
{
|
||||
if (itemBtmColors == null || itemBtmColors.Length == 0)
|
||||
{
|
||||
return Color.white;
|
||||
}
|
||||
|
||||
int safeIndex = Mathf.Clamp(visualIndex, 0, itemBtmColors.Length - 1);
|
||||
return itemBtmColors[safeIndex];
|
||||
}
|
||||
|
||||
private void ApplyEquipperProfile(AllyHero_SO hero)
|
||||
|
||||
Reference in New Issue
Block a user