/// <summary> /// Update index when up or down is clicked. /// </summary> public void Move(int dir) { if (isPopup) { return; } saveFiles.Move(dir); saveFileIndex.value = saveFiles.GetPosition(); }
private void SetupBexpAwarding() { int convertedExp = 10 * awardAmount; StatsContainer stats = playerData.stats[entryList.GetPosition()]; bonusExp.text = "Available scrap: " + (totalScrap.value - awardAmount); bonusExp.color = (awardAmount > 0) ? Color.green : Color.black; spendExp.text = convertedExp.ToString(); currentLevel.text = "Current level: " + ((stats.currentExp + convertedExp >= 100) ? stats.level + 1 : stats.level); currentLevel.color = (stats.currentExp + convertedExp >= 100) ? Color.green : Color.black; currentExp.text = "Current EXP: " + ((stats.currentExp + convertedExp) % 100); currentExp.color = (awardAmount > 0) ? Color.green : Color.black; }
private void SetupClassGains() { LevelGain level = gains[classList.GetPosition()]; //Stats statsBoosts[0].transform.parent.gameObject.SetActive(level.bonusHp > 0); statsBoosts[0].text = "+" + level.bonusHp; statsBoosts[1].transform.parent.gameObject.SetActive(level.bonusDmg > 0); statsBoosts[1].text = "+" + level.bonusDmg; statsBoosts[2].transform.parent.gameObject.SetActive(level.bonusMnd > 0); statsBoosts[2].text = "+" + level.bonusMnd; statsBoosts[3].transform.parent.gameObject.SetActive(level.bonusSkl > 0); statsBoosts[3].text = "+" + level.bonusSkl; statsBoosts[4].transform.parent.gameObject.SetActive(level.bonusSpd > 0); statsBoosts[4].text = "+" + level.bonusSpd; statsBoosts[5].transform.parent.gameObject.SetActive(level.bonusDef > 0); statsBoosts[5].text = "+" + level.bonusDef; //Wpn skills for (int i = 0; i < wpnList.Count; i++) { Destroy(wpnList[i].gameObject); } wpnList.Clear(); for (int i = 0; i < level.weaponSkills.Count; i++) { Transform t = Instantiate(wpnSkillTemplate, wpnSkillParent); t.GetComponentInChildren <Image>().sprite = wpnIcons.icons[(int)level.weaponSkills[i]]; WeaponRank current = playerData.inventory[entryList.GetPosition()].wpnSkills[(int)level.weaponSkills[i]]; WeaponRank next = (current + 1); if (current != WeaponRank.NONE) { t.GetComponentInChildren <Text>().text = current + " > " + next; } else { t.GetComponentInChildren <Text>().text = "+ " + next; } t.gameObject.SetActive(true); wpnList.Add(t); } wpnSkillTemplate.gameObject.SetActive(false); //Skill skillGainIcon.sprite = level.skill.icon; skillGainName.text = level.skill.entryName; skillGainDesc.text = level.skill.description; }
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()); } }
private void CalculateCharge(InventoryTuple t, ref float cost, ref int charges, bool affordable) { InventoryTuple tuple = t ?? characters.GetEntry().invCon.GetTuple(itemList.GetPosition()); charges = tuple.GetMissingCharges(); if (charges == 0) { return; } cost = tuple.ChargeCost(); if (affordable) { int available = Mathf.FloorToInt(totalMoney.value / cost); charges = Mathf.Min(charges, available); } }
private void StoreItem() { Debug.Log("Store item"); if (itemList.GetEntry().tuple == null) { return; } InventoryTuple tuple = charList.GetEntry().invCon.GetTuple(itemList.GetPosition()); playerData.items.Add(tuple.StoreData()); charList.GetEntry().invCon.DropItem(itemList.GetPosition()); charList.GetEntry().invCon.CleanupInventory(); itemList.RemoveEntry(); Transform t2 = Instantiate(restockPrefab, listParentRestock); ItemListEntry entry2 = itemList.CreateEntry(t2); entry2.FillDataEmpty(0); ShowItemInfo(); }
private void CreateSupportEntry() { oldIndex = supportList.GetPosition(); supportList.FilterShow((x) => x.index != selectedIndex); for (int i = 0; i < supportList.Size; i++) { CharEntry other = playerData.stats[supportList.GetEntry(i).index].charData; SupportTuple tuple = playerData.stats[selectedIndex].charData.GetSupport(other); SupportValue value = playerData.baseInfo[selectedIndex].GetSupportValue(other); supportList.GetEntry(i).SetDark(tuple == null); supportList.GetEntry(i).SetSupportValue(tuple, value); } }