Ejemplo n.º 1
0
        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();
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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;
        }