Exemplo n.º 1
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);
    }
Exemplo n.º 2
0
    private void GenerateList()
    {
        TotalScrapText.text = "Scraps:  " + totalScrap.value;
        TotalMoneyText.text = "Money:  " + totalMoney.value;

        if (entryList == null)
        {
            entryList = new EntryList <UpgradeListEntry>(visibleSize);
        }
        entryList.ResetList();
        int         tempListSize = playerData.upgrader.listSize;
        UpgradeType currentType  = (upgradeMode) ? UpgradeType.UPGRADE : UpgradeType.INVENTION;

        for (int i = 0; i < tempListSize; i++)
        {
            if (playerData.upgrader.upgrades[i].upgrade.type == currentType)
            {
                Transform        t  = Instantiate(entryPrefab, listParent);
                UpgradeListEntry ue = entryList.CreateEntry(t);
                ue.FillData(i, playerData.upgrader.upgrades[i].upgrade, playerData.upgrader.upgrades[i].researched, totalScrap.value, totalMoney.value);
            }
        }
        entryPrefab.gameObject.SetActive(false);
        upgradeInfoObject.SetActive(upgradeMode);
        inventionInfoObject.SetActive(!upgradeMode);
        entryList.Sort(SortUpgrades);
        UpdateListDarkness();
    }
Exemplo n.º 3
0
    /// <summary>
    /// Sets up the save file information for the save files.
    /// </summary>
    private void SetupSaveFiles()
    {
        saveFiles = new EntryList <SaveFileEntry>(visibleSize);

        for (int i = 0; i < SaveController.SAVE_FILES_COUNT; i++)
        {
            Transform     t     = Instantiate(entryPrefab, listParent);
            SaveFileEntry entry = saveFiles.CreateEntry(t);
            if (chapterIDs[i].value == CLEAR_GAME_ID)
            {
                entry.FillData("All maps cleared!", totalDays[i].value, playTimes[i].value);
            }
            else if (string.IsNullOrEmpty(chapterIDs[i].value))
            {
                entry.FillData("BASE", totalDays[i].value, playTimes[i].value);
            }
            else
            {
                MapEntry map = (MapEntry)chapterLibrary.GetEntry(chapterIDs[i].value);
                if (map != null)
                {
                    entry.FillData(map.entryName, totalDays[i].value, playTimes[i].value);
                }
                else
                {
                    chapterIDs[i].value = "";
                    totalDays[i].value  = 0;
                    playTimes[i].value  = 0;
                    entry.FillData("", 0, 0);
                }
            }
        }
        entryPrefab.gameObject.SetActive(false);
    }
Exemplo n.º 4
0
 private void Start()
 {
     optionList = new EntryList <OptionEntry>(options.Length);
     for (int i = 0; i < options.Length; i++)
     {
         optionList.CreateEntry(options[i].transform);
         options[i].UpdateUI();
     }
     optionMenu.SetActive(false);
 }
 private void CreateClassList()
 {
     classList.ResetList();
     gains = classWheel.LevelupOptions(selectedChar.classLevels);
     for (int i = 0; i < gains.Count; i++)
     {
         Transform      t     = Instantiate(classPrefab, classParent);
         ClassListEntry entry = classList.CreateEntry(t);
         entry.FillData(gains[i]);
     }
     classPrefab.gameObject.SetActive(false);
     MoveSelection(0);
 }
Exemplo n.º 6
0
    private void GenerateCharacterList()
    {
        TotalMoneyText.text = "Money:  " + totalMoney.value;

        characters.ResetList();

        for (int i = 0; i < playerData.stats.Count; i++)
        {
            Transform        t     = Instantiate(characterPrefab, listParentCharacter);
            RestockListEntry entry = characters.CreateEntry(t);
            entry.FillData(playerData.stats[i], playerData.inventory[i]);
        }
        characterPrefab.gameObject.SetActive(false);
    }
Exemplo n.º 7
0
    private void GenerateShopList()
    {
        entryList.ResetList();
        int listSize = (buyMode) ? shopList.items.Count : playerData.items.Count;

        for (int i = 0; i < listSize; i++)
        {
            ItemEntry item = (buyMode) ? shopList.items[i] : playerData.items[i].item;

            if (buyMode && item.researchNeeded && !playerData.upgrader.IsResearched(item.uuid))
            {
                continue;
            }

            Transform      t     = Instantiate(entryPrefab, entryListParent);
            ItemListEntry  entry = entryList.CreateEntry(t);
            InventoryTuple tup   = new InventoryTuple(item);
            tup.UpdateUpgrades(playerData.upgrader);
            int charges = tup.maxCharge;
            entry.FillData(i, tup, charges.ToString(), totalMoney.value, buyMode, sellRatio.value);
        }
        entryPrefab.gameObject.SetActive(false);
        ForceCategory(0);
    }
Exemplo n.º 8
0
    private void GenerateInventoryList()
    {
        TotalMoneyText.text = "Money:  " + totalMoney.value;

        characters.GetEntry().invCon.CleanupInventory();
        itemList.ResetList();

        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;
            }
            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.ToString();
            if (currentMode == MenuState.RECHARGE)
            {
                chargeStr += " / " + tuple.maxCharge;
            }
            string costStr = (currentMode == MenuState.RECHARGE) ? Mathf.CeilToInt(cost * charges).ToString() : "";
            entry.FillDataSimple(i, tuple, chargeStr, costStr);
        }
        restockPrefab.gameObject.SetActive(false);
        ShowItemInfo();
    }
Exemplo n.º 9
0
    public void CreateList()
    {
        if (supportList == null)
        {
            supportList = new EntryList <SupportListEntry>(maxEntries);
        }
        supportList.ResetList();

        for (int i = 0; i < playerData.stats.Count; i++)
        {
            Transform        t       = Instantiate(entryPrefab, listParent);
            SupportListEntry support = supportList.CreateEntry(t);
            support.FillData(i, playerData.stats[i]);
        }
        entryPrefab.gameObject.SetActive(false);
    }
Exemplo n.º 10
0
    public void GenerateList()
    {
        if (entryList == null)
        {
            entryList = new EntryList <TrainingListEntry>(visibleSize);
        }
        entryList.ResetList();
        for (int i = 0; i < playerData.stats.Count; i++)
        {
            Transform         t     = Instantiate(entryPrefab, listParent);
            TrainingListEntry entry = entryList.CreateEntry(t);
            entry.FillData(playerData.stats[i]);
        }
        entryPrefab.gameObject.SetActive(false);

        MoveSelection(0);
    }
Exemplo n.º 11
0
    private void CreateListEntries()
    {
        for (int i = listParent.childCount - 1; i > 1; i--)
        {
            Destroy(listParent.GetChild(i).gameObject);
        }

        entryList.ResetList();
        for (int i = 0; i < playerData.stats.Count; i++)
        {
            Transform         t     = Instantiate(entryPrefab, listParent);
            TrainingListEntry entry = entryList.CreateEntry(t);
            entry.FillData(playerData.stats[i]);
            entry.SetDark(!playerData.stats[i].CanLevelup());

            t.gameObject.SetActive(true);
        }
        entryPrefab.gameObject.SetActive(false);
    }
Exemplo n.º 12
0
    private void GenerateTopicList()
    {
        topicEntryList.ResetList();
        topicEntryList = new EntryList <TopicEntry>(visibleSize);

        topics.Sort((x, y) => string.Compare(x.topic, y.topic));
        for (int i = 0; i < topics.Count; i++)
        {
            if (topics[i].unlockDay > currentDays.value)
            {
                continue;
            }
            Transform  t        = Instantiate(topicPrefab, topicListParent);
            TopicEntry entry    = topicEntryList.CreateEntry(t);
            bool       newTopic = (currentDays.value == topics[i].unlockDay);
            entry.FillData(i, topics[i].topic, newTopic);
        }
        topicPrefab.gameObject.SetActive(false);
        UpdateTopicList();
    }
Exemplo n.º 13
0
    public void GenerateList()
    {
        currentMode = State.CHAR;
        charListView.SetActive(true);
        inventoryView.SetActive(false);
        storeView.SetActive(false);
        convoyView.SetActive(false);
        if (charList == null)
        {
            charList = new EntryList <PrepCharacterEntry>(visibleSize);
        }
        charList.ResetList();

        for (int i = 0; i < prepList.values.Count; i++)
        {
            Transform          t     = Instantiate(charEntryPrefab, charListParent.transform);
            PrepCharacterEntry entry = charList.CreateEntry(t);
            entry.FillData(playerData.stats[prepList.values[i].index], playerData.inventory[prepList.values[i].index], prepList.values[i]);
        }
        ShowCharInfo();
        charEntryPrefab.gameObject.SetActive(false);
        convoy.Setup();
    }