Exemplo n.º 1
0
            public HudComponentMenu(Client client, Menu parent) : base("HUD Components", parent)
            {
                var hide = new MenuItem(client, this, "Hide All Components");

                hide.Activate += () => {
                    foreach (HudComponent comp in Enum.GetValues(typeof(HudComponent)))
                    {
                        if (DisabledComponents.Contains(comp))
                        {
                            continue;
                        }
                        DisabledComponents.Add(comp);
                    }
                    return(Task.FromResult(0));
                };
                Add(hide);

                var show = new MenuItem(client, this, "Show All Components");

                show.Activate += () => {
                    DisabledComponents.Clear();
                    return(Task.FromResult(0));
                };
                Add(show);

                foreach (HudComponent comp in Enum.GetValues(typeof(HudComponent)))
                {
                    Add(new MenuItemHudComponent(client, this, Enum.GetName(typeof(HudComponent), comp) ?? "", comp, true));
                }
            }
Exemplo n.º 2
0
 protected override Task OnActivate()
 {
     if (DisabledComponents.Contains(Component))
     {
         DisabledComponents.Remove(Component);
     }
     else
     {
         DisabledComponents.Add(Component);
     }
     return(base.OnActivate());
 }
Exemplo n.º 3
0
            public MenuItemHudComponent(Client client, Menu owner, string label, HudComponent comp, bool isChecked = false, int priority = -1) : base(client, owner, label, isChecked, priority)
            {
                Component = comp;

                IsChecked = () => !DisabledComponents.Contains(Component);
            }