Exemplo n.º 1
0
        public static bool ParseShop(ShopHandler shop, string input)
        {
            bool validCommand = true;
            if (input.Equals(ShopCommandList.LOOK, StringComparison.CurrentCultureIgnoreCase) || input.Equals("a"))
            {
                shop.LookAtItem();
            }
            else if (input.Equals(ShopCommandList.NEXT, StringComparison.CurrentCultureIgnoreCase) || input.Equals("d"))
            {
                shop.NextItem();
            }
            else if (input.Equals(ShopCommandList.PURCHASE, StringComparison.CurrentCultureIgnoreCase) || input.Equals("s"))
            {
                shop.PurchaseItem();
            }
            else if (input.Equals(ShopCommandList.EXIT, StringComparison.CurrentCultureIgnoreCase) || input.Equals("e"))
            {
                shop.ExitShop();
            }
            else
            {
                validCommand = false;
                Writer.OutputInvalidCommand();
            }

            return validCommand;
        }
Exemplo n.º 2
0
 public void Shop(IPlayer player)
 {
     if (storeItemList != null && storeItemList.Count > 0)
     {
         ShopHandler shop = new ShopHandler(player, storeItemList);
         shop.ManageShop();
     }
     else
     {
         Writer.OutputNotAvailableCommand();
     }
 }