Esempio n. 1
0
        private SharedBinds() : base(false, true)
        {
            sharedBinds = BindManager.GetOrCreateGroup("SharedBinds");
            sharedBinds.RegisterBinds(new BindGroupInitializer
            {
                { "leftbutton", MyKeys.LeftButton },
                { "rightbutton", MyKeys.RightButton },
                { "mousewheelup", RichHudControls.MousewheelUp },
                { "mousewheeldown", RichHudControls.MousewheelDown },

                { "enter", MyKeys.Enter },
                { "back", MyKeys.Back },
                { "delete", MyKeys.Delete },
                { "escape", MyKeys.Escape },

                { "selectall", MyKeys.Control, MyKeys.A },
                { "copy", MyKeys.Control, MyKeys.C },
                { "cut", MyKeys.Control, MyKeys.X },
                { "paste", MyKeys.Control, MyKeys.V },

                { "uparrow", MyKeys.Up },
                { "downarrow", MyKeys.Down },
                { "leftarrow", MyKeys.Left },
                { "rightarrow", MyKeys.Right },

                { "pageup", MyKeys.PageUp },
                { "pagedown", MyKeys.PageDown },
                { "shift", MyKeys.Shift },
                { "space", MyKeys.Space },
            });
        }
Esempio n. 2
0
 private MasterBinds() : base(false, true)
 {
     bindGroup = BindManager.GetOrCreateGroup("Main");
     bindGroup.RegisterBinds(new BindGroupInitializer()
     {
         { "ToggleTerminalOld", MyKeys.F1 },
         { "ToggleTerminal", MyKeys.F2 }
     });
 }
Esempio n. 3
0
        private void HudInit()
        {
            /* There are three(-ish) ways to register a HUD element to a parent element. By calling the parent's RegisterChild() method
             * and passing in the child element, by calling the child element's Register() method and passing in the parent or by
             * passing the parent into the child's constructor.
             *
             * I'm using HighDpiRoot instead of Root to compensate for scaling at resolutions > 1080p.
             */
            textEditor = new TextEditor(HudMain.HighDpiRoot)
            {
                Visible = false, // I don't want this to be visible on init.
            };

            editorBinds = BindManager.GetOrCreateGroup("editorBinds");
            editorBinds.RegisterBinds(new BindGroupInitializer()
            {
                { "editorToggle", MyKeys.Home }
            });

            editorBinds[0].NewPressed += ToggleEditor;
        }
Esempio n. 4
0
        private BvBinds() : base(false, true)
        {
            staticGroup = BindManager.GetOrCreateGroup("Static");
            staticGroup.RegisterBinds(new BindGroupInitializer()
            {
                { "blueprint", MyKeys.Control, MyKeys.B },
                { "openBpList", MyKeys.F10 }
            });

            Blueprint  = staticGroup["blueprint"];
            OpenBpList = staticGroup["openBpList"];

            modifierGroup = BindManager.GetOrCreateGroup("Modifiers");
            modifierGroup.RegisterBinds(BindsConfig.DefaultModifiers);

            mainGroup = BindManager.GetOrCreateGroup("Main");
            mainGroup.RegisterBinds(BindsConfig.DefaultMain);

            secondaryGroup = BindManager.GetOrCreateGroup("Secondary");
            secondaryGroup.RegisterBinds(BindsConfig.DefaultSecondary);

            dupeGroup = BindManager.GetOrCreateGroup("Dupe");
            dupeGroup.RegisterBinds(BindsConfig.DefaultDupe);
        }
                private object GetOrSetGroupMember(int index, object data, int memberEnum)
                {
                    IBindGroup group = bindGroups[index];

                    switch ((BindGroupAccessors)memberEnum)
                    {
                    case BindGroupAccessors.Name:
                        return(group.Name);

                    case BindGroupAccessors.GetBindFromName:
                        return(new Vector2I(group.Index, group.GetBind(data as string)?.Index ?? -1));

                    case BindGroupAccessors.DoesBindExist:
                        return(group.DoesBindExist(data as string));

                    case BindGroupAccessors.RegisterBindNames:
                        group.RegisterBinds(data as IReadOnlyList <string>); break;

                    case BindGroupAccessors.RegisterBindIndices:
                        group.RegisterBinds(data as IReadOnlyList <MyTuple <string, IReadOnlyList <int> > >); break;

                    case BindGroupAccessors.RegisterBindDefinitions:
                        group.RegisterBinds(data as IReadOnlyList <BindDefinitionData>); break;

                    case BindGroupAccessors.AddBindWithIndices:
                    {
                        var args = (MyTuple <string, IReadOnlyList <int> >)data;
                        return(new Vector2I(group.Index, group.AddBind(args.Item1, args.Item2).Index));
                    }

                    case BindGroupAccessors.AddBindWithNames:
                    {
                        var args = (MyTuple <string, IReadOnlyList <string> >)data;
                        return(new Vector2I(group.Index, group.AddBind(args.Item1, args.Item2).Index));
                    }

                    case BindGroupAccessors.DoesComboConflict:
                    {
                        var args = (MyTuple <IReadOnlyList <int>, int>)data;
                        return(group.DoesComboConflict(args.Item1, args.Item2));
                    }

                    case BindGroupAccessors.TryRegisterBindName:
                    {
                        IBind bind;
                        bool  success = group.TryRegisterBind(data as string, out bind);

                        return(success ? bind.Index : -1);
                    }

                    case BindGroupAccessors.TryRegisterBindWithIndices:
                    {
                        var args = (MyTuple <string, IReadOnlyList <int> >)data;

                        IBind bind;
                        bool  success = group.TryRegisterBind(args.Item1, out bind, args.Item2);

                        return(success ? bind.Index : -1);
                    }

                    case BindGroupAccessors.TryRegisterBindWithNames:
                    {
                        var args = (MyTuple <string, IReadOnlyList <string> >)data;

                        IBind bind;
                        bool  success = group.TryRegisterBind(args.Item1, out bind, args.Item2);

                        return(success ? bind.Index : -1);
                    }

                    case BindGroupAccessors.TryLoadBindData:
                    {
                        var arg = data as IReadOnlyList <BindDefinitionData>;
                        return(group.TryLoadBindData(arg));
                    }

                    case BindGroupAccessors.GetBindData:
                        return(group.GetBindData());

                    case BindGroupAccessors.ClearSubscribers:
                        group.ClearSubscribers();
                        break;

                    case BindGroupAccessors.ID:
                        return(group);
                    }

                    return(null);
                }