GetEntry() public method

public GetEntry ( int index ) : Entry
index int
return Entry
示例#1
0
    private void UpdateInventoryList()
    {
        for (int i = 0; i < InventoryContainer.INVENTORY_SIZE; i++)
        {
            InventoryTuple tuple = characters.GetEntry().invCon.GetTuple(i);
            if (string.IsNullOrEmpty(tuple.uuid))
            {
                if (currentMode == MenuState.STORE)
                {
                    Transform     t2     = Instantiate(restockPrefab, listParentRestock);
                    ItemListEntry entry2 = itemList.CreateEntry(t2);
                    entry2.FillDataEmpty(i);
                }
                continue;
            }

            ItemListEntry entry   = itemList.GetEntry(i);
            int           charges = 0;
            float         cost    = 0;
            CalculateCharge(tuple, ref cost, ref charges, false);
            string chargeStr = tuple.currentCharges + " / " + tuple.maxCharge;
            string costStr   = (currentMode == MenuState.RECHARGE) ? Mathf.CeilToInt(cost * charges).ToString() : "";
            entry.FillDataSimple(i, tuple, chargeStr, costStr);
        }
        itemList.Move(0);
    }
示例#2
0
    private void GenerateInventoryList()
    {
        inventoryView.SetActive(true);
        charListView.SetActive(false);
        storeView.SetActive(true);
        convoyView.SetActive(false);
        TotalMoneyText.text = "Money:  " + totalMoney.value;

        if (itemList == null)
        {
            itemList = new EntryList <ItemListEntry>(itemListSize);
        }
        itemList.ResetList();

        for (int i = 0; i < InventoryContainer.INVENTORY_SIZE; i++)
        {
            InventoryTuple tuple = charList.GetEntry().invCon.GetTuple(i);
            if (string.IsNullOrEmpty(tuple.uuid))
            {
                Transform     t2     = Instantiate(restockPrefab, listParentRestock);
                ItemListEntry entry2 = itemList.CreateEntry(t2);
                entry2.FillDataEmpty(i);
                continue;
            }
            Transform     t       = Instantiate(restockPrefab, listParentRestock);
            ItemListEntry entry   = itemList.CreateEntry(t);
            int           charges = 0;
            float         cost    = 0;
            CalculateCharge(tuple, ref cost, ref charges, false);
            string chargeStr = tuple.currentCharges + " / " + tuple.maxCharge;
            string costStr   = Mathf.CeilToInt(cost * charges).ToString();
            entry.FillDataSimple(i, tuple, chargeStr, costStr);
        }
        restockPrefab.gameObject.SetActive(false);
    }
示例#3
0
    public void UpdateCost()
    {
        if (!buyMode)
        {
            return;
        }

        for (int i = 0; i < entryList.Size; i++)
        {
            ItemListEntry item = entryList.GetEntry(i);
            item.SetAffordable(item.tuple.cost <= totalMoney.value);
        }
    }
示例#4
0
 public void SelectCharacter()
 {
     if (detailedMode == Mode.LIST)
     {
         detailedMode      = Mode.DETAILED;
         selectedIndex     = supportList.GetEntry().index;
         selectName.text   = supportList.GetEntry().entryName.text;
         selectIcon.sprite = supportList.GetEntry().icon.sprite;
         CreateSupportEntry();
         supportList.ForcePosition(0);
     }
     else if (detailedMode == Mode.DETAILED)
     {
         if (supportList.GetEntry().newLevel.enabled)
         {
             levelupPrompt.ShowYesNoPopup("Increase support level?", true);
             detailedMode = Mode.PROMPT;
         }
     }
     else if (detailedMode == Mode.PROMPT)
     {
         if (levelupPrompt.Click(true) == MyPrompt.Result.OK1)
         {
             //Fixa uppdaterat supportvärde
             Debug.Log("Dum dum daaah!");
         }
         detailedMode = Mode.DETAILED;
     }
 }
 public void SelectCharacter()
 {
     if (popupMode)
     {
         levelupScript.Continue();
     }
     else if (!changeMode)
     {
         if (entryList.GetEntry().dark)
         {
             return;
         }
         changeMode   = true;
         selectedChar = playerData.stats[entryList.GetPosition()];
         CreateClassList();
         SetupCharacterInfo();
         SetupClassGains();
         changeView.SetActive(true);
         listView.SetActive(false);
     }
     else
     {
         StartCoroutine(ChangeClass());
     }
 }
示例#6
0
    public IEnumerator AwardExp()
    {
        if (runningExp)
        {
            yield break;
        }

        runningExp         = true;
        lockControls.value = true;
        totalScrap.value  -= awardAmount;
        StatsContainer stats = playerData.stats[entryList.GetPosition()];

        expMeter.gameObject.SetActive(true);
        expMeter.currentExp = stats.currentExp;
        Debug.Log("Exp is currently: " + stats.currentExp);
        yield return(new WaitForSeconds(0.5f * currentGameSpeed.value));

        sfxQueue.Enqueue(levelupFill);
        playSfxEvent.Invoke();

        int convertedExp = 10 * awardAmount;

        awardAmount = 0;
        while (convertedExp > 0)
        {
            convertedExp--;
            expMeter.currentExp++;
            if (expMeter.currentExp == 100)
            {
                expMeter.currentExp = 0;
                stopSfxEvent.Invoke();
                yield return(new WaitForSeconds(1f * currentGameSpeed.value));

                expMeter.gameObject.SetActive(false);
                levelupScript.SetupStats(stats, true);
                Debug.Log("LEVELUP!");
                stats.GainLevel();
                sfxQueue.Enqueue(levelupFanfare);
                playSfxEvent.Invoke();
                yield return(StartCoroutine(levelupScript.RunLevelup(stats)));

                expMeter.gameObject.SetActive(true);
                sfxQueue.Enqueue(levelupFill);
                playSfxEvent.Invoke();
            }
            yield return(null);
        }
        stopSfxEvent.Invoke();
        yield return(new WaitForSeconds(0.5f * currentGameSpeed.value));

        expMeter.gameObject.SetActive(false);
        stats.currentExp = expMeter.currentExp;

        entryList.GetEntry().FillData(stats);
        SetupBexpAwarding();
        SetupCharacterInfo();
        lockControls.value = false;
        runningExp         = false;
    }
    public void SelectItem(bool isUpgrade)
    {
        UpgradeListEntry upgrade = entryList.GetEntry();

        if (!upgrade || !upgrade.affordable)
        {
            return;
        }
        else if (!promptMode)
        {
            if (upgrade.affordable)
            {
                promptMode = true;
                buyPrompt.ShowYesNoPopup((isUpgrade) ? "Buy upgrade?" : "Develop item?", true);
            }
        }
        else
        {
            if (buyPrompt.Click(true) == MyPrompt.Result.OK1)
            {
                Debug.Log((isUpgrade) ? "Upgrade" : "Invent");
                totalMoney.value -= upgrade.upgrade.cost;
                totalScrap.value -= upgrade.upgrade.scrap;
                playerData.upgrader.upgrades[upgrade.index].researched = true;
                playerData.upgrader.CalculateResearch();
                playerData.UpdateUpgrades();
                UpdateListDarkness();
            }
            GenerateList();
            DeselectItem();
            MoveSelection(0);
        }
    }
示例#8
0
    private void ShowItemInfo()
    {
        PrepCharacterEntry entry = charList.GetEntry();
        InventoryTuple     tuple = null;

        if (currentMode == State.STORE)
        {
            tuple = itemList.GetEntry().tuple;
        }
        else if (convoy.GetEntry())
        {
            tuple = convoy.GetEntry().tuple;
        }

        if (!entry || tuple == null || string.IsNullOrEmpty(tuple.uuid))
        {
            itemName.text   = "";
            itemIcon.sprite = null;

            pwrText.text   = "Pwr:  ";
            rangeText.text = "Range:  ";
            hitText.text   = "Hit:  ";
            critText.text  = "Crit:  ";
            reqText.text   = "Req:  ";
            return;
        }

        itemName.text   = tuple.entryName;
        itemIcon.sprite = tuple.icon;

        pwrText.text   = "Pwr:  " + tuple.power.ToString();
        rangeText.text = "Range:  " + tuple.range.ToString();
        hitText.text   = "Hit:  " + tuple.hitRate.ToString();
        critText.text  = "Crit:  " + tuple.critRate.ToString();
        reqText.text   = "Req:  " + tuple.skillReq.ToString();

        if (currentMode == State.TAKE)
        {
            ShowCharInfoTake();
        }
    }
    public void UpdateFile()
    {
        int           i     = saveFiles.GetPosition();
        SaveFileEntry entry = saveFiles.GetEntry();

        if (chapterIDs[i].value == CLEAR_GAME_ID)
        {
            entry.FillData("All maps cleared!", totalDays[i].value, playTimes[i].value);
        }
        else if (chapterIDs[i].value == "")
        {
            entry.FillData("BASE", totalDays[i].value, playTimes[i].value);
        }
        else
        {
            MapEntry map = (MapEntry)chapterLibrary.GetEntry(chapterIDs[i].value);
            entry.FillData(map.entryName, totalDays[i].value, playTimes[i].value);
        }
    }
示例#10
0
 /// <summary>
 /// Updates the state of the how to play screen.
 /// </summary>
 /// <param name="active"></param>
 public void UpdateState(bool active)
 {
     optionList.ForcePosition(0);
     optionMenu.SetActive(active);
     explanationField.text = optionList.GetEntry().explanation;
 }
示例#11
0
 private void UpdateCharacterList()
 {
     for (int i = 0; i < playerData.stats.Count; i++)
     {
         characters.GetEntry(i).UpdateRestock();
     }
 }
示例#12
0
 /// <summary>
 /// Checks if it's possible to click on OK in this screen.
 /// </summary>
 /// <returns></returns>
 public bool CheckOk()
 {
     return(topicEntryList.GetEntry().index == topics.Count - 1);
 }