aboutsummaryrefslogtreecommitdiff
path: root/source/WindowsFormsApplication1/Shiftorium.cs
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-06-25 08:10:03 -0400
committerMichaelTheShifter <[email protected]>2016-06-25 08:10:03 -0400
commit84f689b91a73e512b035df40bbcf556b008a3b81 (patch)
treeda1020b2b5866c7ce300ac7b9c97112fe80fa1b3 /source/WindowsFormsApplication1/Shiftorium.cs
parent6707e2076a63dafab686fd533c95fb8ceb6c23fa (diff)
downloadshiftos-c-_theultimatehacker-84f689b91a73e512b035df40bbcf556b008a3b81.tar.gz
shiftos-c-_theultimatehacker-84f689b91a73e512b035df40bbcf556b008a3b81.tar.bz2
shiftos-c-_theultimatehacker-84f689b91a73e512b035df40bbcf556b008a3b81.zip
Sort source code into folders.
It feels better to know what's responsible for what... Plus I removed some un-needed C# stuff.
Diffstat (limited to 'source/WindowsFormsApplication1/Shiftorium.cs')
-rw-r--r--source/WindowsFormsApplication1/Shiftorium.cs215
1 files changed, 0 insertions, 215 deletions
diff --git a/source/WindowsFormsApplication1/Shiftorium.cs b/source/WindowsFormsApplication1/Shiftorium.cs
deleted file mode 100644
index ce9dbfc..0000000
--- a/source/WindowsFormsApplication1/Shiftorium.cs
+++ /dev/null
@@ -1,215 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-using ShiftOS;
-using SaveSystem;
-
-namespace Shiftorium
-{
- public partial class Frontend : Form
- {
- public Frontend()
- {
- InitializeComponent();
- }
-
- List<Upgrade> AvailableUpgrades = new List<Upgrade>();
- Upgrade selectedUpgrade = null;
-
- private void tmrcodepointsupdate_Tick(object sender, EventArgs e)
- {
- lbcodepoints.Text = "Codepoints: " + API.Codepoints.ToString();
- }
-
- private void Frontend_Load(object sender, EventArgs e)
- {
- ColumnHeader name = new ColumnHeader();
- name.Text = "Upgrade Name";
- name.Width = lbupgrades.Width;
-
- lbupgrades.Columns.Add(name);
- GetUpgrades();
- }
-
- public void GetUpgrades()
- {
- bool ShowUpgrades = true;
- lbupgrades.Items.Clear();
- AvailableUpgrades.Clear();
- Categories.Clear();
- foreach (Upgrade upgrade in Utilities.GetAvailable())
- {
- AvailableUpgrades.Add(upgrade);
- }
- GetCategories();
- try {
- lbcategory.Text = Categories[SelectedCategory].ToUpper();
- if(lbcategory.Text != "FUNDAMENTAL") {
- if(API.Upgrades["hacking"] == false)
- {
- Hacking.StartTutorial();
- PreviousCategory();
- }
- else
- {
- if(API.Upgrades.ContainsKey(lbcategory.Text.ToLower()))
- {
- if(API.Upgrades[lbcategory.Text.ToLower()] == false)
- {
- btnhack.Show();
- ShowUpgrades = false;
- }
- else
- {
- btnhack.Hide();
- }
- }
- }
- }
- else
- {
- btnhack.Hide();
- }
- }
- catch
- {
- lbcategory.Text = "No upgrades!";
- }
- foreach(Upgrade upg in AvailableUpgrades)
- {
- if (ShowUpgrades == true)
- {
- AddItem(upg);
- }
- }
- }
-
- public void AddItem(Upgrade upgrade)
- {
- ListViewItem lv = new ListViewItem();
- var c = upgrade.Cost / API.CurrentSave.PriceDivider;
- lv.Text = upgrade.Name.Replace(upgrade.Cost.ToString(), c.ToString());
- lv.Tag = upgrade.id;
- if (upgrade.Category.ToUpper() == lbcategory.Text.ToUpper())
- {
- if (!upgrade.id.Contains("dummy"))
- {
- lbupgrades.Items.Add(lv);
- }
- }
- }
-
- public void GetCategories()
- {
- foreach(var upg in AvailableUpgrades)
- {
- if(Categories.Contains(upg.Category))
- {
- }
- else
- {
- Categories.Add(upg.Category);
- }
- }
- }
-
- private void lbupgrades_SelectedIndexChanged(object sender, EventArgs e)
- {
- try {
- ListViewItem item = lbupgrades.SelectedItems[0];
- string upg = (string)item.Tag;
- foreach (Upgrade upgrade in AvailableUpgrades)
- {
- if (upgrade.id == upg)
- {
- pnlintro.Hide();
- lbupgradename.Text = upgrade.Name.Replace($" - {upgrade.Cost} CP", "");
- lbudescription.Text = upgrade.Description;
- btnbuy.Show();
- lbprice.Text = (upgrade.Cost / API.CurrentSave.PriceDivider).ToString() + " CP";
- picpreview.Image = upgrade.Preview;
- selectedUpgrade = upgrade;
- }
- }
- } catch
- {
- //do nothing.
- }
-
- }
-
- private void btnbuy_Click(object sender, EventArgs e)
- {
- if(Utilities.Buy(selectedUpgrade) == true)
- {
- btnbuy.Hide();
- lbprice.Text = "Upgrade installed.";
- }
- else
- {
- lbprice.Text = "Can't afford!";
- }
- GetUpgrades();
- lbupgrades.Focus();
- }
-
- public List<string> Categories = new List<string>();
- public int SelectedCategory = 0;
-
- public void PreviousCategory()
- {
- if(SelectedCategory > 0)
- {
- SelectedCategory -= 1;
- GetUpgrades();
- }
- else
- {
- API.PlaySound(ShiftOS.Properties.Resources._3beepvirus);
- }
- }
-
- public void NextCategory()
- {
- if (SelectedCategory < Categories.Count - 1)
- {
- SelectedCategory += 1;
- GetUpgrades();
- }
- else
- {
- API.PlaySound(ShiftOS.Properties.Resources._3beepvirus);
- }
- }
-
- private void btnback_Click(object sender, EventArgs e)
- {
- PreviousCategory();
- }
-
- private void btnforward_Click(object sender, EventArgs e)
- {
- NextCategory();
- }
-
- private void btnhack_Click(object sender, EventArgs e)
- {
- if(API.Upgrades["multitasking"] == true)
- {
- var t = new Terminal();
- API.CreateForm(t, API.LoadedNames.TerminalName, ShiftOS.Properties.Resources.iconTerminal);
- t.StartHackingSession(lbcategory.Text.ToLower());
- }
- else
- {
- API.CreateInfoboxSession("Dependencies not met.", "You need the following upgrades: Multitasking to embark on this activity.", infobox.InfoboxMode.Info);
- }
- }
- }
-}