aboutsummaryrefslogtreecommitdiff
path: root/source/WindowsFormsApplication1/NetGen.cs
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-05-24 20:27:25 -0400
committerMichaelTheShifter <[email protected]>2016-05-24 20:27:35 -0400
commitb6bc4fd3de7324dd4b086c215768bc50b54c49bb (patch)
treeeba44505bcd8d824a093a0b18d471ffa0477384a /source/WindowsFormsApplication1/NetGen.cs
parent95a1f2e4ae8fdb6862dc238106b1cda4948262a9 (diff)
downloadshiftos-c-_theultimatehacker-b6bc4fd3de7324dd4b086c215768bc50b54c49bb.tar.gz
shiftos-c-_theultimatehacker-b6bc4fd3de7324dd4b086c215768bc50b54c49bb.tar.bz2
shiftos-c-_theultimatehacker-b6bc4fd3de7324dd4b086c215768bc50b54c49bb.zip
0.1.1 Release Candidate 1
Committing all code for 0.1.1 Release Candidate 1.
Diffstat (limited to 'source/WindowsFormsApplication1/NetGen.cs')
-rw-r--r--source/WindowsFormsApplication1/NetGen.cs99
1 files changed, 97 insertions, 2 deletions
diff --git a/source/WindowsFormsApplication1/NetGen.cs b/source/WindowsFormsApplication1/NetGen.cs
index 7f09eb1..616505d 100644
--- a/source/WindowsFormsApplication1/NetGen.cs
+++ b/source/WindowsFormsApplication1/NetGen.cs
@@ -46,8 +46,28 @@ namespace ShiftOS
pnlnetinf.BringToFront();
break;
case 1:
+ //clear potential
+ if(potentialModules != null)
+ {
+ foreach(var p in potentialModules)
+ {
+ pnlnetdesign.Controls.Remove(p);
+ p.Hide();
+
+ }
+ potentialModules = new List<Computer>();
+ }
//create net
- network = new EnemyHacker(txtnetname.Text, txtnetdesc.Text, txtnetdesc.Text, 0, 0, "unknown");
+ if (overwrite_net == true)
+ {
+ network = new EnemyHacker(txtnetname.Text, txtnetdesc.Text, txtnetdesc.Text, this.skill, this.speed, cbdifficulty.Text);
+ }
+ else
+ {
+ network = new EnemyHacker(txtnetname.Text, txtnetdesc.Text, txtnetdesc.Text, this.skill, this.speed, cbdifficulty.Text);
+ network.Network = TemplateNet;
+ }
+ network.Network[0].HP = network.Network[0].GetTotalHP();
var c = network.Network[0].Deploy();
c.Left = (pnlnetdesign.Width - 64) / 2;
c.Top = (pnlnetdesign.Height - 64) / 2;
@@ -213,7 +233,7 @@ namespace ShiftOS
var coordinates = pnlnetdesign.PointToClient(Cursor.Position);
int x = coordinates.X;
int y = coordinates.Y;
-
+ fmod.HP = fmod.GetTotalHP();
var computerToPlace = fmod.Deploy();
computerToPlace.Location = new Point(x, y);
pnlnetdesign.Controls.Add(computerToPlace);
@@ -262,5 +282,80 @@ namespace ShiftOS
SelectedSystem = null;
pnlpcinfo.Hide();
}
+
+ int skill = 0;
+ int speed = 0;
+
+ private void txtfskill_TextChanged(object sender, EventArgs e)
+ {
+ try
+ {
+ skill = Convert.ToInt32(txtfskill.Text);
+ }
+ catch
+ {
+ txtfskill.Text = skill.ToString();
+ }
+ }
+
+ private void txtfspeed_TextChanged(object sender, EventArgs e)
+ {
+ try
+ {
+ speed = Convert.ToInt32(txtfspeed.Text);
+ }
+ catch
+ {
+ txtfspeed.Text = speed.ToString();
+ }
+ }
+
+ Dictionary<string, EnemyHacker> Templates = null;
+
+ public void SetupTemplates()
+ {
+ Templates = JsonConvert.DeserializeObject<Dictionary<string, EnemyHacker>>(Properties.Resources.NetBrowser_Enemies);
+ cbnets.Items.Clear();
+ foreach(var t in Templates)
+ {
+ cbnets.Items.Add(t.Key);
+ }
+ }
+
+ private void btnloadfromtemplate_Click(object sender, EventArgs e)
+ {
+ SetupTemplates();
+ pnltemplates.BringToFront();
+ pnltemplates.Visible = !pnltemplates.Visible;
+ }
+
+ bool overwrite_net = true;
+ List<Module> TemplateNet = null;
+
+ public void SetupTemplate(EnemyHacker t)
+ {
+ txtnetname.Text = t.Name;
+ txtnetdesc.Text = t.Description;
+ txtfskill.Text = t.FriendSkill.ToString();
+ txtfspeed.Text = t.FriendSpeed.ToString();
+ cbdifficulty.SelectedItem = t.Difficulty;
+ stage = 0;
+ overwrite_net = false;
+ TemplateNet = t.Network;
+ SetupUI();
+ }
+
+ private void btnrecreate_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ SetupTemplate(Templates[cbnets.Text]);
+ pnltemplates.Hide();
+ }
+ catch
+ {
+
+ }
+ }
}
}