You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
1.2 KiB
26 lines
1.2 KiB
using System;
|
|
using System.Configuration;
|
|
|
|
/// <summary>
|
|
/// This is a concrete, empty model for the buy state of the shop for you to implement
|
|
/// </summary>
|
|
public class BuyModel : ShopModel
|
|
{
|
|
public BuyModel(float pPriceModifier, int pItemCount, int pMoney) : base(pPriceModifier, pItemCount, pMoney)
|
|
{
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------------------------------------------------
|
|
// ConfirmSelectedItem()
|
|
//------------------------------------------------------------------------------------------------------------------------
|
|
//Currently it just removes the selected item from the shop's inventory, rewrite this function and don't forget the unit test.
|
|
|
|
public override void ConfirmSelectedItem()
|
|
{
|
|
OnRemove(GetSelectedItem()); // If there's a view subscribed, this will probably remove the item from it
|
|
inventory.RemoveItemByIndex(selectedItemIndex); // Before removing the item from the model's actual inventory
|
|
SelectItemByIndex(selectedItemIndex >= inventory.GetItemCount() ? --selectedItemIndex : selectedItemIndex);
|
|
}
|
|
|
|
}
|
|
|