Example #1
0
        protected override void OnSlotChanged(SyncDictionaryItemSlot.Operation op, int key, ItemSlotData itemSlotData)
        {
            base.OnSlotChanged(op, key, itemSlotData);
            if (itemSlotData.SlotType == ItemSlotType.Any)
            {
                return;
            }
            SlotReferences.TryGetValue(itemSlotData.SlotType, out var equipmentSlotReference);
            InventorySlots.TryGetValue(key, out var itemSlot);
            var equipableSlot = itemSlot as SlotEquipable;

            switch (op)
            {
            case SyncDictionaryItemSlot.Operation.OP_ADD:
                InventorySlots.Add(key, new SlotEquipable(equipmentSlotReference.SlotTransform, itemSlotData, key));
                return;

            case SyncDictionaryItemSlot.Operation.OP_REMOVE:
                InventorySlots.Remove(key);
                return;
            }
            if (equipableSlot == null)
            {
                return;
            }
            equipableSlot.SlotData = itemSlotData;
            equipableSlot.OnSlotChange();

            EquipmentSlotChanged(itemSlotData, equipableSlot);
        }
    private bool SwapItems(InventorySlots from)
    {
        if (IsEmpty)
        {
            return(false);
        }
        if (from.MyItem.GetType() != MyItem.GetType() || from.MyCount + MyCount > MyItem.StackSize)
        {
            //Copy all items from A
            ObservableStack <Item> tmpFrom = new ObservableStack <Item>(from.itemStack);
            Debug.Log("SLOT A COPIED TO B");
            //Clear slot A
            from.itemStack.Clear();
            Debug.Log("SLOT A CLEARED");

            //Copy from B and put in A
            from.AddItems(itemStack);

            //Clear B
            itemStack.Clear();

            //Move from the copy of A to B
            AddItems(tmpFrom);
            return(true);
        }
        return(false);
    }
Example #3
0
 void Start()
 {
     inventory = GameObject.Find("Player").GetComponent <InventorySlots>();
     closed    = gameObject.transform.Find("Closed").gameObject;
     open      = gameObject.transform.Find("Open").gameObject;
     closeDoor();
 }
Example #4
0
    /// <summary>
    /// Start this instance.
    /// </summary>
    private void Initialize()
    {
        print("Unit.Initialize");
        Transform unitSpriteTransform = transform.Find("Sprite(Clone)");

        _unitAnimationController         = unitSpriteTransform.GetComponent <UnitAnimationController> ();
        _spriteRenderer                  = unitSpriteTransform.GetComponent <SpriteRenderer> ();
        _attributeCollection             = UnitData.AttributeCollection;
        _effectCollection                = new EffectCollection();
        _modifyAttributeEffectCollection = new ModifyAttributeEffectCollection();
        _unitColorEffects                = new List <UnitColorEffect> ();
        SetMaximumValueToCurrentValue(AttributeEnums.AttributeType.HIT_POINTS);
        SetMaximumValueToCurrentValue(AttributeEnums.AttributeType.ABILITY_POINTS);
        _inventorySlots = UnitData.InventorySlots;
        _canvas         = transform.Find("Canvas").GetComponent <Canvas> ();
        FacedDirection  = TileDirection.EAST;

        _characterSheetController = GameManager.Instance.GetCharacterSheetController();
        _combatMenuController     = GameManager.Instance.GetCombatMenuController();

        TileHighlighter = new TileHighlighter(GameManager.Instance.GetTileMap(), _movementHighlightCube);

        _movementAudioSource = gameObject.AddComponent <AudioSource> ();
        _weaponAudioSource   = gameObject.AddComponent <AudioSource> ();

        _currentColor = DefaultColor;
    }
    public void RegulateSlots(int slotCount)
    {
        // Debug.Log("Now regulating slots in equipinventory");
        int currentSlotAmount  = EquipSlotList.Count;
        int amountOfSlotsToAdd = slotCount - currentSlotAmount;

        if (amountOfSlotsToAdd > 0)
        {
            for (int i = 0; i < amountOfSlotsToAdd; i++)
            {
                Debug.Log("Adding a slot to EquipInventory");
                InventorySlots slot = Instantiate(slotPrefab, transform).GetComponent <InventorySlots>();
                EquipSlotList.Add(slot);
            }
        }
        else if (amountOfSlotsToAdd < 0)
        {
            for (int i = 0; i > amountOfSlotsToAdd; i--)
            {
                Debug.Log("Removing a slot to EquipInventory");
                InventorySlots slot = gameObject.GetComponentInChildren <InventorySlots>(); //I hope this works...
                if (slot.IsEmpty)
                {
                    EquipSlotList.Remove(slot);
                }
            }
        }
    }
    /// <summary>
    /// Sets the equipped items.
    /// </summary>
    /// <param name="unit">Unit.</param>
    public void SetEquippedItems(Unit unit)
    {
        _inventorySlots = unit.GetInventorySlots();

        // Delete existing slot image (if exists) before adding new one.
        // TODO: Clearly, this is terrible. Come up with better solution.
        ClearAllSlotImages();
        ClearAttributeText();

        // Iterate over weapons/armor and add
        foreach (Item item in _inventorySlots.GetInventorySlots().Values)
        {
            SetAllAttributesText(item);

            GameObject slotPanel = GetPanelBySlot(item.SlotType).transform.Find("Slot").gameObject;

            RectTransform rectTransform = (RectTransform)slotPanel.transform;
            float         height        = rectTransform.rect.height;
            float         width         = rectTransform.rect.width;

            // Create slot images
            SlotImageCanvas.InstantiateInstance(
                slotImageCanvasPrefab,
                item,
                slotPanel,
                toolTipPanel,
                toolTipPanelSecondary,
                width,
                height
                );
        }
    }
Example #7
0
 public void AddSlots(int slotCount)
 {
     for (int i = 0; i < slotCount; i++)
     {
         InventorySlots slot = Instantiate(slotPrefab, transform).GetComponent <InventorySlots>();
         slotList.Add(slot);
     }
 }
    private UnitData(
        string resRef,
        string firstName,
        string lastName,
        string @class,
        string portraitLocation,
        string movementSoundLocation,
        string sprite,
        UnitType unitType,
        Dictionary <AttributeEnums.AttributeType, float> attributes,
        Dictionary <InventorySlots.SlotType, int> inventory,
        List <int> abilities
        )
    {
        ResRef                = resRef;
        FirstName             = firstName;
        LastName              = lastName;
        Class                 = @class;
        PortraintLocation     = portraitLocation;
        MovementSoundLocation = movementSoundLocation;
        Sprite                = sprite;
        Type = unitType;

        // Set attributes in their collection. If attribute already exists, set value,
        // else, grab from global collection and set new attribute and value
        AttributeCollection globalAttributeCollection = AttributeManager.Instance.GlobalAttributeCollection;

        if (AttributeCollection == null)
        {
            AttributeCollection = new AttributeCollection();
        }
        AttributeCollection = AttributeCollection.GetFromGlobalCollection(attributes, globalAttributeCollection, AttributeCollection);

        // Create inventory slots for unit
        InventorySlots = new InventorySlots();
        foreach (var inventorySlot in inventory)
        {
            // Get item from global inventory
            Item item = ItemManager.Instance.GlobalInventory.GetById(inventorySlot.Value).DeepCopy();
            InventorySlots.Add(inventorySlot.Key, item);
        }

        // Abilities
        AbilityCollection = new AbilityCollection();
        foreach (var id in abilities)
        {
            // Get ability from global instance
            Ability ability = AbilityManager.Instance.GlobalAbilityCollection.Get(id).DeepCopy();
            AbilityCollection.Add(ability);
        }

        // Load the portrait
        Portrait = Resources.Load <Sprite>(PortraintLocation);

        // Load the sounds
        MovementSound = Resources.Load <AudioClip>(MovementSoundLocation);
    }
 void Start()
 {
     _InventoryScript     = GetComponent <Inventory>();
     _InventorySlotScript = GetComponent <InventorySlots>();
     for (int i = 0; i < _Buttons.Length; i++)
     {
         _Buttons[i].interactable = false;
     }
 }
Example #10
0
        public void Load(ByteBuffer buff, int statsyesno)
        {
            uint  previousEquipted = 0;
            ulong previousCount    = 0;

            //ch(hdddqhhhdhhdddhhhhhhhhhhhhd)
            ID       = buff.ReadUInt32();
            ItemID   = buff.ReadUInt32();
            Location = buff.ReadUInt32(); //Location slot

            if (statsyesno == 1)
            {
                foreach (InventoryInfo inv_inf in Globals.gamedata.inventory.Values)
                {
                    if (Util.GetInventoryItemID(inv_inf.ID) == ItemID || inv_inf.ID == ID)
                    {
                        previousEquipted = inv_inf.isEquipped;
                        previousCount    = inv_inf.Count;
                        break;
                    }
                }
            }

            Count      = buff.ReadUInt64();
            Type2      = buff.ReadUInt16();
            Type3      = buff.ReadUInt16();
            isEquipped = buff.ReadUInt16();
            Slot       = (InventorySlots)buff.ReadUInt32();
            Enchant    = buff.ReadUInt16();
            Type4      = buff.ReadUInt16();
            AugID      = buff.ReadUInt32();
            Mana       = buff.ReadUInt32();
            lease_time = buff.ReadInt32();

            buff.ReadUInt16();

            attack_element   = (InventoryElement)buff.ReadUInt16();
            attack_magnitude = buff.ReadInt16();
            fire_defense     = buff.ReadInt16();
            water_defense    = buff.ReadInt16();
            wind_defense     = buff.ReadInt16();
            earth_defense    = buff.ReadInt16();
            unholy_defense   = buff.ReadInt16();
            holy_defense     = buff.ReadInt16();
            //enchant_effect_0 = buff.ReadUInt16();
            //enchant_effect_1 = buff.ReadUInt16();
            //enchant_effect_2 = buff.ReadUInt16();

            buff.ReadUInt32();

            //stats stuff
            if (statsyesno == 1)
            {
                updateStats(ID, ItemID, previousEquipted, isEquipped, previousCount, Count);
            }
        }
Example #11
0
    /// <summary>
    /// Returns a deep copied instance.
    /// </summary>
    /// <returns>The copy.</returns>
    public InventorySlots DeepCopy()
    {
        InventorySlots deepCopiedInventorySlots = new InventorySlots();

        foreach (var item in _items)
        {
            deepCopiedInventorySlots.Add(item.Key, item.Value.DeepCopy());
        }
        return(deepCopiedInventorySlots);
    }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UnitData"/> class.
 /// </summary>
 /// <param name="resRef">Res reference.</param>
 /// <param name="firstName">First name.</param>
 /// <param name="lastName">Last name.</param>
 /// <param name="class">Class.</param>
 /// <param name="portrait">Portrait.</param>
 /// <param name="movementSound">Movement sound.</param>
 /// <param name="sprite">Sprite.</param>
 /// <param name="unitType">Unit type.</param>
 /// <param name="attributeCollection">Attribute collection.</param>
 /// <param name="inventorySlots">Inventory slots.</param>
 /// <param name="abilityCollection">Ability collection.</param>
 private UnitData(string resRef, string firstName, string lastName, string @class, Sprite portrait, AudioClip movementSound, string sprite, UnitType unitType, AttributeCollection attributeCollection, InventorySlots inventorySlots, AbilityCollection abilityCollection)
 {
     ResRef              = resRef;
     FirstName           = firstName;
     LastName            = lastName;
     Class               = @class;
     Portrait            = portrait;
     MovementSound       = movementSound;
     Sprite              = sprite;
     Type                = unitType;
     AttributeCollection = attributeCollection;
     InventorySlots      = inventorySlots;
     AbilityCollection   = abilityCollection;
 }
Example #13
0
    public void TestDeepCopy()
    {
        _slots.Add(_i1);

        // Make sure shallow copy is the same
        InventorySlots shallowCopy = _slots;

        Assert.AreSame(_slots, shallowCopy);

        // Make sure deep copy is different
        InventorySlots deepCopy = _slots.DeepCopy();

        Assert.AreNotSame(_slots, deepCopy);
    }
Example #14
0
    public void Populate()
    {
        RealmInventory = DarkestDungeonManager.Campaign.RealmInventory;
        InventoryRows  = new List <InventoryRow>();

        int trinketCount   = RealmInventory.Trinkets.Count;
        int rowCount       = Mathf.Max(3, trinketCount / 7 + 1);
        int trinketsLoaded = 0;

        CurrentCapacity = trinketCount;
        MaxCapacity     = rowCount * 7;

        for (int i = 0; i < rowCount; i++)
        {
            InventoryRow newRow = Instantiate(rowTemplate);
            newRow.Initialize(this);
            newRow.onRowEmptied += RealmInventoryWindow_onRowEmptied;
            newRow.RectTransform.SetParent(trinketBox, false);
            InventoryRows.Add(newRow);
            InventorySlots.AddRange(newRow.InventorySlots);

            for (int j = 0; j < 7; j++)
            {
                if (trinketsLoaded != trinketCount)
                {
                    Trinket trinket = RealmInventory.Trinkets[trinketsLoaded];
                    newRow.InventorySlots[j].CreateItem(trinket);
                    newRow.ItemAdded();
                    trinketsLoaded++;
                }
                else
                {
                    break;
                }
            }
        }

        for (int i = 0; i < InventoryRows.Count; i++)
        {
            InventoryRows[i].RowNumber     = i + 1;
            InventoryRows[i].onRowEmptied += RealmInventoryWindow_onRowEmptied;
            for (int j = 0; j < InventoryRows[i].SlotCount; j++)
            {
                InventoryRows[i].InventorySlots[j].onDropIn  += RealmInventoryWindow_onDropIn;
                InventoryRows[i].InventorySlots[j].onDropOut += RealmInventoryWindow_onDropOut;
            }
        }
        UpdateWindow();
    }
Example #15
0
    public bool CheckValidSlot(InventorySlots slot)
    {
        if (slot == InventorySlots.Any)
        {
            return(true);
        }

        foreach (InventorySlots validSlot in ValidSlots)
        {
            if (validSlot == slot)
            {
                return(true);
            }
        }

        return(false);
    }
Example #16
0
        protected override void InitilizeInventorySlots()
        {
            base.InitilizeInventorySlots();
            var count = 0;

            foreach (var equipmentSlot in SlotReferences)
            {
                var equipableSlot = new SlotEquipable(equipmentSlot.Value.SlotTransform, InventorySlotData[count + Capacity], count + Capacity);
                InventorySlots.Add(count + Capacity, equipableSlot);
                count++;
                // call the hook function or it won't initilize the LocalEquips
                if (equipableSlot.SlotData.Occupant())
                {
                    EquipmentSlotChanged(equipableSlot.SlotData, equipableSlot);
                }
            }
        }
    private void RealmInventoryRowEmptied(int rowNumber)
    {
        if (rowNumber > 3 && rowNumber == InventoryRows.Count)
        {
            for (int i = rowNumber; i > 3; i--)
            {
                if (InventoryRows[i - 1].HasItems)
                {
                    break;
                }

                InventorySlots.RemoveAll(slot => InventoryRows[i - 1].InventorySlots.Contains(slot));
                Destroy(InventoryRows[i - 1].gameObject);
                MaxCapacity -= InventoryRows[i - 1].SlotCount;
                InventoryRows.RemoveAt(i - 1);
            }
        }
    }
Example #18
0
        public bool AddItem(Item item, uint slot, InventorySlots bag)
        {
            if (!this.Containers.ContainsKey((uint)bag))
            {
                return(false);
            }

            item.Player = player.Guid;
            item.Bag    = (uint)bag;
            if (GetBag((uint)bag)?.AddItem(item, slot) == true)
            {
                this.UpdateSurrounding(item);
                player.QueryItemCheck(item.Entry);
                return(true);
            }

            return(false);
        }
    private InventoryRow AddRow()
    {
        InventoryRow newRow = Instantiate(rowTemplate);

        newRow.Initialize(this);
        newRow.RectTransform.SetParent(trinketBox, false);
        InventoryRows.Add(newRow);
        InventorySlots.AddRange(newRow.InventorySlots);

        newRow.RowNumber        = InventoryRows.Count;
        MaxCapacity            += newRow.SlotCount;
        newRow.EventRowEmptied += RealmInventoryRowEmptied;

        for (int j = 0; j < newRow.SlotCount; j++)
        {
            newRow.InventorySlots[j].EventDropIn  += RealmInventorySlotDropIn;
            newRow.InventorySlots[j].EventDropOut += RealmInventorySlotDropOut;
        }
        return(newRow);
    }
 public void DropItemUponClose()
 {
     if (Hand.MyInstance.MyMoveable != null)
     {
         Debug.Log("The hand is holding something");
         if (!EquipScreen.MyInstance.IsOpen)
         {
             Image icon = Hand.MyInstance.GetIcon();
             if (icon != null)
             {
                 if (fromSlot == null)
                 {
                     Debug.Log("fromSlot is null");
                 }
                 fromSlot.PutItemBack(); //This only makes the inventory icon white again
                 Hand.MyInstance.Drop(); //This makes moveable null
                 FromSlot = null;        //This makes the fromslot null
             }
         }
     }
 }
Example #21
0
 public void FindItemInInventoryAndRemove(Item item)
 {
     //called from EquipScreen and other screens where inventory items may show up
     //This is for those screens to find the item that corresponds to the item that is in their inventory
     //So it finds the item in its slot and finds the item in a slot in the inventory then removes it
     foreach (InventorySlots slots in slotList)
     {
         InventorySlots thisSlot = slots.GetComponent <InventorySlots>();
         if (thisSlot == null)
         {
             // Debug.Log("thisSlot is null");
         }
         // Debug.Log("thisSlot comes from: " + thisSlot.transform.parent.name);
         if (thisSlot.MyItem == item)
         {
             Debug.Log("The item that was in this slot has been found in the inventory and will be removed now");
             thisSlot.RemoveItem(item);
             break;
         }
     }
 }
Example #22
0
    /// <summary>
    /// Метод фильтрации инвентаря.
    /// </summary>
    /// <param name="filter">Указывает категорию слотов <see cref="InventorySlots"/>,
    /// которые должны быть отображены</param>
    public void FilterInventoryView(InventorySlots filter)
    {
        var allSlots = GetComponentInChildren <ScrollRect>().gameObject.
                       GetComponentsInChildren <InventorySlotScript>(true);

        foreach (var slot in allSlots)
        {
            // выключаем:
            // 1. пустые слоты
            // 2. слоты, которые содержат предмет другого типа
            if ((slot.ItemView != null) &&
                ((filter == InventorySlots.NonEquipable) || (slot.ItemView.item.SlotType == filter)))
            {
                slot.gameObject.SetActive(true);
            }
            else
            {
                slot.gameObject.SetActive(false);
            }
        }
    }
Example #23
0
    public void Start()
    {
        currentSlot            = InventorySlots.Zero;
        inventorySlotText.text = "0 - Hands";
        slot_0.gameObject.SetActive(true);
        slot_1.gameObject.SetActive(false);
        slot_2.gameObject.SetActive(false);
        slot_3.gameObject.SetActive(false);
        slot_4.gameObject.SetActive(false);
        slot_5.gameObject.SetActive(false);
        slot_6.gameObject.SetActive(false);
        slot_7.gameObject.SetActive(false);
        slot_8.gameObject.SetActive(false);
        slot_9.gameObject.SetActive(false);


        myAudioSource = gameObject.GetComponent <AudioSource>();

        myAudioSource.clip = changeWeapon;
        myAudioSource.Play();
    }
Example #24
0
 public Item this[InventorySlots slot]
 {
     get
     {
         return(Slots[slot]);
     }
     set
     {
         if (value is Item)
         {
             Item valueItem = value;
             foreach (InventorySlots validSlot in valueItem.ValidSlots)
             {
                 if (EquipItem(valueItem, slot))
                 {
                     return;
                 }
             }
             EquipItem(valueItem, valueItem.ValidSlots[0], true);
         }
     }
 }
Example #25
0
    public bool UnequipItem(InventorySlots slot)
    {
        bool foundItem = false;

        if (slot == InventorySlots.Any)
        {
            foreach (InventorySlots selectedSlot in Slots.Keys)
            {
                if (Slots[selectedSlot] != null)
                {
                    EmptySlot(selectedSlot);
                    foundItem = true;
                }
            }
        }
        else if (Slots[slot] != null)
        {
            EmptySlot(slot);
            foundItem = true;
        }

        return(foundItem);
    }
    private bool MergeItems(InventorySlots from)
    {
        /*
         * MergeItems will be checked only by the pointer
         */
        Debug.Log("MergeItems have been called");
        if (IsEmpty)
        {
            return(false);
        }
        if (from.MyItem.GetType() == MyItem.GetType() && !IsFull)
        {
            //How many free slots are there
            int freeSpace = MyItem.StackSize - MyCount;

            for (int i = 0; i < freeSpace; i++)
            {
                AddItem(from.itemStack.Pop());
            }
            return(true);
        }
        return(false);
    }
Example #27
0
        public void Clear_Equip(InventorySlots slot)
        {
            if (this.panel_inven_lear.InvokeRequired)
            {
                Clear_Equip2_Callback d = new Clear_Equip2_Callback(Clear_Equip);
                panel_inven_lear.Invoke(d, new object[] { slot });
                return;
            }

            switch (slot)
            {
                case InventorySlots.Shirt:
                    toolTip1.SetToolTip(panel_inven_shirt, "");
                    if (panel_inven_shirt.BackgroundImage != null)
                    {
                        panel_inven_shirt.BackgroundImage.Dispose();
                        panel_inven_shirt.BackgroundImage = null;
                    }
                    break;
                case InventorySlots.Ear:
                    break;
                case InventorySlots.Neck:
                    toolTip1.SetToolTip(panel_inven_neck, "");
                    if (panel_inven_neck.BackgroundImage != null)
                    {
                        panel_inven_neck.BackgroundImage.Dispose();
                        panel_inven_neck.BackgroundImage = null;
                    }
                    break;
                case InventorySlots.Finger:
                    break;
                case InventorySlots.Head:
                    toolTip1.SetToolTip(panel_inven_head, "");
                    if (panel_inven_head.BackgroundImage != null)
                    {
                        panel_inven_head.BackgroundImage.Dispose();
                        panel_inven_head.BackgroundImage = null;
                    }
                    break;
                case InventorySlots.RHand:
                    toolTip1.SetToolTip(panel_inven_rhand, "");
                    if (panel_inven_rhand.BackgroundImage != null)
                    {
                        panel_inven_rhand.BackgroundImage.Dispose();
                        panel_inven_rhand.BackgroundImage = null;
                    }
                    break;
                case InventorySlots.LHand:
                    toolTip1.SetToolTip(panel_inven_lhand, "");
                    if (panel_inven_lhand.BackgroundImage != null)
                    {
                        panel_inven_lhand.BackgroundImage.Dispose();
                        panel_inven_lhand.BackgroundImage = null;
                    }
                    break;
                case InventorySlots.Gloves:
                    toolTip1.SetToolTip(panel_inven_gloves, "");
                    if (panel_inven_gloves.BackgroundImage != null)
                    {
                        panel_inven_gloves.BackgroundImage.Dispose();
                        panel_inven_gloves.BackgroundImage = null;
                    }
                    break;
                case InventorySlots.Chest:
                    toolTip1.SetToolTip(panel_inven_top, "");
                    if (panel_inven_top.BackgroundImage != null)
                    {
                        panel_inven_top.BackgroundImage.Dispose();
                        panel_inven_top.BackgroundImage = null;
                    }
                    break;
                case InventorySlots.Pants:
                    toolTip1.SetToolTip(panel_inven_pants, "");
                    if (panel_inven_pants.BackgroundImage != null)
                    {
                        panel_inven_pants.BackgroundImage.Dispose();
                        panel_inven_pants.BackgroundImage = null;
                    }
                    break;
                case InventorySlots.Feet:
                    toolTip1.SetToolTip(panel_inven_boots, "");
                    if (panel_inven_boots.BackgroundImage != null)
                    {
                        panel_inven_boots.BackgroundImage.Dispose();
                        panel_inven_boots.BackgroundImage = null;
                    }
                    break;
                case InventorySlots.Dunno:
                    break;
                case InventorySlots.LRHand:
                    toolTip1.SetToolTip(panel_inven_lhand, "");
                    toolTip1.SetToolTip(panel_inven_rhand, "");
                    if (panel_inven_lhand.BackgroundImage != null)
                    {
                        panel_inven_lhand.BackgroundImage.Dispose();
                        panel_inven_lhand.BackgroundImage = null;
                    }
                    if (panel_inven_rhand.BackgroundImage != null)
                    {
                        panel_inven_rhand.BackgroundImage.Dispose();
                        panel_inven_rhand.BackgroundImage = null;
                    }
                    break;
                case InventorySlots.FullBody:
                    toolTip1.SetToolTip(panel_inven_top, "");
                    toolTip1.SetToolTip(panel_inven_pants, "");
                    if (panel_inven_top.BackgroundImage != null)
                    {
                        panel_inven_top.BackgroundImage.Dispose();
                        panel_inven_top.BackgroundImage = null;
                    }
                    if (panel_inven_pants.BackgroundImage != null)
                    {
                        panel_inven_pants.BackgroundImage.Dispose();
                        panel_inven_pants.BackgroundImage = null;
                    }
                    break;
                case InventorySlots.Accessory:
                    toolTip1.SetToolTip(panel_inven_acc, "");
                    if (panel_inven_acc.BackgroundImage != null)
                    {
                        panel_inven_acc.BackgroundImage.Dispose();
                        panel_inven_acc.BackgroundImage = null;
                    }
                    break;
            }
        }
Example #28
0
 void Start()
 {
     _SlotsScript   = GetComponent <InventorySlots>();
     _InfoText.text = "";
 }
Example #29
0
 private void Start()
 {
     inventorySlots = GameObject.Find("Player").GetComponent <InventorySlots>();
 }
Example #30
0
 public InventoryObject get_Objeto_en_Posicion(InventorySlots posicion) => objetos.FirstOrDefault(o => o.posicion == posicion);
Example #31
0
        public void Load(ByteBuffer buff, int statsyesno)
        {
            uint previousEquipted = 0;
            ulong previousCount = 0;
            //ch(hdddqhhhdhhdddhhhhhhhhhhhhd)
            ID = buff.ReadUInt32();
            ItemID = buff.ReadUInt32();
            Location = buff.ReadUInt32(); //Location slot

            if (statsyesno == 1)
            {
                foreach (InventoryInfo inv_inf in Globals.gamedata.inventory.Values)
                {
                    if (Util.GetInventoryItemID(inv_inf.ID) == ItemID || inv_inf.ID == ID)
                    {
                        previousEquipted = inv_inf.isEquipped;
                        previousCount = inv_inf.Count;
                        break;
                    }
                }
            }

            Count = buff.ReadUInt64();
            Type2 = buff.ReadUInt16();
            Type3 = buff.ReadUInt16();
            isEquipped = buff.ReadUInt16();
            Slot = (InventorySlots)buff.ReadUInt32();
            Enchant = buff.ReadUInt16();
            Type4 = buff.ReadUInt16();
            AugID = buff.ReadUInt32();
            Mana = buff.ReadUInt32();
            lease_time = buff.ReadInt32();

            buff.ReadUInt16();

            attack_element = (InventoryElement)buff.ReadUInt16();
            attack_magnitude = buff.ReadInt16();
            fire_defense = buff.ReadInt16();
            water_defense = buff.ReadInt16();
            wind_defense = buff.ReadInt16();
            earth_defense = buff.ReadInt16();
            unholy_defense = buff.ReadInt16();
            holy_defense = buff.ReadInt16();
            enchant_effect_0 = buff.ReadUInt16();
            enchant_effect_1 = buff.ReadUInt16();
            enchant_effect_2 = buff.ReadUInt16();

            buff.ReadUInt32();

            //stats stuff
            if (statsyesno == 1)
            {
                updateStats(ID, ItemID, previousEquipted, isEquipped, previousCount, Count);
            }
        }
Example #32
0
        public virtual void Func_40219_x_()
        {
            ItemStack itemstack = InventorySlots.GetSlot(0).GetStack();

            if (!ItemStack.AreItemStacksEqual(itemstack, Field_40222_o))
            {
                Field_40222_o = itemstack;

                do
                {
                    Field_40226_k += Field_40230_x.Next(4) - Field_40230_x.Next(4);
                }while (Field_40229_i <= Field_40226_k + 1.0F && Field_40229_i >= Field_40226_k - 1.0F);
            }

            Field_40227_h++;
            Field_40225_j = Field_40229_i;
            Field_40221_n = Field_40224_m;
            bool flag = false;

            for (int i = 0; i < 3; i++)
            {
                if (ContainerEnchantment.EnchantLevels[i] != 0)
                {
                    flag = true;
                }
            }

            if (flag)
            {
                Field_40224_m += 0.2F;
            }
            else
            {
                Field_40224_m -= 0.2F;
            }

            if (Field_40224_m < 0.0F)
            {
                Field_40224_m = 0.0F;
            }

            if (Field_40224_m > 1.0F)
            {
                Field_40224_m = 1.0F;
            }

            float f  = (Field_40226_k - Field_40229_i) * 0.4F;
            float f1 = 0.2F;

            if (f < -f1)
            {
                f = -f1;
            }

            if (f > f1)
            {
                f = f1;
            }

            Field_40223_l += (f - Field_40223_l) * 0.9F;
            Field_40229_i  = Field_40229_i + Field_40223_l;
        }