Massive removal of old UI code:
Easy accessors added FView and FControl to various components throughout UI. Mishmash of methods in "Display" interface attached as appropriate to singletons. AllZone updated to remove display and one or two others in favor of singletons, for future deprecation. Some renaming for consistency. Skins folder moved out of "images", which will be deprecated soon. FControl refactored to reuse single instance of each UI state.
66
.gitattributes
vendored
@@ -10317,8 +10317,6 @@ res/draft/rare.txt svneol=native#text/plain
|
||||
res/draft/uncommon.txt svneol=native#text/plain
|
||||
res/gamedata/NonStackingKWList.txt svneol=native#text/plain
|
||||
res/gamedata/TypeLists.txt svneol=native#text/plain
|
||||
res/gui/display_layout.xml svneol=native#text/xml
|
||||
res/gui/gui.properties svneol=native#text/plain
|
||||
res/images/deckeditor/filter_artifact_n.png -text svneol=unset#image/png
|
||||
res/images/deckeditor/filter_artifact_y.png -text svneol=unset#image/png
|
||||
res/images/deckeditor/filter_black_n.png -text svneol=unset#image/png
|
||||
@@ -10345,30 +10343,6 @@ res/images/deckeditor/filter_sorcery_n.png -text svneol=unset#image/png
|
||||
res/images/deckeditor/filter_sorcery_y.png -text svneol=unset#image/png
|
||||
res/images/deckeditor/filter_white_n.png -text svneol=unset#image/png
|
||||
res/images/deckeditor/filter_white_y.png -text svneol=unset#image/png
|
||||
res/images/skins/darkascension/bg_match.jpg -text
|
||||
res/images/skins/darkascension/bg_splash.png -text
|
||||
res/images/skins/darkascension/bg_texture.jpg -text
|
||||
res/images/skins/darkascension/font1.ttf -text
|
||||
res/images/skins/darkascension/sprite_icons.png -text
|
||||
res/images/skins/default/bg_match.jpg -text
|
||||
res/images/skins/default/bg_splash.png -text
|
||||
res/images/skins/default/bg_texture.jpg -text
|
||||
res/images/skins/default/font1.ttf -text
|
||||
res/images/skins/default/grid_icons.png -text
|
||||
res/images/skins/default/loader.gif -text
|
||||
res/images/skins/default/sprite_avatars.png -text
|
||||
res/images/skins/default/sprite_foils.png -text
|
||||
res/images/skins/default/sprite_icons.png -text
|
||||
res/images/skins/rebel/bg_match.jpg -text
|
||||
res/images/skins/rebel/bg_splash.png -text
|
||||
res/images/skins/rebel/bg_texture.jpg -text
|
||||
res/images/skins/rebel/font1.ttf -text
|
||||
res/images/skins/rebel/sprite_icons.png -text
|
||||
res/images/skins/smith/bg_match.jpg -text
|
||||
res/images/skins/smith/bg_splash.png -text
|
||||
res/images/skins/smith/bg_texture.jpg -text
|
||||
res/images/skins/smith/font1.ttf -text
|
||||
res/images/skins/smith/sprite_icons.png -text
|
||||
res/lang/de.properties svneol=native#text/plain
|
||||
res/lang/en.properties svneol=native#text/plain
|
||||
res/lang/howTo/de.properties svneol=native#text/plain
|
||||
@@ -10853,6 +10827,30 @@ res/quest/themes/Zombies[!!-~]B.thm -text
|
||||
res/reprintSetInfo.py svneol=native#text/x-python
|
||||
res/sealed/juzamjedi.zsealed -text
|
||||
res/setInfoScript.py svneol=native#text/x-python
|
||||
res/skins/darkascension/bg_match.jpg -text
|
||||
res/skins/darkascension/bg_splash.png -text
|
||||
res/skins/darkascension/bg_texture.jpg -text
|
||||
res/skins/darkascension/font1.ttf -text
|
||||
res/skins/darkascension/sprite_icons.png -text
|
||||
res/skins/default/bg_match.jpg -text
|
||||
res/skins/default/bg_splash.png -text
|
||||
res/skins/default/bg_texture.jpg -text
|
||||
res/skins/default/font1.ttf -text
|
||||
res/skins/default/grid_icons.png -text
|
||||
res/skins/default/loader.gif -text
|
||||
res/skins/default/sprite_avatars.png -text
|
||||
res/skins/default/sprite_foils.png -text
|
||||
res/skins/default/sprite_icons.png -text
|
||||
res/skins/rebel/bg_match.jpg -text
|
||||
res/skins/rebel/bg_splash.png -text
|
||||
res/skins/rebel/bg_texture.jpg -text
|
||||
res/skins/rebel/font1.ttf -text
|
||||
res/skins/rebel/sprite_icons.png -text
|
||||
res/skins/smith/bg_match.jpg -text
|
||||
res/skins/smith/bg_splash.png -text
|
||||
res/skins/smith/bg_texture.jpg -text
|
||||
res/skins/smith/font1.ttf -text
|
||||
res/skins/smith/sprite_icons.png -text
|
||||
res/sound/tap.mp3 -text svneol=unset#audio/mpeg
|
||||
res/token-images.txt -text
|
||||
src/main/config/Forge.icns -text
|
||||
@@ -10913,7 +10911,6 @@ src/main/java/forge/Constant.java svneol=native#text/plain
|
||||
src/main/java/forge/ConstantStringArrayList.java svneol=native#text/plain
|
||||
src/main/java/forge/Counters.java svneol=native#text/plain
|
||||
src/main/java/forge/DefaultPlayerZone.java svneol=native#text/plain
|
||||
src/main/java/forge/Display.java svneol=native#text/plain
|
||||
src/main/java/forge/EndOfCombat.java svneol=native#text/plain
|
||||
src/main/java/forge/EndOfTurn.java svneol=native#text/plain
|
||||
src/main/java/forge/ExternalPanel.java svneol=native#text/plain
|
||||
@@ -11139,7 +11136,7 @@ src/main/java/forge/control/match/ControlDetail.java -text
|
||||
src/main/java/forge/control/match/ControlDock.java -text
|
||||
src/main/java/forge/control/match/ControlField.java -text
|
||||
src/main/java/forge/control/match/ControlHand.java -text
|
||||
src/main/java/forge/control/match/ControlInput.java -text
|
||||
src/main/java/forge/control/match/ControlMessage.java -text
|
||||
src/main/java/forge/control/match/ControlPicture.java -text
|
||||
src/main/java/forge/control/match/ControlTabber.java -text
|
||||
src/main/java/forge/control/match/ControlWinLose.java -text
|
||||
@@ -11297,18 +11294,18 @@ src/main/java/forge/util/MyRandom.java svneol=native#text/plain
|
||||
src/main/java/forge/util/SectionUtil.java -text
|
||||
src/main/java/forge/util/package-info.java -text
|
||||
src/main/java/forge/view/FView.java svneol=native#text/plain
|
||||
src/main/java/forge/view/GuiTopLevel.java -text
|
||||
src/main/java/forge/view/Main.java -text
|
||||
src/main/java/forge/view/bazaar/BazaarTopLevel.java -text
|
||||
src/main/java/forge/view/SplashFrame.java -text
|
||||
src/main/java/forge/view/ViewBazaarUI.java -text
|
||||
src/main/java/forge/view/ViewEditorUI.java -text
|
||||
src/main/java/forge/view/ViewHomeUI.java -text
|
||||
src/main/java/forge/view/ViewMatchUI.java -text
|
||||
src/main/java/forge/view/bazaar/ViewItem.java -text
|
||||
src/main/java/forge/view/bazaar/ViewStall.java svneol=native#text/plain
|
||||
src/main/java/forge/view/bazaar/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/view/editor/EditorTopLevel.java -text
|
||||
src/main/java/forge/view/editor/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/view/home/HomeTopLevel.java -text
|
||||
src/main/java/forge/view/home/QuestFileLister.java -text
|
||||
src/main/java/forge/view/home/QuestPreferencesHandler.java -text
|
||||
src/main/java/forge/view/home/SplashFrame.java -text
|
||||
src/main/java/forge/view/home/StartButton.java -text
|
||||
src/main/java/forge/view/home/ViewConstructed.java -text
|
||||
src/main/java/forge/view/home/ViewDraft.java -text
|
||||
@@ -11317,7 +11314,6 @@ src/main/java/forge/view/home/ViewSealed.java -text
|
||||
src/main/java/forge/view/home/ViewSettings.java -text
|
||||
src/main/java/forge/view/home/ViewUtilities.java -text
|
||||
src/main/java/forge/view/home/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/view/match/MatchTopLevel.java -text
|
||||
src/main/java/forge/view/match/QuestWinLoseCardViewer.java -text
|
||||
src/main/java/forge/view/match/QuestWinLoseHandler.java -text
|
||||
src/main/java/forge/view/match/ViewBattlefield.java -text
|
||||
@@ -11325,7 +11321,7 @@ src/main/java/forge/view/match/ViewDetail.java -text
|
||||
src/main/java/forge/view/match/ViewDock.java -text
|
||||
src/main/java/forge/view/match/ViewField.java -text
|
||||
src/main/java/forge/view/match/ViewHand.java -text
|
||||
src/main/java/forge/view/match/ViewInput.java -text
|
||||
src/main/java/forge/view/match/ViewMessage.java -text
|
||||
src/main/java/forge/view/match/ViewPicture.java -text
|
||||
src/main/java/forge/view/match/ViewTabber.java -text
|
||||
src/main/java/forge/view/match/ViewWinLose.java -text
|
||||
|
||||
1
.gitignore
vendored
@@ -10,7 +10,6 @@ res/PerSetTrackingResults
|
||||
res/cardsfolder/cardsfolder.zip
|
||||
res/decks/AI_o1.dck
|
||||
res/decks/o1.bdk
|
||||
res/gui/display_new_layout.xml
|
||||
res/images/themes
|
||||
res/oracleScript.log
|
||||
res/pics
|
||||
|
||||
2
.project
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Forge</name>
|
||||
<name>ForgeLocal</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
||||
@@ -1,288 +0,0 @@
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Split>
|
||||
<parent>
|
||||
<bounds>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</bounds>
|
||||
<weight>0.0</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<children>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Split reference="../../.."/>
|
||||
</children>
|
||||
<rowLayout>true</rowLayout>
|
||||
</parent>
|
||||
<bounds>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1024</width>
|
||||
<height>687</height>
|
||||
</bounds>
|
||||
<weight>0.0</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<children>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Split>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>197</width>
|
||||
<height>687</height>
|
||||
</bounds>
|
||||
<weight>0.0</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<children>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>197</width>
|
||||
<height>126</height>
|
||||
</bounds>
|
||||
<weight>0.2</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<name>info</name>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>0</x>
|
||||
<y>126</y>
|
||||
<width>197</width>
|
||||
<height>5</height>
|
||||
</bounds>
|
||||
<weight>0.0</weight>
|
||||
<isVisible>true</isVisible>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>0</x>
|
||||
<y>131</y>
|
||||
<width>197</width>
|
||||
<height>142</height>
|
||||
</bounds>
|
||||
<weight>0.2</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<name>compy</name>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>0</x>
|
||||
<y>273</y>
|
||||
<width>197</width>
|
||||
<height>5</height>
|
||||
</bounds>
|
||||
<weight>0.0</weight>
|
||||
<isVisible>true</isVisible>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>0</x>
|
||||
<y>278</y>
|
||||
<width>197</width>
|
||||
<height>115</height>
|
||||
</bounds>
|
||||
<weight>0.2</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<name>stack</name>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>0</x>
|
||||
<y>393</y>
|
||||
<width>197</width>
|
||||
<height>5</height>
|
||||
</bounds>
|
||||
<weight>0.0</weight>
|
||||
<isVisible>true</isVisible>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>0</x>
|
||||
<y>398</y>
|
||||
<width>197</width>
|
||||
<height>137</height>
|
||||
</bounds>
|
||||
<weight>0.2</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<name>combat</name>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>0</x>
|
||||
<y>535</y>
|
||||
<width>197</width>
|
||||
<height>5</height>
|
||||
</bounds>
|
||||
<weight>0.0</weight>
|
||||
<isVisible>true</isVisible>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>0</x>
|
||||
<y>540</y>
|
||||
<width>197</width>
|
||||
<height>147</height>
|
||||
</bounds>
|
||||
<weight>0.2</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<name>human</name>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
</children>
|
||||
<rowLayout>false</rowLayout>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Split>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>197</x>
|
||||
<y>0</y>
|
||||
<width>5</width>
|
||||
<height>687</height>
|
||||
</bounds>
|
||||
<weight>0.0</weight>
|
||||
<isVisible>true</isVisible>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Split>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>202</x>
|
||||
<y>0</y>
|
||||
<width>678</width>
|
||||
<height>687</height>
|
||||
</bounds>
|
||||
<weight>1.0</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<children>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>202</x>
|
||||
<y>0</y>
|
||||
<width>678</width>
|
||||
<height>281</height>
|
||||
</bounds>
|
||||
<weight>0.4</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<name>compyPlay</name>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>202</x>
|
||||
<y>281</y>
|
||||
<width>678</width>
|
||||
<height>5</height>
|
||||
</bounds>
|
||||
<weight>0.0</weight>
|
||||
<isVisible>true</isVisible>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>202</x>
|
||||
<y>286</y>
|
||||
<width>678</width>
|
||||
<height>313</height>
|
||||
</bounds>
|
||||
<weight>0.4</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<name>humanPlay</name>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>202</x>
|
||||
<y>599</y>
|
||||
<width>678</width>
|
||||
<height>5</height>
|
||||
</bounds>
|
||||
<weight>0.0</weight>
|
||||
<isVisible>true</isVisible>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>202</x>
|
||||
<y>604</y>
|
||||
<width>678</width>
|
||||
<height>83</height>
|
||||
</bounds>
|
||||
<weight>0.2</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<name>humanHand</name>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
</children>
|
||||
<rowLayout>false</rowLayout>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Split>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>880</x>
|
||||
<y>0</y>
|
||||
<width>5</width>
|
||||
<height>687</height>
|
||||
</bounds>
|
||||
<weight>0.0</weight>
|
||||
<isVisible>true</isVisible>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Split>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>885</x>
|
||||
<y>0</y>
|
||||
<width>139</width>
|
||||
<height>687</height>
|
||||
</bounds>
|
||||
<weight>0.0</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<children>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>885</x>
|
||||
<y>0</y>
|
||||
<width>139</width>
|
||||
<height>496</height>
|
||||
</bounds>
|
||||
<weight>0.5</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<name>detail</name>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>885</x>
|
||||
<y>496</y>
|
||||
<width>139</width>
|
||||
<height>5</height>
|
||||
</bounds>
|
||||
<weight>0.0</weight>
|
||||
<isVisible>true</isVisible>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Divider>
|
||||
<org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
<parent reference="../../.."/>
|
||||
<bounds>
|
||||
<x>885</x>
|
||||
<y>501</y>
|
||||
<width>139</width>
|
||||
<height>186</height>
|
||||
</bounds>
|
||||
<weight>0.5</weight>
|
||||
<isVisible>true</isVisible>
|
||||
<name>picture</name>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Leaf>
|
||||
</children>
|
||||
<rowLayout>false</rowLayout>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Split>
|
||||
</children>
|
||||
<rowLayout>true</rowLayout>
|
||||
</org.jdesktop.swingx.MultiSplitLayout_-Split>
|
||||
@@ -1,3 +0,0 @@
|
||||
Display--file=display_layout.xml
|
||||
Display/new--file=display_new_layout.xml
|
||||
DeckEditor--file=deck_editor_layout.xml
|
||||
@@ -53,7 +53,6 @@ regular/rare--file=rare.txt
|
||||
|
||||
name-mutator--file=name-mutator.txt
|
||||
|
||||
gui--properties=gui/gui.properties
|
||||
quest--properties=quest/quest.properties
|
||||
draft--properties=draft/draft.properties
|
||||
|
||||
@@ -64,8 +63,6 @@ image/token--file=pics/tokens
|
||||
image/icon--file=images/icons
|
||||
pics/booster--file=pics/booster
|
||||
pics/booster/images--file=quest/booster-images.txt
|
||||
symbols/small--file=images/symbols-13
|
||||
sound/base--file=sound
|
||||
|
||||
quest/opponent/icons--file=quest/quest-opponent-icons.txt
|
||||
quest/pet/icons--file=quest/quest-pet-shop-icons.txt
|
||||
|
||||
|
Before Width: | Height: | Size: 359 KiB After Width: | Height: | Size: 359 KiB |
|
Before Width: | Height: | Size: 389 KiB After Width: | Height: | Size: 389 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 260 KiB After Width: | Height: | Size: 260 KiB |
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 172 KiB |
|
Before Width: | Height: | Size: 208 KiB After Width: | Height: | Size: 208 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 404 B After Width: | Height: | Size: 404 B |
|
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 549 KiB After Width: | Height: | Size: 549 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 260 KiB After Width: | Height: | Size: 260 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 152 KiB |
|
Before Width: | Height: | Size: 341 KiB After Width: | Height: | Size: 341 KiB |
|
Before Width: | Height: | Size: 340 KiB After Width: | Height: | Size: 340 KiB |
|
Before Width: | Height: | Size: 776 KiB After Width: | Height: | Size: 776 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
@@ -36,8 +36,6 @@ import forge.properties.NewConstants;
|
||||
import forge.quest.data.QuestData;
|
||||
import forge.quest.data.QuestEvent;
|
||||
import forge.quest.data.QuestEventManager;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.toolbox.FOverlay;
|
||||
|
||||
/**
|
||||
* Please use public getters and setters instead of direct field access.
|
||||
@@ -88,12 +86,6 @@ public final class AllZone {
|
||||
// shared between Input_Attack, Input_Block, Input_CombatDamage ,
|
||||
// InputState_Computer
|
||||
|
||||
/** Global <code>display</code>. */
|
||||
private static Display display;
|
||||
|
||||
/** Global <code>overlay</code>. */
|
||||
private static FOverlay overlay;
|
||||
|
||||
/** Constant <code>DECK_MGR</code>. */
|
||||
private static DeckManager deckManager;
|
||||
|
||||
@@ -493,31 +485,6 @@ public final class AllZone {
|
||||
return Singletons.getModel().getGameState().getStackZone();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getDisplay.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link forge.Display} object.
|
||||
* @since 1.0.15
|
||||
*/
|
||||
public static Display getDisplay() {
|
||||
return AllZone.display;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* setDisplay.
|
||||
* </p>
|
||||
*
|
||||
* @param display0
|
||||
* a {@link forge.Display} object.
|
||||
* @since 1.0.15
|
||||
*/
|
||||
public static void setDisplay(final Display display0) {
|
||||
AllZone.display = display0;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getZone.
|
||||
@@ -630,11 +597,11 @@ public final class AllZone {
|
||||
public static void newGameCleanup() {
|
||||
Singletons.getModel().getGameState().newGameCleanup();
|
||||
|
||||
AllZone.getDisplay().showCombat("");
|
||||
AllZone.getDisplay().loadPrefs();
|
||||
Singletons.getControl().getMatchControl().showCombat("");
|
||||
Singletons.getModel().loadPrefs();
|
||||
AllZone.getInputControl().clearInput();
|
||||
AllZone.getColorChanger().reset();
|
||||
((GuiTopLevel) AllZone.getDisplay()).showStack();
|
||||
Singletons.getControl().getMatchControl().showStack();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -655,25 +622,6 @@ public final class AllZone {
|
||||
return AllZone.COLOR_CHANGER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the overlay.
|
||||
*
|
||||
* @return overlay
|
||||
*/
|
||||
public static FOverlay getOverlay() {
|
||||
return AllZone.overlay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the overlay.
|
||||
*
|
||||
* @param overlay0
|
||||
*   Overlay panel
|
||||
*/
|
||||
public static void setOverlay(final FOverlay overlay0) {
|
||||
AllZone.overlay = overlay0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the CardRatings object.
|
||||
*
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
package forge;
|
||||
|
||||
import javax.swing.JButton;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* ButtonUtil class.
|
||||
@@ -35,8 +37,8 @@ public class ButtonUtil {
|
||||
ButtonUtil.getOK().setText("OK");
|
||||
ButtonUtil.getCancel().setText("Cancel");
|
||||
|
||||
ButtonUtil.getOK().setSelectable(false);
|
||||
ButtonUtil.getCancel().setSelectable(false);
|
||||
ButtonUtil.getOK().setEnabled(false);
|
||||
ButtonUtil.getCancel().setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,8 +47,8 @@ public class ButtonUtil {
|
||||
* </p>
|
||||
*/
|
||||
public static void enableOnlyOK() {
|
||||
ButtonUtil.getOK().setSelectable(true);
|
||||
ButtonUtil.getCancel().setSelectable(false);
|
||||
ButtonUtil.getOK().setEnabled(true);
|
||||
ButtonUtil.getCancel().setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,8 +57,8 @@ public class ButtonUtil {
|
||||
* </p>
|
||||
*/
|
||||
public static void enableOnlyCancel() {
|
||||
ButtonUtil.getOK().setSelectable(false);
|
||||
ButtonUtil.getCancel().setSelectable(true);
|
||||
ButtonUtil.getOK().setEnabled(false);
|
||||
ButtonUtil.getCancel().setEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,8 +67,8 @@ public class ButtonUtil {
|
||||
* </p>
|
||||
*/
|
||||
public static void disableAll() {
|
||||
ButtonUtil.getOK().setSelectable(false);
|
||||
ButtonUtil.getCancel().setSelectable(false);
|
||||
ButtonUtil.getOK().setEnabled(false);
|
||||
ButtonUtil.getCancel().setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,8 +77,8 @@ public class ButtonUtil {
|
||||
* </p>
|
||||
*/
|
||||
public static void enableAll() {
|
||||
ButtonUtil.getOK().setSelectable(true);
|
||||
ButtonUtil.getCancel().setSelectable(true);
|
||||
ButtonUtil.getOK().setEnabled(true);
|
||||
ButtonUtil.getCancel().setEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,7 +87,7 @@ public class ButtonUtil {
|
||||
* </p>
|
||||
*/
|
||||
public static void disableOK() {
|
||||
ButtonUtil.getOK().setSelectable(false);
|
||||
ButtonUtil.getOK().setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,7 +96,7 @@ public class ButtonUtil {
|
||||
* </p>
|
||||
*/
|
||||
public static void disableCancel() {
|
||||
ButtonUtil.getCancel().setSelectable(false);
|
||||
ButtonUtil.getCancel().setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,8 +106,8 @@ public class ButtonUtil {
|
||||
*
|
||||
* @return a {@link forge.MyButton} object.
|
||||
*/
|
||||
private static MyButton getOK() {
|
||||
return AllZone.getDisplay().getButtonOK();
|
||||
private static JButton getOK() {
|
||||
return Singletons.getView().getMatchView().getBtnOK();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +117,7 @@ public class ButtonUtil {
|
||||
*
|
||||
* @return a {@link forge.MyButton} object.
|
||||
*/
|
||||
private static MyButton getCancel() {
|
||||
return AllZone.getDisplay().getButtonCancel();
|
||||
private static JButton getCancel() {
|
||||
return Singletons.getView().getMatchView().getBtnCancel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ import forge.card.CardRulesReader;
|
||||
import forge.card.replacement.ReplacementHandler;
|
||||
import forge.card.trigger.TriggerHandler;
|
||||
import forge.error.ErrorViewer;
|
||||
import forge.view.SplashFrame;
|
||||
import forge.view.toolbox.FProgressBar;
|
||||
|
||||
/**
|
||||
@@ -262,7 +263,7 @@ public class CardReader implements Runnable {
|
||||
*/
|
||||
protected final Card loadCardsUntilYouFind(final String cardName) {
|
||||
Card result = null;
|
||||
final FProgressBar barProgress = Singletons.getView().getProgressBar();
|
||||
final FProgressBar barProgress = SplashFrame.PROGRESS_BAR;
|
||||
|
||||
// Iterate through txt files or zip archive.
|
||||
// Report relevant numbers to progress monitor model.
|
||||
|
||||
@@ -716,7 +716,7 @@ public class Combat {
|
||||
this.addDefendingDamage(damageDealt, attacker);
|
||||
} else {
|
||||
if (attacker.hasKeyword("Trample") || (block.size() > 1)) {
|
||||
AllZone.getDisplay().assignDamage(attacker, block, damageDealt);
|
||||
Singletons.getControl().getMatchControl().assignDamage(attacker, block, damageDealt);
|
||||
} else {
|
||||
block.get(0).addAssignedDamage(damageDealt, attacking.get(i));
|
||||
}
|
||||
@@ -768,7 +768,7 @@ public class Combat {
|
||||
this.addDefendingDamage(damageDealt, attacker);
|
||||
} else {
|
||||
if (attacker.hasKeyword("Trample") || (block.size() > 1)) {
|
||||
AllZone.getDisplay().assignDamage(attacker, block, damageDealt);
|
||||
Singletons.getControl().getMatchControl().assignDamage(attacker, block, damageDealt);
|
||||
} else {
|
||||
block.get(0).addAssignedDamage(damageDealt, attacking.get(i));
|
||||
}
|
||||
|
||||
@@ -2264,7 +2264,7 @@ public class CombatUtil {
|
||||
* </p>
|
||||
*/
|
||||
public static void showCombat() {
|
||||
AllZone.getDisplay().showCombat("");
|
||||
Singletons.getControl().getMatchControl().showCombat("");
|
||||
|
||||
Card[] defend = null;
|
||||
final StringBuilder display = new StringBuilder();
|
||||
@@ -2304,7 +2304,7 @@ public class CombatUtil {
|
||||
}
|
||||
} // loop through attackers
|
||||
}
|
||||
AllZone.getDisplay().showCombat(display.toString().trim());
|
||||
Singletons.getControl().getMatchControl().showCombat(display.toString().trim());
|
||||
|
||||
} // showBlockers()
|
||||
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Display interface.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface Display {
|
||||
/**
|
||||
* <p>
|
||||
* showMessage.
|
||||
* </p>
|
||||
*
|
||||
* @param s
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
void showMessage(String s);
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getButtonOK.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link forge.MyButton} object.
|
||||
*/
|
||||
MyButton getButtonOK();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getButtonCancel.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link forge.MyButton} object.
|
||||
*/
|
||||
MyButton getButtonCancel();
|
||||
|
||||
// public void showStatus(String message);
|
||||
/**
|
||||
* <p>
|
||||
* showCombat.
|
||||
* </p>
|
||||
*
|
||||
* @param message
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
void showCombat(String message);
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* setVisible.
|
||||
* </p>
|
||||
*
|
||||
* @param b
|
||||
* a boolean.
|
||||
*/
|
||||
void setVisible(boolean b);
|
||||
|
||||
// assigns combat damage, used by Combat.setAssignedDamage()
|
||||
/**
|
||||
* <p>
|
||||
* assignDamage.
|
||||
* </p>
|
||||
*
|
||||
* @param attacker
|
||||
* a {@link forge.Card} object.
|
||||
* @param blockers
|
||||
* a {@link forge.CardList} object.
|
||||
* @param damage
|
||||
* a int.
|
||||
*/
|
||||
void assignDamage(Card attacker, CardList blockers, int damage);
|
||||
|
||||
// public void addAssignDamage(Card attacker, Card blocker, int damage);
|
||||
// public void addAssignDamage(Card attacker, int damage);
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* stopAtPhase.
|
||||
* </p>
|
||||
*
|
||||
* @param turn
|
||||
* a {@link forge.Player} object.
|
||||
* @param phase
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
boolean stopAtPhase(Player turn, String phase);
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* loadPrefs.
|
||||
* </p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
boolean loadPrefs();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* savePrefs.
|
||||
* </p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
boolean savePrefs();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* canLoseByDecking.
|
||||
* </p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
boolean canLoseByDecking();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* setCard.
|
||||
* </p>
|
||||
*
|
||||
* @param c
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
void setCard(Card c);
|
||||
}
|
||||
@@ -60,7 +60,6 @@ import forge.properties.ForgePreferences.FPref;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants.Lang.GameAction.GameActionText;
|
||||
import forge.util.MyRandom;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.match.ViewWinLose;
|
||||
|
||||
/**
|
||||
@@ -896,7 +895,7 @@ public class GameAction {
|
||||
final boolean refreeze = AllZone.getStack().isFrozen();
|
||||
AllZone.getStack().setFrozen(true);
|
||||
|
||||
final JFrame frame = (JFrame) AllZone.getDisplay();
|
||||
final JFrame frame = Singletons.getView();
|
||||
if (!frame.isDisplayable()) {
|
||||
return;
|
||||
}
|
||||
@@ -1637,8 +1636,8 @@ public class GameAction {
|
||||
AllZone.getComputerPlayer().drawCard();
|
||||
}
|
||||
|
||||
AllZone.getDisplay().setCard(AllZone.getHumanPlayer().getCardsIn(Zone.Hand).get(0));
|
||||
((GuiTopLevel) (AllZone.getDisplay())).getController().getMatchView().getInputController().updateGameCount();
|
||||
Singletons.getControl().getMatchControl().setCard(AllZone.getHumanPlayer().getCardsIn(Zone.Hand).get(0));
|
||||
Singletons.getControl().getMatchControl().getMessageControl().updateGameCount();
|
||||
|
||||
AllZone.getInputControl().setInput(new InputMulligan());
|
||||
PhaseHandler.setGameBegins(1);
|
||||
|
||||
@@ -375,7 +375,7 @@ public final class GameActionUtil {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public static boolean showYesNoDialog(final Card c, String question, final boolean defaultNo) {
|
||||
AllZone.getDisplay().setCard(c);
|
||||
Singletons.getControl().getMatchControl().setCard(c);
|
||||
final StringBuilder title = new StringBuilder();
|
||||
title.append(c.getName()).append(" - Ability");
|
||||
|
||||
@@ -461,7 +461,7 @@ public final class GameActionUtil {
|
||||
* @return a boolean.
|
||||
*/
|
||||
private static boolean showLandfallDialog(final Card c) {
|
||||
AllZone.getDisplay().setCard(c);
|
||||
Singletons.getControl().getMatchControl().setCard(c);
|
||||
final String[] choices = { "Yes", "No" };
|
||||
|
||||
Object q = null;
|
||||
|
||||
@@ -71,14 +71,11 @@ public class GuiMultipleBlockers extends JFrame {
|
||||
* a {@link forge.CardList} object.
|
||||
* @param damage
|
||||
* a int.
|
||||
* @param display
|
||||
* a {@link forge.CardContainer} object.
|
||||
*/
|
||||
public GuiMultipleBlockers(final Card attacker, final CardList creatureList, final int damage, final CardContainer display) {
|
||||
public GuiMultipleBlockers(final Card attacker, final CardList creatureList, final int damage) {
|
||||
this();
|
||||
this.assignDamage = damage;
|
||||
this.updateDamageLabel(); // update user message about assigning damage
|
||||
this.guiDisplay = display;
|
||||
this.att = attacker;
|
||||
this.blockers = creatureList;
|
||||
|
||||
@@ -241,9 +238,7 @@ public class GuiMultipleBlockers extends JFrame {
|
||||
final CardContainer cardPanel = (CardContainer) o;
|
||||
final Card c = cardPanel.getCard();
|
||||
|
||||
if (this.guiDisplay != null) {
|
||||
this.guiDisplay.setCard(c);
|
||||
}
|
||||
Singletons.getControl().getMatchControl().setCard(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ public class HumanPlayer extends Player {
|
||||
protected final void clashMoveToTopOrBottom(final Card c) {
|
||||
String choice = "";
|
||||
final String[] choices = { "top", "bottom" };
|
||||
AllZone.getDisplay().setCard(c);
|
||||
Singletons.getControl().getMatchControl().setCard(c);
|
||||
choice = GuiUtils.getChoice(c.getName() + " - Top or bottom of Library", choices);
|
||||
|
||||
if (choice.equals("bottom")) {
|
||||
|
||||
@@ -746,7 +746,7 @@ public class MagicStack extends MyObservable {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage("Mana Vortex - select a land to sacrifice");
|
||||
Singletons.getControl().getMatchControl().showMessage("Mana Vortex - select a land to sacrifice");
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -938,7 +938,7 @@ public class MagicStack extends MyObservable {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage("Choose target creature to haunt.");
|
||||
Singletons.getControl().getMatchControl().showMessage("Choose target creature to haunt.");
|
||||
ButtonUtil.disableAll();
|
||||
}
|
||||
|
||||
@@ -952,7 +952,7 @@ public class MagicStack extends MyObservable {
|
||||
MagicStack.this.add(haunterDiesWork);
|
||||
this.stop();
|
||||
} else {
|
||||
AllZone.getDisplay().showMessage("Cannot target this card (Shroud? Protection?).");
|
||||
Singletons.getControl().getMatchControl().showMessage("Cannot target this card (Shroud? Protection?).");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.Stack;
|
||||
import com.esotericsoftware.minlog.Log;
|
||||
|
||||
import forge.Constant.Zone;
|
||||
import forge.view.GuiTopLevel;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -319,7 +318,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
|
||||
|
||||
// UNTAP
|
||||
if (phase.equals(Constant.Phase.UNTAP)) {
|
||||
((GuiTopLevel) AllZone.getDisplay()).showStack();
|
||||
Singletons.getControl().getMatchControl().showStack();
|
||||
PhaseUtil.handleUntap();
|
||||
}
|
||||
// UPKEEP
|
||||
@@ -411,11 +410,11 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
|
||||
AllZone.getEndOfCombat().executeUntil();
|
||||
AllZone.getEndOfCombat().executeAt();
|
||||
CombatUtil.showCombat();
|
||||
((GuiTopLevel) AllZone.getDisplay()).showStack();
|
||||
Singletons.getControl().getMatchControl().showStack();
|
||||
}
|
||||
else if (phase.equals(Constant.Phase.MAIN2)) {
|
||||
CombatUtil.showCombat();
|
||||
((GuiTopLevel) AllZone.getDisplay()).showStack();
|
||||
Singletons.getControl().getMatchControl().showStack();
|
||||
}
|
||||
// END_OF_TURN
|
||||
else if (phase.equals(Constant.Phase.END_OF_TURN)) {
|
||||
@@ -526,7 +525,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
|
||||
}
|
||||
|
||||
if (this.getPhase().equals(Constant.Phase.COMBAT_END)) {
|
||||
((GuiTopLevel) (AllZone.getDisplay())).showStack();
|
||||
Singletons.getControl().getMatchControl().showStack();
|
||||
AllZone.getCombat().reset();
|
||||
this.resetAttackedThisCombat(this.getPlayerTurn());
|
||||
this.bCombat = false;
|
||||
|
||||
@@ -20,8 +20,7 @@ package forge;
|
||||
import java.util.HashMap;
|
||||
|
||||
import forge.Constant.Zone;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.match.MatchTopLevel;
|
||||
import forge.control.ControlMatchUI;
|
||||
import forge.view.match.ViewField.PhaseLabel;
|
||||
|
||||
/**
|
||||
@@ -382,7 +381,7 @@ public class PhaseUtil {
|
||||
public static void visuallyActivatePhase(final String s) {
|
||||
PhaseLabel lbl = null;
|
||||
final Player p = AllZone.getPhaseHandler().getPlayerTurn();
|
||||
final MatchTopLevel t = ((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView();
|
||||
final ControlMatchUI t = Singletons.getControl().getMatchControl();
|
||||
|
||||
int i; // Index of field; computer is 0, human is 1
|
||||
if (p.isComputer()) {
|
||||
@@ -392,38 +391,35 @@ public class PhaseUtil {
|
||||
}
|
||||
|
||||
if (s.equals(Constant.Phase.UPKEEP)) {
|
||||
lbl = t.getFieldControllers().get(i).getView().getLblUpkeep();
|
||||
lbl = t.getFieldControls().get(i).getView().getLblUpkeep();
|
||||
} else if (s.equals(Constant.Phase.DRAW)) {
|
||||
lbl = t.getFieldControllers().get(i).getView().getLblDraw();
|
||||
lbl = t.getFieldControls().get(i).getView().getLblDraw();
|
||||
} else if (s.equals(Constant.Phase.MAIN1)) {
|
||||
lbl = t.getFieldControllers().get(i).getView().getLblMain1();
|
||||
lbl = t.getFieldControls().get(i).getView().getLblMain1();
|
||||
} else if (s.equals(Constant.Phase.COMBAT_BEGIN)) {
|
||||
lbl = t.getFieldControllers().get(i).getView().getLblBeginCombat();
|
||||
lbl = t.getFieldControls().get(i).getView().getLblBeginCombat();
|
||||
} else if (s.equals(Constant.Phase.COMBAT_DECLARE_ATTACKERS)) {
|
||||
lbl = t.getFieldControllers().get(i).getView().getLblDeclareAttackers();
|
||||
lbl = t.getFieldControls().get(i).getView().getLblDeclareAttackers();
|
||||
} else if (s.equals(Constant.Phase.COMBAT_DECLARE_BLOCKERS)) {
|
||||
lbl = t.getFieldControllers().get(i).getView().getLblDeclareBlockers();
|
||||
lbl = t.getFieldControls().get(i).getView().getLblDeclareBlockers();
|
||||
} else if (s.equals(Constant.Phase.COMBAT_DAMAGE)) {
|
||||
lbl = t.getFieldControllers().get(i).getView().getLblCombatDamage();
|
||||
lbl = t.getFieldControls().get(i).getView().getLblCombatDamage();
|
||||
} else if (s.equals(Constant.Phase.COMBAT_FIRST_STRIKE_DAMAGE)) {
|
||||
lbl = t.getFieldControllers().get(i).getView().getLblFirstStrike();
|
||||
lbl = t.getFieldControls().get(i).getView().getLblFirstStrike();
|
||||
} else if (s.equals(Constant.Phase.COMBAT_END)) {
|
||||
lbl = t.getFieldControllers().get(i).getView().getLblEndCombat();
|
||||
lbl = t.getFieldControls().get(i).getView().getLblEndCombat();
|
||||
} else if (s.equals(Constant.Phase.MAIN2)) {
|
||||
lbl = t.getFieldControllers().get(i).getView().getLblMain2();
|
||||
lbl = t.getFieldControls().get(i).getView().getLblMain2();
|
||||
} else if (s.equals(Constant.Phase.END_OF_TURN)) {
|
||||
lbl = t.getFieldControllers().get(i).getView().getLblEndTurn();
|
||||
lbl = t.getFieldControls().get(i).getView().getLblEndTurn();
|
||||
} else if (s.equals(Constant.Phase.CLEANUP)) {
|
||||
lbl = t.getFieldControllers().get(i).getView().getLblCleanup();
|
||||
lbl = t.getFieldControls().get(i).getView().getLblCleanup();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
t.getController().resetAllPhaseButtons();
|
||||
// Could be a potential recursion bug here, but I checked and hopefully there isn't.
|
||||
// Please remove this comments if > 1 week and no problems. Doublestrike 12-01-11
|
||||
t.repaint();
|
||||
// End potential recursion bug
|
||||
t.resetAllPhaseButtons();
|
||||
Singletons.getView().getMatchView().repaint();
|
||||
lbl.setActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,6 @@ import forge.card.staticability.StaticAbility;
|
||||
import forge.game.GameLossReason;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.util.MyRandom;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.match.MatchTopLevel;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -1284,7 +1282,7 @@ public abstract class Player extends GameEntity {
|
||||
AllZone.getTriggerHandler().runTrigger("Drawn", runParams);
|
||||
}
|
||||
// lose:
|
||||
else if (!Constant.Runtime.DEV_MODE[0] || AllZone.getDisplay().canLoseByDecking()) {
|
||||
else if (!Constant.Runtime.DEV_MODE[0] || Constant.Runtime.MILL[0]) {
|
||||
// if devMode is off, or canLoseByDecking is Enabled, run Lose
|
||||
// Condition
|
||||
if (!this.cantLose()) {
|
||||
@@ -1812,9 +1810,7 @@ public abstract class Player extends GameEntity {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean canPlayLand() {
|
||||
|
||||
final MatchTopLevel t = ((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView();
|
||||
if (t.getTabberController().getView().getLblUnlimitedLands().getEnabled() && this.isHuman() && Constant.Runtime.DEV_MODE[0]) {
|
||||
if (Singletons.getView().getMatchView().getViewTabber().getLblUnlimitedLands().getEnabled() && this.isHuman() && Constant.Runtime.DEV_MODE[0]) {
|
||||
return PhaseHandler.canCastSorcery(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public final class PlayerUtil {
|
||||
if (AllZone.getHumanPlayer().getZone(Zone.Hand).size() == 0) {
|
||||
this.stop();
|
||||
}
|
||||
AllZone.getDisplay().showMessage(
|
||||
Singletons.getControl().getMatchControl().showMessage(
|
||||
"Select " + (nCards - this.n) + " cards to discard, unless you discard a " + uType + ".");
|
||||
ButtonUtil.disableAll();
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public final class PlayerUtil {
|
||||
this.stop();
|
||||
}
|
||||
|
||||
AllZone.getDisplay().showMessage("Select a card to discard");
|
||||
Singletons.getControl().getMatchControl().showMessage("Select a card to discard");
|
||||
ButtonUtil.disableAll();
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ public final class PlayerUtil {
|
||||
this.stop();
|
||||
}
|
||||
|
||||
AllZone.getDisplay().showMessage("Chains of Mephistopheles:\n" + "Select a card to discard");
|
||||
Singletons.getControl().getMatchControl().showMessage("Chains of Mephistopheles:\n" + "Select a card to discard");
|
||||
ButtonUtil.disableAll();
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ public final class PlayerUtil {
|
||||
return;
|
||||
}
|
||||
|
||||
AllZone.getDisplay().showMessage(message + " (" + (nCards - this.n) + " left)");
|
||||
Singletons.getControl().getMatchControl().showMessage(message + " (" + (nCards - this.n) + " left)");
|
||||
ButtonUtil.disableAll();
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ public final class PlayerUtil {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage("Select a card to put on the " + topOrBottom + " of your library.");
|
||||
Singletons.getControl().getMatchControl().showMessage("Select a card to put on the " + topOrBottom + " of your library.");
|
||||
ButtonUtil.disableAll();
|
||||
|
||||
if ((this.n == num) || (AllZone.getHumanPlayer().getZone(Zone.Hand).size() == 0)) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge;
|
||||
|
||||
import forge.control.FControl;
|
||||
import forge.model.FModel;
|
||||
import forge.view.FView;
|
||||
|
||||
@@ -29,6 +30,8 @@ public final class Singletons {
|
||||
|
||||
private static FView view = null;
|
||||
|
||||
private static FControl control = null;
|
||||
|
||||
/**
|
||||
* Do not instantiate.
|
||||
*/
|
||||
@@ -74,4 +77,22 @@ public final class Singletons {
|
||||
Singletons.view = theView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the control.
|
||||
*
|
||||
* @return the view
|
||||
*/
|
||||
public static FControl getControl() {
|
||||
return Singletons.control;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the control.
|
||||
*
|
||||
* @param theControl
|
||||
* the view to set
|
||||
*/
|
||||
public static void setControl(final FControl theControl) {
|
||||
Singletons.control = theControl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage("Select one tapped land to untap");
|
||||
Singletons.getControl().getMatchControl().showMessage("Select one tapped land to untap");
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage("Select one tapped artifact to untap");
|
||||
Singletons.getControl().getMatchControl().showMessage("Select one tapped artifact to untap");
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage("Select one creature to untap");
|
||||
Singletons.getControl().getMatchControl().showMessage("Select one creature to untap");
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -486,7 +486,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage(
|
||||
Singletons.getControl().getMatchControl().showMessage(
|
||||
abyss.getName() + " - Select one nonartifact creature to destroy");
|
||||
ButtonUtil.disableAll();
|
||||
}
|
||||
@@ -554,7 +554,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage(
|
||||
Singletons.getControl().getMatchControl().showMessage(
|
||||
"Yawgmoth Demon - Select one artifact to sacrifice or be dealt 2 damage");
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
@@ -2303,7 +2303,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage(
|
||||
Singletons.getControl().getMatchControl().showMessage(
|
||||
c.getName() + " - Select new target creature. (Click Cancel to remain as is.)");
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
@@ -2375,7 +2375,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
this.stop();
|
||||
return;
|
||||
}
|
||||
AllZone.getDisplay().showMessage(
|
||||
Singletons.getControl().getMatchControl().showMessage(
|
||||
source.getName() + " - Select " + num
|
||||
+ " untapped artifact(s), creature(s), or land(s) you control");
|
||||
ButtonUtil.disableAll();
|
||||
@@ -2424,7 +2424,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage(crd + " - Discard a card from your hand");
|
||||
Singletons.getControl().getMatchControl().showMessage(crd + " - Discard a card from your hand");
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ import forge.Counters;
|
||||
import forge.PhaseHandler;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
import forge.card.cost.Cost;
|
||||
import forge.card.cost.CostUtil;
|
||||
@@ -1384,7 +1385,7 @@ public class AbilityFactoryCounters {
|
||||
@Override
|
||||
public void showMessage() {
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
AllZone.getDisplay().showMessage("Proliferate: Choose permanents and/or players");
|
||||
Singletons.getControl().getMatchControl().showMessage("Proliferate: Choose permanents and/or players");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,6 +43,7 @@ import forge.Counters;
|
||||
import forge.GameActionUtil;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.cost.Cost;
|
||||
import forge.card.spellability.Ability;
|
||||
import forge.card.spellability.AbilityActivated;
|
||||
@@ -851,7 +852,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage("Discard a land card (or select Mox Diamond to sacrifice it)");
|
||||
Singletons.getControl().getMatchControl().showMessage("Discard a land card (or select Mox Diamond to sacrifice it)");
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -1223,7 +1224,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(card.getName()).append(" - Exile cards from hand. Currently, ");
|
||||
sb.append(this.exiled.size()).append(" selected. (Press OK when done.)");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyOK();
|
||||
}
|
||||
|
||||
@@ -1258,7 +1259,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
||||
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(card.getName()).append(" - Returning cards to top of library.");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
|
||||
// Then look at the exiled cards and put them on
|
||||
// top of your library in any order.
|
||||
@@ -1585,7 +1586,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
||||
public void showMessage() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(cardName).append(" - Select an artifact on the battlefield");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -1637,7 +1638,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
||||
if (AllZone.getHumanPlayer().getZone(Constant.Zone.Hand).size() == 0) {
|
||||
this.stop();
|
||||
}
|
||||
AllZone.getDisplay().showMessage(prompt);
|
||||
Singletons.getControl().getMatchControl().showMessage(prompt);
|
||||
ButtonUtil.disableAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import forge.Counters;
|
||||
import forge.GameActionUtil;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.cost.Cost;
|
||||
import forge.card.spellability.Ability;
|
||||
@@ -372,7 +373,7 @@ public class CardFactoryCreatures {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage("Select an artifact you control");
|
||||
Singletons.getControl().getMatchControl().showMessage("Select an artifact you control");
|
||||
ButtonUtil.disableAll();
|
||||
}
|
||||
|
||||
@@ -502,7 +503,7 @@ public class CardFactoryCreatures {
|
||||
@Override
|
||||
public void showMessage() {
|
||||
ButtonUtil.disableAll();
|
||||
AllZone.getDisplay().showMessage("Exile a nonland card from your hand.");
|
||||
Singletons.getControl().getMatchControl().showMessage("Exile a nonland card from your hand.");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -555,9 +556,9 @@ public class CardFactoryCreatures {
|
||||
@Override
|
||||
public void showMessage() {
|
||||
if (index[0] == 0) {
|
||||
AllZone.getDisplay().showMessage("Select target land you control.");
|
||||
Singletons.getControl().getMatchControl().showMessage("Select target land you control.");
|
||||
} else {
|
||||
AllZone.getDisplay().showMessage("Select target land opponent controls.");
|
||||
Singletons.getControl().getMatchControl().showMessage("Select target land opponent controls.");
|
||||
}
|
||||
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
@@ -1249,7 +1250,7 @@ public class CardFactoryCreatures {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage(msg);
|
||||
Singletons.getControl().getMatchControl().showMessage(msg);
|
||||
ButtonUtil.enableOnlyOK();
|
||||
}
|
||||
|
||||
@@ -1665,7 +1666,7 @@ public class CardFactoryCreatures {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(card.getName()).append(" - Reveal an artifact. Revealed ");
|
||||
sb.append(this.revealed.size()).append(" so far. Click OK when done.");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyOK();
|
||||
}
|
||||
|
||||
@@ -1780,7 +1781,7 @@ public class CardFactoryCreatures {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("Select up to 5 target permanents. Selected (");
|
||||
sb.append(targetPerms.size()).append(") so far. Click OK when done.");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyOK();
|
||||
}
|
||||
|
||||
@@ -1819,7 +1820,7 @@ public class CardFactoryCreatures {
|
||||
public void showMessage() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(card.getName()).append(" - Select target player");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -1877,7 +1878,7 @@ public class CardFactoryCreatures {
|
||||
toDisplay += "Currently, (" + toSac.size() + ") selected with a total power of: "
|
||||
+ getTotalPower();
|
||||
toDisplay += " Click OK when Done.";
|
||||
AllZone.getDisplay().showMessage(toDisplay);
|
||||
Singletons.getControl().getMatchControl().showMessage(toDisplay);
|
||||
ButtonUtil.enableAll();
|
||||
}
|
||||
|
||||
@@ -2095,7 +2096,7 @@ public class CardFactoryCreatures {
|
||||
message += "or artifact ";
|
||||
}
|
||||
message += "on the battlefield";
|
||||
AllZone.getDisplay().showMessage(cardName + " - " + message);
|
||||
Singletons.getControl().getMatchControl().showMessage(cardName + " - " + message);
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -2335,7 +2336,7 @@ public class CardFactoryCreatures {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage(card + " - Select an artifact you control");
|
||||
Singletons.getControl().getMatchControl().showMessage(card + " - Select an artifact you control");
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import forge.Counters;
|
||||
import forge.GameActionUtil;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.cost.Cost;
|
||||
import forge.card.spellability.Ability;
|
||||
import forge.card.spellability.AbilityActivated;
|
||||
@@ -208,7 +209,7 @@ class CardFactoryLands {
|
||||
public void showMessage() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(cardName).append(" - Select an untapped land to sacrifice");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -226,7 +227,7 @@ class CardFactoryLands {
|
||||
paid[0]++;
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(cardName).append(" - Select an untapped land to sacrifice");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
} else {
|
||||
this.stop();
|
||||
}
|
||||
@@ -297,7 +298,7 @@ class CardFactoryLands {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage(
|
||||
Singletons.getControl().getMatchControl().showMessage(
|
||||
cardName + " - Select one " + type[0] + " to sacrifice");
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
@@ -390,7 +391,7 @@ class CardFactoryLands {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage(
|
||||
Singletons.getControl().getMatchControl().showMessage(
|
||||
"Scorched Ruins - Select an untapped land to sacrifice");
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
@@ -407,7 +408,7 @@ class CardFactoryLands {
|
||||
AllZone.getGameAction().sacrifice(c);
|
||||
if (paid[0] < 1) {
|
||||
paid[0]++;
|
||||
AllZone.getDisplay().showMessage(
|
||||
Singletons.getControl().getMatchControl().showMessage(
|
||||
"Scorched Ruins - Select an untapped land to sacrifice");
|
||||
} else {
|
||||
this.stop();
|
||||
@@ -485,7 +486,7 @@ class CardFactoryLands {
|
||||
public void showMessage() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(card.getName()).append(" - Reveal a card.");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -671,7 +672,7 @@ class CardFactoryLands {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(cardName);
|
||||
sb.append(" - Select one non-Lair land to return to your hand");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -740,7 +741,7 @@ class CardFactoryLands {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(card).append(" - Select one untapped ");
|
||||
sb.append(type[0]).append(" to return");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ import forge.HandSizeOp;
|
||||
import forge.Player;
|
||||
import forge.PlayerUtil;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.cost.Cost;
|
||||
import forge.card.spellability.AbilitySub;
|
||||
import forge.card.spellability.Spell;
|
||||
@@ -116,9 +117,9 @@ public class CardFactorySorceries {
|
||||
@Override
|
||||
public void showMessage() {
|
||||
if (index[0] == 0) {
|
||||
AllZone.getDisplay().showMessage("Select target land you control.");
|
||||
Singletons.getControl().getMatchControl().showMessage("Select target land you control.");
|
||||
} else {
|
||||
AllZone.getDisplay().showMessage("Select target land opponent controls.");
|
||||
Singletons.getControl().getMatchControl().showMessage("Select target land opponent controls.");
|
||||
}
|
||||
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
@@ -608,7 +609,7 @@ public class CardFactorySorceries {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("Select target ").append(humanBasic.get(this.count));
|
||||
sb.append(" land to not sacrifice");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
}
|
||||
@@ -1068,7 +1069,7 @@ public class CardFactorySorceries {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("Select target creatures and/or players. Currently, ");
|
||||
sb.append(this.getNumTargets()).append(" targets. Click OK when done.");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
}
|
||||
|
||||
private int getNumTargets() {
|
||||
@@ -1102,11 +1103,11 @@ public class CardFactorySorceries {
|
||||
@Override
|
||||
public void selectCard(final Card c, final PlayerZone zone) {
|
||||
if (!c.canBeTargetedBy(spell)) {
|
||||
AllZone.getDisplay().showMessage("Cannot target this card.");
|
||||
Singletons.getControl().getMatchControl().showMessage("Cannot target this card.");
|
||||
return; // cannot target
|
||||
}
|
||||
if (targets.contains(c)) {
|
||||
AllZone.getDisplay().showMessage("You have already selected this target.");
|
||||
Singletons.getControl().getMatchControl().showMessage("You have already selected this target.");
|
||||
return; // cannot target the same creature twice.
|
||||
}
|
||||
|
||||
@@ -1119,11 +1120,11 @@ public class CardFactorySorceries {
|
||||
@Override
|
||||
public void selectPlayer(final Player player) {
|
||||
if (!player.canBeTargetedBy(spell)) {
|
||||
AllZone.getDisplay().showMessage("Cannot target this player.");
|
||||
Singletons.getControl().getMatchControl().showMessage("Cannot target this player.");
|
||||
return; // cannot target
|
||||
}
|
||||
if (targetPlayers.contains(player)) {
|
||||
AllZone.getDisplay().showMessage("You have already selected this player.");
|
||||
Singletons.getControl().getMatchControl().showMessage("You have already selected this player.");
|
||||
return; // cannot target the same player twice.
|
||||
}
|
||||
targetPlayers.add(player);
|
||||
@@ -1656,7 +1657,7 @@ public class CardFactorySorceries {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(cardName).append(" - Select a target creature to gain Fear (up to ");
|
||||
sb.append(this.stop - this.count).append(" more)");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableAll();
|
||||
}
|
||||
|
||||
@@ -1698,7 +1699,7 @@ public class CardFactorySorceries {
|
||||
public void showMessage() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(cardName).append(" - Select target creature to get -X/-X");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -1779,7 +1780,7 @@ public class CardFactorySorceries {
|
||||
public void showMessage() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(cardName).append(" - Select target player to lose life");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ import forge.HandSizeOp;
|
||||
import forge.PhaseHandler;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.cost.Cost;
|
||||
import forge.card.mana.ManaCost;
|
||||
@@ -807,7 +808,7 @@ public class CardFactoryUtil {
|
||||
if (spell.getTargetCard() != null) {
|
||||
this.stop();
|
||||
}
|
||||
AllZone.getDisplay().showMessage("Select target Spell: ");
|
||||
Singletons.getControl().getMatchControl().showMessage("Select target Spell: ");
|
||||
final Card choice = GuiUtils.getChoiceOptional("Choose a Spell", choices.toArray());
|
||||
if (choice != null) {
|
||||
spell.setTargetCard(choice);
|
||||
@@ -855,7 +856,7 @@ public class CardFactoryUtil {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage(message);
|
||||
Singletons.getControl().getMatchControl().showMessage(message);
|
||||
ButtonUtil.disableAll();
|
||||
}
|
||||
|
||||
@@ -1750,7 +1751,7 @@ public class CardFactoryUtil {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage(message);
|
||||
Singletons.getControl().getMatchControl().showMessage(message);
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -1762,7 +1763,7 @@ public class CardFactoryUtil {
|
||||
@Override
|
||||
public void selectCard(final Card card, final PlayerZone zone) {
|
||||
if (targeted && !card.canBeTargetedBy(spell)) {
|
||||
AllZone.getDisplay().showMessage("Cannot target this card (Shroud? Protection?).");
|
||||
Singletons.getControl().getMatchControl().showMessage("Cannot target this card (Shroud? Protection?).");
|
||||
} else if (choices.contains(card)) {
|
||||
spell.setTargetCard(card);
|
||||
if (spell.getManaCost().equals("0") || free) {
|
||||
@@ -1807,7 +1808,7 @@ public class CardFactoryUtil {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage(message);
|
||||
Singletons.getControl().getMatchControl().showMessage(message);
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -1889,7 +1890,7 @@ public class CardFactoryUtil {
|
||||
this.stop();
|
||||
}
|
||||
|
||||
AllZone.getDisplay().showMessage("Select a card to discard");
|
||||
Singletons.getControl().getMatchControl().showMessage("Select a card to discard");
|
||||
ButtonUtil.disableAll();
|
||||
}
|
||||
|
||||
@@ -1909,7 +1910,7 @@ public class CardFactoryUtil {
|
||||
}
|
||||
|
||||
void done() {
|
||||
AllZone.getDisplay().showMessage("Returning cards to hand.");
|
||||
Singletons.getControl().getMatchControl().showMessage("Returning cards to hand.");
|
||||
AllZone.getGameAction().exile(recall);
|
||||
final CardList grave = AllZone.getHumanPlayer().getCardsIn(Zone.Graveyard);
|
||||
for (int i = 1; i <= this.n; i++) {
|
||||
@@ -1951,7 +1952,7 @@ public class CardFactoryUtil {
|
||||
public void showMessage() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("Select target wolf to damage for ").append(spell.getSourceCard());
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -1993,7 +1994,7 @@ public class CardFactoryUtil {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage("Select target artifact creature");
|
||||
Singletons.getControl().getMatchControl().showMessage("Select target artifact creature");
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -3504,7 +3505,7 @@ public class CardFactoryUtil {
|
||||
public void showMessage() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("Select a ").append(type).append(" to untap");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -4724,7 +4725,7 @@ public class CardFactoryUtil {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage("Choose target creature to haunt.");
|
||||
Singletons.getControl().getMatchControl().showMessage("Choose target creature to haunt.");
|
||||
ButtonUtil.disableAll();
|
||||
}
|
||||
|
||||
@@ -4738,7 +4739,7 @@ public class CardFactoryUtil {
|
||||
AllZone.getStack().add(haunterDiesWork);
|
||||
this.stop();
|
||||
} else {
|
||||
AllZone.getDisplay().showMessage("Cannot target this card (Shroud? Protection?).");
|
||||
Singletons.getControl().getMatchControl().showMessage("Cannot target this card (Shroud? Protection?).");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -27,13 +27,13 @@ import javax.swing.SwingUtilities;
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardReader;
|
||||
import forge.Singletons;
|
||||
import forge.card.CardRules;
|
||||
import forge.error.ErrorViewer;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.item.CardDb;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.view.SplashFrame;
|
||||
import forge.view.toolbox.FProgressBar;
|
||||
|
||||
/**
|
||||
@@ -82,7 +82,7 @@ public class PreloadingCardFactory extends AbstractCardFactory {
|
||||
try {
|
||||
this.readCards(file);
|
||||
|
||||
final FProgressBar barProgress = Singletons.getView().getProgressBar();
|
||||
final FProgressBar barProgress = SplashFrame.PROGRESS_BAR;
|
||||
if (barProgress != null) {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -27,6 +27,7 @@ import forge.Constant;
|
||||
import forge.Constant.Zone;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.gui.input.Input;
|
||||
@@ -325,7 +326,7 @@ public class CostDiscard extends CostPartWithList {
|
||||
sb.append(nNeeded - this.nDiscard);
|
||||
sb.append(" remaining.");
|
||||
}
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import forge.Constant.Zone;
|
||||
import forge.GameActionUtil;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.gui.GuiUtils;
|
||||
@@ -400,7 +401,7 @@ public class CostExile extends CostPartWithList {
|
||||
this.typeList = sa.getActivatingPlayer().getCardsIn(part.getFrom());
|
||||
this.typeList = this.typeList.getValidCards(type.split(";"), sa.getActivatingPlayer(),
|
||||
sa.getSourceCard());
|
||||
AllZone.getDisplay().showMessage(msg.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(msg.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import forge.Constant.Zone;
|
||||
import forge.PhaseHandler;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
@@ -275,7 +276,7 @@ public class CostMana extends CostPart {
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
AllZone.getDisplay().showMessage(
|
||||
Singletons.getControl().getMatchControl().showMessage(
|
||||
"Pay X Mana Cost for " + sa.getSourceCard().getName() + "\n" + this.xPaid + " Paid so far.");
|
||||
}
|
||||
|
||||
@@ -472,7 +473,7 @@ public class CostMana extends CostPart {
|
||||
public void showMessage() {
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
final String displayMana = this.mana.toString().replace("X", "").trim();
|
||||
AllZone.getDisplay().showMessage("Pay Mana Cost: " + displayMana);
|
||||
Singletons.getControl().getMatchControl().showMessage("Pay Mana Cost: " + displayMana);
|
||||
|
||||
final StringBuilder msg = new StringBuilder("Pay Mana Cost: " + displayMana);
|
||||
if (this.phyLifeToLose > 0) {
|
||||
@@ -485,7 +486,7 @@ public class CostMana extends CostPart {
|
||||
msg.append("\n(Click on your life total to pay life for phyrexian mana.)");
|
||||
}
|
||||
|
||||
AllZone.getDisplay().showMessage(msg.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(msg.toString());
|
||||
if (this.mana.isPaid()) {
|
||||
this.done();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.ButtonUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
@@ -25,6 +24,7 @@ import forge.Constant.Zone;
|
||||
import forge.Counters;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
@@ -271,7 +271,7 @@ public class CostPutCounter extends CostPartWithList {
|
||||
this.typeList = sa.getActivatingPlayer().getCardsIn(Zone.Battlefield);
|
||||
this.typeList = this.typeList.getValidCards(type.split(";"), sa.getActivatingPlayer(),
|
||||
sa.getSourceCard());
|
||||
AllZone.getDisplay().showMessage(msg.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(msg.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import forge.ComputerUtil;
|
||||
import forge.Constant.Zone;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.gui.input.Input;
|
||||
@@ -231,7 +232,7 @@ public class CostReturn extends CostPartWithList {
|
||||
this.typeList = sa.getActivatingPlayer().getCardsIn(Zone.Battlefield);
|
||||
this.typeList = this.typeList.getValidCards(type.split(";"), sa.getActivatingPlayer(),
|
||||
sa.getSourceCard());
|
||||
AllZone.getDisplay().showMessage(msg.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(msg.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import forge.Constant;
|
||||
import forge.Constant.Zone;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.gui.GuiUtils;
|
||||
@@ -256,7 +257,7 @@ public class CostReveal extends CostPartWithList {
|
||||
sb.append(nNeeded - this.nReveal);
|
||||
sb.append(" remaining.");
|
||||
}
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import forge.ComputerUtil;
|
||||
import forge.Constant.Zone;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.gui.input.Input;
|
||||
@@ -273,7 +274,7 @@ public class CostSacrifice extends CostPartWithList {
|
||||
msg.append("s");
|
||||
}
|
||||
|
||||
AllZone.getDisplay().showMessage(msg.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(msg.toString());
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.ButtonUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
@@ -27,6 +26,7 @@ import forge.Constant;
|
||||
import forge.Constant.Zone;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.gui.input.Input;
|
||||
@@ -243,7 +243,7 @@ public class CostTapType extends CostPartWithList {
|
||||
}
|
||||
|
||||
final int left = nCards - this.nTapped;
|
||||
AllZone.getDisplay()
|
||||
Singletons.getControl().getMatchControl()
|
||||
.showMessage("Select a " + tapType.getDescription() + " to tap (" + left + " left)");
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import forge.Constant;
|
||||
import forge.Constant.Zone;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.gui.input.Input;
|
||||
|
||||
@@ -329,7 +330,7 @@ public class TargetSelection {
|
||||
sb.append("\n");
|
||||
sb.append(tgt.getVTSelection());
|
||||
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
|
||||
// If reached Minimum targets, enable OK button
|
||||
if (!tgt.isMinTargetsChosen(sa.getSourceCard(), sa)) {
|
||||
@@ -361,7 +362,7 @@ public class TargetSelection {
|
||||
// leave this in temporarily, there some seriously wrong things
|
||||
// going on here
|
||||
if (targeted && !card.canBeTargetedBy(sa)) {
|
||||
AllZone.getDisplay().showMessage("Cannot target this card (Shroud? Protection? Restrictions?).");
|
||||
Singletons.getControl().getMatchControl().showMessage("Cannot target this card (Shroud? Protection? Restrictions?).");
|
||||
} else if (choices.contains(card)) {
|
||||
tgt.addTarget(card);
|
||||
this.done();
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package forge.control;
|
||||
|
||||
import forge.view.home.HomeTopLevel;
|
||||
import forge.view.ViewHomeUI;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this type.
|
||||
*
|
||||
*/
|
||||
public class ControlHomeUI {
|
||||
private HomeTopLevel view;
|
||||
private ViewHomeUI view;
|
||||
|
||||
/** @param v0   HomeTopLevel */
|
||||
public ControlHomeUI(HomeTopLevel v0) {
|
||||
/** @param v0   ViewHomeUI */
|
||||
public ControlHomeUI(ViewHomeUI v0) {
|
||||
view = v0;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ public class ControlHomeUI {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
/** @return HomeTopLevel */
|
||||
public HomeTopLevel getView() {
|
||||
/** @return ViewHomeUI */
|
||||
public ViewHomeUI getView() {
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,24 +17,38 @@
|
||||
*/
|
||||
package forge.control;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardContainer;
|
||||
import forge.CardList;
|
||||
import forge.Constant;
|
||||
import forge.Constant.Zone;
|
||||
import forge.GuiMultipleBlockers;
|
||||
import forge.ImageCache;
|
||||
import forge.Player;
|
||||
import forge.Singletons;
|
||||
import forge.control.match.ControlDetail;
|
||||
import forge.control.match.ControlDock;
|
||||
import forge.control.match.ControlField;
|
||||
import forge.view.match.MatchTopLevel;
|
||||
import forge.control.match.ControlHand;
|
||||
import forge.control.match.ControlMessage;
|
||||
import forge.control.match.ControlPicture;
|
||||
import forge.control.match.ControlTabber;
|
||||
import forge.view.ViewMatchUI;
|
||||
import forge.view.match.ViewField;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* ControlMatchUI
|
||||
* </p>
|
||||
* Top-level controller for matches. Implements Display.
|
||||
* Top-level controller for matches.
|
||||
*
|
||||
*/
|
||||
public class ControlMatchUI {
|
||||
private final MatchTopLevel view;
|
||||
public class ControlMatchUI implements CardContainer {
|
||||
private final ViewMatchUI view;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -51,9 +65,9 @@ public class ControlMatchUI {
|
||||
* So, this class must be called after everything is already in place.
|
||||
*
|
||||
* @param v
|
||||
*   A MatchTopLevel object
|
||||
*   A ViewMatchUI object
|
||||
*/
|
||||
public ControlMatchUI(final MatchTopLevel v) {
|
||||
public ControlMatchUI(final ViewMatchUI v) {
|
||||
this.view = v;
|
||||
}
|
||||
|
||||
@@ -64,17 +78,16 @@ public class ControlMatchUI {
|
||||
public void initMatch() {
|
||||
// All child components have been assembled; observers and listeners can
|
||||
// be added safely.
|
||||
this.view.getTabberController().addObservers();
|
||||
this.view.getTabberController().addListeners();
|
||||
ControlMatchUI.this.getTabberControl().addObservers();
|
||||
ControlMatchUI.this.getTabberControl().addListeners();
|
||||
|
||||
this.view.getInputController().addListeners();
|
||||
ControlMatchUI.this.getMessageControl().addListeners();
|
||||
|
||||
this.view.getHandController().addObservers();
|
||||
this.view.getHandController().addListeners();
|
||||
ControlMatchUI.this.getHandControl().addObservers();
|
||||
ControlMatchUI.this.getHandControl().addListeners();
|
||||
|
||||
// Update all observers with values for start of match.
|
||||
final List<ControlField> fieldControllers = this.view.getFieldControllers();
|
||||
for (final ControlField f : fieldControllers) {
|
||||
for (final ControlField f : ControlMatchUI.this.getFieldControls()) {
|
||||
f.addObservers();
|
||||
f.addListeners();
|
||||
f.getPlayer().updateObservers();
|
||||
@@ -85,7 +98,7 @@ public class ControlMatchUI {
|
||||
AllZone.getStack().updateObservers();
|
||||
AllZone.getHumanPlayer().getZone(Zone.Battlefield).updateObservers();
|
||||
AllZone.getInputControl().updateObservers();
|
||||
this.view.getTabberController().updateObservers();
|
||||
ControlMatchUI.this.getTabberControl().updateObservers();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,15 +128,190 @@ public class ControlMatchUI {
|
||||
// This method is in the top-level controller because it affects ALL fields
|
||||
// (not just one).
|
||||
public void resetAllPhaseButtons() {
|
||||
final List<ControlField> fieldControllers = this.view.getFieldControllers();
|
||||
|
||||
for (final ControlField c : fieldControllers) {
|
||||
for (final ControlField c : ControlMatchUI.this.getFieldControls()) {
|
||||
c.resetPhaseButtons();
|
||||
}
|
||||
}
|
||||
|
||||
/** @return MatchTopLevel */
|
||||
public MatchTopLevel getView() {
|
||||
return view;
|
||||
/** @param s0   {@link java.lang.String} */
|
||||
public void showMessage(final String s0) {
|
||||
getMessageControl().setMessage(s0);
|
||||
}
|
||||
|
||||
/** */
|
||||
public void showStack() {
|
||||
ControlMatchUI.this.getTabberControl().showPnlStack();
|
||||
}
|
||||
|
||||
/** @param s0   {@link java.lang.String} */
|
||||
public void showCombat(final String s0) {
|
||||
ControlMatchUI.this.getTabberControl().getView().updateCombat(s0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the detail controller.
|
||||
*
|
||||
* @return ControlDetail
|
||||
*/
|
||||
public ControlDetail getDetailControl() {
|
||||
return view.getViewDetail().getControl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the picture controller.
|
||||
*
|
||||
* @return ControlPicture
|
||||
*/
|
||||
public ControlPicture getPictureControl() {
|
||||
return view.getViewPicture().getControl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the tabber controller.
|
||||
*
|
||||
* @return ControlTabber
|
||||
*/
|
||||
public ControlTabber getTabberControl() {
|
||||
return view.getViewTabber().getControl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the input controller.
|
||||
*
|
||||
* @return ControlMessage
|
||||
*/
|
||||
public ControlMessage getMessageControl() {
|
||||
return view.getViewMessage().getControl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand controller.
|
||||
*
|
||||
* @return ControlHand
|
||||
*/
|
||||
public ControlHand getHandControl() {
|
||||
return view.getViewHand().getControl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dock controller.
|
||||
*
|
||||
* @return ControlDock
|
||||
*/
|
||||
public ControlDock getDockControl() {
|
||||
return view.getDockView().getControl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the field controllers.
|
||||
*
|
||||
* @return List<ControlField>
|
||||
*/
|
||||
public List<ControlField> getFieldControls() {
|
||||
final List<ViewField> fields = view.getViewBattlefield().getFields();
|
||||
final List<ControlField> controllers = new ArrayList<ControlField>();
|
||||
|
||||
for (final ViewField f : fields) {
|
||||
controllers.add(f.getControl());
|
||||
}
|
||||
|
||||
return controllers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires up trample dialog. Very old code, due for refactoring with new UI.
|
||||
* Could possibly move to view.
|
||||
*
|
||||
* @param attacker   {@link forge.Card}
|
||||
* @param blockers   {@link forge.CardList}
|
||||
* @param damage   int
|
||||
*/
|
||||
public void assignDamage(final Card attacker, final CardList blockers, final int damage) {
|
||||
if (damage <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
new GuiMultipleBlockers(attacker, blockers, damage);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Checks if game control should stop at a phase, for either
|
||||
* a forced programmatic stop, or a user-induced phase toggle.
|
||||
* @param turn   {@link forge.Player}
|
||||
* @param phase   {@link java.lang.String}
|
||||
* @return boolean
|
||||
*/
|
||||
public final boolean stopAtPhase(final Player turn, final String phase) {
|
||||
final List<ControlField> fieldControllers = ControlMatchUI.this.getFieldControls();
|
||||
|
||||
// AI field is at index [0]
|
||||
if (turn.isComputer()) {
|
||||
if (phase.equals(Constant.Phase.UPKEEP)) {
|
||||
return fieldControllers.get(0).getView().getLblUpkeep().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.DRAW)) {
|
||||
return fieldControllers.get(0).getView().getLblDraw().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.MAIN1)) {
|
||||
return fieldControllers.get(0).getView().getLblMain1().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
|
||||
return fieldControllers.get(0).getView().getLblBeginCombat().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_ATTACKERS)) {
|
||||
return fieldControllers.get(0).getView().getLblDeclareAttackers().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_BLOCKERS)) {
|
||||
return fieldControllers.get(0).getView().getLblDeclareBlockers().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_FIRST_STRIKE_DAMAGE)) {
|
||||
return fieldControllers.get(0).getView().getLblFirstStrike().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_DAMAGE)) {
|
||||
return fieldControllers.get(0).getView().getLblCombatDamage().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_END)) {
|
||||
return fieldControllers.get(0).getView().getLblEndCombat().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.MAIN2)) {
|
||||
return fieldControllers.get(0).getView().getLblMain2().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.END_OF_TURN)) {
|
||||
return fieldControllers.get(0).getView().getLblEndTurn().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.DRAW)) {
|
||||
return fieldControllers.get(0).getView().getLblDraw().getEnabled();
|
||||
}
|
||||
}
|
||||
// Human field is at index [1]
|
||||
else {
|
||||
if (phase.equals(Constant.Phase.UPKEEP)) {
|
||||
return fieldControllers.get(1).getView().getLblUpkeep().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.DRAW)) {
|
||||
return fieldControllers.get(1).getView().getLblDraw().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.MAIN1)) {
|
||||
return fieldControllers.get(1).getView().getLblMain1().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
|
||||
return fieldControllers.get(1).getView().getLblBeginCombat().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_ATTACKERS)) {
|
||||
return fieldControllers.get(1).getView().getLblDeclareAttackers().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_BLOCKERS)) {
|
||||
return fieldControllers.get(1).getView().getLblDeclareBlockers().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_FIRST_STRIKE_DAMAGE)) {
|
||||
return fieldControllers.get(1).getView().getLblFirstStrike().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_DAMAGE)) {
|
||||
return fieldControllers.get(1).getView().getLblCombatDamage().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_END)) {
|
||||
return fieldControllers.get(1).getView().getLblEndCombat().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.MAIN2)) {
|
||||
return fieldControllers.get(1).getView().getLblMain2().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.END_OF_TURN)) {
|
||||
return fieldControllers.get(1).getView().getLblEndTurn().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.DRAW)) {
|
||||
return fieldControllers.get(1).getView().getLblDraw().getEnabled();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCard(final Card c) {
|
||||
Singletons.getControl().getMatchControl().getDetailControl().showCard(c);
|
||||
Singletons.getControl().getMatchControl().getPictureControl().showCard(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Card getCard() {
|
||||
return Singletons.getControl().getMatchControl().getDetailControl().getCurrentCard();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,17 +22,14 @@ import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowListener;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.control.KeyboardShortcuts.Shortcut;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.bazaar.BazaarTopLevel;
|
||||
import forge.view.editor.EditorTopLevel;
|
||||
import forge.view.home.HomeTopLevel;
|
||||
import forge.view.match.MatchTopLevel;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -42,17 +39,12 @@ import forge.view.match.MatchTopLevel;
|
||||
* between various display states in that JFrame. Controllers are instantiated
|
||||
* separately by each state's top level view class.
|
||||
*/
|
||||
public class FControl {
|
||||
private final JLayeredPane display;
|
||||
private final GuiTopLevel view;
|
||||
public final class FControl {
|
||||
private List<Shortcut> shortcuts;
|
||||
private JLayeredPane display;
|
||||
private int state;
|
||||
|
||||
private HomeTopLevel home = null;
|
||||
private MatchTopLevel match = null;
|
||||
private EditorTopLevel editor = null;
|
||||
private WindowAdapter waDefault, waConcede, waLeaveBazaar;
|
||||
private BazaarTopLevel bazaar;
|
||||
private WindowListener waDefault, waConcede, waLeaveBazaar;
|
||||
|
||||
/** */
|
||||
public static final int HOME_SCREEN = 0;
|
||||
@@ -70,21 +62,14 @@ public class FControl {
|
||||
* Controls all Forge UI functionality inside one JFrame. This class
|
||||
* switches between various display states in that JFrame. Controllers are
|
||||
* instantiated separately by each state's top level view class.
|
||||
*
|
||||
* @param v0   GuiTopLevel
|
||||
*/
|
||||
public FControl(GuiTopLevel v0) {
|
||||
this.view = v0;
|
||||
|
||||
this.display = (JLayeredPane) this.view.getContentPane();
|
||||
this.shortcuts = KeyboardShortcuts.attachKeyboardShortcuts(this.view);
|
||||
|
||||
public FControl() {
|
||||
// "Close" button override during match
|
||||
this.waConcede = new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(final WindowEvent e) {
|
||||
view.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
getMatchView().getDockController().concede();
|
||||
Singletons.getView().setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
Singletons.getControl().getMatchControl().getDockControl().concede();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -92,21 +77,27 @@ public class FControl {
|
||||
this.waLeaveBazaar = new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(final WindowEvent e) {
|
||||
view.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
Singletons.getView().setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
changeState(0);
|
||||
getHomeView().showQuestMenu();
|
||||
Singletons.getView().getHomeView().showQuestMenu();
|
||||
}
|
||||
};
|
||||
|
||||
// Default action on window close
|
||||
this.waDefault = new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent e) {
|
||||
view.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
Singletons.getView().setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** After view and model have been initialized, control can start. */
|
||||
public void initialize() {
|
||||
this.shortcuts = KeyboardShortcuts.attachKeyboardShortcuts();
|
||||
this.display = Singletons.getView().getLayeredContentPane();
|
||||
|
||||
// Handles resizing in null layouts of layers in JLayeredPane.
|
||||
view.addComponentListener(new ComponentAdapter() {
|
||||
Singletons.getView().addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentResized(final ComponentEvent e) {
|
||||
sizeChildren();
|
||||
@@ -124,84 +115,61 @@ public class FControl {
|
||||
*   State index: 0 for home, 1 for match, etc.
|
||||
*/
|
||||
public void changeState(final int i0) {
|
||||
this.home = null;
|
||||
this.match = null;
|
||||
this.editor = null;
|
||||
clearChildren(JLayeredPane.DEFAULT_LAYER);
|
||||
this.state = i0;
|
||||
|
||||
this.display.removeAll();
|
||||
this.view.removeWindowListener(waConcede);
|
||||
this.view.removeWindowListener(waLeaveBazaar);
|
||||
this.view.addWindowListener(waDefault);
|
||||
this.view.addOverlay();
|
||||
/// out out out ghandi asdf
|
||||
Singletons.getView().removeWindowListener(waConcede);
|
||||
Singletons.getView().removeWindowListener(waLeaveBazaar);
|
||||
Singletons.getView().addWindowListener(waDefault);
|
||||
////////////////
|
||||
|
||||
// Fire up new state
|
||||
switch (i0) {
|
||||
case HOME_SCREEN:
|
||||
this.home = new HomeTopLevel();
|
||||
this.display.add(this.home, JLayeredPane.DEFAULT_LAYER);
|
||||
display.add(Singletons.getView().getHomeView(), JLayeredPane.DEFAULT_LAYER);
|
||||
sizeChildren();
|
||||
break;
|
||||
|
||||
case MATCH_SCREEN:
|
||||
this.match = new MatchTopLevel();
|
||||
this.display.add(this.match, JLayeredPane.DEFAULT_LAYER);
|
||||
display.add(Singletons.getView().getMatchView(), JLayeredPane.DEFAULT_LAYER);
|
||||
sizeChildren();
|
||||
view.addWindowListener(waConcede);
|
||||
Singletons.getView().addWindowListener(waConcede);
|
||||
break;
|
||||
|
||||
case DEFAULT_EDITOR:
|
||||
this.editor = new EditorTopLevel();
|
||||
this.display.add(this.editor);
|
||||
display.add(Singletons.getView().getEditorView(), JLayeredPane.DEFAULT_LAYER);
|
||||
break;
|
||||
|
||||
case QUEST_BAZAAR:
|
||||
this.bazaar = new BazaarTopLevel();
|
||||
this.display.add(bazaar, JLayeredPane.DEFAULT_LAYER);
|
||||
display.add(Singletons.getView().getBazaarView(), JLayeredPane.DEFAULT_LAYER);
|
||||
sizeChildren();
|
||||
view.addWindowListener(waLeaveBazaar);
|
||||
Singletons.getView().addWindowListener(waLeaveBazaar);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the match view.
|
||||
*
|
||||
* @return MatchTopLevel
|
||||
/** Gets the match controller.
|
||||
* @return {@link forge.control.match.ControlMatchUI}
|
||||
*/
|
||||
public MatchTopLevel getMatchView() {
|
||||
return this.match;
|
||||
public ControlMatchUI getMatchControl() {
|
||||
if (getState() != FControl.MATCH_SCREEN) {
|
||||
throw new IllegalArgumentException("FControl$getMatchControl\n"
|
||||
+ "may only be called while the match UI is showing.");
|
||||
}
|
||||
return Singletons.getView().getMatchView().getControl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the match controller.
|
||||
*
|
||||
* @return ControlMatchUI
|
||||
*/
|
||||
public ControlMatchUI getMatchController() {
|
||||
return this.match.getController();
|
||||
/** Gets the home controller.
|
||||
* @return {@link forge.control.home.ControlHomeUI} */
|
||||
public ControlHomeUI getHomeControl() {
|
||||
if (getState() != FControl.HOME_SCREEN) {
|
||||
throw new IllegalArgumentException("FControl$getHomeControl\n"
|
||||
+ "may only be called while the home UI is showing.");
|
||||
}
|
||||
|
||||
/** @return HomeTopLevel */
|
||||
public HomeTopLevel getHomeView() {
|
||||
return this.home;
|
||||
}
|
||||
|
||||
/** @return HomeTopLevel */
|
||||
public ControlHomeUI getHomeController() {
|
||||
return this.home.getController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the match view.
|
||||
*
|
||||
* @return MatchTopLevel
|
||||
*/
|
||||
public BazaarTopLevel getBazaarView() {
|
||||
return this.bazaar;
|
||||
return Singletons.getView().getHomeView().getControl();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,16 +187,24 @@ public class FControl {
|
||||
return this.shortcuts;
|
||||
}
|
||||
|
||||
/** Remove all children from a specified layer. */
|
||||
private void clearChildren(final int layer0) {
|
||||
final Component[] children = Singletons.getView()
|
||||
.getLayeredContentPane().getComponentsInLayer(layer0);
|
||||
|
||||
for (Component c : children) {
|
||||
display.remove(c);
|
||||
}
|
||||
}
|
||||
|
||||
/** Sizes children of JLayeredPane to fully fit their layers. */
|
||||
private void sizeChildren() {
|
||||
Component[] children;
|
||||
children = FControl.this.display.getComponentsInLayer(JLayeredPane.DEFAULT_LAYER);
|
||||
|
||||
Component[] children = display.getComponentsInLayer(JLayeredPane.DEFAULT_LAYER);
|
||||
if (children.length == 0) { return; }
|
||||
children[0].setSize(display.getSize());
|
||||
|
||||
children[0].setSize(FControl.this.display.getSize());
|
||||
|
||||
children = FControl.this.display.getComponentsInLayer(JLayeredPane.MODAL_LAYER);
|
||||
children[0].setSize(FControl.this.display.getSize());
|
||||
children = display.getComponentsInLayer(JLayeredPane.MODAL_LAYER);
|
||||
if (children.length == 0) { return; }
|
||||
children[0].setSize(display.getSize());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.home.ViewSettings.KeyboardShortcutField;
|
||||
|
||||
/**
|
||||
@@ -32,12 +31,11 @@ public class KeyboardShortcuts {
|
||||
* Attaches all keyboard shortcuts for match UI,
|
||||
* and returns a list of shortcuts with necessary properties for later access.
|
||||
*
|
||||
* @param frame GuiTopLevel (must be passed here since AllZone hasn't been set yet).
|
||||
* @return List<Shortcut> Shortcut objects
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public static List<Shortcut> attachKeyboardShortcuts(final GuiTopLevel frame) {
|
||||
final JComponent c = (JComponent) frame.getContentPane();
|
||||
public static List<Shortcut> attachKeyboardShortcuts() {
|
||||
final JComponent c = (JComponent) Singletons.getView().getContentPane();
|
||||
final InputMap im = c.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
|
||||
final ActionMap am = c.getActionMap();
|
||||
|
||||
@@ -50,8 +48,8 @@ public class KeyboardShortcuts {
|
||||
final Action actShowStack = new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (frame.getController().getState() != 1) { return; }
|
||||
frame.getController().getMatchController().getView().getTabberController().showPnlStack();
|
||||
if (Singletons.getControl().getState() != 1) { return; }
|
||||
Singletons.getControl().getMatchControl().getTabberControl().showPnlStack();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -59,8 +57,8 @@ public class KeyboardShortcuts {
|
||||
final Action actShowCombat = new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (frame.getController().getState() != 1) { return; }
|
||||
frame.getController().getMatchController().getView().getTabberController().showPnlCombat();
|
||||
if (Singletons.getControl().getState() != 1) { return; }
|
||||
Singletons.getControl().getMatchControl().getTabberControl().showPnlCombat();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -68,8 +66,8 @@ public class KeyboardShortcuts {
|
||||
final Action actShowConsole = new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (frame.getController().getState() != 1) { return; }
|
||||
frame.getController().getMatchController().getView().getTabberController().showPnlGameLog();
|
||||
if (Singletons.getControl().getState() != 1) { return; }
|
||||
Singletons.getControl().getMatchControl().getTabberControl().showPnlGameLog();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -77,8 +75,8 @@ public class KeyboardShortcuts {
|
||||
final Action actShowPlayers = new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (frame.getController().getState() != 1) { return; }
|
||||
frame.getController().getMatchController().getView().getTabberController().showPnlPlayers();
|
||||
if (Singletons.getControl().getState() != 1) { return; }
|
||||
Singletons.getControl().getMatchControl().getTabberControl().showPnlPlayers();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -86,8 +84,8 @@ public class KeyboardShortcuts {
|
||||
final Action actShowDev = new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (frame.getController().getState() != 1) { return; }
|
||||
frame.getController().getMatchController().getView().getTabberController().showPnlDev();
|
||||
if (Singletons.getControl().getState() != 1) { return; }
|
||||
Singletons.getControl().getMatchControl().getTabberControl().showPnlDev();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -95,8 +93,8 @@ public class KeyboardShortcuts {
|
||||
final Action actConcede = new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (frame.getController().getState() != 1) { return; }
|
||||
frame.getController().getMatchController().getView().getDockController().concede();
|
||||
if (Singletons.getControl().getState() != 1) { return; }
|
||||
Singletons.getControl().getMatchControl().getDockControl().concede();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import forge.CardList;
|
||||
import forge.Command;
|
||||
import forge.Constant;
|
||||
import forge.PlayerType;
|
||||
import forge.Singletons;
|
||||
import forge.control.FControl;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.generate.Generate2ColorDeck;
|
||||
@@ -33,7 +34,6 @@ import forge.deck.generate.Generate5ColorDeck;
|
||||
import forge.deck.generate.GenerateThemeDeck;
|
||||
import forge.game.GameType;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.home.ViewConstructed;
|
||||
|
||||
/**
|
||||
@@ -534,9 +534,8 @@ public class ControlConstructed {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GuiTopLevel g = ((GuiTopLevel) AllZone.getDisplay());
|
||||
g.getController().changeState(FControl.MATCH_SCREEN);
|
||||
g.getController().getMatchController().initMatch();
|
||||
Singletons.getControl().changeState(FControl.MATCH_SCREEN);
|
||||
Singletons.getControl().getMatchControl().initMatch();
|
||||
|
||||
AllZone.getGameAction().newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import javax.swing.SwingUtilities;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Constant;
|
||||
import forge.Singletons;
|
||||
import forge.control.FControl;
|
||||
import forge.deck.Deck;
|
||||
import forge.game.GameType;
|
||||
@@ -19,7 +20,6 @@ import forge.game.limited.BoosterDraft;
|
||||
import forge.game.limited.CardPoolLimitation;
|
||||
import forge.gui.GuiUtils;
|
||||
import forge.gui.deckeditor.DeckEditorDraft;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.home.ViewDraft;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
@@ -144,9 +144,8 @@ public class ControlDraft {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GuiTopLevel g = (GuiTopLevel) AllZone.getDisplay();
|
||||
g.getController().changeState(FControl.MATCH_SCREEN);
|
||||
g.getController().getMatchController().initMatch();
|
||||
Singletons.getControl().changeState(FControl.MATCH_SCREEN);
|
||||
Singletons.getControl().getMatchControl().initMatch();
|
||||
AllZone.getGameAction().newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,7 +37,6 @@ import forge.quest.data.QuestPreferences.QPref;
|
||||
import forge.quest.data.QuestUtil;
|
||||
import forge.quest.data.item.QuestItemZeppelin;
|
||||
import forge.quest.data.pet.QuestPetAbstract;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.home.ViewQuest;
|
||||
|
||||
/**
|
||||
@@ -163,8 +162,7 @@ public class ControlQuest {
|
||||
public void execute() {
|
||||
AllZone.getQuestData().saveData();
|
||||
refreshDecks();
|
||||
GuiTopLevel g = ((GuiTopLevel) AllZone.getDisplay());
|
||||
g.getController().getHomeView().getBtnQuest().grabFocus();
|
||||
Singletons.getView().getHomeView().getBtnQuest().grabFocus();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -499,10 +497,8 @@ public class ControlQuest {
|
||||
|
||||
/** */
|
||||
private void showBazaar() {
|
||||
GuiTopLevel g = ((GuiTopLevel) AllZone.getDisplay());
|
||||
|
||||
g.getController().changeState(FControl.QUEST_BAZAAR);
|
||||
g.validate();
|
||||
Singletons.getControl().changeState(FControl.QUEST_BAZAAR);
|
||||
Singletons.getView().validate();
|
||||
}
|
||||
|
||||
/** */
|
||||
@@ -565,9 +561,11 @@ public class ControlQuest {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GuiTopLevel g = (GuiTopLevel) AllZone.getDisplay();
|
||||
g.getController().changeState(FControl.MATCH_SCREEN);
|
||||
g.getController().getMatchController().initMatch();
|
||||
view.getBarProgress().setVisible(false);
|
||||
view.getBtnStart().setVisible(true);
|
||||
|
||||
Singletons.getControl().changeState(FControl.MATCH_SCREEN);
|
||||
Singletons.getControl().getMatchControl().initMatch();
|
||||
|
||||
AllZone.getMatchState().reset();
|
||||
if (event.getEventType().equals("challenge")) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import forge.AllZone;
|
||||
import forge.Command;
|
||||
import forge.Constant;
|
||||
import forge.PlayerType;
|
||||
import forge.Singletons;
|
||||
import forge.control.FControl;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckIO;
|
||||
@@ -27,7 +28,6 @@ import forge.item.CardPrinted;
|
||||
import forge.item.ItemPool;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.home.ViewSealed;
|
||||
|
||||
/**
|
||||
@@ -122,9 +122,8 @@ public class ControlSealed {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GuiTopLevel g = ((GuiTopLevel) AllZone.getDisplay());
|
||||
g.getController().changeState(FControl.MATCH_SCREEN);
|
||||
g.getController().getMatchController().initMatch();
|
||||
Singletons.getControl().changeState(FControl.MATCH_SCREEN);
|
||||
Singletons.getControl().getMatchControl().initMatch();
|
||||
|
||||
AllZone.getGameAction().newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
|
||||
}
|
||||
|
||||
@@ -12,13 +12,11 @@ import javax.swing.SwingWorker;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Command;
|
||||
import forge.Constant;
|
||||
import forge.Singletons;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.home.ViewSettings;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
@@ -222,10 +220,8 @@ public class ControlSettings {
|
||||
view.getLblTitleSkin().setIcon(null);
|
||||
view.getLblTitleSkin().setText("Choose Skin");
|
||||
|
||||
// Must create a new HomeTopLevel to reset all color/image/icon
|
||||
// values in components.
|
||||
((GuiTopLevel) AllZone.getDisplay()).getController().changeState(0);
|
||||
((GuiTopLevel) AllZone.getDisplay()).getController().getHomeView().showSettingsMenu();
|
||||
Singletons.getControl().changeState(0);
|
||||
Singletons.getView().getHomeView().showSettingsMenu();
|
||||
}
|
||||
};
|
||||
w.execute();
|
||||
|
||||
@@ -41,6 +41,7 @@ import forge.Constant.Zone;
|
||||
import forge.GuiDisplayUtil;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
import forge.gui.ForgeAction;
|
||||
import forge.gui.GuiUtils;
|
||||
@@ -56,9 +57,7 @@ import forge.properties.NewConstants.Lang.GuiDisplay.ComputerHand;
|
||||
import forge.properties.NewConstants.Lang.GuiDisplay.ComputerLibrary;
|
||||
import forge.properties.NewConstants.Lang.GuiDisplay.HumanHand;
|
||||
import forge.properties.NewConstants.Lang.GuiDisplay.HumanLibrary;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.match.ViewField;
|
||||
import forge.view.match.MatchTopLevel;
|
||||
import forge.view.toolbox.FLabel;
|
||||
|
||||
/**
|
||||
@@ -443,11 +442,12 @@ public class ControlField {
|
||||
maAvatar = new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
final MatchTopLevel t = ((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView();
|
||||
if (ControlField.this.player.isComputer()) {
|
||||
t.getInputController().getInputControl().selectPlayer(AllZone.getComputerPlayer());
|
||||
Singletons.getControl().getMatchControl().getMessageControl()
|
||||
.getInputControl().selectPlayer(AllZone.getComputerPlayer());
|
||||
} else {
|
||||
t.getInputController().getInputControl().selectPlayer(AllZone.getHumanPlayer());
|
||||
Singletons.getControl().getMatchControl().getMessageControl()
|
||||
.getInputControl().selectPlayer(AllZone.getHumanPlayer());
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -456,11 +456,9 @@ public class ControlField {
|
||||
maCardOver = new MouseMotionAdapter() {
|
||||
@Override
|
||||
public void mouseMoved(final MouseEvent me) {
|
||||
final MatchTopLevel t = ((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView();
|
||||
final Card c = ControlField.this.view.getTabletop().getCardFromMouseOverPanel();
|
||||
if (c != null) {
|
||||
t.getDetailController().showCard(c);
|
||||
t.getPictureController().showCard(c);
|
||||
Singletons.getControl().getMatchControl().setCard(c);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -469,14 +467,13 @@ public class ControlField {
|
||||
maCardClick = new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
final MatchTopLevel t = ((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView();
|
||||
|
||||
// original version:
|
||||
// final Card c = t.getDetailController().getCurrentCard();
|
||||
// Roujin's bug fix version dated 2-12-2012
|
||||
final Card c = ControlField.this.view.getTabletop().getCardFromMouseOverPanel();
|
||||
|
||||
final Input input = t.getInputController().getInputControl().getInput();
|
||||
final Input input = Singletons.getControl().getMatchControl().getMessageControl().getInputControl().getInput();
|
||||
|
||||
if (c != null && c.isInZone(Zone.Battlefield)) {
|
||||
if (c.isTapped()
|
||||
@@ -514,8 +511,9 @@ public class ControlField {
|
||||
((InputBlock) input).removeFromAllBlocking(c);
|
||||
}
|
||||
} else {
|
||||
t.getInputController().getInputControl()
|
||||
.selectCard(c, AllZone.getHumanPlayer().getZone(Zone.Battlefield));
|
||||
Singletons.getControl().getMatchControl().getMessageControl()
|
||||
.getInputControl().selectCard(c,
|
||||
AllZone.getHumanPlayer().getZone(Zone.Battlefield));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +40,7 @@ import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.Constant.Zone;
|
||||
import forge.PlayerZone;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.match.MatchTopLevel;
|
||||
import forge.Singletons;
|
||||
import forge.view.match.ViewHand;
|
||||
|
||||
/**
|
||||
@@ -70,8 +69,6 @@ public class ControlHand {
|
||||
this.view = v;
|
||||
this.cardsInPanel = new ArrayList<Card>();
|
||||
|
||||
final MatchTopLevel t = view.getTopLevel();
|
||||
|
||||
maCardClick = new MouseAdapter() {
|
||||
// Card click
|
||||
@Override
|
||||
@@ -81,8 +78,8 @@ public class ControlHand {
|
||||
}
|
||||
final Card c = view.getHandArea().getCardFromMouseOverPanel();
|
||||
if (c != null) {
|
||||
view.getTopLevel().getInputController().getInputControl().selectCard(c, AllZone.getHumanPlayer().getZone(Zone.Hand));
|
||||
view.getTopLevel().getInputController().getView().getBtnOK().requestFocusInWindow();
|
||||
Singletons.getControl().getMatchControl().getMessageControl().getInputControl().selectCard(c, AllZone.getHumanPlayer().getZone(Zone.Hand));
|
||||
Singletons.getView().getMatchView().getBtnOK().requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -93,7 +90,7 @@ public class ControlHand {
|
||||
public void mouseMoved(final MouseEvent me) {
|
||||
final Card c = view.getHandArea().getCardFromMouseOverPanel();
|
||||
if (c != null) {
|
||||
((GuiTopLevel) AllZone.getDisplay()).setCard(c);
|
||||
Singletons.getControl().getMatchControl().setCard(c);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -103,7 +100,9 @@ public class ControlHand {
|
||||
public void update(final Observable a, final Object b) {
|
||||
final PlayerZone pZone = (PlayerZone) a;
|
||||
final HandArea p = view.getHandArea();
|
||||
final Rectangle rctLibraryLabel = t.getFieldControllers().get(1).getView().getLblLibrary().getBounds();
|
||||
final Rectangle rctLibraryLabel = Singletons.getControl()
|
||||
.getMatchControl().getFieldControls().get(1)
|
||||
.getView().getLblLibrary().getBounds();
|
||||
final Card[] c = pZone.getCards();
|
||||
|
||||
// Animation starts from the library label.
|
||||
@@ -129,10 +128,12 @@ public class ControlHand {
|
||||
diff = new ArrayList<Card>(Arrays.asList(c));
|
||||
diff.removeAll(tmp);
|
||||
|
||||
JLayeredPane layeredPane = SwingUtilities.getRootPane(t.getTopLevelFrame()).getLayeredPane();
|
||||
JLayeredPane layeredPane = Singletons.getView().getLayeredPane();
|
||||
int fromZoneX = 0, fromZoneY = 0;
|
||||
|
||||
final Point zoneLocation = SwingUtilities.convertPoint(t.getFieldControllers().get(1).getView().getLblLibrary(),
|
||||
final Point zoneLocation = SwingUtilities.convertPoint(Singletons
|
||||
.getControl().getMatchControl().getFieldControls()
|
||||
.get(1).getView().getLblLibrary(),
|
||||
Math.round(rctLibraryLabel.width / 2.0f), Math.round(rctLibraryLabel.height / 2.0f), layeredPane);
|
||||
fromZoneX = zoneLocation.x;
|
||||
fromZoneY = zoneLocation.y;
|
||||
@@ -152,7 +153,7 @@ public class ControlHand {
|
||||
endX = toPos.x;
|
||||
endY = toPos.y;
|
||||
final arcane.ui.CardPanel animationPanel = new arcane.ui.CardPanel(card);
|
||||
if (t.getTopLevelFrame().isShowing()) {
|
||||
if (Singletons.getView().isShowing()) {
|
||||
Animation.moveCard(startX, startY, startWidth, endX, endY, endWidth, animationPanel, toPanel,
|
||||
layeredPane, 500);
|
||||
} else {
|
||||
@@ -186,15 +187,14 @@ public class ControlHand {
|
||||
*/
|
||||
public void addCardPanelListeners(final CardPanel c) {
|
||||
// Grab top level controller to facilitate interaction between children
|
||||
final MatchTopLevel t = ((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView();
|
||||
final Card cardobj = c.getCard();
|
||||
|
||||
// Sidebar pic/detail on card hover
|
||||
c.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseEntered(final MouseEvent e) {
|
||||
t.getDetailController().showCard(cardobj);
|
||||
t.getPictureController().showCard(cardobj);
|
||||
Singletons.getControl().getMatchControl().getDetailControl().showCard(cardobj);
|
||||
Singletons.getControl().getMatchControl().getPictureControl().showCard(cardobj);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -207,7 +207,7 @@ public class ControlHand {
|
||||
return;
|
||||
}
|
||||
|
||||
t.getInputController().getInputControl()
|
||||
Singletons.getControl().getMatchControl().getMessageControl().getInputControl()
|
||||
.selectCard(cardobj, AllZone.getHumanPlayer().getZone(Zone.Hand));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,14 +23,14 @@ import java.awt.event.ActionListener;
|
||||
import forge.AllZone;
|
||||
import forge.Constant;
|
||||
import forge.GuiInput;
|
||||
import forge.view.match.ViewInput;
|
||||
import forge.view.match.ViewMessage;
|
||||
|
||||
/**
|
||||
* Child controller - handles operations related to input panel.
|
||||
* Child controller - handles operations related to message panel.
|
||||
*
|
||||
*/
|
||||
public class ControlInput {
|
||||
private final ViewInput view;
|
||||
public class ControlMessage {
|
||||
private final ViewMessage view;
|
||||
|
||||
private final GuiInput inputControl;
|
||||
|
||||
@@ -42,29 +42,29 @@ public class ControlInput {
|
||||
* @param v
|
||||
*   The Swing component for the input area
|
||||
*/
|
||||
public ControlInput(final ViewInput v) {
|
||||
public ControlMessage(final ViewMessage v) {
|
||||
this.view = v;
|
||||
this.inputControl = new GuiInput();
|
||||
|
||||
this.alOK = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent evt) {
|
||||
ControlInput.this.btnOKActionPerformed(evt);
|
||||
ControlMessage.this.btnOKActionPerformed(evt);
|
||||
|
||||
if (AllZone.getPhaseHandler().isNeedToNextPhase()) {
|
||||
// moves to next turn
|
||||
AllZone.getPhaseHandler().setNeedToNextPhase(false);
|
||||
AllZone.getPhaseHandler().nextPhase();
|
||||
}
|
||||
ControlInput.this.view.getBtnOK().requestFocusInWindow();
|
||||
ControlMessage.this.view.getBtnOK().requestFocusInWindow();
|
||||
}
|
||||
};
|
||||
|
||||
this.alCancel = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent evt) {
|
||||
ControlInput.this.btnCancelActionPerformed(evt);
|
||||
ControlInput.this.view.getBtnOK().requestFocusInWindow();
|
||||
ControlMessage.this.btnCancelActionPerformed(evt);
|
||||
ControlMessage.this.view.getBtnOK().requestFocusInWindow();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -114,9 +114,9 @@ public class ControlInput {
|
||||
return this.inputControl;
|
||||
}
|
||||
|
||||
/** @return ViewInput */
|
||||
public ViewInput getView() {
|
||||
return view;
|
||||
/** @param s0   {@link java.lang.String} */
|
||||
public void setMessage(String s0) {
|
||||
view.getTarMessage().setText(s0);
|
||||
}
|
||||
|
||||
/** Updates count label in input area. */
|
||||
@@ -8,8 +8,8 @@ import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
import forge.Constant;
|
||||
import forge.Singletons;
|
||||
import forge.Constant.Zone;
|
||||
import forge.Singletons;
|
||||
import forge.control.FControl;
|
||||
import forge.deck.Deck;
|
||||
import forge.game.GameType;
|
||||
@@ -17,7 +17,6 @@ import forge.gui.GuiUtils;
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.match.ViewWinLose;
|
||||
|
||||
/**
|
||||
@@ -75,10 +74,10 @@ public class ControlWinLose {
|
||||
/** Action performed when "quit" button is pressed in default win/lose UI. */
|
||||
public void actionOnQuit() {
|
||||
AllZone.getMatchState().reset();
|
||||
AllZone.getDisplay().savePrefs();
|
||||
FControl g = ((GuiTopLevel) AllZone.getDisplay()).getController();
|
||||
g.getMatchController().deinitMatch();
|
||||
g.changeState(FControl.HOME_SCREEN);
|
||||
Singletons.getModel().savePrefs();
|
||||
Singletons.getControl().getMatchControl().deinitMatch();
|
||||
Singletons.getControl().changeState(FControl.HOME_SCREEN);
|
||||
GuiUtils.closeOverlay();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,7 +121,7 @@ public class ControlWinLose {
|
||||
Constant.Runtime.HUMAN_DECK[0] = hDeck;
|
||||
}
|
||||
}
|
||||
AllZone.getDisplay().savePrefs();
|
||||
Singletons.getModel().savePrefs();
|
||||
AllZone.getGameAction().newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,11 +40,10 @@ import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import net.slightlymagic.braids.util.UtilFunctions;
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.Singletons;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.view.toolbox.FOverlay;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -357,8 +356,8 @@ public final class GuiUtils {
|
||||
list.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(final ListSelectionEvent ev) {
|
||||
if ((list.getSelectedValue() instanceof Card) && (AllZone.getDisplay() != null)) {
|
||||
AllZone.getDisplay().setCard((Card) list.getSelectedValue());
|
||||
if (list.getSelectedValue() instanceof Card) {
|
||||
Singletons.getControl().getMatchControl().setCard((Card) list.getSelectedValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -406,9 +405,8 @@ public final class GuiUtils {
|
||||
|
||||
/** Removes child components and closes overlay. */
|
||||
public static void closeOverlay() {
|
||||
final FOverlay overlay = AllZone.getOverlay();
|
||||
overlay.removeAll();
|
||||
overlay.hideOverlay();
|
||||
Singletons.getView().getOverlay().removeAll();
|
||||
Singletons.getView().getOverlay().hideOverlay();
|
||||
}
|
||||
|
||||
/** Duplicate in DeckEditorQuestMenu and
|
||||
|
||||
@@ -39,7 +39,7 @@ import javax.swing.WindowConstants;
|
||||
import net.slightlymagic.maxmtg.Predicate;
|
||||
import forge.AllZone;
|
||||
import forge.Constant;
|
||||
import forge.control.FControl;
|
||||
import forge.Singletons;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckIO;
|
||||
import forge.deck.DeckManager;
|
||||
@@ -53,7 +53,6 @@ import forge.item.InventoryItem;
|
||||
import forge.item.ItemPoolView;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants.Lang.GuiBoosterDraft;
|
||||
import forge.view.GuiTopLevel;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -133,8 +132,8 @@ public class DeckEditorDraft extends DeckEditorBase {
|
||||
ForgeProps.getLocalized(GuiBoosterDraft.CLOSE_MESSAGE), "", JOptionPane.YES_NO_OPTION);
|
||||
if (n == JOptionPane.YES_OPTION) {
|
||||
DeckEditorDraft.this.dispose();
|
||||
FControl g = ((GuiTopLevel) AllZone.getDisplay()).getController();
|
||||
g.getHomeView().getDraftController().updateHumanDecks();
|
||||
// ghandi why is draft controller in a view
|
||||
Singletons.getView().getHomeView().getDraftController().updateHumanDecks();
|
||||
}
|
||||
} // windowClosing()
|
||||
});
|
||||
@@ -351,8 +350,8 @@ public class DeckEditorDraft extends DeckEditorBase {
|
||||
// close and open next screen
|
||||
this.dispose();
|
||||
|
||||
FControl g = ((GuiTopLevel) AllZone.getDisplay()).getController();
|
||||
g.getHomeView().getDraftController().updateHumanDecks();
|
||||
// ghandi here is is again
|
||||
Singletons.getView().getHomeView().getDraftController().updateHumanDecks();
|
||||
|
||||
} /* saveDraft() */
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -43,7 +44,7 @@ public abstract class Input implements java.io.Serializable {
|
||||
* </p>
|
||||
*/
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage("Blank Input");
|
||||
Singletons.getControl().getMatchControl().showMessage("Blank Input");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,11 +27,11 @@ import forge.Constant;
|
||||
import forge.Constant.Zone;
|
||||
import forge.GameActionUtil;
|
||||
import forge.PlayerZone;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.Singletons;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Input_Attack class.
|
||||
* InputAttack class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
@@ -57,7 +57,7 @@ public class InputAttack extends Input {
|
||||
sb.append("Declare Attackers: Select Creatures to Attack ");
|
||||
sb.append(o.toString());
|
||||
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
|
||||
if (AllZone.getCombat().getRemainingDefenders() == 0) {
|
||||
// Nothing left to attack, has to attack this defender
|
||||
@@ -117,7 +117,7 @@ public class InputAttack extends Input {
|
||||
CombatUtil.showCombat();
|
||||
}
|
||||
else {
|
||||
((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView().getInputController().remind();
|
||||
Singletons.getControl().getMatchControl().getMessageControl().remind();
|
||||
}
|
||||
} // selectCard()
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import forge.Command;
|
||||
import forge.Constant;
|
||||
import forge.GameActionUtil;
|
||||
import forge.PlayerZone;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.Singletons;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -74,14 +74,14 @@ public class InputBlock extends Input {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("To Block, click on your Opponents attacker first, then your blocker(s). ");
|
||||
sb.append("To cancel a block right-click on your blocker");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
} else {
|
||||
final String attackerName = this.currentAttacker.isFaceDown() ? "Morph" : this.currentAttacker.getName();
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("Select a creature to block ").append(attackerName).append(" (");
|
||||
sb.append(this.currentAttacker.getUniqueNumber()).append("). ");
|
||||
sb.append("To cancel a block right-click on your blocker");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
}
|
||||
|
||||
CombatUtil.showCombat();
|
||||
@@ -112,7 +112,7 @@ public class InputBlock extends Input {
|
||||
}
|
||||
}
|
||||
else {
|
||||
((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView().getInputController().remind();
|
||||
Singletons.getControl().getMatchControl().getMessageControl().remind();
|
||||
}
|
||||
this.showMessage();
|
||||
} // selectCard()
|
||||
|
||||
@@ -24,6 +24,7 @@ import forge.CombatUtil;
|
||||
import forge.Constant;
|
||||
import forge.Constant.Zone;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -53,7 +54,7 @@ public class InputCleanup extends Input {
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
sb.append("Cleanup Phase: You can only have a maximum of ").append(AllZone.getHumanPlayer().getMaxHandSize());
|
||||
sb.append(" cards, you currently have ").append(n).append(" cards in your hand - select a card to discard");
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
|
||||
// goes to the next phase
|
||||
if ((n <= AllZone.getHumanPlayer().getMaxHandSize()) || (AllZone.getHumanPlayer().getMaxHandSize() == -1)) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import forge.Constant;
|
||||
import forge.MyObservable;
|
||||
import forge.PhaseHandler;
|
||||
import forge.Player;
|
||||
import forge.Singletons;
|
||||
import forge.model.FModel;
|
||||
|
||||
/**
|
||||
@@ -246,7 +247,7 @@ public class InputControl extends MyObservable implements java.io.Serializable {
|
||||
final boolean skip = this.model.getGameState().getPhaseHandler().doSkipPhase();
|
||||
this.model.getGameState().getPhaseHandler().setSkipPhase(false);
|
||||
if ((this.model.getGameState().getStack().size() == 0)
|
||||
&& !forge.AllZone.getDisplay().stopAtPhase(playerTurn, phase) && skip) {
|
||||
&& !Singletons.getControl().getMatchControl().stopAtPhase(playerTurn, phase) && skip) {
|
||||
this.model.getGameState().getPhaseHandler().passPriority();
|
||||
return null;
|
||||
} else {
|
||||
|
||||
@@ -37,11 +37,9 @@ import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.game.GamePlayerRating;
|
||||
import forge.quest.data.QuestData;
|
||||
import forge.view.GuiTopLevel;
|
||||
|
||||
/**
|
||||
/**
|
||||
* <p>
|
||||
* Input_Mulligan class.
|
||||
* InputMulligan class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
@@ -58,9 +56,9 @@ public class InputMulligan extends Input {
|
||||
@Override
|
||||
public final void showMessage() {
|
||||
ButtonUtil.enableAll();
|
||||
AllZone.getDisplay().getButtonOK().setText("No");
|
||||
AllZone.getDisplay().getButtonCancel().setText("Yes");
|
||||
AllZone.getDisplay().showMessage("Do you want to Mulligan?");
|
||||
Singletons.getView().getMatchView().getBtnOK().setText("No");
|
||||
Singletons.getView().getMatchView().getBtnCancel().setText("Yes");
|
||||
Singletons.getControl().getMatchControl().showMessage("Do you want to Mulligan?");
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -225,7 +223,7 @@ public class InputMulligan extends Input {
|
||||
c0.getController().drawCards(hand.size());
|
||||
}
|
||||
} else {
|
||||
((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView().getInputController().remind();
|
||||
Singletons.getControl().getMatchControl().getMessageControl().remind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import forge.Card;
|
||||
import forge.GuiDisplayUtil;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.Singletons;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -63,7 +63,7 @@ public class InputPassPriority extends Input implements java.io.Serializable {
|
||||
sb.append("\n");
|
||||
sb.append("Priority: ").append(player);
|
||||
|
||||
AllZone.getDisplay().showMessage(sb.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(sb.toString());
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -85,7 +85,7 @@ public class InputPassPriority extends Input implements java.io.Serializable {
|
||||
AllZone.getPhaseHandler().setPriority(AllZone.getHumanPlayer());
|
||||
}
|
||||
else {
|
||||
((GuiTopLevel) AllZone.getDisplay()).getController().getMatchController().getView().getInputController().remind();
|
||||
Singletons.getControl().getMatchControl().getMessageControl().remind();
|
||||
}
|
||||
} // selectCard()
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import forge.Constant.Zone;
|
||||
import forge.PhaseHandler;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
@@ -287,7 +288,7 @@ public class InputPayManaCost extends InputMana {
|
||||
msg.append("\n(Click on your life total to pay life for phyrexian mana.)");
|
||||
}
|
||||
|
||||
AllZone.getDisplay().showMessage(msg.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(msg.toString());
|
||||
if (this.manaCost.isPaid() && !new ManaCost(this.originalManaCost).isPaid()) {
|
||||
this.originalCard.setSunburstValue(this.manaCost.getSunburst());
|
||||
this.done();
|
||||
|
||||
@@ -22,6 +22,7 @@ import forge.ButtonUtil;
|
||||
import forge.Card;
|
||||
import forge.Command;
|
||||
import forge.PlayerZone;
|
||||
import forge.Singletons;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
@@ -188,7 +189,7 @@ public class InputPayManaCostAbility extends InputMana {
|
||||
if (this.showOnlyOKButton) {
|
||||
ButtonUtil.enableOnlyOK();
|
||||
}
|
||||
AllZone.getDisplay().showMessage(this.message + "Pay Mana Cost: \r\n" + this.manaCost.toString());
|
||||
Singletons.getControl().getMatchControl().showMessage(this.message + "Pay Mana Cost: \r\n" + this.manaCost.toString());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import arcane.util.MultiplexOutputStream;
|
||||
import forge.AllZone;
|
||||
@@ -31,15 +32,18 @@ import forge.ComputerAIGeneral;
|
||||
import forge.ComputerAIInput;
|
||||
import forge.Constant;
|
||||
import forge.ConstantStringArrayList;
|
||||
import forge.Singletons;
|
||||
import forge.game.GameSummary;
|
||||
import forge.gui.input.InputControl;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.quest.data.QuestPreferences;
|
||||
import forge.util.FileUtil;
|
||||
import forge.util.HttpUtil;
|
||||
import forge.view.match.ViewField;
|
||||
import forge.view.match.ViewTabber;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
@@ -306,4 +310,91 @@ public class FModel {
|
||||
return this.gameState;
|
||||
}
|
||||
|
||||
/** TODO: Needs to be reworked for efficiency with rest of prefs saves in codebase. */
|
||||
public final boolean savePrefs() {
|
||||
final ForgePreferences fp = preferences;
|
||||
final List<ViewField> fieldViews = Singletons.getView().getMatchView().getFieldViews();
|
||||
|
||||
// AI field is at index [0]
|
||||
fp.setPref(FPref.PHASE_AI_UPKEEP, String.valueOf(fieldViews.get(0).getLblUpkeep().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_DRAW, String.valueOf(fieldViews.get(0).getLblDraw().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_MAIN1, String.valueOf(fieldViews.get(0).getLblMain1().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_BEGINCOMBAT, String.valueOf(fieldViews.get(0).getLblBeginCombat().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_DECLAREATTACKERS, String.valueOf(fieldViews.get(0).getLblDeclareAttackers().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_DECLAREBLOCKERS, String.valueOf(fieldViews.get(0).getLblDeclareBlockers().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_FIRSTSTRIKE, String.valueOf(fieldViews.get(0).getLblFirstStrike().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_COMBATDAMAGE, String.valueOf(fieldViews.get(0).getLblCombatDamage().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_ENDCOMBAT, String.valueOf(fieldViews.get(0).getLblEndCombat().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_MAIN2, String.valueOf(fieldViews.get(0).getLblMain2().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_EOT, String.valueOf(fieldViews.get(0).getLblEndTurn().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_CLEANUP, String.valueOf(fieldViews.get(0).getLblCleanup().getEnabled()));
|
||||
|
||||
// Human field is at index [1]
|
||||
fp.setPref(FPref.PHASE_HUMAN_UPKEEP, String.valueOf(fieldViews.get(1).getLblUpkeep().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_DRAW, String.valueOf(fieldViews.get(1).getLblDraw().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_MAIN1, String.valueOf(fieldViews.get(1).getLblMain1().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_BEGINCOMBAT, String.valueOf(fieldViews.get(1).getLblBeginCombat().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_DECLAREATTACKERS, String.valueOf(fieldViews.get(1).getLblDeclareAttackers().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_DECLAREBLOCKERS, String.valueOf(fieldViews.get(1).getLblDeclareBlockers().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_FIRSTSTRIKE, String.valueOf(fieldViews.get(1).getLblFirstStrike().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_COMBATDAMAGE, String.valueOf(fieldViews.get(1).getLblCombatDamage().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_ENDCOMBAT, String.valueOf(fieldViews.get(1).getLblEndCombat().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_MAIN2, String.valueOf(fieldViews.get(1).getLblMain2().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_EOT, String.valueOf(fieldViews.get(1).getLblEndTurn().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_CLEANUP, String.valueOf(fieldViews.get(1).getLblCleanup().getEnabled()));
|
||||
|
||||
ViewTabber v = Singletons.getView().getMatchView().getViewTabber();
|
||||
Constant.Runtime.MILL[0] = v.getLblMilling().getEnabled();
|
||||
|
||||
fp.setPref(FPref.DEV_MILLING_LOSS, String.valueOf(Constant.Runtime.MILL[0]));
|
||||
fp.setPref(FPref.UI_LAYOUT_PARAMS, String.valueOf(Singletons.getView().getMatchView().getLayoutParams()));
|
||||
fp.setPref(FPref.DEV_UNLIMITED_LAND, String.valueOf(v.getLblUnlimitedLands().getEnabled()));
|
||||
|
||||
fp.save();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** TODO: Needs to be reworked for efficiency with rest of prefs loads in codebase. */
|
||||
public final boolean loadPrefs() {
|
||||
final ForgePreferences fp = Singletons.getModel().getPreferences();
|
||||
final List<ViewField> fieldViews = Singletons.getView().getMatchView().getFieldViews();
|
||||
|
||||
Constant.Runtime.MILL[0] = fp.getPrefBoolean(FPref.DEV_MILLING_LOSS);
|
||||
Constant.Runtime.DEV_MODE[0] = fp.getPrefBoolean(FPref.DEV_MODE_ENABLED);
|
||||
Constant.Runtime.UPLOAD_DRAFT[0] = fp.getPrefBoolean(FPref.UI_UPLOAD_DRAFT);
|
||||
Constant.Runtime.RANDOM_FOIL[0] = fp.getPrefBoolean(FPref.UI_RANDOM_FOIL);
|
||||
Constant.Runtime.UPLOAD_DRAFT[0] =
|
||||
(Constant.Runtime.NET_CONN[0] ? fp.getPrefBoolean(FPref.UI_UPLOAD_DRAFT) : false);
|
||||
|
||||
// AI field is at index [0]
|
||||
fieldViews.get(0).getLblUpkeep().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_UPKEEP));
|
||||
fieldViews.get(0).getLblDraw().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_DRAW));
|
||||
fieldViews.get(0).getLblMain1().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_MAIN1));
|
||||
fieldViews.get(0).getLblBeginCombat().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_BEGINCOMBAT));
|
||||
fieldViews.get(0).getLblDeclareAttackers().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_DECLAREATTACKERS));
|
||||
fieldViews.get(0).getLblDeclareBlockers().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_DECLAREBLOCKERS));
|
||||
fieldViews.get(0).getLblFirstStrike().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_FIRSTSTRIKE));
|
||||
fieldViews.get(0).getLblCombatDamage().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_COMBATDAMAGE));
|
||||
fieldViews.get(0).getLblEndCombat().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_ENDCOMBAT));
|
||||
fieldViews.get(0).getLblMain2().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_MAIN2));
|
||||
fieldViews.get(0).getLblEndTurn().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_EOT));
|
||||
fieldViews.get(0).getLblCleanup().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_CLEANUP));
|
||||
|
||||
// Human field is at index [1]
|
||||
fieldViews.get(1).getLblUpkeep().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_UPKEEP));
|
||||
fieldViews.get(1).getLblDraw().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_DRAW));
|
||||
fieldViews.get(1).getLblMain1().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_MAIN1));
|
||||
fieldViews.get(1).getLblBeginCombat().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_BEGINCOMBAT));
|
||||
fieldViews.get(1).getLblDeclareAttackers().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_DECLAREATTACKERS));
|
||||
fieldViews.get(1).getLblDeclareBlockers().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_DECLAREBLOCKERS));
|
||||
fieldViews.get(1).getLblFirstStrike().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_FIRSTSTRIKE));
|
||||
fieldViews.get(1).getLblCombatDamage().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_COMBATDAMAGE));
|
||||
fieldViews.get(1).getLblEndCombat().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_ENDCOMBAT));
|
||||
fieldViews.get(1).getLblMain2().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_MAIN2));
|
||||
fieldViews.get(1).getLblEndTurn().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_EOT));
|
||||
fieldViews.get(1).getLblCleanup().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_CLEANUP));
|
||||
|
||||
Singletons.getView().getMatchView().setLayoutParams(fp.getPref(FPref.UI_LAYOUT_PARAMS));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,78 +17,58 @@
|
||||
*/
|
||||
package forge.view;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import net.slightlymagic.braids.util.UtilFunctions;
|
||||
import forge.AllZone;
|
||||
import forge.Singletons;
|
||||
import forge.control.FControl;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.view.home.SplashFrame;
|
||||
import forge.view.toolbox.CardFaceSymbols;
|
||||
import forge.view.toolbox.FProgressBar;
|
||||
import forge.view.toolbox.FOverlay;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* The main view for Forge: a java swing application. All view class instances
|
||||
* should be accessible from here.
|
||||
*/
|
||||
public class FView {
|
||||
@SuppressWarnings("serial")
|
||||
public final class FView extends JFrame {
|
||||
private final JLayeredPane lpnContent = new JLayeredPane();
|
||||
private final FOverlay overlay = new FOverlay();
|
||||
|
||||
private transient SplashFrame splashFrame;
|
||||
private FProgressBar barProgress = null;
|
||||
private SplashFrame splash;
|
||||
private ViewHomeUI home = null;
|
||||
private ViewMatchUI match = null;
|
||||
private ViewEditorUI editor = null;
|
||||
private ViewBazaarUI bazaar = null;
|
||||
|
||||
/**
|
||||
* The splashFrame field is guaranteed to exist when this constructor exits.
|
||||
*
|
||||
*/
|
||||
//private static final JLayeredPane lpnContent;
|
||||
//private static final FControl control;
|
||||
|
||||
/** The splash frame is guaranteed to exist when this constructor exits. */
|
||||
public FView() {
|
||||
// We must use invokeAndWait here to fulfill the constructor's
|
||||
// contract. NOPMD by Braids on 8/18/11 11:37 PM
|
||||
UtilFunctions.invokeInEventDispatchThreadAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
FView.this.splashFrame = new SplashFrame();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
super();
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FView.this.splashFrame.setVisible(true);
|
||||
try { splash = new SplashFrame(); }
|
||||
catch (Exception e) { e.printStackTrace(); }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows singleton (global) access to a progress bar (which must be set first).
|
||||
*
|
||||
* @return {@link forge.view.toolbox.FProgressBar}
|
||||
*/
|
||||
public final FProgressBar getProgressBar() {
|
||||
return this.barProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a progress bar so it can be accessed via singletons.
|
||||
*
|
||||
* @param bar0   {@link forge.view.toolbox.FProgressBar}
|
||||
*/
|
||||
public final void setProgressBar(FProgressBar bar0) {
|
||||
this.barProgress = bar0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell the view that the model has been bootstrapped, the initial stuff
|
||||
* for the skin is in place, and data is ready for initial display.
|
||||
*/
|
||||
public final void initialize() {
|
||||
this.setProgressBar(splashFrame.getProgressBar());
|
||||
public void initialize() {
|
||||
|
||||
// Preloads all cards (using progress bar).
|
||||
AllZone.getCardFactory();
|
||||
@@ -102,16 +82,37 @@ public class FView {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
barProgress.setDescription("Creating display components.");
|
||||
final GuiTopLevel g = new GuiTopLevel();
|
||||
AllZone.setDisplay(g);
|
||||
g.getController().changeState(FControl.HOME_SCREEN);
|
||||
SplashFrame.PROGRESS_BAR.setDescription("Creating display components.");
|
||||
|
||||
FView.this.splashFrame.dispose();
|
||||
FView.this.splashFrame = null;
|
||||
// Frame styling
|
||||
FView.this.setMinimumSize(new Dimension(800, 600));
|
||||
FView.this.setLocationRelativeTo(null);
|
||||
FView.this.setExtendedState(FView.this.getExtendedState() | Frame.MAXIMIZED_BOTH);
|
||||
FView.this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
FView.this.setIconImage(FSkin.getIcon(FSkin.ForgeIcons.ICO_FAVICON).getImage());
|
||||
FView.this.setTitle("Forge: " + Singletons.getModel().getBuildInfo().getVersion());
|
||||
|
||||
barProgress.setDescription("Forge is ready to launch.");
|
||||
g.setVisible(true);
|
||||
// Content pane
|
||||
FView.this.lpnContent.setOpaque(true);
|
||||
FView.this.setContentPane(FView.this.lpnContent);
|
||||
|
||||
// Overlay
|
||||
overlay.setBounds(0, 0, FView.this.getWidth(), FView.this.getHeight());
|
||||
FView.this.lpnContent.add(overlay, JLayeredPane.MODAL_LAYER);
|
||||
|
||||
// Instantiate all different state screens
|
||||
FView.this.home = new ViewHomeUI();
|
||||
FView.this.match = new ViewMatchUI();
|
||||
FView.this.editor = new ViewEditorUI();
|
||||
FView.this.bazaar = new ViewBazaarUI();
|
||||
|
||||
// All is ready to go - fire up home screen and discard splash frame.
|
||||
Singletons.getControl().changeState(FControl.HOME_SCREEN);
|
||||
|
||||
FView.this.splash.dispose();
|
||||
FView.this.splash = null;
|
||||
|
||||
FView.this.setVisible(true);
|
||||
|
||||
// Open previous menu on first run, or constructed.
|
||||
// Focus is reset when the frame becomes visible,
|
||||
@@ -120,15 +121,61 @@ public class FView {
|
||||
ForgePreferences.HomeMenus.valueOf(Singletons.getModel().getPreferences().getPref(FPref.UI_HOMEMENU));
|
||||
|
||||
switch(lastMenu) {
|
||||
case constructed: g.getHomeView().getBtnConstructed().grabFocus(); break;
|
||||
case draft: g.getHomeView().getBtnDraft().grabFocus(); break;
|
||||
case sealed: g.getHomeView().getBtnSealed().grabFocus(); break;
|
||||
case quest: g.getHomeView().getBtnQuest().grabFocus(); break;
|
||||
case settings: g.getHomeView().getBtnSettings().grabFocus(); break;
|
||||
case utilities: g.getHomeView().getBtnUtilities().grabFocus(); break;
|
||||
case constructed: FView.this.getHomeView().getBtnConstructed().grabFocus(); break;
|
||||
case draft: FView.this.getHomeView().getBtnDraft().grabFocus(); break;
|
||||
case sealed: FView.this.getHomeView().getBtnSealed().grabFocus(); break;
|
||||
case quest: FView.this.getHomeView().getBtnQuest().grabFocus(); break;
|
||||
case settings: FView.this.getHomeView().getBtnSettings().grabFocus(); break;
|
||||
case utilities: FView.this.getHomeView().getBtnUtilities().grabFocus(); break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
});
|
||||
} // End FView()
|
||||
|
||||
/** @return {@link javax.swing.JLayeredPane} */
|
||||
public JLayeredPane getLayeredContentPane() {
|
||||
return FView.this.lpnContent;
|
||||
}
|
||||
|
||||
/** @return {@link forge.view.toolbox.FOverlay} */
|
||||
public FOverlay getOverlay() {
|
||||
return FView.this.overlay;
|
||||
}
|
||||
|
||||
/** @return {@link forge.view.ViewHomeUI} */
|
||||
public ViewHomeUI getHomeView() {
|
||||
if (Singletons.getControl().getState() != FControl.HOME_SCREEN) {
|
||||
throw new IllegalArgumentException("FView$getHomeView\n"
|
||||
+ "may only be called while the home UI is showing.");
|
||||
}
|
||||
return FView.this.home;
|
||||
}
|
||||
|
||||
/** @return {@link forge.view.ViewMatchUI} */
|
||||
public ViewMatchUI getMatchView() {
|
||||
if (Singletons.getControl().getState() != FControl.MATCH_SCREEN) {
|
||||
throw new IllegalArgumentException("FView$getMatchView\n"
|
||||
+ "may only be called while the match UI is showing.");
|
||||
}
|
||||
return FView.this.match;
|
||||
}
|
||||
|
||||
/** @return {@link forge.view.ViewEditorUI} */
|
||||
public ViewEditorUI getEditorView() {
|
||||
if (Singletons.getControl().getState() != FControl.DEFAULT_EDITOR) {
|
||||
throw new IllegalArgumentException("FView$getEditorView\n"
|
||||
+ "may only be called while the editor UI is showing.");
|
||||
}
|
||||
return FView.this.editor;
|
||||
}
|
||||
|
||||
/** @return {@link forge.view.ViewBazaarUI} */
|
||||
public ViewBazaarUI getBazaarView() {
|
||||
if (Singletons.getControl().getState() != FControl.QUEST_BAZAAR) {
|
||||
throw new IllegalArgumentException("FView$getBazaarView\n"
|
||||
+ "may only be called while the bazaar UI is showing.");
|
||||
}
|
||||
return FView.this.bazaar;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,444 +0,0 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.view;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLayeredPane;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardContainer;
|
||||
import forge.CardList;
|
||||
import forge.Constant;
|
||||
import forge.Display;
|
||||
import forge.GuiMultipleBlockers;
|
||||
import forge.MyButton;
|
||||
import forge.Player;
|
||||
import forge.Singletons;
|
||||
import forge.control.FControl;
|
||||
import forge.control.match.ControlField;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.view.home.HomeTopLevel;
|
||||
import forge.view.match.ViewField;
|
||||
import forge.view.match.ViewTabber;
|
||||
import forge.view.toolbox.FOverlay;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
* Parent JFrame for Forge UI.
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class GuiTopLevel extends JFrame implements Display, CardContainer {
|
||||
private final JLayeredPane lpnContent;
|
||||
private final FControl control;
|
||||
|
||||
/**
|
||||
* Parent JFrame for Forge UI.
|
||||
*/
|
||||
public GuiTopLevel() {
|
||||
super();
|
||||
this.setMinimumSize(new Dimension(800, 600));
|
||||
this.setLocationRelativeTo(null);
|
||||
this.setExtendedState(this.getExtendedState() | Frame.MAXIMIZED_BOTH);
|
||||
|
||||
this.lpnContent = new JLayeredPane();
|
||||
this.lpnContent.setOpaque(true);
|
||||
this.setContentPane(this.lpnContent);
|
||||
this.addOverlay();
|
||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
this.setIconImage(FSkin.getIcon(FSkin.ForgeIcons.ICO_FAVICON).getImage());
|
||||
this.setTitle("Forge: " + Singletons.getModel().getBuildInfo().getVersion());
|
||||
|
||||
// Init controller
|
||||
this.control = new FControl(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds overlay panel to modal layer. Used when removeAll() has been called
|
||||
* on the JLayeredPane parent.
|
||||
*/
|
||||
public void addOverlay() {
|
||||
final FOverlay pnlOverlay = new FOverlay();
|
||||
AllZone.setOverlay(pnlOverlay);
|
||||
pnlOverlay.setOpaque(false);
|
||||
pnlOverlay.setVisible(false);
|
||||
pnlOverlay.setBounds(0, 0, this.getWidth(), this.getHeight());
|
||||
this.lpnContent.add(pnlOverlay, JLayeredPane.MODAL_LAYER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the controller.
|
||||
*
|
||||
* @return FControl
|
||||
*/
|
||||
public FControl getController() {
|
||||
return this.control;
|
||||
}
|
||||
|
||||
/** @return {@link forge.view.home.HomeTopLevel} */
|
||||
public HomeTopLevel getHomeView() {
|
||||
return control.getHomeController().getView();
|
||||
}
|
||||
|
||||
/*
|
||||
* ========================================================
|
||||
*
|
||||
* WILL BE DEPRECATED SOON WITH DISPLAY INTERFACE UPDATE!!!
|
||||
*
|
||||
* ========================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see forge.Display#showMessage(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void showMessage(final String s) {
|
||||
control.getMatchController().getView().getPnlMessage().setText(s);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see forge.Display#getButtonOK()
|
||||
*/
|
||||
@Override
|
||||
public MyButton getButtonOK() {
|
||||
final MyButton ok = new MyButton() {
|
||||
@Override
|
||||
public void select() {
|
||||
control.getMatchController().getView().getInputController().getInputControl().selectButtonOK();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return control.getMatchController().getView().getInputController().getView().getBtnOK().isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectable(final boolean b) {
|
||||
control.getMatchController().getView().getInputController().getView().getBtnOK().setEnabled(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return control.getMatchController().getView().getInputController().getView().getBtnOK().getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setText(final String text) {
|
||||
control.getMatchController().getView().getInputController().getView().getBtnOK().setText(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
control.getMatchController().getView().getInputController().getView().getBtnOK().setText("OK");
|
||||
}
|
||||
};
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see forge.Display#getButtonCancel()
|
||||
*/
|
||||
@Override
|
||||
public MyButton getButtonCancel() {
|
||||
final MyButton cancel = new MyButton() {
|
||||
@Override
|
||||
public void select() {
|
||||
control.getMatchController().getView().getInputController().getInputControl().selectButtonCancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return control.getMatchController().getView().getInputController().getView().getBtnCancel().isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectable(final boolean b) {
|
||||
control.getMatchController().getView().getInputController().getView().getBtnCancel().setEnabled(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return control.getMatchController().getView().getInputController().getView().getBtnCancel().getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setText(final String text) {
|
||||
control.getMatchController().getView().getInputController().getView().getBtnCancel().setText(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
control.getMatchController().getView().getInputController().getView().getBtnCancel().setText("Cancel");
|
||||
}
|
||||
};
|
||||
return cancel;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see forge.Display#showCombat(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void showCombat(final String s0) {
|
||||
control.getMatchController().getView().getTabberController().getView().updateCombat(s0);
|
||||
}
|
||||
|
||||
/** */
|
||||
public void showStack() {
|
||||
control.getMatchController().getView().getTabberController().showPnlStack();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see forge.Display#assignDamage(forge.Card, forge.CardList, int)
|
||||
*/
|
||||
@Override
|
||||
public void assignDamage(final Card attacker, final CardList blockers, final int damage) {
|
||||
if (damage <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
new GuiMultipleBlockers(attacker, blockers, damage, this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see forge.Display#stopAtPhase(forge.Player, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public final boolean stopAtPhase(final Player turn, final String phase) {
|
||||
final List<ControlField> fieldControllers = control.getMatchView().getFieldControllers();
|
||||
|
||||
// AI field is at index [0]
|
||||
if (turn.isComputer()) {
|
||||
if (phase.equals(Constant.Phase.UPKEEP)) {
|
||||
return fieldControllers.get(0).getView().getLblUpkeep().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.DRAW)) {
|
||||
return fieldControllers.get(0).getView().getLblDraw().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.MAIN1)) {
|
||||
return fieldControllers.get(0).getView().getLblMain1().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
|
||||
return fieldControllers.get(0).getView().getLblBeginCombat().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_ATTACKERS)) {
|
||||
return fieldControllers.get(0).getView().getLblDeclareAttackers().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_BLOCKERS)) {
|
||||
return fieldControllers.get(0).getView().getLblDeclareBlockers().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_FIRST_STRIKE_DAMAGE)) {
|
||||
return fieldControllers.get(0).getView().getLblFirstStrike().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_DAMAGE)) {
|
||||
return fieldControllers.get(0).getView().getLblCombatDamage().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_END)) {
|
||||
return fieldControllers.get(0).getView().getLblEndCombat().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.MAIN2)) {
|
||||
return fieldControllers.get(0).getView().getLblMain2().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.END_OF_TURN)) {
|
||||
return fieldControllers.get(0).getView().getLblEndTurn().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.DRAW)) {
|
||||
return fieldControllers.get(0).getView().getLblDraw().getEnabled();
|
||||
}
|
||||
}
|
||||
// Human field is at index [1]
|
||||
else {
|
||||
if (phase.equals(Constant.Phase.UPKEEP)) {
|
||||
return fieldControllers.get(1).getView().getLblUpkeep().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.DRAW)) {
|
||||
return fieldControllers.get(1).getView().getLblDraw().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.MAIN1)) {
|
||||
return fieldControllers.get(1).getView().getLblMain1().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
|
||||
return fieldControllers.get(1).getView().getLblBeginCombat().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_ATTACKERS)) {
|
||||
return fieldControllers.get(1).getView().getLblDeclareAttackers().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_BLOCKERS)) {
|
||||
return fieldControllers.get(1).getView().getLblDeclareBlockers().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_FIRST_STRIKE_DAMAGE)) {
|
||||
return fieldControllers.get(1).getView().getLblFirstStrike().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_DAMAGE)) {
|
||||
return fieldControllers.get(1).getView().getLblCombatDamage().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_END)) {
|
||||
return fieldControllers.get(1).getView().getLblEndCombat().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.MAIN2)) {
|
||||
return fieldControllers.get(1).getView().getLblMain2().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.END_OF_TURN)) {
|
||||
return fieldControllers.get(1).getView().getLblEndTurn().getEnabled();
|
||||
} else if (phase.equals(Constant.Phase.DRAW)) {
|
||||
return fieldControllers.get(1).getView().getLblDraw().getEnabled();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Required by Display interface. Due to be deprecated: should be handled by
|
||||
* a control class, and poorly named; "decking" == "milling" in preferences,
|
||||
* same terminology should be used throughout project for obvious reasons.
|
||||
* Unless "decking" is already the correct terminology, in which case,
|
||||
* everything else is poorly named.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean canLoseByDecking() {
|
||||
return Constant.Runtime.MILL[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* loadPrefs.
|
||||
* </p>
|
||||
* Required by Display interface. Due to be deprecated: will be handled by
|
||||
* ControlMatchUI.
|
||||
*
|
||||
*
|
||||
* @return boolean.
|
||||
*/
|
||||
@Override
|
||||
public final boolean loadPrefs() {
|
||||
final ForgePreferences fp = Singletons.getModel().getPreferences();
|
||||
final List<ViewField> fieldViews = this.control.getMatchController().getView().getFieldViews();
|
||||
|
||||
Constant.Runtime.MILL[0] = fp.getPrefBoolean(FPref.DEV_MILLING_LOSS);
|
||||
Constant.Runtime.DEV_MODE[0] = fp.getPrefBoolean(FPref.DEV_MODE_ENABLED);
|
||||
Constant.Runtime.UPLOAD_DRAFT[0] = fp.getPrefBoolean(FPref.UI_UPLOAD_DRAFT);
|
||||
Constant.Runtime.RANDOM_FOIL[0] = fp.getPrefBoolean(FPref.UI_RANDOM_FOIL);
|
||||
Constant.Runtime.UPLOAD_DRAFT[0] =
|
||||
(Constant.Runtime.NET_CONN[0] ? fp.getPrefBoolean(FPref.UI_UPLOAD_DRAFT) : false);
|
||||
|
||||
// AI field is at index [0]
|
||||
fieldViews.get(0).getLblUpkeep().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_UPKEEP));
|
||||
fieldViews.get(0).getLblDraw().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_DRAW));
|
||||
fieldViews.get(0).getLblMain1().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_MAIN1));
|
||||
fieldViews.get(0).getLblBeginCombat().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_BEGINCOMBAT));
|
||||
fieldViews.get(0).getLblDeclareAttackers().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_DECLAREATTACKERS));
|
||||
fieldViews.get(0).getLblDeclareBlockers().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_DECLAREBLOCKERS));
|
||||
fieldViews.get(0).getLblFirstStrike().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_FIRSTSTRIKE));
|
||||
fieldViews.get(0).getLblCombatDamage().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_COMBATDAMAGE));
|
||||
fieldViews.get(0).getLblEndCombat().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_ENDCOMBAT));
|
||||
fieldViews.get(0).getLblMain2().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_MAIN2));
|
||||
fieldViews.get(0).getLblEndTurn().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_EOT));
|
||||
fieldViews.get(0).getLblCleanup().setEnabled(fp.getPrefBoolean(FPref.PHASE_AI_CLEANUP));
|
||||
|
||||
// Human field is at index [1]
|
||||
fieldViews.get(1).getLblUpkeep().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_UPKEEP));
|
||||
fieldViews.get(1).getLblDraw().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_DRAW));
|
||||
fieldViews.get(1).getLblMain1().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_MAIN1));
|
||||
fieldViews.get(1).getLblBeginCombat().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_BEGINCOMBAT));
|
||||
fieldViews.get(1).getLblDeclareAttackers().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_DECLAREATTACKERS));
|
||||
fieldViews.get(1).getLblDeclareBlockers().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_DECLAREBLOCKERS));
|
||||
fieldViews.get(1).getLblFirstStrike().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_FIRSTSTRIKE));
|
||||
fieldViews.get(1).getLblCombatDamage().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_COMBATDAMAGE));
|
||||
fieldViews.get(1).getLblEndCombat().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_ENDCOMBAT));
|
||||
fieldViews.get(1).getLblMain2().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_MAIN2));
|
||||
fieldViews.get(1).getLblEndTurn().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_EOT));
|
||||
fieldViews.get(1).getLblCleanup().setEnabled(fp.getPrefBoolean(FPref.PHASE_HUMAN_CLEANUP));
|
||||
|
||||
this.control.getMatchController().getView().setLayoutParams(fp.getPref(FPref.UI_LAYOUT_PARAMS));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* savePrefs.
|
||||
* </p>
|
||||
* Required by Display interface. Due to be deprecated: should be in FModel.
|
||||
* Also, this functionality is already performed elsewhere
|
||||
* in the code base.
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
@Override
|
||||
public final boolean savePrefs() {
|
||||
final ForgePreferences fp = Singletons.getModel().getPreferences();
|
||||
final List<ViewField> fieldViews = this.control.getMatchController().getView().getFieldViews();
|
||||
|
||||
// AI field is at index [0]
|
||||
fp.setPref(FPref.PHASE_AI_UPKEEP, String.valueOf(fieldViews.get(0).getLblUpkeep().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_DRAW, String.valueOf(fieldViews.get(0).getLblDraw().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_MAIN1, String.valueOf(fieldViews.get(0).getLblMain1().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_BEGINCOMBAT, String.valueOf(fieldViews.get(0).getLblBeginCombat().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_DECLAREATTACKERS, String.valueOf(fieldViews.get(0).getLblDeclareAttackers().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_DECLAREBLOCKERS, String.valueOf(fieldViews.get(0).getLblDeclareBlockers().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_FIRSTSTRIKE, String.valueOf(fieldViews.get(0).getLblFirstStrike().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_COMBATDAMAGE, String.valueOf(fieldViews.get(0).getLblCombatDamage().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_ENDCOMBAT, String.valueOf(fieldViews.get(0).getLblEndCombat().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_MAIN2, String.valueOf(fieldViews.get(0).getLblMain2().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_EOT, String.valueOf(fieldViews.get(0).getLblEndTurn().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_AI_CLEANUP, String.valueOf(fieldViews.get(0).getLblCleanup().getEnabled()));
|
||||
|
||||
// Human field is at index [1]
|
||||
fp.setPref(FPref.PHASE_HUMAN_UPKEEP, String.valueOf(fieldViews.get(1).getLblUpkeep().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_DRAW, String.valueOf(fieldViews.get(1).getLblDraw().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_MAIN1, String.valueOf(fieldViews.get(1).getLblMain1().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_BEGINCOMBAT, String.valueOf(fieldViews.get(1).getLblBeginCombat().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_DECLAREATTACKERS, String.valueOf(fieldViews.get(1).getLblDeclareAttackers().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_DECLAREBLOCKERS, String.valueOf(fieldViews.get(1).getLblDeclareBlockers().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_FIRSTSTRIKE, String.valueOf(fieldViews.get(1).getLblFirstStrike().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_COMBATDAMAGE, String.valueOf(fieldViews.get(1).getLblCombatDamage().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_ENDCOMBAT, String.valueOf(fieldViews.get(1).getLblEndCombat().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_MAIN2, String.valueOf(fieldViews.get(1).getLblMain2().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_EOT, String.valueOf(fieldViews.get(1).getLblEndTurn().getEnabled()));
|
||||
fp.setPref(FPref.PHASE_HUMAN_CLEANUP, String.valueOf(fieldViews.get(1).getLblCleanup().getEnabled()));
|
||||
|
||||
ViewTabber v = this.control.getMatchController().getView().getTabberController().getView();
|
||||
Constant.Runtime.MILL[0] = v.getLblMilling().getEnabled();
|
||||
|
||||
fp.setPref(FPref.DEV_MILLING_LOSS, String.valueOf(Constant.Runtime.MILL[0]));
|
||||
fp.setPref(FPref.UI_LAYOUT_PARAMS, String.valueOf(control.getMatchController().getView().getLayoutParams()));
|
||||
fp.setPref(FPref.DEV_UNLIMITED_LAND, String.valueOf(v.getLblUnlimitedLands().getEnabled()));
|
||||
|
||||
fp.save();
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see forge.Display#setCard(forge.Card)
|
||||
*/
|
||||
@Override
|
||||
public void setCard(final Card c) {
|
||||
this.control.getMatchView().getDetailController().showCard(c);
|
||||
this.control.getMatchView().getPictureController().showCard(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Required by display interface. Due to be deprecated: handled by control
|
||||
* class.
|
||||
*
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public final Card getCard() {
|
||||
return this.control.getMatchView().getDetailController().getCurrentCard();
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
package forge.view;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.control.FControl;
|
||||
import forge.error.ErrorViewer;
|
||||
import forge.error.ExceptionHandler;
|
||||
import forge.model.FModel;
|
||||
@@ -45,15 +46,20 @@ public final class Main {
|
||||
try {
|
||||
final FModel model = new FModel();
|
||||
final FView view = new FView();
|
||||
final FControl control = new FControl();
|
||||
|
||||
Singletons.setModel(model);
|
||||
Singletons.setView(view);
|
||||
Singletons.setControl(control);
|
||||
|
||||
// Instantiate FGameState for TriggerHandler on card objects created in preloader.
|
||||
model.resetGameState();
|
||||
|
||||
// Start splash frame.
|
||||
view.initialize();
|
||||
|
||||
// Start control on FView.
|
||||
control.initialize();
|
||||
} catch (final Throwable exn) {
|
||||
ErrorViewer.showError(exn);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.view.home;
|
||||
package forge.view;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
@@ -56,7 +56,8 @@ public class SplashFrame extends JFrame {
|
||||
private static final int CLOSEBTN_SIDELENGTH = 15;
|
||||
private static final Color CLOSEBTN_COLOR = new Color(215, 208, 188);
|
||||
|
||||
private final FProgressBar barLoader;
|
||||
/** Preload bar, static accessible. */
|
||||
public static final FProgressBar PROGRESS_BAR = new FProgressBar();
|
||||
|
||||
/**
|
||||
* Create the frame; this <strong>must</strong> be called from an event
|
||||
@@ -140,21 +141,16 @@ public class SplashFrame extends JFrame {
|
||||
pnlContent.getInputMap().put(KeyStroke.getKeyStroke("ESCAPE"), "escAction");
|
||||
pnlContent.getActionMap().put("escAction", actClose);
|
||||
|
||||
barLoader = new FProgressBar();
|
||||
barLoader.setString("Welcome to Forge.");
|
||||
barLoader.setBounds(SplashFrame.BAR_PADDING_X, splashHeightPx - SplashFrame.BAR_PADDING_Y
|
||||
PROGRESS_BAR.setString("Welcome to Forge.");
|
||||
PROGRESS_BAR.setBounds(SplashFrame.BAR_PADDING_X, splashHeightPx - SplashFrame.BAR_PADDING_Y
|
||||
- SplashFrame.BAR_HEIGHT, splashWidthPx - (2 * SplashFrame.BAR_PADDING_X), SplashFrame.BAR_HEIGHT);
|
||||
pnlContent.add(barLoader);
|
||||
pnlContent.add(PROGRESS_BAR);
|
||||
|
||||
final JLabel bgLabel = new JLabel(bgIcon);
|
||||
bgLabel.setBounds(0, 0, splashWidthPx, splashHeightPx);
|
||||
pnlContent.add(bgLabel);
|
||||
|
||||
this.pack();
|
||||
}
|
||||
|
||||
/** @return FProgressBar   The preloader. */
|
||||
public final FProgressBar getProgressBar() {
|
||||
return this.barLoader;
|
||||
this.setVisible(true);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package forge.view.bazaar;
|
||||
package forge.view;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
@@ -7,6 +7,7 @@ import javax.swing.SwingUtilities;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.Command;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
import forge.view.bazaar.ViewStall;
|
||||
import forge.view.toolbox.FLabel;
|
||||
import forge.view.toolbox.FPanel;
|
||||
import forge.view.toolbox.FSkin;
|
||||
@@ -15,14 +16,14 @@ import forge.view.toolbox.FSkin;
|
||||
/** Lays out containers and borders for resizeable layout and
|
||||
* instantiates top-level controller for bazaar UI. */
|
||||
@SuppressWarnings("serial")
|
||||
public class BazaarTopLevel extends FPanel {
|
||||
public class ViewBazaarUI extends FPanel {
|
||||
private final JPanel pnlAllStalls;
|
||||
private final ViewStall pnlSingleStall;
|
||||
private FLabel previousSelected;
|
||||
|
||||
/** Lays out containers and borders for resizeable layout and
|
||||
* instantiates top-level controller for bazaar UI. */
|
||||
public BazaarTopLevel() {
|
||||
public ViewBazaarUI() {
|
||||
super();
|
||||
|
||||
// Final inits
|
||||
@@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.view.editor;
|
||||
package forge.view;
|
||||
|
||||
import forge.view.toolbox.FPanel;
|
||||
|
||||
@@ -26,12 +26,12 @@ import forge.view.toolbox.FPanel;
|
||||
*/
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class EditorTopLevel extends FPanel {
|
||||
public class ViewEditorUI extends FPanel {
|
||||
|
||||
/**
|
||||
* Instantiates a new editor top level.
|
||||
*/
|
||||
public EditorTopLevel() {
|
||||
public ViewEditorUI() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.view.home;
|
||||
package forge.view;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -37,6 +37,12 @@ import forge.control.home.ControlSealed;
|
||||
import forge.control.home.ControlUtilities;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.view.home.ViewConstructed;
|
||||
import forge.view.home.ViewDraft;
|
||||
import forge.view.home.ViewQuest;
|
||||
import forge.view.home.ViewSealed;
|
||||
import forge.view.home.ViewSettings;
|
||||
import forge.view.home.ViewUtilities;
|
||||
import forge.view.toolbox.FButton;
|
||||
import forge.view.toolbox.FPanel;
|
||||
import forge.view.toolbox.FSkin;
|
||||
@@ -49,7 +55,7 @@ import forge.view.toolbox.FSkin;
|
||||
*/
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class HomeTopLevel extends FPanel {
|
||||
public class ViewHomeUI extends FPanel {
|
||||
private JPanel pnlMenu, pnlContent;
|
||||
private FButton btnDraft, btnConstructed, btnSealed, btnQuest, btnSettings, btnUtilities, btnExit, btnDeckEditor;
|
||||
private String constraints;
|
||||
@@ -68,7 +74,7 @@ public class HomeTopLevel extends FPanel {
|
||||
/**
|
||||
* Instantiates a new home top level.
|
||||
*/
|
||||
public HomeTopLevel() {
|
||||
public ViewHomeUI() {
|
||||
super();
|
||||
|
||||
constructed = new ViewConstructed(this);
|
||||
@@ -131,7 +137,7 @@ public class HomeTopLevel extends FPanel {
|
||||
btnDeckEditor = new FButton();
|
||||
btnDeckEditor.setAction(new AbstractAction() {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
HomeTopLevel.this.getUtilitiesController().showDeckEditor(null, null);
|
||||
ViewHomeUI.this.getUtilitiesController().showDeckEditor(null, null);
|
||||
}
|
||||
});
|
||||
btnDeckEditor.setText("Deck Editor");
|
||||
@@ -331,7 +337,7 @@ public class HomeTopLevel extends FPanel {
|
||||
}
|
||||
|
||||
/** @return ControlHomeUI */
|
||||
public ControlHomeUI getController() {
|
||||
public ControlHomeUI getControl() {
|
||||
return control;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.view.match;
|
||||
package forge.view;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
@@ -23,23 +23,21 @@ import java.awt.Graphics;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseMotionAdapter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.AllZone;
|
||||
import forge.control.ControlMatchUI;
|
||||
import forge.control.match.ControlDetail;
|
||||
import forge.control.match.ControlDock;
|
||||
import forge.control.match.ControlField;
|
||||
import forge.control.match.ControlHand;
|
||||
import forge.control.match.ControlInput;
|
||||
import forge.control.match.ControlPicture;
|
||||
import forge.control.match.ControlTabber;
|
||||
import forge.view.match.ViewBattlefield;
|
||||
import forge.view.match.ViewDetail;
|
||||
import forge.view.match.ViewDock;
|
||||
import forge.view.match.ViewField;
|
||||
import forge.view.match.ViewHand;
|
||||
import forge.view.match.ViewMessage;
|
||||
import forge.view.match.ViewPicture;
|
||||
import forge.view.match.ViewTabber;
|
||||
import forge.view.toolbox.FPanel;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
@@ -52,16 +50,15 @@ import forge.view.toolbox.FSkin;
|
||||
*/
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class MatchTopLevel extends FPanel {
|
||||
private ViewBattlefield battlefield;
|
||||
private ViewDetail detail;
|
||||
private ViewDock dock;
|
||||
private ViewHand hand;
|
||||
private ViewInput input;
|
||||
private ViewPicture picture;
|
||||
private ViewTabber tabber;
|
||||
|
||||
private ControlMatchUI control;
|
||||
public class ViewMatchUI extends FPanel {
|
||||
private final ControlMatchUI control;
|
||||
private final ViewBattlefield battlefield;
|
||||
private final ViewDetail detail;
|
||||
private final ViewDock dock;
|
||||
private final ViewHand hand;
|
||||
private final ViewMessage message;
|
||||
private final ViewPicture picture;
|
||||
private final ViewTabber tabber;
|
||||
private int w, h, b;
|
||||
private double delta;
|
||||
|
||||
@@ -90,7 +87,7 @@ public class MatchTopLevel extends FPanel {
|
||||
* - Implements Display interface used in singleton pattern
|
||||
*
|
||||
*/
|
||||
public MatchTopLevel() {
|
||||
public ViewMatchUI() {
|
||||
super();
|
||||
|
||||
// Set properties
|
||||
@@ -134,7 +131,7 @@ public class MatchTopLevel extends FPanel {
|
||||
add(pnlB6);
|
||||
|
||||
// Declare and add various view components
|
||||
input = new ViewInput();
|
||||
message = new ViewMessage();
|
||||
hand = new ViewHand(this);
|
||||
dock = new ViewDock();
|
||||
battlefield = new ViewBattlefield();
|
||||
@@ -143,7 +140,7 @@ public class MatchTopLevel extends FPanel {
|
||||
picture = new ViewPicture();
|
||||
|
||||
String constraints = "w 100%!, h 100%!";
|
||||
pnlInput.add(input, constraints);
|
||||
pnlInput.add(message, constraints);
|
||||
pnlHand.add(hand, constraints);
|
||||
pnlBattlefield.add(battlefield, constraints);
|
||||
pnlDock.add(dock, constraints);
|
||||
@@ -153,7 +150,7 @@ public class MatchTopLevel extends FPanel {
|
||||
|
||||
// After all components are in place, instantiate controller.
|
||||
addDragListeners();
|
||||
this.control = new ControlMatchUI(this);
|
||||
control = new ControlMatchUI(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -357,124 +354,64 @@ public class MatchTopLevel extends FPanel {
|
||||
super.paintComponent(g);
|
||||
}
|
||||
|
||||
// ========== Retrieval functions for easier interaction with children
|
||||
// panels.
|
||||
//========== Retrieval methods
|
||||
|
||||
/**
|
||||
* Retrieves top level controller (actions, observers, etc.) for this UI.
|
||||
*
|
||||
* @return ControlMatchUI
|
||||
*/
|
||||
public ControlMatchUI getController() {
|
||||
/** @return {@link forge.control.ControlMatchUI} */
|
||||
public ControlMatchUI getControl() {
|
||||
return this.control;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the detail controller.
|
||||
*
|
||||
* @return ControlDetail
|
||||
*/
|
||||
public ControlDetail getDetailController() {
|
||||
return MatchTopLevel.this.detail.getController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the picture controller.
|
||||
*
|
||||
* @return ControlPicture
|
||||
*/
|
||||
public ControlPicture getPictureController() {
|
||||
return MatchTopLevel.this.picture.getController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the tabber controller.
|
||||
*
|
||||
* @return ControlTabber
|
||||
*/
|
||||
public ControlTabber getTabberController() {
|
||||
return MatchTopLevel.this.tabber.getController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the input controller.
|
||||
*
|
||||
* @return ControlInput
|
||||
*/
|
||||
public ControlInput getInputController() {
|
||||
return MatchTopLevel.this.input.getController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hand controller.
|
||||
*
|
||||
* @return ControlHand
|
||||
*/
|
||||
public ControlHand getHandController() {
|
||||
return MatchTopLevel.this.hand.getController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dock controller.
|
||||
*
|
||||
* @return ControlDock
|
||||
*/
|
||||
public ControlDock getDockController() {
|
||||
return MatchTopLevel.this.dock.getController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the field controllers.
|
||||
*
|
||||
* @return List<ControlField>
|
||||
*/
|
||||
public List<ControlField> getFieldControllers() {
|
||||
final List<ViewField> fields = this.battlefield.getFields();
|
||||
final List<ControlField> controllers = new ArrayList<ControlField>();
|
||||
|
||||
for (final ViewField f : fields) {
|
||||
controllers.add(f.getController());
|
||||
}
|
||||
|
||||
return controllers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the field views.
|
||||
*
|
||||
* @return List<ViewField>
|
||||
*/
|
||||
public List<ViewField> getFieldViews() {
|
||||
return MatchTopLevel.this.battlefield.getFields();
|
||||
return ViewMatchUI.this.battlefield.getFields();
|
||||
}
|
||||
|
||||
// ========== Input panel and human hand retrieval functions
|
||||
// Also due to be deprecated. Access should be handled by child component
|
||||
// view and/or controller.
|
||||
|
||||
/**
|
||||
* Gets the pnl message.
|
||||
*
|
||||
* @return <b>JTextArea</b> Message area of input panel.
|
||||
*/
|
||||
public JTextArea getPnlMessage() {
|
||||
return MatchTopLevel.this.input.getTarMessage();
|
||||
/** @return {@link forge.view.match.ViewDock} */
|
||||
public ViewDock getDockView() {
|
||||
return this.dock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pnl hand.
|
||||
*
|
||||
* @return <b>ViewHand</b> Retrieves player hand panel.
|
||||
*/
|
||||
public ViewHand getPnlHand() {
|
||||
return MatchTopLevel.this.hand;
|
||||
/** @return {@link forge.view.match.ViewTabber} */
|
||||
public ViewTabber getViewTabber() {
|
||||
return this.tabber;
|
||||
}
|
||||
/**
|
||||
* Gets the top level frame.
|
||||
*
|
||||
* @return JFrame
|
||||
*/
|
||||
public JFrame getTopLevelFrame() {
|
||||
return (JFrame) AllZone.getDisplay();
|
||||
|
||||
/** @return {@link forge.view.match.ViewDetail} */
|
||||
public ViewDetail getViewDetail() {
|
||||
return this.detail;
|
||||
}
|
||||
|
||||
/** @return {@link forge.view.match.ViewPicture} */
|
||||
public ViewPicture getViewPicture() {
|
||||
return this.picture;
|
||||
}
|
||||
|
||||
/** @return {@link forge.view.match.ViewHand} */
|
||||
public ViewHand getViewHand() {
|
||||
return this.hand;
|
||||
}
|
||||
|
||||
/** @return {@link forge.view.match.ViewMessage} */
|
||||
public ViewMessage getViewMessage() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
/** @return {@link forge.view.match.ViewBattlefield} */
|
||||
public ViewBattlefield getViewBattlefield() {
|
||||
return this.battlefield;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnCancel() {
|
||||
return this.message.getBtnCancel();
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JButton} */
|
||||
public JButton getBtnOK() {
|
||||
return this.message.getBtnOK();
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,8 @@ import javax.swing.SwingUtilities;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.AllZone;
|
||||
import forge.Command;
|
||||
import forge.Singletons;
|
||||
import forge.quest.data.bazaar.QuestStallPurchasable;
|
||||
import forge.view.GuiTopLevel;
|
||||
import forge.view.toolbox.FLabel;
|
||||
import forge.view.toolbox.FPanel;
|
||||
import forge.view.toolbox.FSkin;
|
||||
@@ -49,7 +49,7 @@ public class ViewItem extends FPanel {
|
||||
AllZone.getQuestData().addCredits(getItem().getSellingPrice());
|
||||
getItem().onPurchase();
|
||||
AllZone.getQuestData().saveData();
|
||||
((GuiTopLevel) AllZone.getDisplay()).getController().getBazaarView().refreshLastInstance();
|
||||
Singletons.getView().getBazaarView().refreshLastInstance();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import forge.control.bazaar.ControlStall;
|
||||
import forge.quest.data.bazaar.QuestStallDefinition;
|
||||
import forge.quest.data.bazaar.QuestStallManager;
|
||||
import forge.quest.data.bazaar.QuestStallPurchasable;
|
||||
import forge.view.ViewBazaarUI;
|
||||
import forge.view.toolbox.FLabel;
|
||||
import forge.view.toolbox.FScrollPane;
|
||||
import forge.view.toolbox.FSkin;
|
||||
@@ -54,12 +55,12 @@ public class ViewStall extends JPanel {
|
||||
private final JPanel pnlInventory;
|
||||
private final FScrollPane scrInventory;
|
||||
private final ControlStall control;
|
||||
private final BazaarTopLevel parentView;
|
||||
private final ViewBazaarUI parentView;
|
||||
private List<ViewItem> lstItemPanels;
|
||||
private QuestStallDefinition stall;
|
||||
|
||||
/** @param v0 {@link forge.view.bazaar.BazaarTopLevel} */
|
||||
protected ViewStall(final BazaarTopLevel v0) {
|
||||
/** @param v0 {@link forge.view.ViewBazaarUI} */
|
||||
public ViewStall(final ViewBazaarUI v0) {
|
||||
// Final/component inits
|
||||
this.lblStallName = new FLabel.Builder().text("").fontAlign(SwingConstants.CENTER).build();
|
||||
this.lblEmpty = new FLabel.Builder()
|
||||
@@ -171,8 +172,8 @@ public class ViewStall extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
/** @return {@link forge.view.bazaar.BazaarTopLevel} */
|
||||
public BazaarTopLevel getParentView() {
|
||||
/** @return {@link forge.view.ViewBazaarUI} */
|
||||
public ViewBazaarUI getParentView() {
|
||||
return this.parentView;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package forge.view.home;
|
||||
|
||||
import javax.swing.JButton;
|
||||
|
||||
import forge.view.ViewHomeUI;
|
||||
import forge.view.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
@@ -11,9 +12,9 @@ import forge.view.toolbox.FSkin;
|
||||
@SuppressWarnings("serial")
|
||||
public class StartButton extends JButton {
|
||||
/**
|
||||
* @param v0   HomeTopLevel
|
||||
* @param v0   ViewHomeUI
|
||||
*/
|
||||
public StartButton(HomeTopLevel v0) {
|
||||
public StartButton(ViewHomeUI v0) {
|
||||
super();
|
||||
setRolloverEnabled(true);
|
||||
setRolloverIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER));
|
||||
|
||||