public void Add(Postava pos) { TreeNode[] nodes; if ((nodes = tree.Nodes.Find(pos.xmlFileName, true)).Length == 0) { if (pos.Load(pos.xmlFileName) == -1) { Program.getMainForm().Cursor = Cursors.Default; return; } else { TreeNode node = tree.Nodes.Add(pos.xmlFileName, pos.jmeno); node.Tag = pos; node.ContextMenuStrip = Program.getMainForm().treeContextMenu; tree.SelectedNode = node; opened = pos; } Program.getMainForm().setNew(pos); } else { tree.SelectedNode = nodes[0]; Program.getMainForm().setNew((Postava)nodes[0].Tag); } }
public levelUp(Postava pos) { InitializeComponent(); postava = pos; String vlast1 = Program.getDB().povolani.FindByjmeno(postava.povolani).vlast1; String vlast2 = Program.getDB().povolani.FindByjmeno(postava.povolani).vlast2; foreach (Pair<String, int> pair in postava.zvyseniVlastnosti) { if (pair.first == vlast1 || pair.first == vlast2) { if (pair.second != 2) { String used = ""; for (int i = 0; i < pair.second; i++) { used += "*"; } hlavniList.Items.Add(getName(pair.first) + " " + used); } } else { if (pair.second != 1) { vedlejsiList.Items.Add(getName(pair.first)); } } } hlavniList.SelectedIndex = 0; vedlejsiList.SelectedIndex = 0; }
public UnavaMgr(Postava pos, Label muL, NumericUpDown unN, FlowLayoutPanel bars, Panel labels, LinkLabel postihULink, Label postihUL) { postava = pos; unavaPanel = bars; mezUnavyL = muL; unavaLabels = labels; unavaN = unN; postihLink = postihULink; postihL = postihUL; int mez = postava.getVlastnostO("Mez únavy"); boxes = new List<CheckBox>(); for (int i = 0; i < mez * 3; i++) { CheckBox box = new CheckBox(); //box.ThreeState = true; box.Checked = false; box.Margin = new Padding(0); box.Parent = unavaPanel; box.Width = box.Height = 15; box.Click += new EventHandler(changeCheck); box.Tag = i+1; boxes.Add(box); } }
public ZivotyMgr(Postava pos, Label mzL, NumericUpDown zrN, FlowLayoutPanel bars, Panel labels, LinkLabel postihZLink, Label postihZL) { postava = pos; zivotyPanel = bars; mezZraneniL = mzL; zivotyLabels = labels; zraneniN = zrN; postihLink = postihZLink; postihL = postihZL; int mez = postava.getVlastnostO("Mez zranění"); boxes = new List<CheckBox>(); for (int i = 0; i < mez * 3; i++) { CheckBox box = new CheckBox(); //box.ThreeState = true; box.Checked = false; box.Margin = new Padding(0); box.Parent = zivotyPanel; box.Width = box.Height = 15; box.Click += new EventHandler(changeCheck); box.Tag = i+1; boxes.Add(box); } }
public newKombinace(Postava pos, Kombinace kombo) { InitializeComponent(); postava = pos; r1.Checked = true; r1.Enabled = false; r2.Enabled = false; TreeNode[] nodes = tree.Nodes.Find(kombo.zbran, true); if (nodes.Length != 0) { tree.SelectedNode = nodes[0]; } else { MessageBox.Show("V databázi neexistuje zbraň " + kombo.zbran); DialogResult = DialogResult.Abort; this.Close(); } list.SelectedIndex = list.FindString(kombo.stit); checkBox1.Checked = kombo.obouruc; if (Program.getDB().zbrane.FindByjmeno(kombo.zbran).obourucni == 1) { checkBox1.Checked = true; checkBox1.Enabled = false; } nazevKomba.Text = kombo.nazev; }
public newKombinace(Postava pos) { InitializeComponent(); postava = pos; r1.Checked = true; }
public opravyDialog(Postava pos) { InitializeComponent(); this.opr = new Oprava("", "", 0); this.Text = "Nová opravy"; postava = pos; listUpdate(); }
public ZbrojMgr(Postava pos) { zJmeno = "Beze zbroje"; pJmeno = "Bez pokrývky hlavy"; zVaha = 0; pVaha = 0; postava = pos; }
public newPredmet(Postava pos) { InitializeComponent(); postava = pos; zaplatitCh.Checked = true; zaplatitCh.Checked = false; UpdateTree(); }
public skillsUp(Postava pos, String vlast1, String vlast2) { InitializeComponent(); this.vlast1 = vlast1; this.vlast2 = vlast2; this.postava = pos; typ1 = Fill(list1, this.vlast1, nazvy1); typ2 = Fill(list2, this.vlast2, nazvy2); }
public opravyDialog(Postava pos, Oprava opr) { InitializeComponent(); this.opr = opr; this.Text = "Nová opravy"; postava = pos; listUpdate(); setLabels(); }
public UpravaPostavyDialog3(Postava pos, String druzina, int fyz, int psy, int komb) { InitializeComponent(); this.postava = pos; this.fyz = fyz; this.psy = psy; this.komb = komb; this.druzina = druzina; TreeNode node1 = tree.Nodes.Add("Fyzické"); TreeNode node2 = tree.Nodes.Add("Psychické"); TreeNode node3 = tree.Nodes.Add("Kombinované"); databaseDataSet db = Program.getDB(); OrderedEnumerableRowCollection<databaseDataSet.zbraneRow> en = db.zbrane.OrderBy(row => row.kategorie); node1.Nodes.Add("Boj (" + en.ElementAt(0).kategorie + ")").Tag = "Boj (" + en.ElementAt(0).kategorie + ")"; String s = en.ElementAt(0).kategorie; foreach (databaseDataSet.zbraneRow row in en) { if (s != row.kategorie) { node1.Nodes.Add("Boj (" + row.kategorie + ")").Tag = "Boj (" + row.kategorie + ")"; s = row.kategorie; } } node1.Nodes.Add("Boj s vrhacími zbraněmi").Tag = "Boj s vrhacími zbraněmi"; node1.Nodes.Add("Nošení zbroje").Tag = "Nošení zbroje"; node1.Nodes.Add("Používání štítu").Tag = "Používání štítu"; node3.Nodes.Add("Boj s luky").Tag = "Boj s luky"; node3.Nodes.Add("Boj s kušemi").Tag = "Boj s kušemi"; foreach (databaseDataSet.dovednostiRow row in Program.getDB().dovednosti) { if (row.typ == "fyz") { node1.Nodes.Add(row.jmeno).Tag = row.jmeno; } else if (row.typ == "psy") { node2.Nodes.Add(row.jmeno).Tag = row.jmeno; } else { node3.Nodes.Add(row.jmeno).Tag = row.jmeno; } } fyzL.Text = fyz.ToString(); psyL.Text = psy.ToString(); kombL.Text = komb.ToString(); }
public opravy(Postava pos) { InitializeComponent(); Text += pos.jmeno; postava = pos; foreach (Oprava op in postava.opravy) { opravi.Add(new Oprava(op.vlastnost, op.name, op.bonus, op.custom)); } UpdateList(); }
public vyberZbroje(Postava pos, String z, String p) { InitializeComponent(); postava = pos; int stup = postava.dovednostiMgr.getDovednost("Nošení zbroje"); dovednostL.Text = "Dovednost nošení zbroje na " + (stup == 0 ? "žádném" : (stup.ToString() + ".")) + " stupni"; foreach (databaseDataSet.zbrojeRow row in Program.getDB().zbroje) { zbrojeList.Items.Add(row.jmeno.ToString()); } foreach (databaseDataSet.prilbyRow row in Program.getDB().prilby) { prilbyList.Items.Add(row.jmeno.ToString()); } zbrojeList.SelectedIndex = zbrojeList.Items.IndexOf(z); prilbyList.SelectedIndex = prilbyList.Items.IndexOf(p); }
public static void ToTXT(Postava pos) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Textový soubor|*.txt|Všechny soubory|*.*"; sfd.AddExtension = true; sfd.FileName = pos.jmeno; if (sfd.ShowDialog() == DialogResult.OK) { System.IO.StreamWriter sw = new System.IO.StreamWriter(sfd.FileName); sw.WriteLine(pos.jmeno); sw.WriteLine(pos.rasa + " " + pos.povolani.ToLower()); sw.WriteLine(); sw.WriteLine("Úroveň\t\t" + pos.uroven.ToString()); sw.WriteLine("Zkušenosti\t" + pos.zkusenosti.ToString()); sw.WriteLine(); int i = 0; foreach (Pair<String, int> vlast in pos.getAllVlastnosti()) { String zvys = ""; if (i < 6) for (int j = 0; j < pos.zvyseniVlastnosti[i].second; j++) zvys += "*"; sw.WriteLine(vlast.first + zvys + ":\t\t" + Program.parseBonus(vlast.second)); i++; if (i == 6) sw.WriteLine(); if (i == 10) sw.WriteLine(); if (i == 13) sw.WriteLine(); if (i == 17) sw.WriteLine(); if (i == 19) sw.WriteLine(); } //foreach(pos. sw.Flush(); System.Diagnostics.Process.Start(sfd.FileName); } }
public newKombinace(Postava pos, Strelna kombo) { InitializeComponent(); postava = pos; r2.Checked = true; r1.Enabled = false; r2.Enabled = false; TreeNode[] nodes = tree.Nodes.Find(kombo.zbran, true); if (nodes.Length != 0) { tree.SelectedNode = nodes[0]; } else { MessageBox.Show("V databázi neexistuje zbraň " + kombo.zbran); DialogResult = DialogResult.Abort; this.Close(); } nazevKomba.Text = kombo.nazev; }
public TreeNode Add(Postava pos, String druzina, bool setNew) { TreeNode[] nodes; if ((nodes = tree.Nodes.Find(pos.xmlFileName, true)).Length == 0) { if ((nodes = tree.Nodes.Find(druzina, true)).Length == 1) { if (pos.Load(pos.xmlFileName) == -1) { Program.getMainForm().Cursor = Cursors.Default; return null; } else { TreeNode node = nodes[0]; TreeNode posnode = node.Nodes.Add(pos.xmlFileName, pos.jmeno); posnode.ContextMenuStrip = Program.getMainForm().treeContextMenu; posnode.Tag = pos; opened = pos; tree.SelectedNode = posnode; if (setNew) Program.getMainForm().setNew(pos); return posnode; } } } else { if (setNew) { tree.SelectedNode = nodes[0]; Program.getMainForm().setNew((Postava)nodes[0].Tag); } } return null; }
public VybavaMgr(FlowLayoutPanel flowPanel, Postava pos) { postava = pos; this.flowPanel = flowPanel; this.flowPanel.Controls.Clear(); }
public DovednostiMgr(FlowLayoutPanel fp1, FlowLayoutPanel fp2, FlowLayoutPanel fp3, Panel dets, Postava pos) { postava = pos; details = dets; this.p1 = fp1; this.p2 = fp2; this.p3 = fp3; this.p1.Controls.Clear(); this.p2.Controls.Clear(); this.p3.Controls.Clear(); }
public void OpenSelected() { opened = (Postava)tree.SelectedNode.Tag; Program.getMainForm().setNew(opened); }
public void AddNew(Postava pos) { TreeNode node = tree.Nodes.Add(pos.xmlFileName, pos.jmeno); node.Tag = pos; node.ContextMenuStrip = Program.getMainForm().treeContextMenu; tree.SelectedNode = node; opened = pos; Program.getMainForm().setNew(pos); }
public void AddNew(Postava pos, String druzina) { TreeNode[] nodes = tree.Nodes.Find(druzina, true); if (nodes.Length > 0) { TreeNode node = nodes[0]; TreeNode posnode = node.Nodes.Add(pos.xmlFileName, pos.jmeno); posnode.ContextMenuStrip = Program.getMainForm().treeContextMenu; posnode.Tag = pos; opened = pos; tree.SelectedNode = posnode; Program.getMainForm().setNew(pos); } }
public void RemoveSelected() { Main main = Program.getMainForm(); if (tree.SelectedNode.Tag == opened) { main.tabControl1.Visible = false; opened = null; } tree.SelectedNode.Remove(); }
public void RemoveDruzina(TreeNode tnode) { foreach (TreeNode node in tnode.Nodes) { if (node.Tag.GetType() == typeof(Postava)) { if (((Postava)node.Tag).Equals(opened)) { Program.getMainForm().tabControl1.Visible = false; opened = null; } } node.Remove(); } tnode.Remove(); }
private void createB_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; Postava pos = new Postava(); pos.jmeno = jmeno; pos.povolani = povolani; pos.zena = (pohlavi == "Žena" ? true : false); pos.rasa = rasa; pos.setUroven(1); pos.setZkusenosti(0); pos.setZakladniVlastnosti(vlastnosti); pos.setVlastnost("Vel", konstituce[0]); pos.setVlastnost("Hmp", konstituce[1]); pos.setVlastnost("Výška", konstituce[2]); pos.penize = majetky[body[1]]; pos.Calculate(); this.Hide(); UpravaPostavyDialog3 uprava = new UpravaPostavyDialog3(pos, druzina, dovednosti[body[2]][0], dovednosti[body[2]][1], dovednosti[body[2]][2]); DialogResult dres; if ((dres = uprava.ShowDialog(Program.getMainForm())) == DialogResult.Retry) { this.Show(); Cursor = Cursors.Default; return; } else if (dres == DialogResult.Cancel) { this.Close(); } Cursor = Cursors.Default; this.DialogResult = DialogResult.OK; this.Close(); }
private void cmStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { cmStrip.Hide(); switch (e.ClickedItem.Text) { case "Nová postava...": { Main main = Program.getMainForm(); main.Cursor = Cursors.WaitCursor; NovaPostavaDialog novaPostava = new NovaPostavaDialog(main, tree.SelectedNode.Name); novaPostava.ShowDialog(main); main.Cursor = Cursors.Default; break; } case "Vložit existující postavu...": { Main main = Program.getMainForm(); OpenFileDialog dialog = main.openDialog; if (dialog.ShowDialog(main) == DialogResult.OK) { Postava pos = new Postava(); pos.xmlFileName = dialog.FileName; Add(pos, tree.SelectedNode.Name, true); } break; } case "Uložit": foreach (TreeNode node in tree.SelectedNode.Nodes) { ((Postava)node.Tag).Save(); } if (tree.SelectedNode.Tag == null) { Main main = Program.getMainForm(); main.saveDialog2.FileName = tree.SelectedNode.Text; if (main.saveDialog2.ShowDialog(main) == DialogResult.OK) { tree.SelectedNode.Tag = main.saveDialog2.FileName; SaveDruzina(tree.SelectedNode); } } else { SaveDruzina(tree.SelectedNode); } break; case "Zavřít": RemoveDruzina(tree.SelectedNode); break; } }
public void LoadDruzina(String filename) { TreeNode drz = null; try { System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(filename); System.Xml.XmlNode node = doc.GetElementsByTagName("druzina")[0]; String name = node.Attributes["nazev"].Value; drz = NewDruzina(name); drz.Tag = filename; Program.getMainForm().AddRecentDrz(filename); for(int i = 0; i < node.ChildNodes.Count; i++) { System.Xml.XmlElement n = (System.Xml.XmlElement)node.ChildNodes[i]; String fn = n.FirstChild.Value; Postava pos = new Postava(); pos.xmlFileName = fn; Add(pos, name, (i == node.ChildNodes.Count - 1 ? true : false)); } } catch { if (drz != null) RemoveDruzina(drz); MessageBox.Show("Soubor " + filename + " není platný soubor družiny pro program CGen+.", "Neplatný soubor", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }