コード例 #1
0
        public IActionResult ProcessShopSelection(Inquiry inquiry, long cartID, long cartItemID, int resourceTypeID, int rateCompositionID, int numberOfUnits, int numberOfGuests, decimal pricePerUnit)
        {
            inquiry.DateOfInquiry = System.DateTime.Now;
            string userID = "system";
            Cart   cCart  = (shopRepository.GetCart(cartID) ?? shopRepository.CreateCart(inquiry, userID));

            CartItem cCartItem = shopRepository.GetCartItem(cartItemID);

            if (cCartItem == null)
            {
                cCart = shopRepository.AddCartItemToCart(cCart, resourceTypeID, rateCompositionID, inquiry.DateOfArrival, inquiry.DateOfDeparture, numberOfUnits, pricePerUnit);
            }
            else
            {
                cCart = shopRepository.UpdateCartItemInCart(cCartItem, rateCompositionID, numberOfUnits, numberOfGuests, pricePerUnit);
            }


            ShopDisplay shop = new ShopDisplay()
            {
                Cart = cCart,
                OfferedResourceTypes = availabilityRepsository.GetOfferedResourceTypes(inquiry),
                Inquiry = inquiry,
            };

            return(View(nameof(Index), shop));
        }
コード例 #2
0
ファイル: ShopNPC.cs プロジェクト: Hyunsoul37/Unity3D_RPG
    private void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").transform;
        shop   = GameObject.FindGameObjectWithTag("ShopDisplay").GetComponent <ShopDisplay>();
        Cam    = Camera.main.transform;

        NPC_Name.text = Name;
    }
コード例 #3
0
        public IActionResult CheckAvailability(string companyID, int channelID, DateTime dateOfArrival, DateTime dateOfDeparture, int numberOfGuests, int numberOfUnits)
        {
            Inquiry inquiry = shopRepository.CreateInquiry(companyID, channelID, dateOfArrival, dateOfDeparture, numberOfUnits, numberOfGuests);

            ShopDisplay shopDisplay = new ShopDisplay()
            {
                Inquiry = inquiry,
                OfferedResourceTypes = availabilityRepsository.GetOfferedResourceTypes(inquiry)
            };

            return(View("Index", shopDisplay));
        }
コード例 #4
0
        public IActionResult RemoveItemFromCart(long cartItemID, Inquiry inquiry)
        {
            CartItem cartItem = shopRepository.GetCartItem(cartItemID);
            Cart     cart     = shopRepository.GetCart(cartItem.CartID);


            ShopDisplay shop = new ShopDisplay()
            {
                Cart = cart,
                OfferedResourceTypes = availabilityRepsository.GetOfferedResourceTypes(inquiry),
                Inquiry = inquiry
            };

            return(View(nameof(Index), shop));
        }
コード例 #5
0
ファイル: Shop.cs プロジェクト: vncastanheira/Inventory
 public void Open()
 {
     ShopInstance = Instantiate(shopDisplayPrefab);
     ShopInstance.Prime(Items);
 }
コード例 #6
0
        public static void Buy(Inventory playerInventory, PlayerBalance playerBalance, Item itemToBuy, ShopDisplay shopDisplay)
        {
            // Check if the player can afford the item.
            var itemValue = itemToBuy.GetValue();
            var canAfford = playerBalance.GetBalance() >= itemValue;

            // Return if the item is too expensive.
            if (!canAfford)
            {
                return;
            }

            // Add the item to the inventory.
            playerInventory.AddItem(itemToBuy);
            // Remove the price of the item from the
            playerBalance.ChangeBalance(-itemValue);

            // Regenerate the ui.
            shopDisplay.Regenerate();
        }