public override void receiveRightClick(int x, int y, bool playSound = true) { Point p = new Point(x, y); Point o = new Point(this.Area.X + zoom10, this.Area.Y + zoom10); if (this.FloatingComponent != null && this.FloatingComponent.InBounds(p, o)) { this.FloatingComponent.RightClick(p, o); return; } foreach (IInteractiveMenuComponent el in this.EventOrder) { if (el.InBounds(p, o)) { GiveFocus(el); this.FocusElement = el; el.RightClick(p, o); return; } } ResetFocus(); }
public override void performHoverAction(int x, int y) { base.performHoverAction(x, y); if (!this.Area.Contains(x, y) || this.Hold) { return; } Point p = new Point(x, y); Point o = new Point(this.Area.X + FrameworkMenu.Zoom10, this.Area.Y + FrameworkMenu.Zoom10); if (this.HoverInElement != null && !this.HoverInElement.InBounds(p, o)) { this.HoverInElement.HoverOut(p, o); this.HoverInElement = null; } if (this.FloatingComponent != null && this.FloatingComponent.InBounds(p, o)) { this.FloatingComponent.HoverOver(p, o); return; } foreach (IInteractiveMenuComponent el in this.EventOrder) { if (el.InBounds(p, o)) { if (this.HoverInElement == null) { this.HoverInElement = el; el.HoverIn(p, o); } el.HoverOver(p, o); break; } } }
/// <summary> /// Gives focus to a specified component. /// </summary> /// <param name="component"> /// The component to give focus. /// </param> public virtual void GiveFocus(IInteractiveMenuComponent component) { if (component == this.FocusElement) { return; } this.ResetFocus(); this.FocusElement = component; var focusElement = this.FocusElement as IKeyboardComponent; if (focusElement != null) { Game1.keyboardDispatcher.Subscriber = new KeyboardSubscriberProxy(focusElement); } if (!this.InteractiveComponents.Contains(component)) { this.FloatingComponent = component; component.Attach(this); } component.FocusGained(); }
public void GiveFocus(IInteractiveMenuComponent component) { throw new NotImplementedException(); }
public override void CommandReceived(char cmd) { if (Disabled) { return; } switch ((int)cmd) { case 8: if (Value.Length <= 0) { return; } Value = Value.Substring(0, Value.Length - 1); Game1.playSound("tinyWhip"); return; case 9: if (TabPressed != null) { Value = TabPressed(this, Parent.GetAttachedMenu(), Value); return; } if (!(Parent is IComponentCollection)) { return; } bool Next = false; IInteractiveMenuComponent first = null; foreach (IInteractiveMenuComponent imc in (Parent as IComponentCollection).InteractiveComponents) { if (first == null && imc is TextboxFormComponent) { first = imc; } if (imc == this) { Next = true; continue; } if (Next && imc is TextboxFormComponent) { Parent.GiveFocus(imc); return; } } Parent.GiveFocus(first); return; case 13: if (EnterPressed != null) { Value = EnterPressed(this, Parent.GetAttachedMenu(), Value); } else { Parent.ResetFocus(); } return; } }
public TabInfo(IInteractiveMenuComponent component, int icon) { Component = component; Icon = icon; }
internal static void ButtonClicked(IInteractiveMenuComponent component, IComponentContainer collection, FrameworkMenu menu) { Console.WriteLine("ButtonClicked"); }
internal static void TextboxChanged(IInteractiveMenuComponent component, IComponentContainer collection, FrameworkMenu menu, string value) { Console.WriteLine("TextboxChanged: " + value); }
internal static void HeartsChanged(IInteractiveMenuComponent component, IComponentContainer collection, FrameworkMenu menu, int value) { Console.WriteLine("HeartsChanged: " + value.ToString()); }
internal static void CheckboxChanged(IInteractiveMenuComponent component, IComponentContainer collection, FrameworkMenu menu, bool value) { Console.WriteLine("CheckBoxChanged: " + (value ? "true" : "false")); }
public TabInfo(IInteractiveMenuComponent component, Texture2D texture, Rectangle crop) { Component = component; Texture = texture; Crop = crop; }
private static void OnDecline(IInteractiveMenuComponent component, IComponentContainer container, FrameworkMenu menu) { Game1.activeClickableMenu = Menu; }
private static void OnBackButton(IInteractiveMenuComponent component, IComponentContainer container, FrameworkMenu menu) { Game1.activeClickableMenu = BoardMainMenu.Menu; }
private static void OnCareButton(IInteractiveMenuComponent component, IComponentContainer container, FrameworkMenu menu) { }
/// <summary> /// Called when a command is received /// </summary> /// <param name="cmd"> /// The command received /// </param> public override void CommandReceived(char cmd) { if (this.Disabled) { return; } switch ((int)cmd) { case 8: if (this.Value.Length <= 0) { return; } this.Value = this.Value.Substring(0, this.Value.Length - 1); Game1.playSound("tinyWhip"); return; case 9: if (this.TabPressed != null) { this.Value = this.TabPressed(this, this.Parent.GetAttachedMenu(), this.Value); return; } if (!(this.Parent is IComponentCollection)) { return; } var next = false; IInteractiveMenuComponent first = null; foreach (var imc in ((IComponentCollection)this.Parent).InteractiveComponents) { if (first == null && imc is TextboxFormComponent) { first = imc; } if (imc == this) { next = true; continue; } if (next && imc is TextboxFormComponent) { this.Parent.GiveFocus(imc); return; } } this.Parent.GiveFocus(first); return; case 13: if (this.EnterPressed != null) { this.Value = this.EnterPressed(this, this.Parent.GetAttachedMenu(), this.Value); } else { this.Parent.ResetFocus(); } return; } }