Beispiel #1
0
        void LoadItemFromSlot(IconBase iconBase)
        {
            ResourcesManager resourceManager = ResourcesManager.Instance;

            switch (currentEqSlot.eqSlotType)
            {
            case EquipmentSlotType.Weapons:
                LoadWeaponItem(resourceManager, iconBase);
                break;

            case EquipmentSlotType.Arrows:
                break;

            case EquipmentSlotType.Bolts:
                break;

            case EquipmentSlotType.Equipment:
                UpdateItemSlotInfo(resourceManager, iconBase, Itemtype.Equipment);
                break;

            case EquipmentSlotType.Rings:
                break;

            case EquipmentSlotType.Covenant:
                break;

            case EquipmentSlotType.Consumables:
                UpdateItemSlotInfo(resourceManager, iconBase, Itemtype.Consumable);
                break;

            default:
                break;
            }
        }
        public void SelectGesture(bool pos)
        {
            if (pos)
            {
                gestureIndex++;
            }
            else
            {
                gestureIndex--;
            }

            if (gestureIndex < 0)
            {
                gestureIndex = gestures.Count - 1;
            }

            if (gestureIndex > gestures.Count - 1)
            {
                gestureIndex = 0;
            }

            if (gestures[gestureIndex] == null)
            {
                Debug.Log("No such gesture found @ index: " + gestureIndex);
            }

            IconBase iconBase = gestures[gestureIndex].iconBase;

            gestureSelector.transform.SetParent(iconBase.transform);
            gestureSelector.anchoredPosition = Vector2.zero;

            currentGestureAnim = gestures[gestureIndex].targetAnim;
            closeWeapons       = gestures[gestureIndex].closeWeapons;
        }
Beispiel #3
0
        /// <summary>
        ///Load items to inventory UI in Left Equipment Panel
        /// </summary>
        /// <param name="itemType">Item Type</param>
        public void LoadCurrentItems(Itemtype itemType)
        {
            //List<Item> itemList = session.GetItemsAsList(item);
            List <ItemInventoryInstance> itemList = session.GetItemInstanceList(itemType);

            if (itemList == null || itemList.Count == 0)
            {
                return;
            }

            GameObject prefabSlot = equipment_Left.leftInventory.inventorySlotTemplate;
            Transform  parent     = equipment_Left.leftInventory.slotGrid.transform;

            int diff  = iconSlotsCreated.Count - itemList.Count;
            int extra = (diff > 0) ? diff : 0;

            maxInv_Index        = itemList.Count;
            currentCreatedItems = new List <IconBase>();

            //By default, set currently selected item the first one in the inventory list
            currentInv_Index = 0;

            for (int i = 0; i < itemList.Count + extra; i++)
            {
                if (i > itemList.Count - 1)
                {
                    iconSlotsCreated[i].gameObject.SetActive(false);
                    continue;
                }

                Item item = ResourcesManager.Instance.GetItem(itemList[i].itemId, itemType);

                IconBase icon = null;
                if (iconSlotsCreated.Count - 1 < i)
                {
                    GameObject go = Instantiate(prefabSlot) as GameObject;
                    go.transform.SetParent(parent);
                    go.SetActive(true);
                    icon = go.GetComponent <IconBase>();
                    iconSlotsCreated.Add(icon);
                }
                else
                {
                    icon = iconSlotsCreated[i];
                }

                currentCreatedItems.Add(icon);
                icon.gameObject.SetActive(true);
                icon.icon.enabled = true;
                icon.icon.sprite  = item.itemIcon;
                icon.id           = itemList[i].uniqueId;
            }
        }
Beispiel #4
0
        void LoadWeaponItem(ResourcesManager resManager, IconBase icon)
        {
            ItemInventoryInstance invInstance = session.GetWeaponItem(icon.id);
            string      weaponID    = invInstance.itemId;
            WeaponStats weaponStats = resManager.GetWeaponStats(weaponID);
            Item        item        = resManager.GetItem(weaponID, Itemtype.Weapon);

            equipment_Left.currentItem.text = item.name_item;

            //Update Center Overlay UI Panel
            UpdateCenterOverlay(item);
            center_Overlay.skillName.text = weaponStats.skillName;

            //Center Main UI
            weaponInfo.smallIcon.sprite = item.itemIcon;
            weaponInfo.itemName.text    = item.name_item;
            weaponInfo.weaponType.text  = weaponStats.weaponType;
            weaponInfo.damageType.text  = weaponStats.damageType;
            weaponInfo.skillName.text   = weaponStats.skillName;
            weaponInfo.weightCost.text  = weaponStats.weightCost.ToString();

            //Update the min durability!!!
            weaponInfo.durability_Min.text = weaponInfo.durability_Max.ToString();
            weaponInfo.durability_Max.text = weaponInfo.durability_Max.ToString();

            //Attack Power
            UpdateAttackDefenseUIElement(weaponInfo.attackPowerSlots, AttackDefenseType.Physical, weaponStats.attackPhysical.ToString());
            UpdateAttackDefenseUIElement(weaponInfo.attackPowerSlots, AttackDefenseType.Magic, weaponStats.attackMagic.ToString());
            UpdateAttackDefenseUIElement(weaponInfo.attackPowerSlots, AttackDefenseType.Fire, weaponStats.attackFire.ToString());
            UpdateAttackDefenseUIElement(weaponInfo.attackPowerSlots, AttackDefenseType.Lightning, weaponStats.attackLigthning.ToString());
            UpdateAttackDefenseUIElement(weaponInfo.attackPowerSlots, AttackDefenseType.Dark, weaponStats.attackDark.ToString());
            UpdateAttackDefenseUIElement(weaponInfo.attackPowerSlots, AttackDefenseType.Critical, weaponStats.attackCritical.ToString());

            UpdateAttackDefenseUIElement(weaponInfo.additionalEffects, AttackDefenseType.Frost, weaponStats.attackFrost.ToString(), true);
            UpdateAttackDefenseUIElement(weaponInfo.additionalEffects, AttackDefenseType.Curse, weaponStats.attackCurse.ToString(), true);
            //UpdateAttackDefenseUIElement(weaponInfo.additionalEffects, AttackDefenseType.Poison, weaponStats.poisonDamage.ToString());
            //UpdateAttackDefenseUIElement(weaponInfo.additionalEffects, AttackDefenseType.Bleed, weaponStats.frostDamage.ToString(), true);

            //Guard Absorptions
            UpdateAttackDefenseUIElement(weaponInfo.guardAbsorptions, AttackDefenseType.Physical, weaponStats.defensePhysical.ToString());
            UpdateAttackDefenseUIElement(weaponInfo.guardAbsorptions, AttackDefenseType.Magic, weaponStats.defenseMagic.ToString());
            UpdateAttackDefenseUIElement(weaponInfo.guardAbsorptions, AttackDefenseType.Fire, weaponStats.defenseFire.ToString());
            UpdateAttackDefenseUIElement(weaponInfo.guardAbsorptions, AttackDefenseType.Lightning, weaponStats.defenseLigthning.ToString());
            UpdateAttackDefenseUIElement(weaponInfo.guardAbsorptions, AttackDefenseType.Dark, weaponStats.defenseDark.ToString());
            UpdateAttackDefenseUIElement(weaponInfo.guardAbsorptions, AttackDefenseType.Dark, weaponStats.defenseDark.ToString());
            UpdateAttackDefenseUIElement(weaponInfo.guardAbsorptions, AttackDefenseType.Stability, weaponStats.defenseStability.ToString());
        }
        void CreateGestureUI()
        {
            for (int i = 0; i < gestures.Count; i++)
            {
                GameObject go = Instantiate(gestureIconTemplate) as GameObject;
                go.transform.SetParent(gesturesGrid.transform);
                go.transform.localScale = Vector3.one;
                go.SetActive(true);

                IconBase iconBase = go.GetComponent <IconBase>();
                iconBase.icon.sprite = gestures[i].iconSprite;
                gestures[i].iconBase = iconBase;
            }

            gesturesGrid.SetActive(false);
            gestureSelector.gameObject.SetActive(false);

            //By default, the first gesture in the list is selected
            gestureIndex = 1;
            SelectGesture(false);
        }
Beispiel #6
0
        public void Tick()
        {
            inputUI.Tick();
            HandleUIState(inputUI);

            if (prevEqSlot != currentEqSlot)
            {
                if (currentEqSlot != null)
                {
                    equipment_Left.slotName.text = currentEqSlot.slotName;
                    LoadItemFromSlot(currentEqSlot.iconBase);
                }
            }

            if (currentCreatedItems != null)
            {
                if (currentCreatedItems.Count > 0)
                {
                    if (previousInv_Index != currentInv_Index)
                    {
                        if (currentInvIcon)
                        {
                            currentInvIcon.background.color = slotUnSelectedColor;
                        }

                        if (currentInv_Index < currentCreatedItems.Count)
                        {
                            currentInvIcon = currentCreatedItems[currentInv_Index];
                            currentInvIcon.background.color = slotSelectedColor;
                            LoadItemFromSlot(currentInvIcon);
                        }
                    }
                }
            }

            prevEqSlot        = currentEqSlot;
            previousInv_Index = currentInv_Index;
        }
Beispiel #7
0
        void UpdateItemSlotInfo(ResourcesManager resManager, IconBase iconBase, Itemtype itemtype)
        {
            ItemInventoryInstance invInstance = null;

            if (!centerOverlayIsOpen)
            {
                centerOverlay.SetActive(false);
            }

            centerOverlay.SetActive(false);

            switch (itemtype)
            {
            case Itemtype.Spell:
                break;

            case Itemtype.Consumable:
                invInstance = session.GetConsumableItem(iconBase.id);
                centerOverlay.SetActive(true);
                break;

            case Itemtype.Equipment:
                //invInstance = session.GetArmorItem(iconBase.id);
                centerOverlay.SetActive(true);
                break;

            default:
                break;
            }

            string itemID = invInstance.itemId;
            Item   item   = resManager.GetItem(itemID, itemtype);

            UpdateCenterOverlay(item);
            equipment_Left.currentItem.text = item.name_item;
        }