Esempio n. 1
0
    public void StoreData(StatsContainer stats, InventoryContainer invCon, SkillsContainer skillCont, SupportContainer supportCont)
    {
        id           = stats.charData.uuid;
        currentClass = stats.currentClass.uuid;
        classLevels  = new int[ClassWheel.CLASS_COUNT];
        for (int i = 0; i < ClassWheel.CLASS_COUNT; i++)
        {
            classLevels[i] = stats.classLevels[i];
        }

        level      = stats.level;
        currentExp = stats.currentExp;

        wpnSkills = new int[InventoryContainer.WPN_SKILLS];
        for (int i = 0; i < invCon.wpnSkills.Length; i++)
        {
            wpnSkills[i] = (int)invCon.wpnSkills[i];
        }

        inventory  = new List <string>();
        invCharges = new List <int>();
        for (int i = 0; i < InventoryContainer.INVENTORY_SIZE; i++)
        {
            if (string.IsNullOrEmpty(invCon.GetTuple(i).uuid))
            {
                continue;
            }
            inventory.Add(invCon.GetTuple(i).uuid);
            invCharges.Add(invCon.GetTuple(i).currentCharges);
        }

        skills = new List <string>();
        for (int i = 0; i < skillCont.skills.Length; i++)
        {
            if (!skillCont.skills[i])
            {
                continue;
            }
            skills.Add(skillCont.skills[i].uuid);
        }

        stats.GenerateStartingStats();

        eHp  = stats.eHp;
        eDmg = stats.eDmg;
        eMnd = stats.eMnd;
        eSpd = stats.eSpd;
        eSkl = stats.eSkl;
        eDef = stats.eDef;

        roomNo   = supportCont.roomNo;
        supports = new List <SupportValue>();
        for (int i = 0; i < supportCont.supportValues.Count; i++)
        {
            supports.Add(supportCont.supportValues[i]);
        }
    }
Esempio n. 2
0
    //Inventory

    /// <summary>
    /// Returns the first equippable weapon of the given item type.
    /// </summary>
    /// <param name="category"></param>
    /// <returns></returns>
    public InventoryTuple GetEquippedWeapon(ItemCategory category)
    {
        if (category == ItemCategory.WEAPON)
        {
            return(inventory.GetTuple(0));
        }
        return(inventory.GetFirstUsableItemTuple(category));
    }
Esempio n. 3
0
    /// <summary>
    /// Checks the inventory to see if there is any items to restock.
    /// </summary>
    public void UpdateRestock()
    {
        bool restock = false;

        for (int i = 0; i < InventoryContainer.INVENTORY_SIZE; i++)
        {
            InventoryTuple tuple = invCon.GetTuple(i);
            if (!string.IsNullOrEmpty(tuple.uuid) && tuple.currentCharges < tuple.maxCharge)
            {
                restock = true;
                break;
            }
        }
        canRestock.enabled = restock;
    }
    /// <summary>
    /// Updates the inventory and the explanation groups.
    /// </summary>
    private void Setup()
    {
        InventoryContainer inv = selectedCharacter.value.inventory;

        for (int i = 0; i < InventoryContainer.INVENTORY_SIZE; i++)
        {
            inventory[i] = inv.GetTuple(i);
        }

        SkillsContainer skill = selectedCharacter.value.skills;

        for (int i = 0; i < SkillsContainer.SKILL_SIZE; i++)
        {
            skills[i].value = skill.skills[i];
        }

        baseStats.UpdateSelection(page == StatsPage.BASIC);
        statsStats.UpdateSelection(page == StatsPage.STATS);
        inventoryStats.UpdateSelection(page == StatsPage.INVENTORY);
    }
    /// <summary>
    /// Displays the inventory page. Contains information on the inventory, weaponskills and constitution.
    /// </summary>
    /// <param name="tactics"></param>
    private void ShowInventoryStats(TacticsMove tactics)
    {
        if (tactics == null)
        {
            return;
        }
        StatsContainer     stats     = tactics.stats;
        InventoryContainer inventory = tactics.inventory;

        menuView.SetActive(true);
        statsObject.SetActive(false);
        basicObject.SetActive(false);
        inventoryObject.SetActive(true);
        characterName.text = stats.charData.entryName;

        ClassWheel wheel = (stats.charData.faction == Faction.ENEMY) ? enemyClassWheel : playerClassWheel;

        WeaponRank[] ranks = wheel.GetWpnSkillFromLevel(stats.classLevels);
        int          pos   = 0;

        for (int i = 0; i < weaponSkillIcons.Length; i++)
        {
            while (pos < ranks.Length && ranks[pos] == WeaponRank.NONE)
            {
                pos++;
            }
            if (pos >= ranks.Length)
            {
                weaponSkillIcons[i].transform.parent.gameObject.SetActive(false);
            }
            else
            {
                weaponSkillIcons[i].transform.parent.gameObject.SetActive(true);
                weaponSkillIcons[i].sprite = weaponTypeIcons.icons[pos];
                weaponSkillRating[i].text  = ranks[pos].ToString();
            }
            pos++;
        }

        // Set up inventory list
        for (int i = 0; i < 5; i++)
        {
            if (i >= InventoryContainer.INVENTORY_SIZE || string.IsNullOrEmpty(inventory.GetTuple(i).uuid))
            {
                inventoryFields[i].color = Color.yellow;
                inventoryFields[i].text  = "---";
                inventoryValues[i].text  = " ";
            }
            else
            {
                InventoryTuple tuple = inventory.GetTuple(i);
                WeaponRank     skill = inventory.GetWpnSkill(tuple);
                inventoryFields[i].color = (tuple.droppable) ? Color.green :
                                           (tuple.CanUse(skill)) ? Color.yellow : Color.grey;
                inventoryFields[i].text = tuple.entryName;
                inventoryValues[i].text = (tuple.maxCharge >= 0) ? tuple.currentCharges.ToString() : " ";
                if (tuple.itemCategory == ItemCategory.CONSUME && tuple.maxCharge == 1)
                {
                    inventoryValues[i].text = " ";
                }
            }
        }

        UpdateSelection();
    }