public void Test_Inventory_AddGold() { Invent invent = new Invent(null); invent.AddGold(10); Assert.AreEqual(110, invent.GetGold); }
private void refresh() { this.Invent = ApplicationState.Model.GetInventory(Character).Where(i => i.inventoryId == "MainInventory").ToList(); inventByLocation = Invent.ToDictionary(item => new Tuple <int, int>(item.X, item.Y)); borderByLocation = new Dictionary <Tuple <int, int>, Border>(); render(); }
public void itemUpgrade(int i) { PlayerShip shipScript = playerShip.GetComponent <PlayerShip>(); Invent invScript = playerShip.GetComponent <Invent>(); if (invScript.checkSlot(i)) { Item item = invScript.getSlot(i); switch (item.type) { case "shooter": if (shipScript.getMetal() >= ((Shooter)item).upgradeCost()) { shipScript.spendMetal(((Shooter)item).upgradeCost()); ((Shooter)item).upgrade(); } break; case "default": default: Debug.Log("Default item upgrade not valid"); break; } } }
public void Get_the_inventory_of_the_team() { Team team = new Team("Team1"); Invent inventory = new Invent(team); team.Invent.AddGold(100); Assert.AreEqual(200, team.Invent.GetGold); }
public ActionResult DeleteConfirmed(int id) { Invent invent = db.Invent.Find(id); db.Invent.Remove(invent); db.SaveChanges(); return(RedirectToAction("Index")); }
public Merchant(MainForm contextForm, LogicalGame.Merchant merchant, Invent invent) { InitializeComponent(); _invent = invent; m = merchant; _contextForm = contextForm; requiredItem.Add(new ListItems().Items[0], 3); }
public ActionResult Edit([Bind(Include = "Id,Name,Quantity")] Invent invent) { if (ModelState.IsValid) { db.Entry(invent).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(invent)); }
public ActionResult Edit([Bind(Include = "Id,Date,Quantity,ProductId")] Invent invent) { if (ModelState.IsValid) { db.Entry(invent).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProductId = new SelectList(db.Product, "Id", "Name", invent.ProductId); return(View(invent)); }
public ActionResult Create([Bind(Include = "Id,Name,Quantity")] Invent invent) { if (ModelState.IsValid) { invent.Id = Guid.NewGuid(); db.Invents.Add(invent); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(invent)); }
public void itemSell(int i) { PlayerShip shipScript = playerShip.GetComponent <PlayerShip>(); Invent invScript = playerShip.GetComponent <Invent>(); if (invScript.checkSlot(i)) { Item item = invScript.getSlot(i); shipScript.metal += item.getSellValue(); invScript.emptySlot(i); } }
/// <summary> /// Permite agrear un nuevo producto al inventario /// </summary> /// <param name="invent">Entidad de inventario</param> /// <exception cref="ArgumentOutOfRangeException"> El producto o la cantidad es 0 o inferior </exception> /// <exception cref="ArgumentNullException">Si la entidad inventario es nula</exception> /// <exception cref="ProductNotFoundException">Si el producto que llega en el inventario no existe</exception> /// <exception cref="UpdateInventException">Se produce cuanto intenta almacenar el inventario</exception> /// <returns>Tarea en segundo plano</returns> Task ICatalog.AddInventAsync(Invent invent) { try { InventIsValid(invent); model.Invent.Add(invent); return(model.SaveChangesAsync()); } catch (Exception ex) { throw new UpdateInventException(ex); } }
public void Test_Inventory_AddItem() { Item itemtest = new Item("épée", 10, 120, "Epee standard", "arme"); itemtest.AddRequired("attaque physique", 7); itemtest.AddStats("attaque physique", 5); Invent invent = new Invent(null); invent.AddItem(itemtest, 2); Assert.AreEqual(true, invent.GetItem(itemtest)); }
// GET: Invents/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Invent invent = db.Invent.Find(id); if (invent == null) { return(HttpNotFound()); } return(View(invent)); }
// GET: Invents/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Invent invent = db.Invent.Find(id); if (invent == null) { return(HttpNotFound()); } ViewBag.ProductId = new SelectList(db.Product, "Id", "Name", invent.ProductId); return(View(invent)); }
public async void AddInvent(Invent invent) { try { await catalog.AddInventAsync(new Model.Context.Invent { Id = invent.Id, Date = invent.Date, Quantity = invent.Quantity, ProductId = invent.ProductId }); } catch (Exception ex) { throw new FaultException <FaultCatalog>(new FaultCatalog { Exception = ex, Message = "Error al agregar al inventario" }); } }
/// <summary> /// Invents the is valid. /// </summary> /// <param name="invent">The invent.</param> /// <exception cref="ArgumentNullException">invent</exception> /// <exception cref="ArgumentOutOfRangeException"> /// ProductId /// or /// Quantity /// </exception> /// <exception cref="ProductNotFoundException"></exception> private void InventIsValid(Invent invent) { if (invent == null) { throw new ArgumentNullException("invent"); } if (invent.ProductId <= 0) { throw new ArgumentOutOfRangeException("ProductId"); } if (invent.Quantity <= 0) { throw new ArgumentOutOfRangeException("Quantity"); } if (!this.model.Product.Any(x => x.Id == invent.ProductId)) { throw new ProductNotFoundException(); } }
void loadUIElements(GameObject ship) { Invent invent = ship.GetComponent <Invent>(); for (int i = 0; i < 5; i++) { if (invent.checkSlot(i)) { bottomBarOverlays[i].gameObject.SetActive(true); shopOverlays[i].gameObject.SetActive(true); bottomBarOverlays[i].sprite = invent.getSlot(i).image; shopOverlays[i].sprite = invent.getSlot(i).image; shopItemNames[i].text = invent.getSlot(i).getName() + "\nLvl " + invent.getSlot(i).getLevel(); Item item = invent.getSlot(i); switch (item.type) { case "shooter": shopItemStats[i].text = ((Shooter)item).getStats(); shopItemUpgrades[i].text = ((Shooter)item).getUpgradeStats(); break; case "default": default: shopItemStats[i].text = "child class stats not defined."; shopItemUpgrades[i].text = "child class upgrade stats not defined"; break; } } else { bottomBarOverlays[i].gameObject.SetActive(false); shopOverlays[i].gameObject.SetActive(false); shopItemNames[i].text = ""; shopItemStats[i].text = ""; shopItemUpgrades[i].text = ""; } } }
public void itemPressed(int i) { PlayerShip shipScript = playerShip.GetComponent <PlayerShip>(); Invent invScript = playerShip.GetComponent <Invent>(); if (invScript.checkSlot(i)) { Item item = invScript.getSlot(i); switch (item.type) { case "shooter": item.setShip(playerShip); // Inefficient ((Shooter)item).activate(); break; case "default": default: item.setShip(playerShip); // Inefficient ((Shooter)item).activate(); break; } } }
/// <summary> /// Actualizar Inventario /// </summary> /// <param name="id">Identificador del inventario</param> /// <param name="invent">Inventario</param> /// <returns></returns> /// <exception cref="UpdateInventException"> Se genera al intentar actualizar el inventario /// </exception> Task ICatalog.UpdateInventAsync(int id, Invent invent) { try { InventIsValid(invent); if (!model.Invent.Any(x => x.Id == id)) { throw new UpdateInventException(); } var _invent = model.Invent.FindAsync(id).Result; //Se puede usar el objeto AutoMapper para esta tarea. iMapper.Map<Contex.Invent, Model.Invent>(invent); _invent.Date = invent.Date; _invent.Quantity = invent.Quantity; return(model.SaveChangesAsync()); } catch (Exception ex) { throw new UpdateInventException(ex); } }
private void Start() { inventory = GameObject.FindGameObjectWithTag("Player").GetComponent <Invent>(); }
Task ICatalog.UpdateInventAsync(int id, Invent invent) { throw new NotImplementedException(); }
Task ICatalog.AddInventAsync(Invent invent) { throw new NotImplementedException(); }
public Inventory(MainForm contextForm, Invent inventory) { InitializeComponent(); _inventory = inventory; _contextForm = contextForm; }
// Use this for initialization void Start() { //initialize isTouching to false; isTouching = false; //initialize CollectedAll, set to false CollectedAll = false; //find the middle of screen width = Screen.width /2; height = Screen.height /2; //set GUI window to middle of screen windowRect = new Rect(width,height,400,200); //populate Strings CollectionIncomplete = "You must collect All Four items to unlock this passage"; CollectionComplete = "Get ready to take the Test of your life!"; //How to reference variables in other classes // inventory = GameObject.FindGameObjectWithTag("Player").GetComponent<Invent>(); }
private void Start() { invet = FindObjectOfType <Invent>(); p = FindObjectOfType <PlayerItem>(); tem = FindObjectOfType <TemManager>(); }
private void refresh(string accountName) { this.Invent = ApplicationState.Model.GetInventory(Character, false, accountName).Where(i => i.InventoryId == "MainInventory").ToList(); inventByLocation = Invent.ToDictionary(item => new Tuple <int, int>(item.X, item.Y)); render(); }
public void UpdateInvent(int id, Invent invent) { throw new NotImplementedException(); }