Ejemplo n.º 1
0
        /// <summary>
        /// Button for adding ice
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Click_AddIce(object sender, RoutedEventArgs e)
        {
            if (DataContext is Order order)
            {
                if (isDrink)
                {
                    _drink.AddIce();
                }
                else if (isCombo)
                {
                    _combo.Drink.AddIce();
                }
            }

            sp3.Children.Clear();
            // Remove "add ice" button and add "remove ice" button
            Button removeIce = new Button();

            removeIce.SetValue(Grid.RowProperty, 1);
            removeIce.SetValue(Grid.ColumnProperty, 2);
            removeIce.Height = 88;

            removeIce.Content  = "Remove Ice";
            removeIce.FontSize = 20;
            removeIce.Click   += Click_RemoveIce;
            sp3.Children.Add(removeIce);
        }
 /// <summary>
 /// Determines whether the drink has ice.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void SelectIce(object sender, RoutedEventArgs args)
 {
     if (drink.Ice)
     {
         drink.HoldIce();
         IceButton.Background = UserInterfaceOptions.BaseColor;
     }
     else
     {
         drink.AddIce();
         IceButton.Background = UserInterfaceOptions.SelectedColor;
     }
 }
Ejemplo n.º 3
0
    //check for lid, everything else after ingredients have snapped
    public void LateUpdate()
    {
        //on mouseup, check for ingredients
        if (Input.GetMouseButtonUp(0))
        {
            this.hasLid = false;
            foreach (Transform child in this.transform)
            {
                if (child.name == "Lid")
                {
                    this.hasLid = true;
                }
                else if (child.name == "Sleeve")
                {
                    this.hasSleeve = true;
                }
            }

            //look through the ingredients and modify the drink accordingly
            if (!ingredients.IsEmpty())
            {
                foreach (string itemName in ingredients.Enumerate())
                {
                    if (itemName.Contains("milk"))
                    {
                        drink.AddMilk(itemName);
                    }
                    else if (itemName.Equals("blended"))
                    {
                        Fill();
                        drink.AddBlended();
                    }
                    else if (itemName.Contains("coffee"))
                    {
                        drink.AddCoffee(itemName);
                        Fill();
                    }
                    else if (itemName.Contains("ice"))
                    {
                        drink.AddIce();
                    }
                }
            }
            //then clear the list
            ingredients.ClearIngredients();
        }
    }