private void partList_ItemSelected(ObjectListControl sender, ItemSelctedEventArgs e) { Console.WriteLine("Selected " + e.Index); BodyPart thisPart = (BodyPart)partList.SelectedItem; if (thisPart.canHold) { holdingList.Clear(); if (thisPart.Holding != null) { holdingList.AddItem(thisPart.Holding, true); } foreach (var itemPair in Party.Items.Where(x => x.Value > 0 && x.Key is Equipment && ((Equipment)x.Key).HeldBy == thisPart.Type && ((Equipment)x.Key) != thisPart.Holding)) { Equipment equipment = (Equipment)itemPair.Key; holdingList.AddItem(equipment, false); } } if (thisPart.canWear) { wearingList.Clear(); if (thisPart.Wearing != null) { wearingList.AddItem(thisPart.Wearing, true); } foreach (var itemPair in Party.Items.Where(x => x.Value > 0 && x.Key is Equipment && ((Equipment)x.Key).WornOn == thisPart.Type && ((Equipment)x.Key) != thisPart.Wearing)) { Equipment equipment = (Equipment)itemPair.Key; wearingList.AddItem(equipment, false); } } }
private void PopulateItems() { itemList.Clear(); itemList.Selected.Clear(); foreach (Item item in Game.World.Player.Items.Keys) { if (Game.World.Player.Items[item] > 0) { itemList.AddItem(item, false); } } }
private void characterList_ItemSelected(ObjectListControl sender, ItemSelctedEventArgs e) { Console.WriteLine("Selected " + e.Index); if (partList != null) { partList.Clear(); foreach (BodyPart part in ((Character)characterList.SelectedItem).BodyParts) { if (part.canHold || part.canWear) { partList.AddItem(part, false); } if (part.BodyParts == null) { continue; } foreach (BodyPart innerpart in part.BodyParts) { if (innerpart.canHold || innerpart.canWear) { partList.AddItem(innerpart, false); } if (innerpart.BodyParts == null) { continue; } foreach (BodyPart inmostpart in innerpart.BodyParts) { if (inmostpart.canHold || inmostpart.canWear) { partList.AddItem(inmostpart, false); } } } } } partList.Select(0); }