public override void draw(SpriteBatch b) { if (WindowBar != null) { WindowBar.draw(b); } if (ShouldDraw) { this.DrawWindow(b); if (IsActionButtonSidebarVisible && SidebarActionButtons.Any()) { this.DrawActionButtonSidebar(b); } } base.draw(b); if (!IsOnHomePage && ShouldDraw) { // Up button container UpButton.draw(b, c: Desktop.Taskbar.InterfaceColour, layerDepth: 1f); // Up button icon b.Draw( texture: ModEntry.Sprites, destinationRectangle: UpButton.bounds, sourceRectangle: UpButtonIconSource, color: Color.White); } }
public override void draw(SpriteBatch b) { // Show/hide tab button this.DrawExpandButton(b); if (_xTranslateScale > 0f) { WindowBar.DrawWindowBarContainer(b, x: xPositionOnScreen, y: yPositionOnScreen, w: width, h: height, colour: InterfaceColour, greyed: false, simpleStyle: false); // Main icon this.DrawAvatarButton(b, AvatarButton.bounds); // Taskbar icons, except for first (avatar) and last (mute) for (int i = 1; i < Icons.Count - 1; ++i) { Rectangle area = new Rectangle(Icons[i].bounds.X - (Padding.X / 2), Icons[i].bounds.Y - Padding.Y, Icons[i].bounds.Width + Padding.X, Icons[i].bounds.Height + (Padding.Y * 2)); WindowBar.DrawWindowBarContainer(b, area: area, colour: InterfaceColour, greyed: false, simpleStyle: true, drawShadow: true); Icons[i].draw(b); } // Mute icon MuteButton.draw(b); } base.draw(b); }
public override void receiveLeftClick(int x, int y, bool playSound = true) { if (x < 0 || y < 0 || x > Game1.viewport.Width || y > Game1.viewport.Height) { return; } base.receiveLeftClick(x, y, playSound); Taskbar.receiveLeftClick(x, y, playSound); foreach (IClickableMenu child in Children.ToList()) { // Handle clicks for window bars child.receiveLeftClick(x, y, playSound); bool clickedParent = child.GetParentMenu() is WindowBar parent && parent.isWithinBounds(x, y); if (clickedParent) { SelectedChildIndex = Children.IndexOf(child); return; } } foreach (IClickableMenu child in Children.ToList()) { // Handle clicks for window pages WindowBar parent = child.GetParentMenu() as WindowBar; bool clickedChild = child.isWithinBounds(x, y) && (parent == null || parent.ShouldDrawChild); bool clickedTaskbarIcon = Taskbar.Icons.Any(icon => icon.name == child.GetType().Name&& icon.containsPoint(x, y)); if (clickedChild || clickedTaskbarIcon) { SelectedChildIndex = Children.IndexOf(child); return; } } SelectedChildIndex = 0; }