public VehicleTab() { InitializeComponent(); gbxItem.AllowDrop = true; Vehicle.Vehicle_Cargo = new string[16]; nav = cvVehicleXml.CreateNavigator(); XPathDocument lvCharXml = new XPathDocument(Properties.Settings.Default.DataLocation + "Characters/" + Player.Name + ".xml"); foreach (Guid lvVehicle in Player.Vehicle) { XPathNavigator playerVehNav = lvCharXml.CreateNavigator().SelectSingleNode(String.Format("Character/Vehicles/Vehicle[@ID='{0}']/@Name", lvVehicle.ToString())); IconLabel lvIconLabel = new IconLabel(); lvIconLabel.Display = playerVehNav.Value; lvIconLabel.Image = nav.SelectSingleNode("Vehicles/Vehicle[@Name = '" + playerVehNav.Value + "']/Image").Value; lvIconLabel.DisplayType = IconLabel.Type.Vehicle; pnlVehicles.Controls.Add(lvIconLabel); foreach (Control c in lvIconLabel.Controls) { c.MouseClick += (sender, e) => { DescribeVehicle(playerVehNav.Value); }; } } }
public GMAdministerExperience() { InitializeComponent(); int characterLength = 0; DirectoryInfo dir = new DirectoryInfo(Global.CharacterFolder); FileInfo[] lvFile; lvFile = dir.GetFiles("*.xml"); for (int i = 0; i < lvFile.Length; i++) { XPathDocument xDoc = new XPathDocument($"{Global.CharacterFolder}{lvFile[i].Name}"); XPathNavigator xNav = xDoc.CreateNavigator(); IconLabel character = new IconLabel(); character.DisplayType = IconLabel.Type.Character; character.DisplaySize = IconLabel.ControlSize.Medium; character.Name = $"char{Path.GetFileNameWithoutExtension(lvFile[i].Name)}"; character.Display = Path.GetFileNameWithoutExtension(lvFile[i].Name); character.Image = xNav.SelectSingleNode("Character/Image").Value; character.BackColor = characterLength % 2 == 0 ? Color.SkyBlue : Color.Silver; NumericUpDown num = new NumericUpDown(); num.Name = $"num{Path.GetFileNameWithoutExtension(lvFile[i].Name)}"; num.Width = 40; num.Minimum = 0; num.Maximum = 300; pnlCharacters.Controls.Add(character); pnlCharacters.Controls.Add(num); pnlCharacters.SetFlowBreak(num, true); characterLength++; } }
public ArcanaTab() { InitializeComponent(); nav = cvArcanaXml.CreateNavigator(); rdoArcanaDeath.AbilityRank = Player.Arcana["Death"]; rdoArcanaFate.AbilityRank = Player.Arcana["Fate"]; rdoArcanaForces.AbilityRank = Player.Arcana["Forces"]; rdoArcanaLife.AbilityRank = Player.Arcana["Life"]; rdoArcanaMatter.AbilityRank = Player.Arcana["Matter"]; rdoArcanaMind.AbilityRank = Player.Arcana["Mind"]; rdoArcanaPrime.AbilityRank = Player.Arcana["Prime"]; rdoArcanaSpace.AbilityRank = Player.Arcana["Space"]; rdoArcanaSpirit.AbilityRank = Player.Arcana["Spirit"]; rdoArcanaTime.AbilityRank = Player.Arcana["Time"]; foreach (var rote in Player.Rote) { IconLabel iLbl = new IconLabel(); iLbl.DisplayType = IconLabel.Type.Rote; XPathNavigator xParent = nav.SelectSingleNode(String.Format("Arcanum/Arcana/Rote[@Name='{0}']", rote.Key)); xParent.MoveToParent(); iLbl.Image = xParent.SelectSingleNode("@Image").Value; iLbl.Display = rote.Key; iLbl.Click += Rote_Click; iLbl.MouseClick += Rote_Click; foreach (Control c in iLbl.Controls) { c.MouseClick += (sender, e) => { DescribeRote(iLbl.Display, iLbl.Image); }; } pnlRotes.Controls.Add(iLbl); } }
public GiftTab() { InitializeComponent(); nav = cvGiftXml.CreateNavigator(); bool includeParent = false; ArrayList childGifts = new ArrayList(); foreach (XPathNavigator lvGiftParent in nav.Select("Gifts/Gift")) { IconLabel iLbl = new IconLabel(); iLbl.DisplayType = IconLabel.Type.Gift; iLbl.Image = lvGiftParent.SelectSingleNode("@Image").Value; iLbl.Display = lvGiftParent.SelectSingleNode("@Name").Value; foreach (string lvGift in Player.Gift) { if (lvGiftParent.SelectSingleNode("Sub[@Name='" + lvGift + "']") != null) { childGifts.Add(lvGift); includeParent = true; } } if (includeParent) { pnlGifts.Controls.Add(iLbl); foreach (string lvChild in childGifts) { Label cLbl = new Label(); cLbl.Text = lvChild; pnlGifts.Controls.Add(cLbl); cLbl.Click += lblOnClick; } childGifts.Clear(); includeParent = false; } } foreach (string rite in Player.Rite) { Label lbl = new Label(); lbl.Text = rite; pnlRites.Controls.Add(lbl); lbl.Click += riteOnClick; } XPathNavigator xAuspiceNav = xAuspiceDoc.CreateNavigator().SelectSingleNode(String.Format("Covenants/Template[@Name='Werewolf']/Covenant[@Name='{0}']/Ability", Player.Covenant)); lblAuspiceAbility.Text = xAuspiceNav.SelectSingleNode("@Name").Value; }
private void FillPanel(XPathDocument xDoc, FlowLayoutPanel lvPanel, string lvItemType) { XPathNavigator xNav = xDoc.CreateNavigator(); XPathExpression exp = lvItemType != "Vehicle" ? xNav.Compile(String.Format("Items/Item[@Type='{0}']", lvItemType)) : xNav.Compile("Vehicles/Vehicle"); exp.AddSort("@Name", XmlSortOrder.Ascending, XmlCaseOrder.UpperFirst, "en-US", XmlDataType.Text); XPathNodeIterator xNodeIter = xNav.Select(exp); while (xNodeIter.MoveNext()) { IconLabel lvIconLabel = new IconLabel(); lvIconLabel.DisplayType = lvItemType != "Vehicle" ? IconLabel.Type.Item : IconLabel.Type.Vehicle; lvIconLabel.Display = xNodeIter.Current.SelectSingleNode("@Name").Value; lvIconLabel.Image = xNodeIter.Current.SelectSingleNode("Image").Value; lvIconLabel.Width = 170; if (lvItemType != "Vehicle") { lvIconLabel.MouseClick += IconLabel_Clicked; foreach (Control c in lvIconLabel.Controls) { c.MouseClick += (sender, e) => { DescribeItem(lvIconLabel.Display, TransactionType.Buy); }; } } else { lvIconLabel.MouseClick += IconVehicleLabel_Clicked; foreach (Control c in lvIconLabel.Controls) { c.MouseClick += (sender, e) => { DescribeVehicle(lvIconLabel.Display, TransactionType.Buy); }; } } lvPanel.Controls.Add(lvIconLabel); } }
private void FillSellPanel() { XPathDocument xItemDoc = new XPathDocument(Global.ItemXml); XPathNavigator xItemNav = xItemDoc.CreateNavigator(); XPathDocument xVehDoc = new XPathDocument(Global.VehicleXml); XPathNavigator xVehNav = xVehDoc.CreateNavigator(); XPathDocument lvCharXml = new XPathDocument(Properties.Settings.Default.DataLocation + "Characters/" + Player.Name + ".xml"); XPathNavigator equipmentNav = lvCharXml.CreateNavigator().SelectSingleNode("Character/Equipment"); foreach (string lvItem in Player.Equipment) { if (!String.IsNullOrEmpty(lvItem)) { string lvName = equipmentNav.SelectSingleNode("Items/Item[@ID = '" + lvItem + "']/@Name").Value; IconLabel lvIconLabel = new IconLabel(); lvIconLabel.DisplayType = IconLabel.Type.Item; lvIconLabel.Display = lvName; lvIconLabel.Image = xItemNav.SelectSingleNode(String.Format("Items/Item[@Name='{0}']/Image", lvName)).Value; lvIconLabel.ID = new Guid(lvItem); lvIconLabel.Width = 170; lvIconLabel.MouseClick += IconLabel_Clicked; foreach (Control c in lvIconLabel.Controls) { c.MouseClick += (sender, e) => { DescribeItem(lvIconLabel.Display, TransactionType.Sell, lvIconLabel.ID); }; } pnlPlayerGear.Controls.Add(lvIconLabel); } } foreach (var lvWeap in Player.Weapon) { if (!string.IsNullOrEmpty(lvWeap)) { string lvWeapName = equipmentNav.SelectSingleNode("Weapons/Weapon[@ID = '" + lvWeap + "']/@Name").Value; IconLabel lvIconLabel = new IconLabel(); lvIconLabel.DisplayType = IconLabel.Type.Item; lvIconLabel.Display = lvWeapName; lvIconLabel.Image = xItemNav.SelectSingleNode(String.Format("Items/Item[@Name='{0}']/Image", lvWeapName)).Value; lvIconLabel.ID = new Guid(lvWeap); lvIconLabel.Width = 170; lvIconLabel.MouseClick += IconLabel_Clicked; foreach (Control c in lvIconLabel.Controls) { c.MouseClick += (sender, e) => { DescribeItem(lvIconLabel.Display, TransactionType.Sell, lvIconLabel.ID); }; } pnlPlayerGear.Controls.Add(lvIconLabel); } } foreach (var lvArmor in Player.Armor) { if (!string.IsNullOrEmpty(lvArmor)) { string lvArmorName = equipmentNav.SelectSingleNode("Armors/Armor[@ID = '" + lvArmor + "']/@Name").Value; IconLabel lvIconLabel = new IconLabel(); lvIconLabel.DisplayType = IconLabel.Type.Item; lvIconLabel.Display = lvArmorName; lvIconLabel.Image = xItemNav.SelectSingleNode(String.Format("Items/Item[@Name='{0}']/Image", lvArmorName)).Value; lvIconLabel.ID = new Guid(lvArmor); lvIconLabel.Width = 170; lvIconLabel.MouseClick += IconLabel_Clicked; foreach (Control c in lvIconLabel.Controls) { c.MouseClick += (sender, e) => { DescribeItem(lvIconLabel.Display, TransactionType.Sell, lvIconLabel.ID); }; } pnlPlayerGear.Controls.Add(lvIconLabel); } } foreach (Guid lvVeh in Player.Vehicle) { XPathNavigator playerVehNav = lvCharXml.CreateNavigator().SelectSingleNode(String.Format("Character/Vehicles/Vehicle[@ID='{0}']/@Name", lvVeh.ToString())); IconLabel lvIconLabel = new IconLabel(); lvIconLabel.DisplayType = IconLabel.Type.Vehicle; lvIconLabel.Display = playerVehNav.Value; lvIconLabel.Image = xVehNav.SelectSingleNode(String.Format("Vehicles/Vehicle[@Name='{0}']/Image", playerVehNav.Value)).Value; lvIconLabel.Width = 170; lvIconLabel.MouseClick += IconVehicleLabel_Clicked; foreach (Control c in lvIconLabel.Controls) { c.MouseClick += (sender, e) => { DescribeVehicle(lvIconLabel.Display, TransactionType.Sell); }; } pnlPlayerGear.Controls.Add(lvIconLabel); } }
public EquipmentTab() { InitializeComponent(); lblMoney.Text = Player.Cash.ToString(); XPathNavigator nav = lvItemXml.CreateNavigator(); XPathNavigator equipmentNav = lvCharXml.CreateNavigator().SelectSingleNode("Character/Equipment"); foreach (string lvEquipment in Player.Equipment) { if (!String.IsNullOrEmpty(lvEquipment)) { string lvName = equipmentNav.SelectSingleNode("Items/Item[@ID = '" + lvEquipment + "']/@Name").Value; Panel pnl = new Panel(); pnl.Height = 25; pnl.Width = 156; IconLabel lvIconLabel = new IconLabel(); lvIconLabel.Display = lvName; lvIconLabel.Image = nav.SelectSingleNode("Items/Item[@Name = '" + lvName + "']/Image").Value; lvIconLabel.DisplayType = IconLabel.Type.Item; Button btn = new Button(); btn.Name = lvEquipment; btn.Height = 24; btn.Width = 24; btn.Left = 130; if (equipmentNav.SelectSingleNode("Items/Item[@ID = '" + lvEquipment + "']/@Equipped").ValueAsBoolean) { btn.Image = Properties.Resources.pack_color; btn.BackColor = Color.Green; } else { btn.Image = Properties.Resources.pack; btn.BackColor = Color.White; } pnl.Controls.Add(lvIconLabel); pnl.Controls.Add(btn); pnlItems.Controls.Add(pnl); btn.MouseClick += EquipButton_Clicked; lvIconLabel.MouseClick += IconLabel_Clicked; foreach (Control c in lvIconLabel.Controls) { c.MouseClick += (sender, e) => { DescribeItem(lvName); }; } } } foreach (string lvWeapon in Player.Weapon) { if (!String.IsNullOrEmpty(lvWeapon)) { string lvName = equipmentNav.SelectSingleNode("Weapons/Weapon[@ID = '" + lvWeapon + "']/@Name").Value; Panel pnl = new Panel(); pnl.Height = 25; pnl.Width = 156; IconLabel lvIconLabel = new IconLabel(); lvIconLabel.Display = lvName; lvIconLabel.Image = nav.SelectSingleNode("Items/Item[@Name = '" + lvName + "']/Image").Value; Button btn = new Button(); btn.Name = lvWeapon; btn.Height = 24; btn.Width = 24; btn.Left = 130; if (equipmentNav.SelectSingleNode("Weapons/Weapon[@ID = '" + lvWeapon + "']/@Equipped").ValueAsBoolean) { btn.Image = Properties.Resources.pack_color; btn.BackColor = Color.Green; } else { btn.Image = Properties.Resources.pack; btn.BackColor = Color.White; } pnl.Controls.Add(lvIconLabel); pnl.Controls.Add(btn); pnlWeapons.Controls.Add(pnl); btn.MouseClick += EquipButton_Clicked; lvIconLabel.MouseClick += IconLabel_Clicked; foreach (Control c in lvIconLabel.Controls) { c.MouseClick += (sender, e) => { DescribeItem(lvName); }; } } } foreach (string lvArmor in Player.Armor) { if (!String.IsNullOrEmpty(lvArmor)) { string lvName = equipmentNav.SelectSingleNode("Armors/Armor[@ID = '" + lvArmor + "']/@Name").Value; Panel pnl = new Panel(); pnl.Height = 25; pnl.Width = 156; IconLabel lvIconLabel = new IconLabel(); lvIconLabel.Display = lvName; lvIconLabel.Image = nav.SelectSingleNode("Items/Item[@Name = '" + lvName + "']/Image").Value; Button btn = new Button(); btn.Name = lvArmor; btn.Height = 24; btn.Width = 24; btn.Left = 130; if (equipmentNav.SelectSingleNode("Armors/Armor[@ID = '" + lvArmor + "']/@Equipped").ValueAsBoolean) { btn.Image = Properties.Resources.pack_color; btn.BackColor = Color.Green; } else { btn.Image = Properties.Resources.pack; btn.BackColor = Color.White; } pnl.Controls.Add(lvIconLabel); pnl.Controls.Add(btn); pnlArmor.Controls.Add(pnl); btn.MouseClick += EquipButton_Clicked; lvIconLabel.MouseClick += IconLabel_Clicked; foreach (Control c in lvIconLabel.Controls) { c.MouseClick += (sender, e) => { DescribeItem(lvName); }; } } } }