void ClearSelection() { if (perkSelected == null) { return; } SetToNormal(perkSelected); perkSelected = null; }
public void OnItemButton(GameObject butObj) { PerkItemUI _item = butObj.GetComponent <PerkItemUI>(); if (_item == perkSelected) { return; } ClearSelection(); perkSelected = _item; SetToSelected(_item); UpdateDisplay(); }
protected override void init() { // init perkList itemList = new List <PerkItemUI>(); for (int i = 0; i < GamePreferences.perkList.Count; i++) { GameObject _obj = Utils.Spawn(pfItemObj, scrollViewContent); PerkItemUI _item = _obj.GetComponent <PerkItemUI>(); itemList.Add(_item); _item.Init(GamePreferences.perkList[i]); _item.SetToNormal(); } //select the first item StartCoroutine(SelectFirst()); }
public void SetToNormal(PerkItemUI perkItem) { perkItem.SetToNormal(); }
public void SetToSelected(PerkItemUI perkItem) { perkItem.SetToSelected(); selectHighlightT.position = perkItem.transform.position; }