private void SetupModuleInfo() { bool cont = false; FutureModule m = null; foreach (var mod in BuyableModules) { if (mod.Name == cmbbuyable.Text) { m = mod; cont = true; } } if (cont == true) { lbmoduleinfo.Text = m.Name; lbmoduleinfo.Text += Environment.NewLine + $"Cost: {m.Cost * Convert.ToInt32(txtgrade.Text)} CP"; lbmoduleinfo.Text += Environment.NewLine + $"Description: {Environment.NewLine}{m.Description}"; } }
private void btndonebuying_Click(object sender, EventArgs e) { var mod = new FutureModule("", 0, "", SystemType.Core); bool cont = false; foreach (var m in BuyableModules) { if (m.Name == cmbbuyable.Text) { mod = m; cont = true; } } if (cont == true) { if (API.Codepoints >= mod.Cost) { if (txthostname.Text != "") { bool cont2 = true; string hname = txthostname.Text.Replace(" ", "_"); foreach (var pc in GetMyNet()) { if (pc.Hostname == hname) { cont2 = false; } } if (cont2 == true) { GetMyNet().Add(new Module(mod.Type, Convert.ToInt32(txtgrade.Text), hname)); API.RemoveCodepoints(mod.Cost); API.CreateInfoboxSession("Module added.", "To deploy the module to the network, select 'Add Module' and choose the hostname from the menu.", infobox.InfoboxMode.Info); pnlbuy.Hide(); if (IsTutorial) { if (TutorialProgress == 19) { SetupTutorialUI(20); } else if (TutorialProgress == 24) { SetupTutorialUI(25); } } } else { API.CreateInfoboxSession("Please enter a unique hostname.", "No two computers can share the same hostname. Please choose another.", infobox.InfoboxMode.Info); } } else { API.CreateInfoboxSession("Please enter a hostname.", "It is best to enter a hostname for your new computer so you know which one it is.", infobox.InfoboxMode.Info); } } else { API.CreateInfoboxSession("Insufficient Codepoints", "You do not have enough Codepoints to buy this module.", infobox.InfoboxMode.Info); } } }