public void GiveFocus(IInteractiveMenuComponent component)
 {
     if (!_InteractiveComponents.Contains(component) || component == FocusElement)
     {
         return;
     }
     Parent.GiveFocus(this);
     ResetFocus();
     FocusElement = component;
     if (FocusElement is IKeyboardComponent)
     {
         Game1.keyboardDispatcher.Subscriber = new KeyboardSubscriberProxy((IKeyboardComponent)FocusElement);
     }
     component.FocusGained();
 }
Beispiel #2
0
 public void GiveFocus(IInteractiveMenuComponent component)
 {
     if (!this.Tabs.Exists(x => x.Component == component) || component == this.FocusElement)
     {
         return;
     }
     this.Parent.GiveFocus(this);
     ResetFocus();
     this.FocusElement = component;
     if (this.FocusElement is IKeyboardComponent)
     {
         Game1.keyboardDispatcher.Subscriber = new KeyboardSubscriberProxy((IKeyboardComponent)this.FocusElement);
     }
     component.FocusGained();
 }
Beispiel #3
0
        /// <summary>
        ///     Gives focus to the specified component
        /// </summary>
        /// <param name="component">
        ///     The component to give focus to
        /// </param>
        public void GiveFocus(IInteractiveMenuComponent component)
        {
            if (!this.InteractiveComponents.Contains(component) || component == this.FocusElement)
            {
                return;
            }

            this.Parent.GiveFocus(this);
            this.ResetFocus();
            this.FocusElement = component;
            var element = this.FocusElement as IKeyboardComponent;

            if (element != null)
            {
                Game1.keyboardDispatcher.Subscriber = new KeyboardSubscriberProxy(element);
            }

            component.FocusGained();
        }
Beispiel #4
0
 public virtual void GiveFocus(IInteractiveMenuComponent component)
 {
     if (component == this.FocusElement)
     {
         return;
     }
     ResetFocus();
     this.FocusElement = component;
     if (this.FocusElement is IKeyboardComponent keyboardComponent)
     {
         Game1.keyboardDispatcher.Subscriber = new KeyboardSubscriberProxy(keyboardComponent);
     }
     if (!this._InteractiveComponents.Contains(component))
     {
         this.FloatingComponent = component;
         component.Attach(this);
     }
     component.FocusGained();
 }