Ejemplo n.º 1
0
 public virtual void reset(IMenuComponent component)
 {
     if (baseTransition != null)
     {
         baseTransition.reset(component);
     }
 }
Ejemplo n.º 2
0
        public static IMenu Create(
            string header,
            List <ICommand> commandList,
            string commandListHeader = null,
            string footer            = null
            )
        {
            IMenuComponent
                _header            = MenuComponentFactory.Create(header),
                _commandListHeader = MenuComponentFactory.Create(commandListHeader),
                _footer            = MenuComponentFactory.Create(footer),
                _commandList       = MenuComponentFactory.CreateFromListMarked(
                commandList.Select(el => (el.Name + " - " + el.Description)).ToList()
                );

            List <IMenuComponent> menuComponents = new List <IMenuComponent>
            {
                _header,
                _commandListHeader,
                _commandList,
                _footer,
            }
            .Where(el => el != null).ToList();

            return(new Menu(menuComponents));
        }
Ejemplo n.º 3
0
        public override void setTransition(IMenuComponent component)
        {
            ICollectionComponent collection = component as ICollectionComponent;

            List <Color> newColors = collection.Colors;

            byte startAlpha = 0;

            if (direction > 0)
            {
                startAlpha = (byte)(255 - collection.Color.A);
            }
            else if (direction < 0)
            {
                startAlpha = collection.Color.A;
            }

            for (int i = 0; i < collection.Colors.Count; i++)
            {
                Color newColor = newColors[i];

                newColor.A = startAlpha;

                newColors[i] = newColor;
            }

            collection.Colors = newColors;

            base.setTransition(collection);
        }
Ejemplo n.º 4
0
 public virtual void initialize(IMenuComponent component)
 {
     if (baseTransition != null)
     {
         baseTransition.initialize(component);
     }
 }
Ejemplo n.º 5
0
 public virtual void update(IMenuComponent component)
 {
     if (baseTransition != null)
     {
         baseTransition.update(component);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        ///     The minimum mana needed to cast the Spell from the 'slot' SpellSlot.
        /// </summary>
        public static int GetNeededMana(SpellSlot slot, IMenuComponent value)
        {
            var ignoreManaManagerMenu = MenuClass.General["nomanagerifblue"];

            if (ignoreManaManagerMenu != null &&
                UtilityClass.Player.HasBuff("crestoftheancientgolem") &&
                ignoreManaManagerMenu.As <MenuBool>().Enabled)
            {
                return(0);
            }

            if (ObjectManager.Get <GameObject>().Any(o =>
                                                     o.Type == GameObjectType.obj_GeneralParticleEmitter &&
                                                     o.Name == "Perks_ManaflowBand_Buff" &&
                                                     o.Distance(UtilityClass.Player) <= 75))
            {
                return(0);
            }

            if (ObjectManager.Get <GameObject>().Any(o =>
                                                     o.Type == GameObjectType.obj_GeneralParticleEmitter &&
                                                     o.Name == "Perks_LastResort_Buf" &&
                                                     o.Distance(UtilityClass.Player) <= 75))
            {
                return(0);
            }

            var spellData = UtilityClass.ManaCostArray.FirstOrDefault(v => v.Key == UtilityClass.Player.ChampionName);
            var cost      = spellData.Value[slot][UtilityClass.Player.GetSpell(slot).Level - 1];

            return
                (value.As <MenuSliderBool>().Value +
                 (int)(cost / UtilityClass.Player.MaxMana * 100));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// O padrão State permite que um objeto altere o seu comportamento quando o seu estado interno muda. O objeto parecerá ter mudado de classe.
        /// </summary>
        private static void TestComposite()
        {
            Menu dinerMenu = new Menu("Diner", "Lunch");

            dinerMenu.AddItem(new Composite.MenuItem("Vegetarian BLT", "(Fakin) Bacon with lettuce & tomato on whole wheat", true, 2.99));
            dinerMenu.AddItem(new Composite.MenuItem("BLT", "Bacon with lettuce & tomato on whole wheat", false, 2.99));
            dinerMenu.AddItem(new Composite.MenuItem("Soup of the day", "Soup of the day, with a side of potato salad", false, 3.29));
            dinerMenu.AddItem(new Composite.MenuItem("Hotdog", "A hot dog, with saurkraut, relish, onions, topped with cheese", false, 3.05));

            Menu pancakeMenu = new Menu("Pancake", "Breakfast");

            pancakeMenu.AddItem(new Composite.MenuItem("K&B's Pancake Breakfast", "Pancakes with scrambled eggs, and toast", true, 2.99));
            pancakeMenu.AddItem(new Composite.MenuItem("Regular Pancake Breakfast", "Pancakes with fried eggs, sausage", false, 2.99));
            pancakeMenu.AddItem(new Composite.MenuItem("Blueberry Pancakes", "Pancakes made with fresh blueberries", true, 3.49));
            pancakeMenu.AddItem(new Composite.MenuItem("Waffles", "Waffles of your choice with blueberries or strawberries", true, 3.59));

            Menu dessertMenu = new Menu("Dessert", "Dessert, of course");

            dessertMenu.AddItem(new Composite.MenuItem("Veggie Burger and Air Fries", "Veggie burger on a whole wheat bun", true, 3.99));
            dessertMenu.AddItem(new Composite.MenuItem("Cheesecake", "Creamy New York Cheesecake, with chocolate graham crust", false, 1.89));
            dinerMenu.AddItem(dessertMenu);

            var items = new IMenuComponent[2];

            items[0] = dinerMenu;
            items[1] = pancakeMenu;

            var iterator = new MenuIterator(items);

            iterator.PrintMenu();
        }
Ejemplo n.º 8
0
        public static IMenu CreateTable <DataType>(
            string header,
            Dictionary <DataType, string> data,
            List <ICommand> commandList,
            string dataHeader        = null,
            string commandListHeader = null,
            string footer            = null
            )
            where DataType : IFormattable
        {
            IMenuComponent
                _header            = MenuComponentFactory.Create(header),
                _dataHeader        = MenuComponentFactory.Create(dataHeader),
                _commandListHeader = MenuComponentFactory.Create(commandListHeader),
                _footer            = MenuComponentFactory.Create(footer),
                _data        = MenuComponentFactory.CreateFromDictionary <DataType>(data),
                _commandList = MenuComponentFactory.CreateFromListMarked(
                commandList.Select(el => (el.Name + " - " + el.Description)).ToList()
                );

            List <IMenuComponent> menuComponents = new List <IMenuComponent>
            {
                _header,
                _dataHeader,
                _data,
                _commandListHeader,
                _commandList,
                _footer,
            }
            .Where(el => el != null).ToList();

            return(new Menu(menuComponents));
        }
Ejemplo n.º 9
0
        public override void setTransition(IMenuComponent component)
        {
            ICollectionComponent collection = component as ICollectionComponent;

            List <Vector2> newPositions = collection.Positions;
            List <Vector2> newOrigins   = collection.Origins;
            List <float>   newScales    = collection.Scales;

            for (int i = 0; i < collection.Scales.Count; i++)
            {
                if (toScale)
                {
                    newScales[i] -= factor;
                }

                newOrigins[i] = defaultOrigin;

                newPositions[i] += scaleOrigin;
            }

            collection.Positions = newPositions;
            collection.Origins   = newOrigins;
            collection.Scales    = newScales;

            base.setTransition(collection);
        }
Ejemplo n.º 10
0
 public virtual void setTransition(IMenuComponent component)
 {
     if (baseTransition != null)
     {
         baseTransition.setTransition(component);
     }
 }
Ejemplo n.º 11
0
        // Load data from database into UI controls.
        // Modify LoadData in Section 1 above to customize.  Or override DataBind() in
        // the individual table and record controls to customize.
        public void LoadData_Base()
        {
            try {
                if ((!this.IsPostBack) || (this.Request["__EVENTTARGET"] == "ChildWindowPostBack") || (this.Request["__EVENTTARGET"] == "isd_geo_location"))
                {
                    // Must start a transaction before performing database operations
                    DbUtils.StartTransaction();
                }



                this.DataBind();



                SetUsersTabContainer();


                // Load and bind data for each record and table UI control.

                SetUsersRecordControl();

                SetGroupsTableControl();


                SetRoles1TableControl();



                // Load data for chart.


                // initialize aspx controls

                SetEditButton();

                SetOKButton();

                //Set the corresponding menu item to be highlighted for this page
                System.Web.UI.MasterPage pageMaster = this.Master;
                if (!(pageMaster == null))
                {
                    IMenuComponent menuComponent = ((IMenuComponent)(this.Master.FindControl("_Menu")));
                    if (!(menuComponent == null))
                    {
                        menuComponent.HiliteSettings = "UsersMenuItem";
                    }
                }
            } catch (Exception ex) {
                // An error has occured so display an error message.
                BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "Page_Load_Error_Message", ex.Message);
            } finally {
                if ((!this.IsPostBack) || (this.Request["__EVENTTARGET"] == "ChildWindowPostBack") || (this.Request["__EVENTTARGET"] == "isd_geo_location"))
                {
                    // End database transaction
                    DbUtils.EndTransaction();
                }
            }
        }
Ejemplo n.º 12
0
        public override void reset(IMenuComponent component)
        {
            component.BoundingBox = defaultRectangle;

            counter = 0;

            base.reset(component);
        }
Ejemplo n.º 13
0
        public override void initialize(IMenuComponent component)
        {
            ICollectionComponent collection = component as ICollectionComponent;

            defaultAlpha = collection.Colors[0].A;

            base.initialize(component);
        }
Ejemplo n.º 14
0
        public override void reset(IMenuComponent component)
        {
            //component.Color = defaultColor;

            counter = 0;

            base.reset(component);
        }
Ejemplo n.º 15
0
        public override void reset(IMenuComponent component)
        {
            component.Position = defaultVector;

            counter = 0;

            base.reset(component);
        }
Ejemplo n.º 16
0
        public override void initialize(IMenuComponent component)
        {
            defaultScale = component.Scale;

            defaultOrigin = component.Origin;

            base.initialize(component);
        }
Ejemplo n.º 17
0
        public override void setTransition(IMenuComponent component)
        {
            if (toVector)
            {
                component.Position -= direction;
            }

            base.setTransition(component);
        }
Ejemplo n.º 18
0
        public override void setTransition(IMenuComponent component)
        {
            if (direction > 0)
            {
                component.Color = new Color((destination / new Vector3(255)));
            }

            base.setTransition(component);
        }
Ejemplo n.º 19
0
 internal static void Example2Clicked(
     IMenuComponent component,
     IComponentContainer container,
     FrameworkMenu menu)
 {
     ExampleList.Visible       = true;
     ExamplePopup.Visible      = false;
     ExamplePopupClose.Visible = false;
 }
Ejemplo n.º 20
0
        public void RemoveComponent(IMenuComponent component)
        {
            bool Removed = false;

            RemoveComponents(a => { bool b = a == component && !Removed; if (b)
                                    {
                                        Removed = true; a.Detach(this);
                                    }
                                    return(b); });
        }
Ejemplo n.º 21
0
        public override void initialize(IMenuComponent component)
        {
            ICollectionComponent collection = component as ICollectionComponent;

            defaultScale = collection.Scales[0];

            defaultOrigin = collection.Origins[0];

            base.initialize(component);
        }
Ejemplo n.º 22
0
        public override void update(IMenuComponent component)
        {
            if (counter < interval)
            {
                component.Position += (direction / new Vector2(interval));

                counter++;
            }

            base.update(component);
        }
Ejemplo n.º 23
0
        public override void initialize(IMenuComponent component)
        {
            ICollectionComponent collection = component as ICollectionComponent;

            foreach (Vector2 position in collection.Positions)
            {
                defaultVectors.Add(position);
            }

            base.initialize(component);
        }
Ejemplo n.º 24
0
        public override void update(IMenuComponent component)
        {
            if (counter < interval)
            {
                component.Scale += (factor / (float)interval);

                counter++;
            }

            base.update(component);
        }
Ejemplo n.º 25
0
        public void Print()
        {
            Console.WriteLine($"{this.Name} - {this.Description}");

            IIterator iterator = menuComponents.GetIterator();

            while (iterator.HasNext())
            {
                IMenuComponent component = (IMenuComponent)iterator.Next();
                component.Print();
            }
        }
Ejemplo n.º 26
0
        public override void reset(IMenuComponent component)
        {
            Color newColor = component.Color;

            newColor.A = defaultAlpha;

            component.Color = newColor;

            counter = 0;

            base.reset(component);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Generates Search Buttons For Menu Component
        /// </summary>
        private IList <SearchButtonViewModel> GenerateSearchButtonsForMenuComponent(IMenuComponent menuComponent)
        {
            //Get all items if this is a menu
            if (menuComponent.GetType() == typeof(Menu))
            {
                var menuiterator = menuComponent.GetIterator();
                return(CreateMenuButtons(menuiterator));
            }

            Log("Not type of Menu", Category.Warn);
            return(null);
        }
Ejemplo n.º 28
0
        public override void reset(IMenuComponent component)
        {
            component.Scale = defaultScale;

            component.Origin = defaultOrigin;

            component.Position -= scaleOrigin;

            counter = 0;

            base.reset(component);
        }
Ejemplo n.º 29
0
 public void AddComponent(IMenuComponent component)
 {
     if (component is IInteractiveMenuComponent)
     {
         _InteractiveComponents.Add(component as IInteractiveMenuComponent);
     }
     else
     {
         _StaticComponents.Add(component);
     }
     component.Attach(this);
     UpdateDrawOrder();
 }
Ejemplo n.º 30
0
 public virtual void AddComponent(IMenuComponent component)
 {
     if (component is IInteractiveMenuComponent menuComponent)
     {
         this._InteractiveComponents.Add(menuComponent);
     }
     else
     {
         this._StaticComponents.Add(component);
     }
     component.Attach(this);
     UpdateDrawOrder();
 }
Ejemplo n.º 31
0
 public override void LoadContent()
 {
     menuTitle = new MenuTitle(heading, ScreenManager.GraphicsDevice.Viewport);
     menuTitle.Load(ScreenManager.Content);
     menuBackground = new MenuBackground(backgroundAssetPath, ScreenManager.GraphicsDevice.Viewport);
     menuBackground.Load(ScreenManager.Content);
     LoadMenuEntries();
     base.LoadContent();
 }