示例#1
0
        public void Test_Inventory_AddGold()
        {
            Invent invent = new Invent(null);

            invent.AddGold(10);
            Assert.AreEqual(110, invent.GetGold);
        }
示例#2
0
 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();
 }
示例#3
0
    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;
            }
        }
    }
示例#4
0
        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);
        }
示例#5
0
        public ActionResult DeleteConfirmed(int id)
        {
            Invent invent = db.Invent.Find(id);

            db.Invent.Remove(invent);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#6
0
        public Merchant(MainForm contextForm, LogicalGame.Merchant merchant, Invent invent)
        {
            InitializeComponent();
            _invent      = invent;
            m            = merchant;
            _contextForm = contextForm;

            requiredItem.Add(new ListItems().Items[0], 3);
        }
示例#7
0
 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));
 }
示例#8
0
 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));
 }
示例#9
0
        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));
        }
示例#10
0
    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);
        }
    }
示例#11
0
 /// <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);
     }
 }
示例#12
0
        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));
        }
示例#13
0
        // 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));
        }
示例#14
0
        // 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));
        }
示例#15
0
 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"
         });
     }
 }
示例#16
0
        /// <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();
            }
        }
示例#17
0
    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 = "";
            }
        }
    }
示例#18
0
    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;
            }
        }
    }
示例#19
0
        /// <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);
            }
        }
示例#20
0
 private void Start()
 {
     inventory = GameObject.FindGameObjectWithTag("Player").GetComponent <Invent>();
 }
示例#21
0
 Task ICatalog.UpdateInventAsync(int id, Invent invent)
 {
     throw new NotImplementedException();
 }
示例#22
0
 Task ICatalog.AddInventAsync(Invent invent)
 {
     throw new NotImplementedException();
 }
示例#23
0
 public Inventory(MainForm contextForm, Invent inventory)
 {
     InitializeComponent();
     _inventory   = inventory;
     _contextForm = contextForm;
 }
示例#24
0
    // 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>();
    }
示例#25
0
 private void Start()
 {
     invet = FindObjectOfType <Invent>();
     p     = FindObjectOfType <PlayerItem>();
     tem   = FindObjectOfType <TemManager>();
 }
示例#26
0
 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();
 }
示例#27
0
 public void UpdateInvent(int id, Invent invent)
 {
     throw new NotImplementedException();
 }