Ejemplo n.º 1
0
    void InitDecorators()
    {
        MenuDecorator[] decorators = GetComponents <MenuDecorator>();
        MenuDecorator   last       = null;

        foreach (MenuDecorator decor in decorators)
        {
            if (last == null)
            {
                this.decorator = decor;
            }
            else
            {
                last.Init(this, decor);
            }
            last = decor;
        }
        if (last != null)
        {
            last.Init(this, null);
        }
    }
 public virtual void Init(Menu in_menu, MenuDecorator in_decorator)
 {
     menu      = in_menu;
     decorator = in_decorator;
 }
Ejemplo n.º 3
0
 public void AddMenu(MenuDecorator menu)
 {
     Menus.Add(menu);
     TotalPrice += menu.GetCost();
     LoggerSingleton.Logger.LogMessage(string.Format("Menu (id:{0}) was added in the order (id: {1}). Menu cost:{2} and was composed of {3}", menu.GetUniqueId(), UniqueKey, menu.TotalPrice, menu.Content));
 }