public void DisplaySelector(ItemSlot forSlot, Action <ItemSlot> onSelected) { Filter(SortingMode.Type, forSlot.Conditions); gameObject.SetActive(true); returnCallback = onSelected; if (forSlot.Default == null) { NoneSlot.gameObject.SetActive(true); DefaultSlot.gameObject.SetActive(false); } else { NoneSlot.gameObject.SetActive(false); DefaultSlot.gameObject.SetActive(true); DefaultSlot.RenderItem(forSlot.Default); if (forSlot.IsDefault) { DefaultSlot.ShowEquipped(); Slot_Pair pairSlot = forSlot.GetSlotBehaviour <Slot_Pair> (); if (pairSlot != null && pairSlot.pair.Item != null) { if (pairSlot.pair.Item.EquiptableSlot == Slot.TwoHanded) { DefaultSlot.HideEquipped(); } } } } }
public void Detatch() { if (slot != null) { slot.onBeforeChanged -= slotBeforeChangeHandler; slot.onAfterChanged -= slotAfterChangeHandler; Slot_Pair pairSlot = slot.GetSlotBehaviour <Slot_Pair> (); if (pairSlot != null) { pairSlot.pair.onBeforeChanged -= slotBeforeChangeHandler; pairSlot.pair.onAfterChanged -= slotAfterChangeHandler; } slotRenderer.RenderEmpty(); } slot = null; }
public void Setup(ItemSlot _slot) { Initiate(); Detatch(); slot = _slot; slot.onBeforeChanged += slotBeforeChangeHandler; slot.onAfterChanged += slotAfterChangeHandler; slotAfterChangeHandler(); Slot_Pair pairSlot = slot.GetSlotBehaviour <Slot_Pair> (); if (pairSlot != null) { pairSlot.pair.onBeforeChanged += slotBeforeChangeHandler; pairSlot.pair.onAfterChanged += slotAfterChangeHandler; } OnSlotChanged(); }
public void RenderSlot(ItemSlot slot) { if (slot == null) { RenderEmpty(); return; } Slot_Pair pairSlot = slot.GetSlotBehaviour <Slot_Pair> (); if (pairSlot != null && pairSlot.pair.Item != null) { if (pairSlot.pair.Item.EquiptableSlot == Slot.TwoHanded) { RenderSlot(pairSlot.pair); Faded = true; return; } } LastSlot = slot; RenderItem(slot.Item); if (slot.Item == null || slot.Item.template == null) { if (slotDecoration != null && slot.SlotDecoration != null) { slotDecoration.gameObject.SetActive(true); slotDecoration.sprite = slot.SlotDecoration; } } Faded = slot.IsDefault && slot.Item != null; }