mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-23 02:12:14 +00:00
Allow bulk buying in Shiftorium GUI.
This commit is contained in:
parent
9566b4b062
commit
3e56dfce88
2 changed files with 22 additions and 4 deletions
|
@ -180,8 +180,6 @@ namespace ShiftOS.WinForms.Applications
|
|||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(137, 13);
|
||||
this.label3.TabIndex = 2;
|
||||
int upgradepercent = (pgupgradeprogress.Value / 100) * 100;
|
||||
this.label3.Text = upgradepercent.ToString();
|
||||
//
|
||||
// pgupgradeprogress
|
||||
//
|
||||
|
|
|
@ -153,9 +153,28 @@ namespace ShiftOS.WinForms.Applications
|
|||
|
||||
private void btnbuy_Click(object sender, EventArgs e)
|
||||
{
|
||||
long cpCost = 0;
|
||||
backend.Silent = true;
|
||||
backend.Buy(upgrades[lbupgrades.SelectedItem.ToString()].ID, upgrades[lbupgrades.SelectedItem.ToString()].Cost);
|
||||
backend.Silent = false;
|
||||
Dictionary<string, int> UpgradesToBuy = new Dictionary<string, int>();
|
||||
foreach (var itm in lbupgrades.SelectedItems)
|
||||
{
|
||||
cpCost += upgrades[itm.ToString()].Cost;
|
||||
UpgradesToBuy.Add(upgrades[itm.ToString()].ID, upgrades[itm.ToString()].Cost);
|
||||
}
|
||||
if (SaveSystem.CurrentSave.Codepoints < cpCost)
|
||||
{
|
||||
Infobox.Show("Insufficient Codepoints", $"You do not have enough Codepoints to perform this action. You need {cpCost - SaveSystem.CurrentSave.Codepoints} more.");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach(var upg in UpgradesToBuy)
|
||||
{
|
||||
backend.Buy(upg.Key, upg.Value);
|
||||
}
|
||||
}
|
||||
|
||||
backend.Silent = false;
|
||||
PopulateShiftorium();
|
||||
btnbuy.Hide();
|
||||
}
|
||||
|
@ -185,6 +204,7 @@ namespace ShiftOS.WinForms.Applications
|
|||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
lbupgrades.SelectionMode = (UpgradeInstalled("shiftorium_gui_bulk_buy") == true) ? SelectionMode.MultiExtended : SelectionMode.One;
|
||||
lbcodepoints.Visible = Shiftorium.UpgradeInstalled("shiftorium_gui_codepoints_display");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue