/// <summary> /// Gives an Item to another Inventory (removes it from this Inventory and adds it to the parameter Inventory) /// </summary> /// <param name="i">Item to give</param> /// <param name="inv">Inventory that will reveive the item</param> public void give(Item i, Inventory inv) { if (!itemls.Contains(i)) return; itemls.Remove(i); inv.Items.Add(i); }
/// <summary> /// Gives an Item to another Inventory (removes it from this Inventory and adds it to the parameter Inventory) /// </summary> /// <param name="i">Index of the Item to give</param> /// <param name="inv">Inventory that will reveive the item</param> public void give(int i, Inventory inv) { if (itemls.Count<i+1) return; Item it = itemls[i]; itemls.Remove(it); inv.Items.Add(it); }
public Unit(Character fleader, String n) { deployed = false; map = new Character[4, 4]; leader = fleader; name = n; org = "main"; inv = new Inventory(); dead = false; map[0, 0] = leader; leader.Position = new Point(0, 0); resetMovement(); }
public Unit(Character fleader, int x, int y) { deployed = false; map = new Character[4, 4]; leader = fleader; name = leader.Name; dead = false; org = "main"; map[x, y] = leader; leader.Position = new Point(x, y); us = Graphic.getSprite(leader); inv = new Inventory(); resetMovement(); }
public UnitInventory(Unit u) { MainWindow.BackgroundImage = Content.Graphics.Instance.Images.background.bg_bigMenu; inv = u.Inventory; lbl_money = new Label("Money"); lbl_money.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_money.Position = new Vector2(50, 50); MainWindow.add(lbl_money); lbl_cmoney = new Label(GameState.CurrentState.mainArmy.Money.ToString()); lbl_cmoney.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM; lbl_cmoney.Position = new Vector2(150, 50); MainWindow.add(lbl_cmoney); lbl_title = new Label("Unit Inventory"); lbl_title.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.TITLE; lbl_title.Position = new Vector2(250, 100); MainWindow.add(lbl_title); lbl_items = new Label("Items"); lbl_items.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_items.Position = new Vector2(90, 130); MainWindow.add(lbl_items); menu_items = new Menu(8); menu_items.Position = new Vector2(70, 150); MainWindow.add(menu_items); lbl_r = new Label("R"); lbl_r.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL; lbl_r.Position = new Vector2(50, 440); MainWindow.add(lbl_r); lbl_rReturn = new Label("Return to army inventory"); lbl_rReturn.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM; lbl_rReturn.Position = new Vector2(80, 440); MainWindow.add(lbl_rReturn); lbl_v = new Label("V"); lbl_v.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL; lbl_v.Position = new Vector2(50, 470); MainWindow.add(lbl_v); lbl_vView = new Label("View Item"); lbl_vView.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM; lbl_vView.Position = new Vector2(80, 470); MainWindow.add(lbl_vView); lbl_esc = new Label("ESC"); lbl_esc.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL; lbl_esc.Position = new Vector2(50, 500); MainWindow.add(lbl_esc); lbl_escAction = new Label("Go Back"); lbl_escAction.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM; lbl_escAction.Position = new Vector2(100, 500); MainWindow.add(lbl_escAction); update_menuItems(); }
public Unit(Character fleader, String n, String forg) { deployed = false; map = new Character[5, 5]; leader = fleader; name = n; dead = false; inv = new Inventory(); org = forg; map[0, 0] = leader; leader.Position = new Point(0, 0); us = Graphic.getSprite(leader); resetMovement(); }
private void shop_load(String path) { XmlDocument doc = new XmlDocument(); doc.Load(path); shop = XmlTransaltor.inventory(doc.DocumentElement); }
public static Inventory inventory(XmlElement e) { Inventory inv = new Inventory(); foreach (XmlElement te in e.ChildNodes) if (te.Name == "Item") inv.Items.Add(item(te)); return inv; }
public static XmlElement inventory(XmlDocument doc, Inventory inv) { XmlElement e = doc.CreateElement("Inventory"); foreach (Item i in inv.Items) e.AppendChild(item(doc, i)); return e; }