Пример #1
0
        /// <inheritdoc />
        void IMenuBuilder.HasSubmenu(string name, int priority, Action <ISubmenuBuilder> configure)
        {
            if (!Submenus.Contains(name))
            {
                Submenus.Add(name);
            }
            ISubmenuBuilder menu2;

            if (!Contributor.Store.TryGetValue(name, out var menu))
            {
                Contributor.Store.Add(name, menu2 = new ConcreteSubmenuBuilder(Contributor)
                {
                    Priority = priority
                });
            }
            else if (menu is ISubmenuBuilder menu3)
            {
                menu2 = menu3;
            }
            else
            {
                throw new InvalidOperationException(
                          $"\"{name}\" is not a submenu.");
            }
            configure.Invoke(menu2);
        }
Пример #2
0
 public void AddSubmenu(string MenuButtonTexturePath, Menu Submenu)
 {
     Submenus.Add(new Submenu(
                      new MenuButton(MenuButtonTexturePath, new SlimDX.Vector2(
                                         _mbStartX,
                                         _mbStartY + (Actions.Count + Submenus.Count) * _mbSpacingBetween
                                         ), new SlimDX.Vector2(
                                         _mbStopX,
                                         _mbStartY + (Actions.Count + Submenus.Count) * _mbSpacingBetween + _mbHeight
                                         )),
                      Submenu
                      ));
 }