aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-04-03 19:46:22 -0400
committerMichael <[email protected]>2017-04-03 19:46:22 -0400
commit3e56dfce88257d6d52e9a59acdb75a6404c0ace1 (patch)
treeeab0ad0d33905f04016054b6609410c89ce5848e
parent9566b4b062ad0f10832584c65457ef6505b097ab (diff)
downloadshiftos_thereturn-3e56dfce88257d6d52e9a59acdb75a6404c0ace1.tar.gz
shiftos_thereturn-3e56dfce88257d6d52e9a59acdb75a6404c0ace1.tar.bz2
shiftos_thereturn-3e56dfce88257d6d52e9a59acdb75a6404c0ace1.zip
Allow bulk buying in Shiftorium GUI.
-rw-r--r--ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs2
-rw-r--r--ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs24
2 files changed, 22 insertions, 4 deletions
diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs
index 36943be..80e1812 100644
--- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs
+++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs
@@ -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
//
diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs
index d2390ff..e1e3357 100644
--- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs
+++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs
@@ -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");
}