From b6bc4fd3de7324dd4b086c215768bc50b54c49bb Mon Sep 17 00:00:00 2001 From: MichaelTheShifter Date: Tue, 24 May 2016 20:27:25 -0400 Subject: 0.1.1 Release Candidate 1 Committing all code for 0.1.1 Release Candidate 1. --- source/WindowsFormsApplication1/NetGen.cs | 99 ++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 2 deletions(-) (limited to 'source/WindowsFormsApplication1/NetGen.cs') 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(); + } //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 Templates = null; + + public void SetupTemplates() + { + Templates = JsonConvert.DeserializeObject>(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 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 + { + + } + } } } -- cgit v1.2.3