public void OnEquip(PGISlotItem item, PGIModel inv, PGISlot slot)
    {
        if (!this.enabled)
        {
            return;
        }

        //Check to see if the equipped item has an ItemType component
        ItemType type = item.GetComponent <ItemType>();

        if (type != null)//type.TypeName.Equals("Two-handed Weapon"))
        {
            //It does. So we need to block
            if (LowerLinkedSlots != null)
            {
                foreach (PGISlot linked in LowerLinkedSlots)
                {
                    linked.Blocked = true;

                    //HACK ALERT:
                    //This is a work-around for a bug introduced with the advent of 3D mesh icons.
                    //This simply ensures the linked slot's default icon is restored as it should be.
                    linked.gameObject.SetActive(false);
                    linked.gameObject.SetActive(true);
                }
            }
        }
    }
예제 #2
0
        public void CanEquip(PGISlotItem item, PGIModel inv, PGISlot slot)
        {
            //If we are equipping on of the filter's types, then we need to see if
            //any of the linked slots are full or blocked.
            if (LinkedSlots != null)
            {
                ItemType type = item.GetComponent <ItemType>();
                if (type != null && TypesThatUseMultiSlots != null)
                {
                    if (TypesThatUseMultiSlots.Contains(type.TypeName))
                    {
                        foreach (PGISlot linked in LinkedSlots)
                        {
                            if (linked.Item != null || linked.Blocked)
                            {
                                //disallow equipping
                                inv.CanPerformAction = false;
                                return;
                            }
                        }
                    }
                }
            }

            //Either the item is not using multiple slots or, if it is,
            //the linked slots are all empty and unblocked. Good to go!
            return;
        }
예제 #3
0
        public void CanStore(UnityAction onFailed, PGISlotItem item, PGISlot slot)
        {
            var inv = slot.Model;

            //If we are equipping on of the filter's types, then we need to see if
            //any of the linked slots are full or blocked.
            if (LinkedSlots != null)
            {
                ItemType type = item.GetComponent <ItemType>();
                if (type != null && HashedTypes != null)
                {
                    if (HashedTypes.Contains(type.TypeName.Hash))
                    {
                        foreach (PGISlot linked in LinkedSlots)
                        {
                            if (linked.Item != null || linked.Blocked)
                            {
                                //disallow equipping
                                onFailed();
                                return;
                            }
                        }
                    }
                }
            }

            //Either the item is not using multiple slots or, if it is,
            //the linked slots are all empty and unblocked. Good to go!
            return;
        }
예제 #4
0
        public void CanEquip(PGISlotItem item, PGIModel inv, PGISlot slot)
        {
            //filter out what can and can't be equipped
            if (AllowedTypes != null && AllowedTypes.Count > 0)
            {
                var type = item.GetComponent <ItemType>();
                if (type != null && AllowedTypes.Contains(type.TypeName))
                {
                    return;
                }

                //let the inventory know that things are not well
                inv.CanPerformAction = false;
            }
        }
예제 #5
0
        bool TestFilter(PGISlotItem item)
        {
            //filter out what can and can't be stored
            if (AllowedIds != null && AllowedIds.Length > 0)
            {
                var type = item.GetComponent <ItemType>();
                if (type == null)
                {
                    return(false);
                }

                if (HashedString.DoNotContain(AllowedIds, type.TypeName.Hash))
                {
                    return(false);
                }
            }

            return(true);
        }
        /// <summary>
        ///     Updates the <see cref="PlayerSaveData" /> to matcha a change in the <see cref="PGIModel" />.
        /// </summary>
        /// <param name="arg0">The item removed.</param>
        /// <param name="pgiModel">The model ???</param>
        private void OnRemoveItem( PGISlotItem arg0, PGIModel pgiModel )
        {
            if( !m_keepSyncedWithInventory ) { return; }

            PlayerData_Unsub();

            ModuleItem moduleItem = arg0.GetComponent<ModuleItem>();
            if( moduleItem != null ) {
                m_saveData.Modules.Remove( moduleItem.Module );
                m_saveData.NotifyChanges();
            }

            PlayerData_Sub();
        }
        /// <summary>
        ///     Updates the <see cref="PlayerSaveData" /> to matcha a change in the <see cref="PGIModel" />.
        /// </summary>
        /// <param name="arg0">The item removed.</param>
        /// <param name="pgiModel">The model ???</param>
        private void OnRemoveItem( PGISlotItem arg0, PGIModel pgiModel )
        {
            if( !m_keepSyncedWithInventory ) { return; }

            PlayerData_Unsub();

            UnitItem unitItem = arg0.GetComponent<UnitItem>();
            if( unitItem != null ) {
                m_saveData.UnitDefinitions.Remove( unitItem.Unit );
                m_saveData.NotifyChanges();
            }

            PlayerData_Sub();
        }
        public void OnStoreItem( PGISlotItem item, PGIModel model )
        {
            if( !enabled ) { return; } // Don't bother if we are disabled

            if( item.GetComponent<ModuleItem>() != null ) { UpdatePreview(); }
        }