Пример #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));
                }
            }
Пример #2
0
 protected override Task OnActivate()
 {
     if (DisabledComponents.Contains(Component))
     {
         DisabledComponents.Remove(Component);
     }
     else
     {
         DisabledComponents.Add(Component);
     }
     return(base.OnActivate());
 }