コード例 #1
0
        /// <summary>
        ///  Handles KeyDown event. Returns true if a component accepted and handled the event.
        /// </summary>
        public virtual bool KeyDown(KeyEventArgs e)
        {
            if (e.Equals(_config.GetConsoleKey()))
            {
                _console.ToggleVisible();
                return(true);
            }

            if (_console.IsVisible())
            {
                if (_console.KeyDown(e))
                {
                    return(true);
                }
            }

            IOrderedEnumerable <IGuiComponent> inputList = from IGuiComponent comp in _components
                                                           where comp.RecieveInput
                                                           orderby comp.ZDepth ascending
                                                           orderby comp.IsVisible() descending
                                                           //Invisible controls still recieve input but after everyone else. This is mostly for the inventory and other toggleable components.
                                                           orderby comp.Focus descending
                                                           select comp;

            return(inputList.Any(current => current.KeyDown(e)));
        }
コード例 #2
0
        /// <summary>
        ///     Handles KeyDown event. Returns true if a component accepted and handled the event.
        /// </summary>
        public virtual bool KeyDown(KeyEventArgs e)
        {
            if (e.Key == _config.GetCVar <Keyboard.Key>("key.keyboard.console"))
            {
                _console.Visible = !_console.Visible;
                return(true);
            }

            if (_console.Visible && _console.KeyDown(e))
            {
                return(true);
            }

            return(_components.Any(control => control.KeyDown(e)));
        }