Exemplo n.º 1
0
    public virtual void SetItem(Slottable newItem)
    {
        item = newItem;

        icon.enabled = true;
        icon.sprite  = item.icon;
    }
Exemplo n.º 2
0
    public void AddItemToData(Slottable slottable, int quantity)
    {
        InventoryItem item  = slottable.m_Item;
        bool          found = false;

        for (int i = 0; i < inventory.entries.Count; i++)
        {
            if (item.isStackable)
            {
                if (inventory.entries[i].itemInstance.m_item.itemId == item.itemId)
                {
                    inventory.entries[i].quantity += quantity;
                    found = true;
                }
            }
            else
            {
                if (inventory.entries[i].itemInstance == slottable.m_itemInstance)
                {
                    inventory.entries[i].quantity += quantity;
                    found = true;
                }
            }
        }


        if (!found)
        {
            InventoryItemEntry newEntry = new InventoryItemEntry();
            newEntry.itemInstance = slottable.m_itemInstance;
            newEntry.quantity     = quantity;
            inventory.entries.Add(newEntry);
        }
    }
Exemplo n.º 3
0
    public virtual void ClearItem()
    {
        item = null;

        icon.enabled = false;
        icon.sprite  = null;
    }
Exemplo n.º 4
0
    public bool CheckAllSlottablesForCursorHover(PointerEventData eventData, ref Slottable sbUnderCursor)
    {
        Slottable prevSlottable = sbUnderCursor;

        sbUnderCursor = null;
        for (int i = 0; i < SlotCount; i++)
        {
            if (this[i].slottable != null)
            {
                if (this[i].slottable.m_isActiveForSelection)
                {
                    if (this[i].slottable.gameObject == eventData.pointerEnter || this[i].slottable.ChildIsPointerEnter(eventData))
                    {
                        sbUnderCursor = this[i].slottable;
                        return(true);
                    }
                }
            }
        }
        if (prevSlottable != null)
        {
            prevSlottable.SetHoverState(false);
        }
        return(false);
    }
Exemplo n.º 5
0
    public void GetSGandSlottableUnderCursor(ref Slottable sbUnderCursor, ref SlotGroup sgUnderCursor, PointerEventData eventData)
    {
        // sgUnderCursor = null;
        // sbUnderCursor = null;
        if (sgUnderCursor != null && !RectTransformUtility.RectangleContainsScreenPoint(sgUnderCursor.m_dropZoneRect, eventData.position))
        {
            sgUnderCursor.SetHoverState(false);
            sgUnderCursor   = null;
            m_sgUnderCursor = null;
        }
        // if(sbUnderCursor != null && !RectTransformUtility.RectangleContainsScreenPoint(sbUnderCursor.m_rectTrans, eventData.position)){
        //  sbUnderCursor = null;
        //  sbUnderCursor
        //  m_sgUnderCursor = null;
        // }
        for (int i = 0; i < m_slotGroups.Count; i++)
        {
            if (m_slotGroups[i].m_isActiveForSelection)
            {
                if (RectTransformUtility.RectangleContainsScreenPoint(m_slotGroups[i].m_dropZoneRect, eventData.position))
                {
                    if (sgUnderCursor == m_slotGroups[i] /*&& sgUnderCursor != null*/)
                    {
                        //do nothing
                    }
                    else
                    {
                        if (sgUnderCursor != null)
                        {
                            sgUnderCursor.SetHoverState(false);
                        }
                        m_slotGroups[i].SetHoverState(true);
                        sgUnderCursor   = m_slotGroups[i];
                        m_sgUnderCursor = sgUnderCursor;
                    }
                }

                Slottable prevSlottableUnderCursor = sbUnderCursor;
                if (m_slotGroups[i].CheckAllSlottablesForCursorHover(eventData, ref sbUnderCursor))
                {
                    if (sbUnderCursor == prevSlottableUnderCursor)
                    {
                        //do nothing
                    }
                    else
                    {
                        if (prevSlottableUnderCursor != null)
                        {
                            prevSlottableUnderCursor.SetHoverState(false);
                        }
                        sbUnderCursor.SetHoverState(true);
                        m_sbUnderCursor = sbUnderCursor;
                    }
                    return;
                }
            }
        }
    }
Exemplo n.º 6
0
    void Swap(Slottable targetSlottable)
    {
        SlotGroup targetSG = targetSlottable.m_OrigSG;

        targetSG.RemoveItemFromData(targetSlottable, targetSlottable.m_Quantity);
        this.m_OrigSG.RemoveItemFromData(this, this.m_PickAmount);

        targetSG.AddItemToData(this, this.m_PickAmount);
        this.m_OrigSG.AddItemToData(targetSlottable, targetSlottable.m_Quantity);
    }
Exemplo n.º 7
0
 public void RemoveItemFromData(Slottable slottable, int quantity)
 {
     for (int i = 0; i < inventory.entries.Count; i++)
     {
         if (inventory.entries[i].itemInstance == slottable.m_itemInstance)
         {
             inventory.entries[i].quantity -= quantity;
         }
     }
 }
Exemplo n.º 8
0
 void FilterPoolSGSlottables(Slottable slottable)
 {
     for (int i = 0; i < m_slotGroups.Count; i++)
     {
         if (m_slotGroups[i].m_slotGroupType == SlotGroupType.Pool)
         {
             m_slotGroups[i].FilterSlottables(slottable);
         }
     }
 }
Exemplo n.º 9
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     print(this.name + "'s PointerEnter called");
     if (eventData.pointerDrag != null && eventData.pointerDrag.GetComponent <Slottable>() != null)
     {
         Slottable travellingSlottable = eventData.pointerDrag.GetComponent <Slottable>();
         travellingSlottable.m_isOnSlot  = true;
         travellingSlottable.m_hoverSlot = this;
         DebugUtility.PrintRed("is on slot: " + travellingSlottable.m_isOnSlot + ", hoverSlot: " + travellingSlottable.m_hoverSlot.gameObject.name);
     }
 }
Exemplo n.º 10
0
    public void OnDrop(PointerEventData eventData)
    {
        Slottable draggedSlottable = eventData.pointerDrag.GetComponent <Slottable>();

        if (draggedSlottable != null && draggedSlottable.m_isPickedUp)
        {
            InventoryItem droppedItem = draggedSlottable.m_Item;

            StartCoroutine(draggedSlottable.MoveToSlot(this));
            Debug.Log(droppedItem.itemName.ToString() + " is dropped on " + this.name);
        }
    }
Exemplo n.º 11
0
    public void SlotIn(Slottable sltbl)
    {
        DebugUtility.PrintRed("Slot in called");

        newSlottable = (Slottable)GameObject.Instantiate(slottablePrefab, Vector3.zero, Quaternion.identity, slotZoneTrans);
        newSlottable.transform.SetAsLastSibling();
        newSlottable.Initialize(null, sltbl.m_itemInstance, sltbl.m_Item, sltbl.m_PickAmount);

        RectTransform newRT = newSlottable.GetComponent <RectTransform>();

        newRT.anchorMin        = new Vector2(0f, 1f);
        newRT.anchorMax        = new Vector2(0f, 1f);
        newRT.anchoredPosition = new Vector2(.5f, .5f);
        newRT.sizeDelta        = new Vector2(80f, 80f);
    }
Exemplo n.º 12
0
    public RectTransform GetSlotRect(Slottable slottable)
    {
        RectTransform result = null;

        for (int i = 0; i < SlotCount; i++)
        {
            if (this[i].slottable != null)
            {
                if (this[i].slottable.m_itemInstance == slottable.m_itemInstance)
                {
                    result = this[i].slotRect;
                }
            }
        }
        return(result);
    }
Exemplo n.º 13
0
    public RectTransform GetNewSlotRect(Slottable slottable)
    {
        RectTransform result = null;

        for (int i = 0; i < m_tempSlots.Count; i++)
        {
            if (m_tempSlots[i].slottable != null)
            {
                if (m_tempSlots[i].slottable.m_itemInstance == slottable.m_itemInstance)
                {
                    result = m_tempSlots[i].slotRect;
                }
            }
        }
        return(result);
    }
Exemplo n.º 14
0
    public void FilterDestination(Slottable slottable)
    {
        SetActiveStateAll(false);
        InventoryItem invItem = slottable.m_Item;

        if (invItem is Bow)
        {
            ActivateSlotGroup(SlotGroupType.Bow);
        }
        else if (invItem is Wear)
        {
            ActivateSlotGroup(SlotGroupType.Wear);
        }
        else if (invItem is CarriedGear)
        {
            ActivateSlotGroup(SlotGroupType.CarriedGear);
        }
        slottable.m_OrigSG.SetActiveForSelectionState(true);
        ActivateSlotGroup(SlotGroupType.Pool);
        FilterPoolSGSlottables(slottable);
    }
Exemplo n.º 15
0
    public void OnPointerExit(PointerEventData eventData)
    {
        print(this.name + "'s PointerExit called");
        if (eventData.pointerDrag != null && eventData.pointerDrag.GetComponent <Slottable>() != null)
        {
            Slottable travellingSlottable = eventData.pointerDrag.GetComponent <Slottable>();
            travellingSlottable.m_isOnSlot = false;
            // travellingSlottable.m_hoverSlot = null;

            string str;
            if (travellingSlottable.m_hoverSlot == null)
            {
                str = "null";
            }
            else
            {
                str = travellingSlottable.m_hoverSlot.gameObject.name;
            }
            DebugUtility.PrintRed("is on slot: " + travellingSlottable.m_isOnSlot + ", hoverSlot: " + str);
        }
    }
Exemplo n.º 16
0
    public void FilterSlottables(Slottable slottable)
    {
        InventoryItem invItem = slottable.m_Item;

        for (int i = 0; i < SlotCount; i++)
        {
            if (this[i].slottable != null)
            {
                this[i].slottable.SetActiveForSelectionState(false);
                if (invItem is Bow)
                {
                    if (this[i].slottable.m_Item is Bow)
                    {
                        this[i].slottable.SetActiveForSelectionState(true);
                    }
                }
                else if (invItem is Wear)
                {
                    if (this[i].slottable.m_Item is Wear)
                    {
                        this[i].slottable.SetActiveForSelectionState(true);
                    }
                }
                else if (invItem is CarriedGear)
                {
                    if (this[i].slottable.m_Item is CarriedGear)
                    {
                        this[i].slottable.SetActiveForSelectionState(true);
                    }
                }
                else if (invItem is CraftItem)
                {
                    if (this[i].slottable.m_Item is CraftItem)
                    {
                        this[i].slottable.SetActiveForSelectionState(true);
                    }
                }
            }
        }
    }
Exemplo n.º 17
0
    public void OnDrop(PointerEventData eventData)
    {
        InventorySlot drop = eventData.pointerDrag.GetComponent <InventorySlot>();

        if (drop.IsEmptySlot())
        {
            return;
        }

        Debug.Log(drop + " was dropped onto " + this.name);

        Slottable droppedItem = drop.item;

        if (this.IsEmptySlot())
        {
            drop.ClearItem();
        }
        else
        {
            drop.SetItem(this.item);
        }

        this.SetItem(droppedItem);
    }
Exemplo n.º 18
0
    void Transact(PointerEventData eventData)
    {
        StopPickUpTimer();
        if (m_isPickedUp)
        {
            SlotGroup targetSG         = null;
            bool      swapped          = false;
            bool      added            = false;
            Slottable swappedSlottable = null;



            if (m_slottableUnderCursor != null)            // on some slottable
            {
                if (m_slottableUnderCursor != this)        // the sb is not the orig
                {
                    m_slottableUnderCursor.OnNonEventDrop(eventData);
                    targetSG = m_SGUnderCursor;
                    if (targetSG != null && targetSG != m_OrigSG)                    //it's in some other SG

                    {
                        if (this.m_Item.isStackable)
                        {
                            // if(targetSG.GetSlotIndex(this.m_Item.itemId) != -1){
                            if (m_slottableUnderCursor.m_Item.itemId == this.m_Item.itemId)
                            {
                                /*	this is stackable and SBUC is same item
                                 */
                                if (m_OrigSG.isSubtractable)
                                {
                                    Add(targetSG);
                                    added = true;
                                }
                            }
                            else
                            {
                                /*	this is stackable but SBUC has different item
                                 */
                                Swap(m_slottableUnderCursor);
                                swapped          = true;
                                swappedSlottable = m_slottableUnderCursor;
                            }
                        }
                        else
                        {
                            /*	this is not stackable
                             */
                            if (m_slottableUnderCursor.m_itemInstance != this.m_itemInstance)
                            {
                                Swap(m_slottableUnderCursor);
                                swapped          = true;
                                swappedSlottable = m_slottableUnderCursor;
                            }
                            else
                            {
                                if (m_OrigSG.isSubtractable)
                                {
                                    Add(targetSG);
                                    added = true;
                                }
                            }
                        }
                    }
                    else                      //targetSG == null || targetSG == m_OrigSG
                    {
                        StartCoroutine(Revert(eventData));
                        return;
                    }
                }
                else                  //m_slottableUnderCursor == this

                {
                    OnNonEventDrop(eventData);
                    m_isTouchedInside  = false;
                    m_isTouchedOutside = false;
                    StartCoroutine(WaitAndReset(eventData));
                    return;
                }
            }
            else              //slottableUnderCursor == null
            {
                if (m_SGUnderCursor != null)
                {
                    if (m_SGUnderCursor != m_OrigSG)                    // in some other SG

                    {
                        targetSG = m_SGUnderCursor;
                        if (m_SGUnderCursor.SlotCount == 1)
                        {
                            if (m_SGUnderCursor[0].slottable != null)
                            {
                                if (m_SGUnderCursor[0].slottable.m_Item.itemId == this.m_Item.itemId && this.m_Item.isStackable)
                                {
                                    /*	this is stackable and the only Slottable the SG has has the same item
                                     */
                                    if (m_OrigSG.isSubtractable)
                                    {
                                        Add(m_SGUnderCursor);
                                        added = true;
                                    }
                                }
                                else
                                {
                                    /*	this is not stackable, nor the only slottable has different item
                                     */
                                    Swap(m_SGUnderCursor[0].slottable);
                                    swapped          = true;
                                    swappedSlottable = m_SGUnderCursor[0].slottable;
                                }
                            }
                            else
                            {
                                /*	the only slot doesn't have a slottable so fill it
                                 */
                                if (m_OrigSG.isSubtractable)
                                {
                                    Add(m_SGUnderCursor);
                                    added = true;
                                }
                            }
                        }
                        else                          //more than one slot
                        {
                            if (m_SGUnderCursor.HasVacancy)
                            {
                                //filled
                                if (m_OrigSG.isSubtractable)
                                {
                                    Add(m_SGUnderCursor);
                                    added = true;
                                }
                            }
                            else                              //no vacancy
                            {
                                if (m_SGUnderCursor.isExpandable)
                                {
                                    if (m_OrigSG.isSubtractable)
                                    {
                                        Add(m_SGUnderCursor);
                                        added = true;
                                    }
                                }
                                else if (m_SGUnderCursor.GetSlotIndex(m_Item.itemId) != -1)                                //the SG has same item
                                {
                                    if (this.m_Item.isStackable)
                                    {
                                        /*	same and stackable
                                         */
                                        if (m_OrigSG.isSubtractable)
                                        {
                                            Add(m_SGUnderCursor);
                                            added = true;
                                        }
                                    }
                                    // else{
                                    //  /* this is not stackable
                                    //  */
                                    //  StartCoroutine(Revert(eventData));
                                    //  return;
                                    // }
                                }
                                // else{
                                //  /*	no same item in the sg
                                //  */
                                //  StartCoroutine(Revert(eventData));
                                //  return;
                                // }
                            }
                        }
                    }
                    else                      //SGUC is the orig SG, and there's no SBUC
                    {
                        StartCoroutine(Revert(eventData));
                        return;
                    }
                }
                else                  //there's no SGUC nor SBUC
                {
                    StartCoroutine(Revert(eventData));
                    return;
                }
            }
            if (!added && !swapped)
            {
                StartCoroutine(Revert(eventData));
            }
            else
            {
                targetSG.CleanUpData();
                this.m_OrigSG.CleanUpData();
                targetSG.SortData();
                this.m_OrigSG.SortData();
                targetSG.UpdateSlots(eventData);
                this.m_OrigSG.UpdateSlots(eventData);

                this.StartCoroutine(this.MoveToSlot(targetSG, targetSG.GetNewSlotRect(this), eventData));
                if (swapped)
                {
                    swappedSlottable.m_draggedIcon = swappedSlottable.CreateAndSetupDraggedIcon(m_canvas, ref swappedSlottable.m_pickedQuantText);
                    swappedSlottable.m_draggedIcon.GetComponent <RectTransform>().anchoredPosition =
                        ConvertRectPosToCanvasPos(swappedSlottable.m_OrigSG.GetSlotRect(swappedSlottable), eventData);
                    swappedSlottable.StartCoroutine(swappedSlottable.MoveToSlot(this.m_OrigSG, this.m_OrigSG.GetNewSlotRect(swappedSlottable), eventData));
                }
            }
        }
        else
        {
            m_isTouchedInside  = false;
            m_isTouchedOutside = false;
            StartCoroutine(WaitAndReset(eventData));
        }
    }
Exemplo n.º 19
0
    public void UpdateSlots(PointerEventData eventData)
    {
        /*	create new slots part
         *              search in the current slots for slottable reference
         *              update quantit
         *              if not found
         *                      create new and update its position and hierarchy
         *                      disable its image component
         *              if the quantity is 0 and not pool
         *                      do not include it in the new slots
         *
         *      Transit part
         *              for each slottable in the current slots
         *                      try to spot the new slot referring to the newSlots
         *                              if found, start to move toward it
         *                              if not, detach it and disable image and leave it there until it is deleted upon completion of transaction
         */
        /*	Create part
         */
        m_tempSlots = new List <Slot>();
        for (int i = 0; i < m_slots.Count; i++)
        {
            Slot newSlot = new Slot();
            newSlot.slottable = null;
            newSlot.slotRect  = m_slots[i].slotRect;
            m_tempSlots.Add(newSlot);
        }
        int addedSlotsCount = inventory.entries.Count - m_slots.Count;

        if (addedSlotsCount > 0)
        {
            for (int i = 0; i < addedSlotsCount; i++)
            {
                Slot newSlot = new Slot();
                newSlot.slottable = null;
                newSlot.slotRect  = Instantiate(m_slotPrefab, Vector3.zero, Quaternion.identity).GetComponent <RectTransform>();
                newSlot.slotRect.SetParent(panel);
                newSlot.slotRect.SetAsLastSibling();
                // LayoutGroup panelLayoutGroup = panel.GetComponent<LayoutGroup>();
                // if(panelLayoutGroup != null){
                //  panelLayoutGroup.CalculateLayoutInputHorizontal();
                //  panelLayoutGroup.CalculateLayoutInputVertical();
                //  panelLayoutGroup.SetLayoutHorizontal();
                //  panelLayoutGroup.SetLayoutVertical();
                // }
                m_tempSlots.Add(newSlot);
            }
        }

        /*	at this point the m_tempSlots has at least as many slots with slotRect as inventory entries
         *      slotRects are oredered hierarchically
         *      slottables are empty
         */
        for (int i = 0; i < inventory.entries.Count; i++)
        {
            bool found = false;
            for (int j = 0; j < m_slots.Count; j++)
            {
                if (m_slots[j].slottable != null)
                {
                    if (m_slots[j].slottable.m_itemInstance == inventory.entries[i].itemInstance)
                    {
                        found = true;
                        m_tempSlots[i].slottable            = m_slots[j].slottable;
                        m_tempSlots[i].slottable.m_Quantity = inventory.entries[i].quantity;
                    }
                }
            }
            if (!found)
            {
                Slottable newSlottable = Instantiate(slottablePrefab, Vector3.zero, Quaternion.identity);
                newSlottable.Initialize(this, inventory.entries[i].itemInstance, inventory.entries[i].itemInstance.m_item, inventory.entries[i].quantity);
                newSlottable.Attach(m_tempSlots[i].slotRect);
                newSlottable.InitHierarchyDependents();
                newSlottable.GetComponent <Image>().enabled = false;
                m_tempSlots[i].slottable = newSlottable;
            }
            if (m_tempSlots[i].slottable.m_Quantity == 0 && m_slotGroupType != SlotGroupType.Pool)
            {
                m_tempSlots[i].slottable = null;
            }
        }

        for (int i = 0; i < m_tempSlots.Count; i++)
        {
            if (m_tempSlots[i].slottable == null && isExpandable)
            {
                m_tempSlots.RemoveAt(i);
            }
        }

        /*	at this point all the itemInstance in the inventory is represented as slottable and stored in m_tempSlots
         *      if not pool the zero quantity slottables are omitted
         */


        /*	Transit part
         */

        for (int i = 0; i < m_slots.Count; i++)
        {
            bool found = false;
            for (int j = 0; j < m_tempSlots.Count; j++)
            {
                if (m_slots[i].slottable != null && m_tempSlots[j].slottable != null)
                {
                    if (m_slots[i].slottable == m_tempSlots[j].slottable)
                    {
                        found = true;

                        m_slots[i].slottable.StartCoroutine(m_slots[i].slottable.MoveWithinSG(m_tempSlots[j].slotRect, .5f, eventData));
                        continue;
                    }
                }
            }
            if (!found)
            {
                if (m_slots[i].slottable != null)
                {
                    m_slots[i].slottable.Detach(eventData);
                    m_slots[i].slottable.GetComponent <Image>().enabled = false;
                }
            }
        }
    }
Exemplo n.º 20
0
    public void InitSlots()
    {
        /*	if isExpandable as many newSlotRects as needed needs to be created to accomodate slottables.
         *      populate the list with pairs of newly created slottables and slotRects
         *      children all the slottables to slotRects
         */

        /*	create slottables
         *      initialize and stuck them in a temp list
         *      sort in the order of itemId
         */
        List <Slottable> slottableTempList = new List <Slottable>();

        for (int i = 0; i < inventory.entries.Count; i++)
        {
            // if(inventory.entries[i].itemInstance != null){

            if ((m_slotGroupType != SlotGroupType.Pool && inventory.entries[i].quantity > 0) || m_slotGroupType == SlotGroupType.Pool)
            {
                Slottable newSlottable = (Slottable)Instantiate(slottablePrefab, Vector3.zero, Quaternion.identity);
                newSlottable.Initialize(this, inventory.entries[i].itemInstance, inventory.entries[i].itemInstance.m_item, inventory.entries[i].quantity);
                slottableTempList.Add(newSlottable);
            }
            // }
        }

        List <Slottable> orderedTemp = new List <Slottable>();

        while (slottableTempList.Count > 0)
        {
            int prevId  = -1;
            int idAtMin = -1;
            for (int i = 0; i < slottableTempList.Count; i++)
            {
                if (slottableTempList[i].m_Item.itemId < prevId || prevId == -1)
                {
                    prevId  = slottableTempList[i].m_Item.itemId;
                    idAtMin = i;
                }
            }
            orderedTemp.Add(slottableTempList[idAtMin]);
            slottableTempList.RemoveAt(idAtMin);
        }


        /*	populate a temp list of slotRect in the sibling order
         *      create if isExpandable
         *      start with a clean slate in that case
         */

        List <RectTransform> slotRTTempList = new List <RectTransform>();

        if (isExpandable)
        {
            int numOfSlotsToCreate = inventory.entries.Count;

            if (panel.childCount != 0)
            {
                for (int i = 0; i < panel.childCount; i++)
                {
                    Destroy(panel.GetChild(i));
                }
            }

            /*	create slots and add them in the temp list
             */
            for (int i = 0; i < numOfSlotsToCreate; i++)
            {
                RectTransform newSlotRect = Instantiate(m_slotPrefab, Vector3.zero, Quaternion.identity, panel).GetComponent <RectTransform>();
                slotRTTempList.Add(newSlotRect);
            }
        }
        else
        {
            for (int i = 0; i < panel.childCount; i++)
            {
                RectTransform slotRect = panel.GetChild(i).GetComponent <RectTransform>();
                slotRTTempList.Add(slotRect);
            }
        }

        /*	make pairs of slottable and slotRect from two temp lists,
         *      and populate m_slots list
         *      do keep in mind that there is possibly empty slots (one without matching slottables)
         */
        if (m_slots != null)
        {
            m_slots.Clear();
        }
        else
        {
            m_slots = new List <Slot>();
        }

        for (int i = 0; i < slotRTTempList.Count; i++)
        {
            Slot newSlot = new Slot();
            if (/*orderedTemp[i] == null*/ i >= orderedTemp.Count)
            {
                newSlot.slottable = null;
            }
            else
            {
                newSlot.slottable = orderedTemp[i];
            }
            newSlot.slotRect = slotRTTempList[i];
            // newSlot.slottable.m_rectTrans.anchoredPosition = newSlot.slotRect.anchoredPosition;
            // newSlot.slottable.transform.SetParent(newSlot.slotRect);
            if (newSlot.slottable != null)
            {
                newSlot.slottable.Attach(newSlot.slotRect);
                newSlot.slottable.InitHierarchyDependents();
                newSlot.slottable.CheckQuantityColor();
            }
            m_slots.Add(newSlot);
        }
    }
Exemplo n.º 21
0
 public override void SetItem(Slottable newItem)
 {
     base.SetItem(newItem);
     button.interactable = true;
 }
 public override void SetItem(Slottable newItem)
 {
     base.SetItem(newItem);
     itemText.text = newItem.itemName;
 }