コード例 #1
0
ファイル: AddShopItems.cs プロジェクト: tartuke/LivingDungeon
 // Update is called once per frame
 void Update()
 {
     if (x == 0)
     {
         shopInventory.Add(item1);
         shopInventory.Add(item2);
         shopInventory.Add(item3);
     }
     x = 1;
 }
コード例 #2
0
        /// <summary>
        /// InitializeStore:
        ///
        /// Sets all bindable properties for the ShopView.
        /// Also calls the API to fetch the store/product data.
        /// </summary>
        private async Task InitializeStore()
        {
            ApiHelper api          = new ApiHelper();
            var       productsList = await api.GetAsync <List <Product> >("Store/GetAllProducts"); //FIXME: correct endpoint

            if (UserContainer.CurrentUser.StoreName == "")                                         //Check if the User has a default Store
            {
                Debug.WriteLine("Error: could not find default store");
                App.SetNewPage <ChooseStoreView>();
            }
            SelectedStoreName = UserContainer.CurrentUser.StoreName; //Set the Header "Store Name" label
            foreach (Product product in productsList)                //Add all products in the returned list to the bindable list
            {
                ShopItem item = new ShopItem {
                    Item = product, Quantity = 0, Price = product.Price
                };
                ShopInventory.Add(item);
                UserContainer.UserCart.Items.Add(item);
            }
        }