You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
782 B
32 lines
782 B
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
|
|
public class EquipSlotMark : MonoBehaviour |
|
{ |
|
public string slot = "Accessory"; |
|
public Image icon; |
|
|
|
MapManager map; |
|
public void OnInitialized(MapManager mapManager) |
|
{ |
|
if (map == null) |
|
{ |
|
map = mapManager; |
|
map.player.character.skill.OnChangedInstall += OnChanged; |
|
} |
|
} |
|
void OnChanged(List<ItemData> items) |
|
{ |
|
ItemData item = items.Find(a => a.type.Equals($"{slot}")); |
|
if (item == null) |
|
{ |
|
icon.enabled = false; |
|
return; |
|
} |
|
|
|
icon.sprite = SpriteManager.Instance.SpriteGet("AtlasIngame", $"ui{item.idx}"); |
|
icon.enabled = true; |
|
} |
|
}
|
|
|