protected void updateSizeAndPosition() { if (!getRotate90()) { super.updateSizeAndPosition(); return; } FMenuTab menuTab = getMenuTab(); float screenHeight = Forge.getScreenHeight(); float width = (screenHeight - 2 * VPrompt.HEIGHT - 2 * VAvatar.HEIGHT) * 4f / 6f; float maxVisibleHeight = menuTab.screenPos.x; paneSize = updateAndGetPaneSize( width + MatchController.getView() .getTopPlayerPanel() .getTabs() .iterator() .next() .getRight(), maxVisibleHeight); // round width and height so borders appear properly paneSize = new ScrollBounds(Math.round(paneSize.getWidth()), Math.round(paneSize.getHeight())); setBounds( Math.round(menuTab.screenPos.x - width), Math.round((screenHeight + width) / 2), paneSize.getWidth(), Math.min(paneSize.getHeight(), maxVisibleHeight)); }
@Override protected ScrollBounds updateAndGetPaneSize(float maxWidth, float maxVisibleHeight) { clear(); float x = MARGINS; float y = MARGINS; float totalWidth; if (Forge.isLandscapeMode()) { totalWidth = Forge.getScreenWidth() * 0.35f; } else { totalWidth = maxWidth - MatchController.getView() .getTopPlayerPanel() .getTabs() .iterator() .next() .getRight(); // keep avatar, life total, and hand tab visible to left of stack } float width = totalWidth - 2 * MARGINS; final FCollectionView<StackItemView> stack = MatchController.instance.getGameView().getStack(); if (stack.isEmpty()) { // show label if stack empty FLabel label = add(new FLabel.Builder().text("[Empty]").font(FONT).align(HAlignment.CENTER).build()); float height = Math.round(label.getAutoSizeBounds().height) + 2 * PADDING; label.setBounds(x, y, width, height); return new ScrollBounds(totalWidth, y + height + MARGINS); } else { // iterate stack in reverse so most recent items appear on bottom StackItemView stackInstance = null; StackInstanceDisplay display = null; float overlap = Math.round(CARD_HEIGHT / 2 + PADDING + BORDER_THICKNESS); for (int i = stack.size() - 1; i >= 0; i--) { stackInstance = stack.get(i); display = new StackInstanceDisplay(stackInstance, width); if (activeStackInstance == stackInstance) { activeItem = display; } else { // only add non-active items here add(display); } // use full preferred height of display for topmost item on stack, overlap amount for other // items display.setBounds(x, y, width, i > 0 ? overlap : display.preferredHeight); y += display.getHeight(); } if (activeStackInstance == null) { activeStackInstance = stackInstance; // use topmost item on stack as default active item activeItem = display; } else { activeItem.setHeight( display.preferredHeight); // increase active item height to preferred height if needed if (activeItem.getBottom() > y) { y = activeItem.getBottom(); // ensure stack height increases if needed } add(activeItem); } scrollIntoView(activeItem); // scroll active display into view revealTargetZones(); } return new ScrollBounds(totalWidth, y + MARGINS); }
@Override public HostedMatch hostMatch() { return MatchController.hostMatch(); }