Пример #1
0
        /*
         *  Make every other slot unselected after the coming slot in parameter is selected.
         */
        public virtual void OnAfterSlotSelected(BaseStorageSlotBehaviour slot)
        {
            for (int i = 0; i < transform.childCount; i++)
            {
                var childSlot = transform.GetChild(i).GetComponent <BaseStorageSlotBehaviour>();
                if (!childSlot.GetItemInstance().Id.Equals(slot.GetItemInstance().Id))
                {
                    //Debug.Log(i);
                    childSlot.SetSelected(false);
                }
            }

            if (SelectedItemPanelBehaviour != null)
            {
                SelectedItemPanelBehaviour.gameObject.SetActive(true);
                SelectedItemPanelBehaviour.SetPanel(slot.GetItemInstance());
            }

            RenderProperButtons();
        }
        public override void OnAfterSlotSelected(BaseStorageSlotBehaviour slot)
        {
            foreach (var characterEquipmentSlot in CharacterEquipmentSlotBehaviours)
            {
                characterEquipmentSlot.SetSelected(false);
            }

            base.OnAfterSlotSelected(slot);

            if (slot.IsSelected)
            {
                SelectedItemPanelBehaviour.gameObject.SetActive(true);
                SelectedItemPanelBehaviour.SetPanel(slot.GetItemInstance());
                // Debug.Log(slot.GetItemInstance().ItemTemplate.ItemName + " is selected.");
            }
            else
            {
                SelectedItemPanelBehaviour.SetPanel(null);
                SelectedItemPanelBehaviour.gameObject.SetActive(false);

                // Debug.Log(slot.GetItemInstance().ItemTemplate.ItemName + " is deselected.");
            }
        }
Пример #3
0
 private void AttachSlotEvents(BaseStorageSlotBehaviour slot)
 {
     slot.OnAfterSelected += new BaseStorageSlotBehaviour.StorageSlotEventHandler(OnAfterSlotSelected);
 }