Esempio n. 1
0
 private JMenu getMenu_ViewOptions() {
   final JMenu menu = new JMenu("View");
   menu.add(getMenuItem_ShowTabs());
   if (currentScreen != null && currentScreen.isMatchScreen()) {
     menu.add(getMenuItem_ShowBackgroundImage());
   }
   return menu;
 }
Esempio n. 2
0
  public boolean setCurrentScreen(final FScreen screen, final boolean previousScreenClosed) {
    // TODO: Uncomment the line below if this function stops being used to refresh
    // the current screen in some places (such as Continue and Restart in the match screen)
    // if (currentScreen == screen) { return; }

    // give previous screen a chance to perform special switch handling and/or cancel switching away
    // from screen
    if (currentScreen != screen && !Singletons.getView().getNavigationBar().canSwitch(screen)) {
      return false;
    }

    if (currentScreen != null
        && currentScreen
            .isMatchScreen()) { // hide targeting overlay and reset image if was on match screen
      // SOverlayUtils.hideTargetingOverlay();
      if (isMatchBackgroundImageVisible()) {
        FView.SINGLETON_INSTANCE.getPnlInsets().setForegroundImage(new ImageIcon());
      }
    }

    clearChildren(JLayeredPane.DEFAULT_LAYER);
    SOverlayUtils.hideOverlay();
    ImageCache.clear(); // reduce memory usage by clearing image cache when switching screens

    currentScreen = screen;

    // load layout for new current screen
    screen.getController().register();
    try {
      SLayoutIO.loadLayout(null);
    } catch (final InvalidLayoutFileException ex) {
      SOptionPane.showMessageDialog(
          String.format(
              "Your %s layout file could not be read. It will be deleted after you press OK.\nThe game will proceed with default layout.",
              screen.getTabCaption()),
          "Warning!");
      if (screen.deleteLayoutFile()) {
        SLayoutIO.loadLayout(null); // try again
      }
    }

    screen.getController().initialize();
    screen.getView().populate();

    if (screen.isMatchScreen()) {
      if (isMatchBackgroundImageVisible()) {
        FView.SINGLETON_INSTANCE
            .getPnlInsets()
            .setForegroundImage(FSkin.getIcon(FSkinProp.BG_MATCH));
      }
      // SOverlayUtils.showTargetingOverlay();
    }

    Singletons.getView().getNavigationBar().updateSelectedTab();
    return true;
  }
 private void resetMatchScreenLayout() {
   final String userPrompt =
       "This will reset the layout of the Match screen.\n"
           + "If you want to save the current layout first, please use "
           + "the Dock tab -> Save Layout option in the Match screen.\n\n"
           + "Reset layout?";
   if (FOptionPane.showConfirmDialog(userPrompt, "Reset Match Screen Layout")) {
     if (FScreen.deleteMatchLayoutFile()) {
       FOptionPane.showMessageDialog("Match Screen layout has been reset.");
     }
   }
 }