- added script button to explorer screen.

- added help button to script screen which opens wiki page.
master
Lodici 2014-06-14 22:41:03 +01:00
parent 2f41940b7f
commit 18718227ed
6 changed files with 42 additions and 10 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

View File

@ -39,6 +39,8 @@ public class IconImages {
public static final ImageIcon LANDS_ICON = loadIcon("w_lands.png");
public static final ImageIcon CREATURES_ICON = loadIcon("w_creatures.png");
public static final ImageIcon SPELLS_ICON = loadIcon("w_spells.png");
public static final ImageIcon EDIT_ICON = loadIcon("w_edit.png");
public static final ImageIcon HELP_ICON = loadIcon("w_help.png");
public static final ImageIcon ARENA=loadIcon("arena.png");
public static final ImageIcon ANY=loadIcon("any.png");

View File

@ -247,15 +247,21 @@ public class ExplorerPanel extends JPanel {
if (e.getClickCount() > 1) {
if (isDeckEditor()) {
addSelectedToDeck();
} else if (cardPoolTable.getSelectedCards().size() == 1) {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
MagicMain.rootFrame.showCardScriptScreen(cardPoolTable.getSelectedCards().get(0));
setCursor (Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} else {
showCardScriptScreen();
}
}
}
}
public void showCardScriptScreen() {
if (cardPoolTable.getSelectedCards().size() == 1) {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
MagicMain.rootFrame.showCardScriptScreen(cardPoolTable.getSelectedCards().get(0));
setCursor (Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
private class DeckMouseListener extends MouseAdapter {
@Override
public void mouseClicked(final MouseEvent e) {

View File

@ -35,8 +35,11 @@ public class CardExplorerScreen
extends AbstractScreen
implements IStatusBar, IActionBar, IOptionsMenu {
private final ExplorerPanel content;
public CardExplorerScreen() {
setContent(new ExplorerPanel());
content = new ExplorerPanel();
setContent(content);
}
/* (non-Javadoc)
@ -68,8 +71,19 @@ public class CardExplorerScreen
*/
@Override
public List<MenuButton> getMiddleActions() {
final List<MenuButton> buttons = new ArrayList<>();
buttons.add(
new ActionBarButton(
IconImages.EDIT_ICON,
"View Script", "View the script and groovy files for the selected card (or double-click row).",
new AbstractAction() {
@Override
public void actionPerformed(final ActionEvent e) {
content.showCardScriptScreen();
}
})
);
if (MagicUtility.isDevMode() || MagicUtility.isDebugMode()) {
final List<MenuButton> buttons = new ArrayList<MenuButton>();
buttons.add(
new ActionBarButton(
IconImages.SAVE_ICON,
@ -84,11 +98,9 @@ public class CardExplorerScreen
}
}
})
);
return buttons;
} else {
return null;
);
}
return buttons;
}
private void saveMissingCardsList() throws IOException {

View File

@ -27,6 +27,7 @@ import java.awt.event.MouseEvent;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import magic.data.URLUtils;
@SuppressWarnings("serial")
public class CardScriptScreen extends AbstractScreen implements IStatusBar, IActionBar {
@ -78,6 +79,17 @@ public class CardScriptScreen extends AbstractScreen implements IStatusBar, IAct
@Override
public List<MenuButton> getMiddleActions() {
final List<MenuButton> buttons = new ArrayList<MenuButton>();
buttons.add(
new ActionBarButton(
IconImages.HELP_ICON,
"Scripting Reference & Help", "Opens the scripting wiki in your browser.",
new AbstractAction() {
@Override
public void actionPerformed(final ActionEvent e) {
URLUtils.openURL("http://code.google.com/p/magarena/wiki/ImplementingCards");
}
})
);
buttons.add(
new ActionBarButton(
IconImages.REFRESH_ICON,