mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Adds first draft of HomeScreen gui. Requires an environmental variable to be present in order to enable it.
Move ManaSymbol initialization from OldGuiNewGame to ApplicationView.
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -10168,6 +10168,7 @@ src/main/java/forge/quest/package-info.java svneol=native#text/plain
|
|||||||
src/main/java/forge/view/FView.java svneol=native#text/plain
|
src/main/java/forge/view/FView.java svneol=native#text/plain
|
||||||
src/main/java/forge/view/package-info.java svneol=native#text/plain
|
src/main/java/forge/view/package-info.java svneol=native#text/plain
|
||||||
src/main/java/forge/view/swing/ApplicationView.java svneol=native#text/plain
|
src/main/java/forge/view/swing/ApplicationView.java svneol=native#text/plain
|
||||||
|
src/main/java/forge/view/swing/Gui_HomeScreen.java -text
|
||||||
src/main/java/forge/view/swing/Main.java svneol=native#text/plain
|
src/main/java/forge/view/swing/Main.java svneol=native#text/plain
|
||||||
src/main/java/forge/view/swing/OldGuiNewGame.java svneol=native#text/plain
|
src/main/java/forge/view/swing/OldGuiNewGame.java svneol=native#text/plain
|
||||||
src/main/java/forge/view/swing/SplashFrame.java -text
|
src/main/java/forge/view/swing/SplashFrame.java -text
|
||||||
@@ -10199,6 +10200,7 @@ src/main/java/net/slightlymagic/maxmtg/Closure1.java -text
|
|||||||
src/main/java/net/slightlymagic/maxmtg/Predicate.java -text
|
src/main/java/net/slightlymagic/maxmtg/Predicate.java -text
|
||||||
src/main/java/net/slightlymagic/maxmtg/PredicateString.java -text
|
src/main/java/net/slightlymagic/maxmtg/PredicateString.java -text
|
||||||
src/main/java/net/slightlymagic/maxmtg/package-info.java svneol=native#text/plain
|
src/main/java/net/slightlymagic/maxmtg/package-info.java svneol=native#text/plain
|
||||||
|
src/main/java/org/eclipse/wb/swing/FocusTraversalOnArray.java -text
|
||||||
src/main/java/tree/properties/PropertyElement.java svneol=native#text/plain
|
src/main/java/tree/properties/PropertyElement.java svneol=native#text/plain
|
||||||
src/main/java/tree/properties/PropertyType.java svneol=native#text/plain
|
src/main/java/tree/properties/PropertyType.java svneol=native#text/plain
|
||||||
src/main/java/tree/properties/TreeProperties.java svneol=native#text/plain
|
src/main/java/tree/properties/TreeProperties.java svneol=native#text/plain
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import forge.quest.data.QuestMatchState;
|
|||||||
import forge.quest.data.QuestPreferences;
|
import forge.quest.data.QuestPreferences;
|
||||||
import forge.quest.gui.QuestFrame;
|
import forge.quest.gui.QuestFrame;
|
||||||
import forge.quest.gui.main.QuestChallenge;
|
import forge.quest.gui.main.QuestChallenge;
|
||||||
|
import forge.view.swing.Gui_HomeScreen;
|
||||||
import forge.view.swing.OldGuiNewGame;
|
import forge.view.swing.OldGuiNewGame;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
@@ -341,7 +342,19 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
|||||||
//are we on a quest?
|
//are we on a quest?
|
||||||
if (model.quest == null) {
|
if (model.quest == null) {
|
||||||
model.match.reset();
|
model.match.reset();
|
||||||
|
|
||||||
|
|
||||||
|
if (System.getenv("NG2") != null) {
|
||||||
|
if (System.getenv("NG2").equalsIgnoreCase("true")) {
|
||||||
|
String argz[] = {};
|
||||||
|
Gui_HomeScreen.main(argz);
|
||||||
|
} else {
|
||||||
new OldGuiNewGame();
|
new OldGuiNewGame();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
new OldGuiNewGame();
|
||||||
|
}
|
||||||
|
|
||||||
} else { //Quest
|
} else { //Quest
|
||||||
|
|
||||||
boolean wonMatch = false;
|
boolean wonMatch = false;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import forge.item.ItemPool;
|
|||||||
import forge.item.ItemPoolView;
|
import forge.item.ItemPoolView;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
|
import forge.view.swing.Gui_HomeScreen;
|
||||||
import forge.view.swing.OldGuiNewGame;
|
import forge.view.swing.OldGuiNewGame;
|
||||||
|
|
||||||
import net.slightlymagic.maxmtg.Predicate;
|
import net.slightlymagic.maxmtg.Predicate;
|
||||||
@@ -103,8 +104,19 @@ public class DeckEditorDraft extends DeckEditorBase implements NewConstants, New
|
|||||||
JOptionPane.YES_NO_OPTION);
|
JOptionPane.YES_NO_OPTION);
|
||||||
if (n == JOptionPane.YES_OPTION) {
|
if (n == JOptionPane.YES_OPTION) {
|
||||||
dispose();
|
dispose();
|
||||||
|
|
||||||
|
if (System.getenv("NG2") != null) {
|
||||||
|
if (System.getenv("NG2").equalsIgnoreCase("true")) {
|
||||||
|
String argz[] = {};
|
||||||
|
Gui_HomeScreen.main(argz);
|
||||||
|
} else {
|
||||||
new OldGuiNewGame();
|
new OldGuiNewGame();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
new OldGuiNewGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}//windowClosing()
|
}//windowClosing()
|
||||||
});
|
});
|
||||||
}//addListeners()
|
}//addListeners()
|
||||||
@@ -284,7 +296,18 @@ public class DeckEditorDraft extends DeckEditorBase implements NewConstants, New
|
|||||||
|
|
||||||
//close and open next screen
|
//close and open next screen
|
||||||
dispose();
|
dispose();
|
||||||
|
|
||||||
|
if (System.getenv("NG2") != null) {
|
||||||
|
if (System.getenv("NG2").equalsIgnoreCase("true")) {
|
||||||
|
String argz[] = {};
|
||||||
|
Gui_HomeScreen.main(argz);
|
||||||
|
} else {
|
||||||
new OldGuiNewGame();
|
new OldGuiNewGame();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
new OldGuiNewGame();
|
||||||
|
}
|
||||||
|
|
||||||
}/*saveDraft()*/
|
}/*saveDraft()*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import forge.AllZone;
|
|||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiUtils;
|
||||||
import forge.quest.gui.bazaar.QuestBazaarPanel;
|
import forge.quest.gui.bazaar.QuestBazaarPanel;
|
||||||
import forge.quest.gui.main.QuestEventManager;
|
import forge.quest.gui.main.QuestEventManager;
|
||||||
|
import forge.view.swing.Gui_HomeScreen;
|
||||||
import forge.view.swing.OldGuiNewGame;
|
import forge.view.swing.OldGuiNewGame;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -107,7 +108,18 @@ public class QuestFrame extends JFrame {
|
|||||||
*/
|
*/
|
||||||
public void returnToMainMenu() {
|
public void returnToMainMenu() {
|
||||||
AllZone.getQuestData().saveData();
|
AllZone.getQuestData().saveData();
|
||||||
(new OldGuiNewGame()).setVisible(true);
|
|
||||||
|
if (System.getenv("NG2") != null) {
|
||||||
|
if (System.getenv("NG2").equalsIgnoreCase("true")) {
|
||||||
|
String argz[] = {};
|
||||||
|
Gui_HomeScreen.main(argz);
|
||||||
|
} else {
|
||||||
|
new OldGuiNewGame();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
new OldGuiNewGame();
|
||||||
|
}
|
||||||
|
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import forge.gui.GuiUtils;
|
|||||||
import forge.quest.data.QuestData;
|
import forge.quest.data.QuestData;
|
||||||
import forge.quest.data.QuestDataIO;
|
import forge.quest.data.QuestDataIO;
|
||||||
import forge.quest.data.QuestPreferences;
|
import forge.quest.data.QuestPreferences;
|
||||||
|
import forge.view.swing.Gui_HomeScreen;
|
||||||
import forge.view.swing.OldGuiNewGame;
|
import forge.view.swing.OldGuiNewGame;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -81,8 +82,19 @@ public class QuestOptions extends JFrame {
|
|||||||
@Override
|
@Override
|
||||||
public void windowClosing(WindowEvent ev) {
|
public void windowClosing(WindowEvent ev) {
|
||||||
QuestOptions.this.dispose();
|
QuestOptions.this.dispose();
|
||||||
|
|
||||||
|
if (System.getenv("NG2") != null) {
|
||||||
|
if (System.getenv("NG2").equalsIgnoreCase("true")) {
|
||||||
|
String argz[] = {};
|
||||||
|
Gui_HomeScreen.main(argz);
|
||||||
|
} else {
|
||||||
new OldGuiNewGame();
|
new OldGuiNewGame();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
new OldGuiNewGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//is there any saved data?
|
//is there any saved data?
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import javax.swing.UIManager;
|
|||||||
import net.slightlymagic.braids.util.UtilFunctions;
|
import net.slightlymagic.braids.util.UtilFunctions;
|
||||||
import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor;
|
import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor;
|
||||||
|
|
||||||
|
import arcane.ui.util.ManaSymbols;
|
||||||
|
|
||||||
import com.esotericsoftware.minlog.Log;
|
import com.esotericsoftware.minlog.Log;
|
||||||
|
|
||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
@@ -124,6 +126,8 @@ public class ApplicationView implements FView {
|
|||||||
|
|
||||||
if(!splashFrame.getSplashHasBeenClosed()) {
|
if(!splashFrame.getSplashHasBeenClosed()) {
|
||||||
try {
|
try {
|
||||||
|
ManaSymbols.loadImages();
|
||||||
|
|
||||||
Constant.Runtime.gameType = GameType.Constructed;
|
Constant.Runtime.gameType = GameType.Constructed;
|
||||||
SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids on 8/7/11 1:07 PM: this isn't a web app
|
SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids on 8/7/11 1:07 PM: this isn't a web app
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -137,8 +141,18 @@ public class ApplicationView implements FView {
|
|||||||
|
|
||||||
|
|
||||||
splashFrame = null;
|
splashFrame = null;
|
||||||
|
|
||||||
|
if (System.getenv("NG2") != null) {
|
||||||
|
if (System.getenv("NG2").equalsIgnoreCase("true")) {
|
||||||
|
String argz[] = {};
|
||||||
|
Gui_HomeScreen.main(argz);
|
||||||
|
} else {
|
||||||
new OldGuiNewGame();
|
new OldGuiNewGame();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
new OldGuiNewGame();
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ErrorViewer.showError(ex);
|
ErrorViewer.showError(ex);
|
||||||
|
|||||||
1558
src/main/java/forge/view/swing/Gui_HomeScreen.java
Normal file
1558
src/main/java/forge/view/swing/Gui_HomeScreen.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -178,7 +178,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
|||||||
setupMenu();
|
setupMenu();
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
|
||||||
ManaSymbols.loadImages();
|
|
||||||
Log.WARN(); // set logging level to warn
|
Log.WARN(); // set logging level to warn
|
||||||
SwingUtilities.updateComponentTreeUI(this);
|
SwingUtilities.updateComponentTreeUI(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2011 Google, Inc.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Google, Inc. - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.wb.swing;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Container;
|
||||||
|
import java.awt.FocusTraversalPolicy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cyclic focus traversal policy based on array of components.
|
||||||
|
* <p>
|
||||||
|
* This class may be freely distributed as part of any application or plugin.
|
||||||
|
*
|
||||||
|
* @author scheglov_ke
|
||||||
|
*/
|
||||||
|
public class FocusTraversalOnArray extends FocusTraversalPolicy {
|
||||||
|
private final Component m_Components[];
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Constructor
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
public FocusTraversalOnArray(Component components[]) {
|
||||||
|
m_Components = components;
|
||||||
|
}
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Utilities
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
private int indexCycle(int index, int delta) {
|
||||||
|
int size = m_Components.length;
|
||||||
|
int next = (index + delta + size) % size;
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
private Component cycle(Component currentComponent, int delta) {
|
||||||
|
int index = -1;
|
||||||
|
loop : for (int i = 0; i < m_Components.length; i++) {
|
||||||
|
Component component = m_Components[i];
|
||||||
|
for (Component c = currentComponent; c != null; c = c.getParent()) {
|
||||||
|
if (component == c) {
|
||||||
|
index = i;
|
||||||
|
break loop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// try to find enabled component in "delta" direction
|
||||||
|
int initialIndex = index;
|
||||||
|
while (true) {
|
||||||
|
int newIndex = indexCycle(index, delta);
|
||||||
|
if (newIndex == initialIndex) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
index = newIndex;
|
||||||
|
//
|
||||||
|
Component component = m_Components[newIndex];
|
||||||
|
if (component.isEnabled() && component.isVisible() && component.isFocusable()) {
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// not found
|
||||||
|
return currentComponent;
|
||||||
|
}
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// FocusTraversalPolicy
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
public Component getComponentAfter(Container container, Component component) {
|
||||||
|
return cycle(component, 1);
|
||||||
|
}
|
||||||
|
public Component getComponentBefore(Container container, Component component) {
|
||||||
|
return cycle(component, -1);
|
||||||
|
}
|
||||||
|
public Component getFirstComponent(Container container) {
|
||||||
|
return m_Components[0];
|
||||||
|
}
|
||||||
|
public Component getLastComponent(Container container) {
|
||||||
|
return m_Components[m_Components.length - 1];
|
||||||
|
}
|
||||||
|
public Component getDefaultComponent(Container container) {
|
||||||
|
return getFirstComponent(container);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user