mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Merge branch 'master' of https://github.com/magefree/mage
This commit is contained in:
commit
22c95f24a3
735 changed files with 54887 additions and 6014 deletions
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-root</artifactId>
|
||||
<version>1.4.8</version>
|
||||
<version>1.4.9</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.mage</groupId>
|
||||
|
@ -42,7 +42,7 @@
|
|||
<groupId>net.sf.trove4j</groupId>
|
||||
<artifactId>trove4j</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mortennobel</groupId>
|
||||
<artifactId>java-image-scaling</artifactId>
|
||||
|
@ -73,12 +73,12 @@
|
|||
<artifactId>forms_rt</artifactId>
|
||||
<version>7.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<type>jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<type>jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>mage-counter-plugin</artifactId>
|
||||
|
@ -131,8 +131,13 @@
|
|||
<artifactId>tritonus_share</artifactId>
|
||||
<version>0.3.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.java.balloontip</groupId>
|
||||
<artifactId>balloontip</artifactId>
|
||||
<version>1.2.4.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<!-- to get the reference to local repository with com\googlecode\jspf\jspf-core\0.9.1\ -->
|
||||
<repositories>
|
||||
<repository>
|
||||
|
@ -140,7 +145,7 @@
|
|||
<url>file://${project.basedir}/../repository</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
@ -183,7 +188,7 @@
|
|||
|
||||
<finalName>mage-client</finalName>
|
||||
</build>
|
||||
|
||||
|
||||
<properties>
|
||||
<manifest.file>src/main/resources/META-INF/MANIFEST.MF</manifest.file>
|
||||
</properties>
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
1 [C15:268] Sol Ring
|
||||
1 [C15:147] Curse of the Nightly Hunt
|
||||
1 [C15:148] Desolation Giant
|
||||
1 [C15:303] Secluded Steppe
|
||||
1 [C15:304] Secluded Steppe
|
||||
1 [C15:308] Smoldering Crater
|
||||
1 [C15:65] Crib Swap
|
||||
1 [C15:171] Warstorm Surge
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
1 [DDQ:29] Tandem Lookout
|
||||
2 [DDQ:21] Topplegeist
|
||||
1 [DDQ:22] Village Bell-Ringer
|
||||
1 [DDQ:23] Voice of the Provinces
|
||||
1 [DDQ:24] Captain of the Mists
|
||||
1 [DDQ:25] Gryff Vanguard
|
||||
1 [DDQ:26] Mist Raven
|
||||
1 [DDQ:27] Nephalia Smuggler
|
||||
1 [DDQ:28] Pore Over the Pages
|
||||
1 [DDQ:20] Thraben Heretic
|
||||
1 [DDQ:18] Slayer of the Wicked
|
||||
1 [DDQ:19] Spectral Gateguards
|
||||
2 [DDQ:9] Elder Cathar
|
||||
4 [DDQ:34] Tranquil Cove
|
||||
1 [DDQ:16] Moorland Inquisitor
|
||||
2 [DDQ:17] Rebuke
|
||||
1 [DDQ:7] Doomed Traveler
|
||||
4 [DDQ:35] Plains
|
||||
1 [DDQ:32] Sharpened Pitchfork
|
||||
1 [DDQ:6] Dearly Departed
|
||||
1 [DDQ:14] Increasing Devotion
|
||||
1 [DDQ:33] Seraph Sanctuary
|
||||
1 [DDQ:5] Chapel Geist
|
||||
1 [DDQ:15] Momentary Blink
|
||||
2 [DDQ:12] Gather the Townsfolk
|
||||
1 [DDQ:4] Champion of the Parish
|
||||
3 [DDQ:38] Island
|
||||
1 [DDQ:3] Cathedral Sanctifier
|
||||
1 [DDQ:13] Goldnight Redeemer
|
||||
2 [DDQ:39] Island
|
||||
4 [DDQ:36] Plains
|
||||
1 [DDQ:10] Emancipation Angel
|
||||
1 [DDQ:2] Bonds of Faith
|
||||
4 [DDQ:37] Plains
|
||||
1 [DDQ:11] Fiend Hunter
|
||||
1 [DDQ:1] Geist of Saint Traft
|
||||
2 [DDQ:40] Island
|
||||
1 [DDQ:31] Butcher's Cleaver
|
||||
1 [DDQ:30] Tower Geist
|
|
@ -0,0 +1,36 @@
|
|||
4 [DDQ:74] Swamp
|
||||
4 [DDQ:75] Swamp
|
||||
1 [DDQ:50] Abattoir Ghoul
|
||||
1 [DDQ:51] Appetite for Brains
|
||||
4 [DDQ:70] Dismal Backwater
|
||||
1 [DDQ:52] Barter in Blood
|
||||
2 [DDQ:53] Butcher Ghoul
|
||||
1 [DDQ:55] Dread Return
|
||||
1 [DDQ:54] Diregraf Ghoul
|
||||
1 [DDQ:57] Falkenrath Noble
|
||||
1 [DDQ:56] Driver of the Dead
|
||||
1 [DDQ:59] Gravecrawler
|
||||
4 [DDQ:76] Swamp
|
||||
2 [DDQ:58] Ghoulraiser
|
||||
1 [DDQ:63] Sever the Bloodline
|
||||
1 [DDQ:61] Human Frailty
|
||||
2 [DDQ:62] Moan of the Unhallowed
|
||||
3 [DDQ:38] Island
|
||||
1 [DDQ:41] Mindbreaker Demon
|
||||
3 [DDQ:39] Island
|
||||
1 [DDQ:42] Compelling Deterrence
|
||||
1 [DDQ:60] Harvester of Souls
|
||||
2 [DDQ:40] Island
|
||||
1 [DDQ:46] Relentless Skaabs
|
||||
1 [DDQ:45] Makeshift Mauler
|
||||
1 [DDQ:44] Havengul Runebinder
|
||||
1 [DDQ:69] Cobbled Wings
|
||||
1 [DDQ:43] Forbidden Alchemy
|
||||
2 [DDQ:68] Diregraf Captain
|
||||
1 [SOI:997] Tooth Collector
|
||||
1 [DDQ:67] Victim of Night
|
||||
2 [DDQ:49] Stitched Drake
|
||||
1 [DDQ:66] Unbreathing Horde
|
||||
3 [DDQ:48] Screeching Skaab
|
||||
1 [DDQ:65] Tribute to Hunger
|
||||
1 [DDQ:47] Scrapskin Drake
|
|
@ -0,0 +1,46 @@
|
|||
1 [DDJ:46] Plagued Rusalka
|
||||
2 [DDJ:47] Elves of Deep Shadow
|
||||
1 [DDJ:48] Golgari Thug
|
||||
1 [DDJ:49] Ravenous Rats
|
||||
1 [DDJ:45] Jarad, Golgari Lich Lord
|
||||
2 [DDJ:90] Forest
|
||||
1 [DDJ:72] Feast or Famine
|
||||
2 [DDJ:71] Putrefy
|
||||
1 [DDJ:74] Vigor Mortis
|
||||
1 [DDJ:73] Nightmare Void
|
||||
1 [DDJ:70] Golgari Germination
|
||||
1 [DDJ:79] Dakmor Salvage
|
||||
1 [DDJ:76] Twilight's Call
|
||||
1 [DDJ:75] Grim Flowering
|
||||
1 [DDJ:78] Barren Moor
|
||||
1 [DDJ:77] Life // Death
|
||||
1 [DDJ:51] Boneyard Wurm
|
||||
1 [DDJ:52] Korozda Guildmage
|
||||
1 [DDJ:50] Reassembling Skeleton
|
||||
1 [DDJ:59] Greater Mossdog
|
||||
1 [DDJ:57] Shambling Shell
|
||||
1 [DDJ:58] Brain Weevil
|
||||
1 [DDJ:55] Eternal Witness
|
||||
1 [DDJ:56] Dreg Mangler
|
||||
1 [DDJ:53] Putrid Leech
|
||||
1 [DDJ:54] Stinkweed Imp
|
||||
2 [DDJ:63] Golgari Rotwurm
|
||||
1 [DDJ:81] Svogthos, the Restless Tomb
|
||||
2 [DDJ:80] Golgari Rot Farm
|
||||
1 [DDJ:62] Sadistic Hypnotist
|
||||
1 [DDJ:61] Stingerfling Spider
|
||||
1 [DDJ:60] Golgari Grave-Troll
|
||||
2 [DDJ:85] Swamp
|
||||
3 [DDJ:84] Swamp
|
||||
3 [DDJ:83] Swamp
|
||||
1 [DDJ:82] Tranquil Thicket
|
||||
2 [DDJ:89] Forest
|
||||
2 [DDJ:88] Forest
|
||||
2 [DDJ:87] Forest
|
||||
1 [DDJ:69] Life from the Loam
|
||||
2 [DDJ:86] Swamp
|
||||
1 [DDJ:68] Yoke of the Damned
|
||||
1 [DDJ:67] Ghoul's Feast
|
||||
1 [DDJ:66] Golgari Signet
|
||||
1 [DDJ:65] Doomgape
|
||||
1 [DDJ:64] Gleancrawler
|
|
@ -0,0 +1,44 @@
|
|||
2 [DDJ:40] Island
|
||||
3 [DDJ:41] Mountain
|
||||
2 [DDJ:20] Pyromatics
|
||||
1 [DDJ:21] Izzet Charm
|
||||
1 [DDJ:22] Reminisce
|
||||
1 [DDJ:23] Thunderheads
|
||||
2 [DDJ:42] Mountain
|
||||
1 [DDJ:24] Vacuumelt
|
||||
1 [DDJ:25] Dissipate
|
||||
2 [DDJ:43] Mountain
|
||||
2 [DDJ:44] Mountain
|
||||
1 [DDJ:26] Quicksilver Dagger
|
||||
1 [DDJ:27] Prophetic Bolt
|
||||
1 [DDJ:29] Sphinx-Bone Wand
|
||||
1 [DDJ:28] Overwhelming Intellect
|
||||
1 [DDJ:16] Isochron Scepter
|
||||
1 [DDJ:15] Magma Spray
|
||||
1 [DDJ:14] Force Spike
|
||||
1 [DDJ:13] Brainstorm
|
||||
1 [DDJ:12] Djinn Illuminatus
|
||||
1 [DDJ:30] Street Spasm
|
||||
1 [DDJ:11] Izzet Chronarch
|
||||
1 [DDJ:10] Galvanoth
|
||||
1 [DDJ:33] Forgotten Cave
|
||||
2 [DDJ:34] Izzet Boilerworks
|
||||
1 [DDJ:31] Invoke the Firemind
|
||||
1 [DDJ:32] Fire // Ice
|
||||
3 [DDJ:37] Island
|
||||
3 [DDJ:38] Island
|
||||
1 [DDJ:35] Lonely Sandbar
|
||||
1 [DDJ:36] Nivix, Aerie of the Firemind
|
||||
1 [DDJ:5] Gelectrode
|
||||
1 [DDJ:4] Izzet Guildmage
|
||||
1 [DDJ:3] Goblin Electromancer
|
||||
2 [DDJ:2] Kiln Fiend
|
||||
2 [DDJ:39] Island
|
||||
1 [DDJ:9] Ogre Savant
|
||||
2 [DDJ:8] Shrewd Hatchling
|
||||
1 [DDJ:7] Steamcore Weird
|
||||
2 [DDJ:6] Wee Dragonauts
|
||||
1 [DDJ:1] Niv-Mizzet, the Firemind
|
||||
1 [DDJ:19] Train of Thought
|
||||
1 [DDJ:17] Izzet Signet
|
||||
1 [DDJ:18] Call to Heel
|
|
@ -0,0 +1,29 @@
|
|||
2 [DD2:50] Seal of Fire
|
||||
1 [DD2:52] Magma Jet
|
||||
2 [DD2:51] Incinerate
|
||||
2 [DD2:39] Slith Firewalker
|
||||
2 [DD2:35] Flamekin Brawler
|
||||
1 [DD2:53] Flame Javelin
|
||||
1 [DD2:36] Fireslinger
|
||||
1 [DD2:54] Cone of Flame
|
||||
2 [DD2:37] Soulbright Flamekin
|
||||
2 [DD2:55] Fireblast
|
||||
1 [DD2:38] Pyre Charger
|
||||
2 [DD2:56] Fireball
|
||||
1 [DD2:57] Demonfire
|
||||
1 [DD2:58] Keldon Megaliths
|
||||
6 [DD2:59] Mountain
|
||||
1 [DD2:34] Chandra Nalaar
|
||||
2 [DD2:41] Inner-Flame Acolyte
|
||||
1 [DD2:40] Flamewave Invoker
|
||||
6 [DD2:62] Mountain
|
||||
6 [DD2:61] Mountain
|
||||
6 [DD2:60] Mountain
|
||||
1 [DD2:48] Hostility
|
||||
2 [DD2:49] Firebolt
|
||||
2 [DD2:46] Oxidda Golem
|
||||
1 [DD2:47] Chartooth Cougar
|
||||
1 [DD2:44] Rakdos Pit Dragon
|
||||
1 [DD2:45] Ingot Chewer
|
||||
1 [DD2:42] Flametongue Kavu
|
||||
2 [DD2:43] Furnace Whelp
|
|
@ -0,0 +1,33 @@
|
|||
6 [DD2:30] Island
|
||||
1 [DD2:4] Voidmage Apprentice
|
||||
1 [DD2:10] Fledgling Mawcor
|
||||
2 [DD2:5] Wall of Deceit
|
||||
1 [DD2:2] Martyr of Frost
|
||||
2 [DD2:12] Mulldrifter
|
||||
1 [DD2:11] Waterspout Djinn
|
||||
2 [DD2:3] Fathom Seer
|
||||
1 [DD2:14] Guile
|
||||
2 [DD2:8] Man-o'-War
|
||||
1 [DD2:13] Air Elemental
|
||||
1 [DD2:9] Ophidian
|
||||
1 [DD2:6] Willbender
|
||||
2 [DD2:16] Spire Golem
|
||||
1 [DD2:15] Riftwing Cloudskate
|
||||
1 [DD2:7] Bottle Gnomes
|
||||
1 [DD2:18] Brine Elemental
|
||||
1 [DD2:17] AEthersnipe
|
||||
1 [DD2:19] Quicksilver Dragon
|
||||
6 [DD2:31] Island
|
||||
6 [DD2:32] Island
|
||||
5 [DD2:33] Island
|
||||
1 [DD2:1] Jace Beleren
|
||||
1 [DD2:23] Daze
|
||||
1 [DD2:22] Mind Stone
|
||||
1 [DD2:21] Ancestral Vision
|
||||
1 [DD2:20] Errant Ephemeron
|
||||
1 [DD2:27] Gush
|
||||
1 [DD2:26] Fact or Fiction
|
||||
2 [DD2:25] Repulse
|
||||
2 [DD2:24] Counterspell
|
||||
1 [DD2:29] Terrain Generator
|
||||
2 [DD2:28] Condescend
|
|
@ -0,0 +1,33 @@
|
|||
1 [DDO:13] Gustcloak Skirmisher
|
||||
1 [DDO:12] Gustcloak Sentinel
|
||||
2 [DDO:15] Kinsbaile Skirmisher
|
||||
2 [DDO:14] Icatian Javelineers
|
||||
2 [DDO:17] Loxodon Partisan
|
||||
1 [DDO:16] Kor Skyfisher
|
||||
1 [DDO:19] Mortal's Ardor
|
||||
1 [DDO:18] Mighty Leap
|
||||
6 [DDO:30] Plains
|
||||
6 [DDO:31] Plains
|
||||
5 [DDO:32] Plains
|
||||
5 [DDO:33] Plains
|
||||
2 [DDO:10] Gustcloak Harrier
|
||||
1 [DDO:11] Gustcloak Savior
|
||||
1 [DDO:1] Elspeth, Sun's Champion
|
||||
2 [DDO:29] Secluded Steppe
|
||||
1 [DDO:2] Banisher Priest
|
||||
2 [DDO:28] Veteran Swordsmith
|
||||
2 [DDO:27] Veteran Armorsmith
|
||||
2 [DDO:26] Sunlance
|
||||
1 [DDO:5] Court Street Denizen
|
||||
1 [DDO:25] Standing Troops
|
||||
1 [DDO:6] Dauntless Onslaught
|
||||
1 [DDO:24] Soul Parry
|
||||
1 [DDO:3] Captain of the Watch
|
||||
2 [DDO:23] Raise the Alarm
|
||||
1 [DDO:4] Celestial Flare
|
||||
1 [DDO:9] Gempalm Avenger
|
||||
1 [DDO:7] Decree of Justice
|
||||
1 [DDO:8] Dictate of Heliod
|
||||
1 [DDO:21] Noble Templar
|
||||
1 [DDO:22] Precinct Captain
|
||||
1 [DDO:20] Mother of Runes
|
|
@ -0,0 +1,32 @@
|
|||
1 [DDO:39] Omenspeaker
|
||||
2 [DDO:38] Man-o'-War
|
||||
4 [DDO:35] Accumulated Knowledge
|
||||
1 [DDO:34] Kiora, the Crashing Wave
|
||||
1 [DDO:37] Inkwell Leviathan
|
||||
1 [DDO:36] AEtherize
|
||||
1 [DDO:56] Simic Sky Swallower
|
||||
1 [DDO:57] Urban Evolution
|
||||
2 [DDO:58] Evolving Wilds
|
||||
1 [DDO:59] Temple of the False God
|
||||
2 [DDO:51] Coiling Oracle
|
||||
2 [DDO:50] Time to Feed
|
||||
2 [DDO:53] Lorescale Coatl
|
||||
1 [DDO:52] Kiora's Follower
|
||||
1 [DDO:55] Plasm Capture
|
||||
1 [DDO:54] Nimbus Swimmer
|
||||
2 [DDO:47] Grazing Gladehart
|
||||
1 [DDO:48] Nessian Asp
|
||||
2 [DDO:45] Explore
|
||||
1 [DDO:46] Explosive Vegetation
|
||||
2 [DDO:49] Netcaster Spider
|
||||
1 [DDO:40] Peel from Reality
|
||||
3 [DDO:65] Forest
|
||||
4 [DDO:64] Forest
|
||||
4 [DDO:63] Forest
|
||||
1 [DDO:44] Whelming Wave
|
||||
3 [DDO:62] Island
|
||||
2 [DDO:43] Surrakar Banisher
|
||||
4 [DDO:61] Island
|
||||
1 [DDO:42] Sealock Monster
|
||||
4 [DDO:60] Island
|
||||
1 [DDO:41] Scourge of Fleets
|
|
@ -0,0 +1,40 @@
|
|||
1 [DDK:24] Lingering Souls
|
||||
1 [DDK:23] Zealous Persecution
|
||||
2 [DDK:26] Spectral Procession
|
||||
1 [DDK:25] Mortify
|
||||
1 [DDK:20] Decompose
|
||||
1 [DDK:22] Urge to Feed
|
||||
1 [DDK:21] Sorin's Thirst
|
||||
3 [DDK:40] Plains
|
||||
1 [DDK:8] Gatekeeper of Malakir
|
||||
1 [DDK:7] Mesmeric Fiend
|
||||
1 [DDK:9] Twilight Drover
|
||||
1 [DDK:4] Wall of Omens
|
||||
1 [DDK:27] Unmake
|
||||
1 [DDK:3] Vampire Lacerator
|
||||
1 [DDK:28] Ancient Craving
|
||||
2 [DDK:6] Duskhunter Bat
|
||||
1 [DDK:29] Mark of the Vampire
|
||||
1 [DDK:5] Child of Night
|
||||
2 [DDK:2] Doomed Traveler
|
||||
1 [DDK:1] Sorin, Lord of Innistrad
|
||||
4 [DDK:37] Swamp
|
||||
1 [DDK:11] Fiend Hunter
|
||||
4 [DDK:36] Swamp
|
||||
1 [DDK:10] Bloodrage Vampire
|
||||
4 [DDK:35] Swamp
|
||||
2 [DDK:34] Tainted Field
|
||||
1 [DDK:15] Vampire Outcasts
|
||||
2 [DDK:33] Evolving Wilds
|
||||
1 [DDK:32] Death Grasp
|
||||
1 [DDK:14] Phantom General
|
||||
1 [DDK:31] Absorb Vis
|
||||
1 [DDK:13] Mausoleum Guard
|
||||
1 [DDK:12] Vampire Nighthawk
|
||||
1 [DDK:30] Field of Souls
|
||||
1 [DDK:18] Butcher of Malakir
|
||||
1 [DDK:19] Vampire's Bite
|
||||
1 [DDK:16] Revenant Patriarch
|
||||
1 [DDK:17] Sengir Vampire
|
||||
3 [DDK:38] Plains
|
||||
3 [DDK:39] Plains
|
|
@ -0,0 +1,40 @@
|
|||
1 [DDK:67] Breaking Point
|
||||
1 [DDK:68] Sulfuric Vortex
|
||||
1 [DDK:42] Goblin Arsonist
|
||||
1 [DDK:43] Scorched Rusalka
|
||||
1 [DDK:69] Blightning
|
||||
1 [DDK:44] Reassembling Skeleton
|
||||
1 [DDK:63] Recoup
|
||||
2 [DDK:45] Ashmouth Hound
|
||||
2 [DDK:46] Hellspark Elemental
|
||||
1 [DDK:65] Strangling Soot
|
||||
1 [DDK:48] Shambling Remains
|
||||
2 [DDK:66] Browbeat
|
||||
1 [DDK:60] Flame Slash
|
||||
1 [DDK:61] Geistflame
|
||||
1 [DDK:62] Pyroclasm
|
||||
1 [AVR:161] Tibalt, the Fiend-Blooded
|
||||
1 [DDK:49] Coal Stoker
|
||||
1 [ARB:46] Terminate
|
||||
1 [DDK:54] Corpse Connoisseur
|
||||
1 [DDK:55] Scourge Devil
|
||||
1 [DDK:52] Hellrider
|
||||
1 [DDK:53] Skirsdag Cultist
|
||||
5 [DDK:76] Mountain
|
||||
1 [DDK:58] Blazing Salvo
|
||||
4 [DDK:77] Mountain
|
||||
1 [DDK:59] Faithless Looting
|
||||
2 [DDK:74] Rakdos Carnarium
|
||||
1 [DDK:56] Gang of Devils
|
||||
5 [DDK:75] Mountain
|
||||
1 [DDK:57] Bump in the Night
|
||||
2 [DDK:37] Swamp
|
||||
1 [DDK:72] Devil's Play
|
||||
2 [DDK:36] Swamp
|
||||
2 [DDK:73] Akoum Refuge
|
||||
2 [DDK:35] Swamp
|
||||
2 [ALA:120] Vithian Stinger
|
||||
1 [DDK:70] Flame Javelin
|
||||
1 [DDK:50] Lavaborn Muse
|
||||
1 [DDK:51] Mad Prophet
|
||||
1 [SHM:199] Torrent of Souls
|
|
@ -0,0 +1,33 @@
|
|||
1 [DDI:59] Chartooth Cougar
|
||||
6 [DDI:77] Mountain
|
||||
6 [DDI:76] Mountain
|
||||
1 [DDI:55] Stone Giant
|
||||
1 [DDI:54] Bloodfire Kavu
|
||||
1 [DDI:57] Lithophage
|
||||
1 [DDI:56] Geyser Glider
|
||||
1 [DDI:51] Anger
|
||||
1 [DDI:50] Vulshok Sorcerer
|
||||
1 [DDI:53] Vulshok Berserker
|
||||
1 [DDI:71] Spire Barrage
|
||||
2 [DDI:70] Seismic Strike
|
||||
1 [DDI:52] Cosi's Ravager
|
||||
1 [DDI:73] Volley of Boulders
|
||||
1 [DDI:72] Jaws of Stone
|
||||
6 [DDI:75] Mountain
|
||||
7 [DDI:74] Mountain
|
||||
1 [DDI:68] Vulshok Battlegear
|
||||
2 [DDI:49] Fiery Hellhound
|
||||
1 [DDI:67] Searing Blaze
|
||||
1 [DDI:66] Vulshok Morningstar
|
||||
1 [DDI:48] AEther Membrane
|
||||
1 [DDI:65] Journeyer's Kite
|
||||
2 [DDI:47] Pilgrim's Eye
|
||||
1 [DDI:46] Pygmy Pyrosaur
|
||||
2 [DDI:45] Plated Geopede
|
||||
1 [DDI:44] Koth of the Hammer
|
||||
1 [DDI:69] Downhill Charge
|
||||
1 [DDI:60] Earth Servant
|
||||
1 [DDI:64] Armillary Sphere
|
||||
2 [DDI:63] Wayfarer's Bauble
|
||||
1 [DDI:62] Bloodfire Colossus
|
||||
1 [DDI:61] Greater Stone Spirit
|
|
@ -0,0 +1,42 @@
|
|||
2 [DDI:9] Slith Strider
|
||||
1 [DDI:18] Cache Raiders
|
||||
1 [DDI:2] Whitemane Lion
|
||||
1 [DDI:15] Cryptic Annelid
|
||||
1 [DDI:33] Azorius Chancery
|
||||
1 [DDI:1] Venser, the Sojourner
|
||||
1 [DDI:14] Clone
|
||||
2 [DDI:32] Overrule
|
||||
1 [DDI:17] Sawtooth Loon
|
||||
1 [DDI:4] Coral Fighters
|
||||
1 [DDI:35] New Benalia
|
||||
1 [DDI:16] Primal Plasma
|
||||
1 [DDI:34] Flood Plain
|
||||
1 [DDI:3] Augury Owl
|
||||
1 [DDI:11] Wall of Denial
|
||||
1 [DDI:37] Soaring Seacliff
|
||||
1 [DDI:6] Mistmeadow Witch
|
||||
1 [DDI:10] Sky Spirit
|
||||
2 [DDI:36] Sejiri Refuge
|
||||
1 [DDI:5] Minamo Sightbender
|
||||
1 [DDI:13] Kor Cartographer
|
||||
1 [DDI:8] Neurok Invisimancer
|
||||
2 [DDI:39] Plains
|
||||
2 [DDI:7] Scroll Thief
|
||||
1 [DDI:12] Galepowder Mage
|
||||
3 [DDI:38] Plains
|
||||
1 [DDI:30] Steel of the Godhead
|
||||
1 [DDI:29] Safe Passage
|
||||
2 [DDI:24] Preordain
|
||||
1 [DDI:23] Path to Exile
|
||||
1 [DDI:22] Sphinx of Uthuun
|
||||
1 [DDI:21] Sunblast Angel
|
||||
1 [DDI:28] Oblivion Ring
|
||||
1 [DDI:27] Angelic Shield
|
||||
1 [DDI:26] Revoke Existence
|
||||
1 [DDI:25] Sigil of Sleep
|
||||
3 [DDI:43] Island
|
||||
4 [DDI:42] Island
|
||||
4 [DDI:41] Island
|
||||
1 [DIS:138] Windreaver
|
||||
2 [DDI:40] Plains
|
||||
1 [DDI:20] Jedit's Dragoons
|
|
@ -0,0 +1,35 @@
|
|||
2 [DDP:51] Dominator Drone
|
||||
2 [DDP:52] Heartstabber Mosquito
|
||||
1 [DDP:53] Induce Despair
|
||||
1 [DDP:50] Corpsehatch
|
||||
5 [DDP:70] Swamp
|
||||
4 [DDP:72] Swamp
|
||||
4 [DDP:71] Swamp
|
||||
2 [DDP:74] Mountain
|
||||
3 [DDP:73] Mountain
|
||||
1 [ZEN:101] Marsh Casualties
|
||||
2 [DDP:75] Mountain
|
||||
3 [DDP:59] Emrakul's Hatcher
|
||||
2 [DDP:56] Read the Bones
|
||||
1 [DDP:55] Pawn of Ulamog
|
||||
1 [DDP:58] Vampire Nighthawk
|
||||
1 [DDP:57] Smother
|
||||
1 [DDP:42] Artisan of Kozilek
|
||||
1 [DDP:43] It That Betrays
|
||||
1 [DDP:41] Oblivion Sower
|
||||
1 [DDP:61] Hellion Eruption
|
||||
2 [DDP:60] Forked Bolt
|
||||
2 [DDP:65] Mind Stone
|
||||
1 [DDP:64] Forerunner of Slaughter
|
||||
1 [DDP:63] Torch Slinger
|
||||
1 [DDP:62] Magmaw
|
||||
1 [DDP:68] Eldrazi Temple
|
||||
2 [DDP:69] Rocky Tar Pit
|
||||
2 [DDP:66] Runed Servitor
|
||||
3 [DDP:67] Akoum Refuge
|
||||
1 [DDP:49] Consume the Meek
|
||||
1 [DDP:48] Cadaver Imp
|
||||
1 [DDP:47] Butcher of Malakir
|
||||
1 [DDP:46] Bloodthrone Vampire
|
||||
1 [DDP:45] Bloodrite Invoker
|
||||
1 [DDP:44] Ulamog's Crusher
|
|
@ -0,0 +1,40 @@
|
|||
1 [DDP:1] Avenger of Zendikar
|
||||
1 [DDP:2] Affa Guard Hound
|
||||
2 [DDP:3] Caravan Escort
|
||||
1 [DDP:4] Kabira Vindicator
|
||||
1 [DDP:30] Stonework Puma
|
||||
1 [DDP:5] Knight of Cliffhaven
|
||||
2 [DDP:31] Evolving Wilds
|
||||
1 [DDP:6] Makindi Griffin
|
||||
2 [DDP:32] Graypelt Refuge
|
||||
1 [DDP:7] Oust
|
||||
1 [DDP:8] Repel the Darkness
|
||||
2 [DDP:9] Sheer Drop
|
||||
2 [DDP:34] Turntimber Grove
|
||||
1 [DDP:33] Stirring Wildwood
|
||||
3 [DDP:36] Plains
|
||||
3 [DDP:35] Plains
|
||||
4 [DDP:38] Forest
|
||||
3 [DDP:37] Plains
|
||||
3 [DDP:39] Forest
|
||||
2 [DDP:13] Graypelt Hunter
|
||||
1 [DDP:14] Grazing Gladehart
|
||||
3 [DDP:40] Forest
|
||||
1 [DDP:11] Daggerback Basilisk
|
||||
1 [DDP:12] Frontier Guide
|
||||
1 [DDP:20] Primal Command
|
||||
1 [DDP:17] Joraga Bard
|
||||
1 [DDP:21] Retreat to Kazandu
|
||||
1 [DDP:18] Khalni Heart Expedition
|
||||
1 [DDP:15] Groundswell
|
||||
1 [DDP:16] Harrow
|
||||
1 [DDP:19] Ondu Giant
|
||||
1 [DDP:25] Turntimber Basilisk
|
||||
2 [DDP:24] Territorial Baloth
|
||||
1 [DDP:23] Tajuru Archer
|
||||
1 [DDP:22] Scute Mob
|
||||
1 [DDP:29] Seer's Sundial
|
||||
1 [DDP:10] Beastbreaker of Bala Ged
|
||||
1 [DDP:28] Explorer's Scope
|
||||
1 [DDP:27] Veteran Warleader
|
||||
1 [DDP:26] Wildheart Invoker
|
|
@ -33,9 +33,9 @@
|
|||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="mageToolbar" min="-2" pref="25" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="desktopPane" max="32767" attributes="0"/>
|
||||
<Component id="mageToolbar" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
|
||||
<Component id="desktopPane" pref="145" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
@ -60,6 +60,18 @@
|
|||
<Properties>
|
||||
<Property name="floatable" type="boolean" value="false"/>
|
||||
<Property name="rollover" type="boolean" value="true"/>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Segoe UI" size="48" style="0"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[614, 60]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[566, 60]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[614, 60]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
|
|
|
@ -31,6 +31,8 @@ import java.awt.AlphaComposite;
|
|||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
|
@ -99,6 +101,7 @@ import mage.client.dialog.ConnectDialog;
|
|||
import mage.client.dialog.ErrorDialog;
|
||||
import mage.client.dialog.FeedbackDialog;
|
||||
import mage.client.dialog.GameEndDialog;
|
||||
import mage.client.dialog.MageDialog;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.dialog.TableWaitingDialog;
|
||||
import mage.client.dialog.UserRequestDialog;
|
||||
|
@ -112,12 +115,15 @@ import mage.client.remote.CallbackClientImpl;
|
|||
import mage.client.table.TablesPane;
|
||||
import mage.client.tournament.TournamentPane;
|
||||
import mage.client.util.EDTExceptionHandler;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.SettingsManager;
|
||||
import mage.client.util.SystemUtil;
|
||||
import mage.client.util.audio.MusicPlayer;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.client.util.gui.countryBox.CountryUtil;
|
||||
import mage.client.util.stats.UpdateMemUsageTask;
|
||||
import mage.components.ImagePanel;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.interfaces.MageClient;
|
||||
import mage.interfaces.callback.CallbackClient;
|
||||
import mage.interfaces.callback.ClientCallback;
|
||||
|
@ -128,13 +134,16 @@ import mage.remote.SessionImpl;
|
|||
import mage.utils.MageVersion;
|
||||
import mage.view.GameEndView;
|
||||
import mage.view.UserRequestMessage;
|
||||
import net.java.balloontip.BalloonTip;
|
||||
import net.java.balloontip.positioners.LeftAbovePositioner;
|
||||
import net.java.balloontip.styles.EdgedBalloonStyle;
|
||||
import net.java.truevfs.access.TArchiveDetector;
|
||||
import net.java.truevfs.access.TConfig;
|
||||
import net.java.truevfs.kernel.spec.FsAccessOption;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.card.arcane.ManaSymbols;
|
||||
import org.mage.plugins.card.constants.Constants;
|
||||
import org.mage.plugins.card.images.DownloadPictures;
|
||||
import org.mage.plugins.card.info.CardInfoPaneImpl;
|
||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||
|
||||
/**
|
||||
|
@ -144,10 +153,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
private static final String TITLE_NAME = "XMage";
|
||||
|
||||
private static final Logger logger = Logger.getLogger(MageFrame.class);
|
||||
private static final String liteModeArg = "-lite";
|
||||
private static final String grayModeArg = "-gray";
|
||||
private static final String fullscreenArg = "-fullscreen";
|
||||
private static final Logger LOGGER = Logger.getLogger(MageFrame.class);
|
||||
private static final String LITE_MODE_ARG = "-lite";
|
||||
private static final String GRAY_MODE_ARG = "-gray";
|
||||
private static final String FILL_SCREEN_ARG = "-fullscreen";
|
||||
|
||||
private static MageFrame instance;
|
||||
|
||||
|
@ -155,10 +164,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
private ConnectDialog connectDialog;
|
||||
private final ErrorDialog errorDialog;
|
||||
private static CallbackClient callbackClient;
|
||||
private static final Preferences prefs = Preferences.userNodeForPackage(MageFrame.class);
|
||||
private static final Preferences PREFS = Preferences.userNodeForPackage(MageFrame.class);
|
||||
private JLabel title;
|
||||
private Rectangle titleRectangle;
|
||||
private static final MageVersion version = new MageVersion(MageVersion.MAGE_VERSION_MAJOR, MageVersion.MAGE_VERSION_MINOR, MageVersion.MAGE_VERSION_PATCH, MageVersion.MAGE_VERSION_MINOR_PATCH, MageVersion.MAGE_VERSION_INFO);
|
||||
private static final MageVersion VERSION = new MageVersion(MageVersion.MAGE_VERSION_MAJOR, MageVersion.MAGE_VERSION_MINOR, MageVersion.MAGE_VERSION_PATCH, MageVersion.MAGE_VERSION_MINOR_PATCH, MageVersion.MAGE_VERSION_INFO);
|
||||
private UUID clientId;
|
||||
private static MagePane activeFrame;
|
||||
private static boolean liteMode = false;
|
||||
|
@ -166,16 +175,20 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
private static boolean grayMode = false;
|
||||
private static boolean fullscreenMode = false;
|
||||
|
||||
private static final Map<UUID, ChatPanelBasic> chats = new HashMap<>();
|
||||
private static final Map<UUID, GamePanel> games = new HashMap<>();
|
||||
private static final Map<UUID, DraftPanel> drafts = new HashMap<>();
|
||||
private static final MageUI ui = new MageUI();
|
||||
private static final Map<UUID, ChatPanelBasic> CHATS = new HashMap<>();
|
||||
private static final Map<UUID, GamePanel> GAMES = new HashMap<>();
|
||||
private static final Map<UUID, DraftPanel> DRAFTS = new HashMap<>();
|
||||
private static final MageUI UI = new MageUI();
|
||||
|
||||
private static final ScheduledExecutorService pingTaskExecutor = Executors.newSingleThreadScheduledExecutor();
|
||||
private static final ScheduledExecutorService PING_TASK_EXECUTOR = Executors.newSingleThreadScheduledExecutor();
|
||||
private static UpdateMemUsageTask updateMemUsageTask;
|
||||
|
||||
private static long startTime;
|
||||
|
||||
private final BalloonTip balloonTip;
|
||||
|
||||
private List<CardInfo> missingCards;
|
||||
|
||||
/**
|
||||
* @return the session
|
||||
*/
|
||||
|
@ -188,7 +201,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
|
||||
public static Preferences getPreferences() {
|
||||
return prefs;
|
||||
return PREFS;
|
||||
}
|
||||
|
||||
public static boolean isLite() {
|
||||
|
@ -201,7 +214,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
@Override
|
||||
public MageVersion getVersion() {
|
||||
return version;
|
||||
return VERSION;
|
||||
}
|
||||
|
||||
public static MageFrame getInstance() {
|
||||
|
@ -226,12 +239,13 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
TConfig config = TConfig.current();
|
||||
config.setArchiveDetector(new TArchiveDetector("zip"));
|
||||
config.setAccessPreference(FsAccessOption.STORE, true);
|
||||
|
||||
try {
|
||||
UIManager.put("desktop", new Color(0, 0, 0, 0));
|
||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
|
||||
GUISizeHelper.calculateGUISizes();
|
||||
// UIManager.put("Table.rowHeight", GUISizeHelper.tableRowHeight);
|
||||
} catch (Exception ex) {
|
||||
logger.fatal(null, ex);
|
||||
LOGGER.fatal(null, ex);
|
||||
}
|
||||
|
||||
ManaSymbols.loadImages();
|
||||
|
@ -253,9 +267,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
errorDialog = new ErrorDialog();
|
||||
errorDialog.setLocation(100, 100);
|
||||
desktopPane.add(errorDialog, JLayeredPane.POPUP_LAYER);
|
||||
ui.addComponent(MageComponents.DESKTOP_PANE, desktopPane);
|
||||
UI.addComponent(MageComponents.DESKTOP_PANE, desktopPane);
|
||||
|
||||
pingTaskExecutor.scheduleAtFixedRate(new Runnable() {
|
||||
PING_TASK_EXECUTOR.scheduleAtFixedRate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
session.ping();
|
||||
|
@ -269,7 +283,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
desktopPane.add(tablesPane, javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
tablesPane.setMaximum(true);
|
||||
} catch (PropertyVetoException ex) {
|
||||
logger.fatal(null, ex);
|
||||
LOGGER.fatal(null, ex);
|
||||
}
|
||||
|
||||
addTooltipContainer();
|
||||
|
@ -298,6 +312,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
});
|
||||
|
||||
// balloonTip = new BalloonTip(desktopPane, "", new ModernBalloonStyle(0, 0, Color.WHITE, Color.YELLOW, Color.BLUE), false);
|
||||
balloonTip = new BalloonTip(desktopPane, "", new EdgedBalloonStyle(Color.WHITE, Color.BLUE), false);
|
||||
balloonTip.setPositioner(new LeftAbovePositioner(0, 0));
|
||||
balloonTip.setVisible(false);
|
||||
|
||||
mageToolbar.add(new javax.swing.JToolBar.Separator());
|
||||
mageToolbar.add(createWindowsButton());
|
||||
|
||||
|
@ -343,7 +362,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
label.setBounds(0, 0, 180, 30);
|
||||
}
|
||||
|
||||
ui.addButton(MageComponents.TABLES_MENU_BUTTON, btnGames);
|
||||
UI.addButton(MageComponents.TABLES_MENU_BUTTON, btnGames);
|
||||
|
||||
setGUISize();
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
|
@ -352,14 +373,16 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_CHECK, "false").equals("true")) {
|
||||
checkForNewImages();
|
||||
}
|
||||
|
||||
updateMemUsageTask.execute();
|
||||
logger.info("Client start up time: " + ((System.currentTimeMillis() - startTime) / 1000 + " seconds"));
|
||||
LOGGER.info("Client start up time: " + ((System.currentTimeMillis() - startTime) / 1000 + " seconds"));
|
||||
if (autoConnect()) {
|
||||
enableButtons();
|
||||
} else {
|
||||
connectDialog.showDialog();
|
||||
}
|
||||
setWindowTitle();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -373,7 +396,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
private void setWindowTitle() {
|
||||
setTitle(TITLE_NAME + " Client: "
|
||||
+ (version == null ? "<not available>" : version.toString()) + " Server: "
|
||||
+ (VERSION == null ? "<not available>" : VERSION.toString()) + " Server: "
|
||||
+ ((session != null && session.isConnected()) ? session.getVersionInfo() : "<not connected>"));
|
||||
}
|
||||
|
||||
|
@ -382,7 +405,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
if (cardInfoPane == null) {
|
||||
return;
|
||||
}
|
||||
cardInfoPane.setSize(Constants.TOOLTIP_WIDTH_MIN, Constants.TOOLTIP_HEIGHT_MIN);
|
||||
// cardInfoPane.setSize(Constants.TOOLTIP_WIDTH_MIN, Constants.TOOLTIP_HEIGHT_MIN);
|
||||
cardInfoPane.setLocation(40, 40);
|
||||
cardInfoPane.setBackground(new Color(0, 0, 0, 0));
|
||||
|
||||
|
@ -391,15 +414,14 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
popupContainer.add(cardInfoPane);
|
||||
popupContainer.setVisible(false);
|
||||
popupContainer.setBounds(0, 0,
|
||||
Constants.TOOLTIP_WIDTH_MIN + Constants.TOOLTIP_BORDER_WIDTH,
|
||||
Constants.TOOLTIP_HEIGHT_MIN + Constants.TOOLTIP_BORDER_WIDTH);
|
||||
// popupContainer.setBounds(0, 0,
|
||||
// Constants.TOOLTIP_WIDTH_MIN + Constants.TOOLTIP_BORDER_WIDTH,
|
||||
// Constants.TOOLTIP_HEIGHT_MIN + Constants.TOOLTIP_BORDER_WIDTH);
|
||||
|
||||
desktopPane.add(popupContainer, JLayeredPane.POPUP_LAYER);
|
||||
|
||||
ui.addComponent(MageComponents.CARD_INFO_PANE, cardInfoPane);
|
||||
ui.addComponent(MageComponents.POPUP_CONTAINER, popupContainer);
|
||||
|
||||
UI.addComponent(MageComponents.CARD_INFO_PANE, cardInfoPane);
|
||||
UI.addComponent(MageComponents.POPUP_CONTAINER, popupContainer);
|
||||
// preview panel normal
|
||||
JPanel cardPreviewContainer = new JPanel();
|
||||
cardPreviewContainer.setOpaque(false);
|
||||
|
@ -413,8 +435,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
cardPreviewContainer.setVisible(false);
|
||||
cardPreviewContainer.setBounds(0, 0, 320 + 80, 500 + 30);
|
||||
|
||||
ui.addComponent(MageComponents.CARD_PREVIEW_PANE, bigCard);
|
||||
ui.addComponent(MageComponents.CARD_PREVIEW_CONTAINER, cardPreviewContainer);
|
||||
UI.addComponent(MageComponents.CARD_PREVIEW_PANE, bigCard);
|
||||
UI.addComponent(MageComponents.CARD_PREVIEW_CONTAINER, cardPreviewContainer);
|
||||
|
||||
desktopPane.add(cardPreviewContainer, JLayeredPane.POPUP_LAYER);
|
||||
|
||||
|
@ -430,8 +452,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
cardPreviewContainerRotated.setVisible(false);
|
||||
cardPreviewContainerRotated.setBounds(0, 0, 500 + 80, 420 + 30);
|
||||
|
||||
ui.addComponent(MageComponents.CARD_PREVIEW_PANE_ROTATED, bigCard);
|
||||
ui.addComponent(MageComponents.CARD_PREVIEW_CONTAINER_ROTATED, cardPreviewContainerRotated);
|
||||
UI.addComponent(MageComponents.CARD_PREVIEW_PANE_ROTATED, bigCard);
|
||||
UI.addComponent(MageComponents.CARD_PREVIEW_CONTAINER_ROTATED, cardPreviewContainerRotated);
|
||||
|
||||
desktopPane.add(cardPreviewContainerRotated, JLayeredPane.POPUP_LAYER);
|
||||
|
||||
|
@ -453,7 +475,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
backgroundPane.setSize(1024, 768);
|
||||
desktopPane.add(backgroundPane, JLayeredPane.DEFAULT_LAYER);
|
||||
} catch (IOException e) {
|
||||
logger.fatal("Error while setting background.", e);
|
||||
LOGGER.fatal("Error while setting background.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -476,7 +498,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
backgroundPane.add(title);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.fatal("Error while adding mage label.", e);
|
||||
LOGGER.fatal("Error while adding mage label.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -510,6 +532,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
MagePane window = (MagePane) windows[i];
|
||||
if (window.isVisible()) {
|
||||
menuItem = new MagePaneMenuItem(window);
|
||||
menuItem.setFont(GUISizeHelper.menuFont);
|
||||
menuItem.setState(i == 0);
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
|
@ -545,28 +568,29 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
private void checkForNewImages() {
|
||||
long beforeCall = System.currentTimeMillis();
|
||||
List<CardInfo> cards = CardRepository.instance.findCards(new CardCriteria());
|
||||
logger.info("Card pool load time: " + ((System.currentTimeMillis() - beforeCall) / 1000 + " seconds"));
|
||||
|
||||
missingCards = CardRepository.instance.findCards(new CardCriteria());
|
||||
LOGGER.info("Card pool load time: " + ((System.currentTimeMillis() - beforeCall) / 1000 + " seconds"));
|
||||
beforeCall = System.currentTimeMillis();
|
||||
if (DownloadPictures.checkForNewCards(cards)) {
|
||||
logger.info("Card images checking time: " + ((System.currentTimeMillis() - beforeCall) / 1000 + " seconds"));
|
||||
if (JOptionPane.showConfirmDialog(this, "New cards are available. Do you want to download the images?", "New images available", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
DownloadPictures.startDownload(null, cards);
|
||||
}
|
||||
if (DownloadPictures.checkForNewCards(missingCards)) {
|
||||
LOGGER.info("Card images checking time: " + ((System.currentTimeMillis() - beforeCall) / 1000 + " seconds"));
|
||||
UserRequestMessage message = new UserRequestMessage("New images available", "Card images are missing (" + missingCards.size() + "). Do you want to download the images?"
|
||||
+ "<br><br><i>You can deactivate the image download check on application start in the preferences.</i>");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_DOWNLOAD_CARD_IMAGES);
|
||||
showUserRequestDialog(message);
|
||||
}
|
||||
}
|
||||
|
||||
public void btnImagesActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
List<CardInfo> cards = CardRepository.instance.findCards(new CardCriteria());
|
||||
|
||||
DownloadPictures.startDownload(null, cards);
|
||||
}
|
||||
|
||||
public void btnSymbolsActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if (JOptionPane.showConfirmDialog(this, "Do you want to download game symbols and additional image files?", "Download additional resources", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) {
|
||||
Plugins.getInstance().downloadSymbols();
|
||||
}
|
||||
UserRequestMessage message = new UserRequestMessage("Download additional resources", "Do you want to download game symbols and additional image files?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_DOWNLOAD_SYMBOLS);
|
||||
showUserRequestDialog(message);
|
||||
}
|
||||
|
||||
public static void setActive(MagePane frame) {
|
||||
|
@ -574,7 +598,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
activeFrame = null;
|
||||
return;
|
||||
}
|
||||
logger.debug("Setting " + frame.getTitle() + " active");
|
||||
LOGGER.debug("Setting " + frame.getTitle() + " active");
|
||||
if (activeFrame != null) {
|
||||
activeFrame.deactivated();
|
||||
}
|
||||
|
@ -584,7 +608,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
try {
|
||||
activeFrame.setSelected(true);
|
||||
} catch (PropertyVetoException ex) {
|
||||
logger.error("Error setting " + frame.getTitle() + " active");
|
||||
LOGGER.error("Error setting " + frame.getTitle() + " active");
|
||||
}
|
||||
activeFrame.activated();
|
||||
ArrowBuilder.getBuilder().hideAllPanels();
|
||||
|
@ -737,7 +761,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
|
||||
public boolean autoConnect() {
|
||||
boolean autoConnectParamValue = Boolean.parseBoolean(prefs.get("autoConnect", "false"));
|
||||
boolean autoConnectParamValue = Boolean.parseBoolean(PREFS.get("autoConnect", "false"));
|
||||
boolean status = false;
|
||||
if (autoConnectParamValue) {
|
||||
status = performConnect();
|
||||
|
@ -750,11 +774,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
int port = MagePreferences.getServerPort();
|
||||
String userName = MagePreferences.getUserName(server);
|
||||
String password = MagePreferences.getPassword(server);
|
||||
String proxyServer = prefs.get("proxyAddress", "");
|
||||
int proxyPort = Integer.parseInt(prefs.get("proxyPort", "0"));
|
||||
ProxyType proxyType = ProxyType.valueByText(prefs.get("proxyType", "None"));
|
||||
String proxyUsername = prefs.get("proxyUsername", "");
|
||||
String proxyPassword = prefs.get("proxyPassword", "");
|
||||
String proxyServer = PREFS.get("proxyAddress", "");
|
||||
int proxyPort = Integer.parseInt(PREFS.get("proxyPort", "0"));
|
||||
ProxyType proxyType = ProxyType.valueByText(PREFS.get("proxyType", "None"));
|
||||
String proxyUsername = PREFS.get("proxyUsername", "");
|
||||
String proxyPassword = PREFS.get("proxyPassword", "");
|
||||
try {
|
||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||
Connection connection = new Connection();
|
||||
|
@ -770,7 +794,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
setUserPrefsToConnection(connection);
|
||||
|
||||
logger.debug("connecting (auto): " + proxyType + " " + proxyServer + " " + proxyPort + " " + proxyUsername);
|
||||
LOGGER.debug("connecting (auto): " + proxyType + " " + proxyServer + " " + proxyPort + " " + proxyUsername);
|
||||
if (MageFrame.connect(connection)) {
|
||||
showGames(false);
|
||||
return true;
|
||||
|
@ -824,6 +848,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
mageToolbar.setFloatable(false);
|
||||
mageToolbar.setRollover(true);
|
||||
mageToolbar.setFont(new java.awt.Font("Segoe UI", 0, 48)); // NOI18N
|
||||
mageToolbar.setMaximumSize(new java.awt.Dimension(614, 60));
|
||||
mageToolbar.setMinimumSize(new java.awt.Dimension(566, 60));
|
||||
mageToolbar.setPreferredSize(new java.awt.Dimension(614, 60));
|
||||
|
||||
btnSendFeedback.setText("Feedback");
|
||||
btnSendFeedback.setFocusable(false);
|
||||
|
@ -938,9 +966,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(mageToolbar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(desktopPane))
|
||||
.addComponent(mageToolbar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(2, 2, 2)
|
||||
.addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
|
@ -960,15 +988,14 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
private void btnConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConnectActionPerformed
|
||||
if (session.isConnected()) {
|
||||
if (JOptionPane.showConfirmDialog(this, "Are you sure you want to disconnect?", "Confirm disconnect", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
session.disconnect(false);
|
||||
tablesPane.clearChat();
|
||||
showMessage("You have disconnected");
|
||||
}
|
||||
UserRequestMessage message = new UserRequestMessage("Confirm disconnect", "Are you sure you want to disconnect?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_DISCONNECT);
|
||||
showUserRequestDialog(message);
|
||||
} else {
|
||||
connectDialog.showDialog();
|
||||
setWindowTitle();
|
||||
}
|
||||
setWindowTitle();
|
||||
}//GEN-LAST:event_btnConnectActionPerformed
|
||||
|
||||
public void btnAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAboutActionPerformed
|
||||
|
@ -981,7 +1008,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
AboutDialog aboutDialog = new AboutDialog();
|
||||
desktopPane.add(aboutDialog, JLayeredPane.POPUP_LAYER);
|
||||
aboutDialog.showDialog(version);
|
||||
aboutDialog.showDialog(VERSION);
|
||||
}//GEN-LAST:event_btnAboutActionPerformed
|
||||
|
||||
private void btnCollectionViewerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCollectionViewerActionPerformed
|
||||
|
@ -1002,20 +1029,16 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
public void exitApp() {
|
||||
if (session.isConnected()) {
|
||||
if (JOptionPane.showConfirmDialog(this, "You are currently connected. Are you sure you want to disconnect?", "Confirm disconnect", JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
|
||||
return;
|
||||
}
|
||||
session.disconnect(false);
|
||||
UserRequestMessage message = new UserRequestMessage("Confirm disconnect", "You are currently connected. Are you sure you want to disconnect?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_EXIT);
|
||||
MageFrame.getInstance().showUserRequestDialog(message);
|
||||
} else {
|
||||
if (JOptionPane.showConfirmDialog(this, "Are you sure you want to exit?", "Confirm exit", JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
|
||||
return;
|
||||
}
|
||||
UserRequestMessage message = new UserRequestMessage("Confirm exit", "Are you sure you want to exit?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_EXIT);
|
||||
MageFrame.getInstance().showUserRequestDialog(message);
|
||||
}
|
||||
CardRepository.instance.closeDB();
|
||||
tablesPane.cleanUp();
|
||||
Plugins.getInstance().shutdown();
|
||||
dispose();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void enableButtons() {
|
||||
|
@ -1044,12 +1067,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
if (setActive) {
|
||||
setActive(tablesPane);
|
||||
} else {
|
||||
// if other panel was already shown, mamke sure it's topmost again
|
||||
if (topPanebefore != null) {
|
||||
} else // if other panel was already shown, mamke sure it's topmost again
|
||||
if (topPanebefore != null) {
|
||||
setActive(topPanebefore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void hideGames() {
|
||||
|
@ -1107,15 +1128,14 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
deckEditorPane.show(mode, deck, name, tableId, time);
|
||||
setActive(deckEditorPane);
|
||||
} catch (PropertyVetoException ex) {
|
||||
logger.fatal(null, ex);
|
||||
LOGGER.fatal(null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void showUserRequestDialog(final UserRequestMessage userRequestMessage) {
|
||||
final UserRequestDialog userRequestDialog = new UserRequestDialog();
|
||||
userRequestDialog.setLocation(100, 100);
|
||||
desktopPane.add(userRequestDialog, JLayeredPane.MODAL_LAYER);
|
||||
// ui.addComponent(MageComponents.DESKTOP_PANE, userRequestDialog);
|
||||
desktopPane.add(userRequestDialog, JLayeredPane.POPUP_LAYER);
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
userRequestDialog.showDialog(userRequestMessage);
|
||||
} else {
|
||||
|
@ -1158,7 +1178,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
collectionViewerPane.setVisible(true);
|
||||
setActive(collectionViewerPane);
|
||||
} catch (PropertyVetoException ex) {
|
||||
logger.fatal(null, ex);
|
||||
LOGGER.fatal(null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1176,27 +1196,27 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
public static void main(final String args[]) {
|
||||
// Workaround for #451
|
||||
System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
|
||||
logger.info("Starting MAGE client version " + version);
|
||||
logger.info("Logging level: " + logger.getEffectiveLevel());
|
||||
LOGGER.info("Starting MAGE client version " + VERSION);
|
||||
LOGGER.info("Logging level: " + LOGGER.getEffectiveLevel());
|
||||
|
||||
startTime = System.currentTimeMillis();
|
||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
@Override
|
||||
public void uncaughtException(Thread t, Throwable e) {
|
||||
logger.fatal(null, e);
|
||||
LOGGER.fatal(null, e);
|
||||
}
|
||||
});
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (String arg : args) {
|
||||
if (arg.startsWith(liteModeArg)) {
|
||||
if (arg.startsWith(LITE_MODE_ARG)) {
|
||||
liteMode = true;
|
||||
}
|
||||
if (arg.startsWith(grayModeArg)) {
|
||||
if (arg.startsWith(GRAY_MODE_ARG)) {
|
||||
grayMode = true;
|
||||
}
|
||||
if (arg.startsWith(fullscreenArg)) {
|
||||
if (arg.startsWith(FILL_SCREEN_ARG)) {
|
||||
fullscreenMode = true;
|
||||
}
|
||||
}
|
||||
|
@ -1247,50 +1267,59 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
public void setStatusText(String status) {
|
||||
this.lblStatus.setText(status);
|
||||
changeGUISize(); // Needed to layout the tooltbar after text length chnage
|
||||
}
|
||||
|
||||
public static MageUI getUI() {
|
||||
return ui;
|
||||
return UI;
|
||||
}
|
||||
|
||||
public static ChatPanelBasic getChat(UUID chatId) {
|
||||
return chats.get(chatId);
|
||||
return CHATS.get(chatId);
|
||||
}
|
||||
|
||||
public static void addChat(UUID chatId, ChatPanelBasic chatPanel) {
|
||||
chats.put(chatId, chatPanel);
|
||||
CHATS.put(chatId, chatPanel);
|
||||
}
|
||||
|
||||
public static void removeChat(UUID chatId) {
|
||||
chats.remove(chatId);
|
||||
CHATS.remove(chatId);
|
||||
}
|
||||
|
||||
public static Map<UUID, ChatPanelBasic> getChatPanels() {
|
||||
return CHATS;
|
||||
}
|
||||
|
||||
public static void addGame(UUID gameId, GamePanel gamePanel) {
|
||||
games.put(gameId, gamePanel);
|
||||
GAMES.put(gameId, gamePanel);
|
||||
}
|
||||
|
||||
public static GamePanel getGame(UUID gameId) {
|
||||
return games.get(gameId);
|
||||
return GAMES.get(gameId);
|
||||
}
|
||||
|
||||
public static void removeGame(UUID gameId) {
|
||||
games.remove(gameId);
|
||||
GAMES.remove(gameId);
|
||||
}
|
||||
|
||||
public static DraftPanel getDraft(UUID draftId) {
|
||||
return drafts.get(draftId);
|
||||
return DRAFTS.get(draftId);
|
||||
}
|
||||
|
||||
public static void removeDraft(UUID draftId) {
|
||||
DraftPanel draftPanel = drafts.get(draftId);
|
||||
DraftPanel draftPanel = DRAFTS.get(draftId);
|
||||
if (draftPanel != null) {
|
||||
drafts.remove(draftId);
|
||||
DRAFTS.remove(draftId);
|
||||
draftPanel.hideDraft();
|
||||
}
|
||||
}
|
||||
|
||||
public static void addDraft(UUID draftId, DraftPanel draftPanel) {
|
||||
drafts.put(draftId, draftPanel);
|
||||
DRAFTS.put(draftId, draftPanel);
|
||||
}
|
||||
|
||||
public BalloonTip getBalloonTip() {
|
||||
return balloonTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1312,13 +1341,13 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
@Override
|
||||
public void disconnected(final boolean errorCall) {
|
||||
if (SwingUtilities.isEventDispatchThread()) { // Returns true if the current thread is an AWT event dispatching thread.
|
||||
logger.info("DISCONNECTED (Event Dispatch Thread)");
|
||||
LOGGER.info("DISCONNECTED (Event Dispatch Thread)");
|
||||
setStatusText("Not connected");
|
||||
disableButtons();
|
||||
hideGames();
|
||||
hideTables();
|
||||
} else {
|
||||
logger.info("DISCONNECTED (NO Event Dispatch Thread)");
|
||||
LOGGER.info("DISCONNECTED (NO Event Dispatch Thread)");
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -1326,44 +1355,32 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
disableButtons();
|
||||
hideGames();
|
||||
hideTables();
|
||||
if (errorCall && JOptionPane.showConfirmDialog(MageFrame.this, "The connection to server was lost. Reconnect?", "Warning", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
if (performConnect()) {
|
||||
enableButtons();
|
||||
}
|
||||
if (errorCall) {
|
||||
UserRequestMessage message = new UserRequestMessage("Connection lost", "The connection to server was lost. Reconnect?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_RECONNECT);
|
||||
showUserRequestDialog(message);
|
||||
} else {
|
||||
session.disconnect(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMessage(final String message) {
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
JOptionPane.showMessageDialog(desktopPane, message);
|
||||
} else {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
JOptionPane.showMessageDialog(desktopPane, message);
|
||||
}
|
||||
});
|
||||
}
|
||||
public void showMessage(String message) {
|
||||
final UserRequestMessage requestMessage = new UserRequestMessage("Message", message);
|
||||
requestMessage.setButton1("OK", null);
|
||||
MageFrame.getInstance().showUserRequestDialog(requestMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(final String message) {
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
JOptionPane.showMessageDialog(desktopPane, message, "Error", JOptionPane.ERROR_MESSAGE);
|
||||
} else {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
JOptionPane.showMessageDialog(desktopPane, message, "Error", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
});
|
||||
}
|
||||
final UserRequestMessage requestMessage = new UserRequestMessage("Error", message);
|
||||
requestMessage.setButton1("OK", null);
|
||||
MageFrame.getInstance().showUserRequestDialog(requestMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1371,6 +1388,122 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
callbackClient.processCallback(callback);
|
||||
}
|
||||
|
||||
public void sendUserReplay(PlayerAction playerAction, UserRequestMessage userRequestMessage) {
|
||||
switch (playerAction) {
|
||||
case CLIENT_DOWNLOAD_SYMBOLS:
|
||||
Plugins.getInstance().downloadSymbols();
|
||||
break;
|
||||
case CLIENT_DOWNLOAD_CARD_IMAGES:
|
||||
DownloadPictures.startDownload(null, missingCards);
|
||||
break;
|
||||
case CLIENT_DISCONNECT:
|
||||
session.disconnect(false);
|
||||
tablesPane.clearChat();
|
||||
showMessage("You have disconnected");
|
||||
setWindowTitle();
|
||||
break;
|
||||
case CLIENT_QUIT_TOURNAMENT:
|
||||
MageFrame.getSession().quitTournament(userRequestMessage.getTournamentId());
|
||||
break;
|
||||
case CLIENT_QUIT_DRAFT_TOURNAMENT:
|
||||
MageFrame.getSession().quitDraft(userRequestMessage.getTournamentId());
|
||||
MageFrame.removeDraft(userRequestMessage.getTournamentId());
|
||||
break;
|
||||
case CLIENT_CONCEDE_GAME:
|
||||
MageFrame.getSession().sendPlayerAction(PlayerAction.CONCEDE, userRequestMessage.getGameId(), null);
|
||||
break;
|
||||
case CLIENT_CONCEDE_MATCH:
|
||||
MageFrame.getSession().quitMatch(userRequestMessage.getGameId());
|
||||
break;
|
||||
case CLIENT_STOP_WATCHING:
|
||||
session.stopWatching(userRequestMessage.getGameId());
|
||||
removeGame(userRequestMessage.getGameId());
|
||||
break;
|
||||
case CLIENT_EXIT:
|
||||
if (session.isConnected()) {
|
||||
session.disconnect(false);
|
||||
}
|
||||
CardRepository.instance.closeDB();
|
||||
tablesPane.cleanUp();
|
||||
Plugins.getInstance().shutdown();
|
||||
dispose();
|
||||
System.exit(0);
|
||||
break;
|
||||
case CLIENT_REMOVE_TABLE:
|
||||
session.removeTable(userRequestMessage.getRoomId(), userRequestMessage.getTableId());
|
||||
break;
|
||||
case CLIENT_RECONNECT:
|
||||
if (performConnect()) {
|
||||
enableButtons();
|
||||
}
|
||||
break;
|
||||
case CLIENT_REPLAY_ACTION:
|
||||
session.stopReplay(userRequestMessage.getGameId());
|
||||
break;
|
||||
default:
|
||||
if (session != null && playerAction != null) {
|
||||
session.sendPlayerAction(playerAction, userRequestMessage.getGameId(), userRequestMessage.getRelatedUserId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
Plugins.getInstance().changeGUISize();
|
||||
CountryUtil.changeGUISize();
|
||||
for (Component component : desktopPane.getComponents()) {
|
||||
if (component instanceof MageDialog) {
|
||||
((MageDialog) component).changeGUISize();
|
||||
}
|
||||
if (component instanceof MagePane) {
|
||||
((MagePane) component).changeGUISize();
|
||||
}
|
||||
}
|
||||
for (ChatPanelBasic chatPanel : getChatPanels().values()) {
|
||||
chatPanel.changeGUISize(GUISizeHelper.chatFont);
|
||||
}
|
||||
try {
|
||||
CardInfoPaneImpl cardInfoPane = (CardInfoPaneImpl) UI.getComponent(MageComponents.CARD_INFO_PANE);
|
||||
if (cardInfoPane != null) {
|
||||
cardInfoPane.changeGUISize();
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
||||
}
|
||||
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
Font font = GUISizeHelper.menuFont;
|
||||
mageToolbar.setFont(font);
|
||||
int newHeight = font.getSize() + 6;
|
||||
Dimension mageToolbarDimension = mageToolbar.getPreferredSize();
|
||||
mageToolbarDimension.height = newHeight + 6;
|
||||
mageToolbar.setMinimumSize(mageToolbarDimension);
|
||||
mageToolbar.setMaximumSize(mageToolbarDimension);
|
||||
mageToolbar.setPreferredSize(mageToolbarDimension);
|
||||
for (Component component : mageToolbar.getComponents()) {
|
||||
if (component instanceof JButton || component instanceof JLabel || component instanceof JToggleButton) {
|
||||
component.setFont(font);
|
||||
Dimension d = component.getPreferredSize();
|
||||
d.height = newHeight;
|
||||
component.setMinimumSize(d);
|
||||
component.setMaximumSize(d);
|
||||
|
||||
}
|
||||
if (component instanceof javax.swing.JToolBar.Separator) {
|
||||
Dimension d = component.getPreferredSize();
|
||||
d.height = newHeight;
|
||||
component.setMinimumSize(d);
|
||||
component.setMaximumSize(d);
|
||||
}
|
||||
}
|
||||
balloonTip.setFont(GUISizeHelper.balloonTooltipFont);
|
||||
}
|
||||
}
|
||||
|
||||
class MagePaneMenuItem extends JCheckBoxMenuItem {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
|
||||
<Properties>
|
||||
|
|
|
@ -24,21 +24,19 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* MagePane.java
|
||||
*
|
||||
* Created on 15-Dec-2009, 9:34:25 PM
|
||||
*/
|
||||
|
||||
package mage.client;
|
||||
|
||||
import java.awt.KeyboardFocusManager;
|
||||
import java.beans.PropertyVetoException;
|
||||
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
|
||||
import javax.swing.plaf.basic.BasicInternalFrameUI;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -46,9 +44,9 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public abstract class MagePane extends javax.swing.JInternalFrame {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(MagePane.class);
|
||||
|
||||
/** Creates new form MagePane */
|
||||
/**
|
||||
* Creates new form MagePane
|
||||
*/
|
||||
public MagePane() {
|
||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
initComponents();
|
||||
|
@ -61,6 +59,10 @@ public abstract class MagePane extends javax.swing.JInternalFrame {
|
|||
}
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUI() {
|
||||
super.updateUI();
|
||||
|
@ -90,10 +92,10 @@ public abstract class MagePane extends javax.swing.JInternalFrame {
|
|||
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
@ -115,8 +117,6 @@ public abstract class MagePane extends javax.swing.JInternalFrame {
|
|||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* Card.java
|
||||
*
|
||||
* Created on 17-Dec-2009, 9:20:50 PM
|
||||
|
@ -222,6 +222,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
|
||||
@Override
|
||||
public void updateImage() {
|
||||
|
||||
}
|
||||
|
||||
protected String getText(String cardType) {
|
||||
|
|
|
@ -39,11 +39,10 @@ import javax.swing.JLayeredPane;
|
|||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JScrollPane;
|
||||
import mage.cards.CardDimensions;
|
||||
import mage.cards.MageCard;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.Listener;
|
||||
import mage.view.AbilityView;
|
||||
import mage.view.CardView;
|
||||
|
@ -59,6 +58,8 @@ public class CardArea extends JPanel implements MouseListener {
|
|||
private final javax.swing.JLayeredPane cardArea;
|
||||
private final javax.swing.JScrollPane scrollPane;
|
||||
private int yTextOffset;
|
||||
private Dimension cardDimension;
|
||||
private int verticalCardOffset;
|
||||
|
||||
/**
|
||||
* Create the panel.
|
||||
|
@ -68,7 +69,7 @@ public class CardArea extends JPanel implements MouseListener {
|
|||
|
||||
scrollPane = new JScrollPane();
|
||||
add(scrollPane, BorderLayout.CENTER);
|
||||
|
||||
setGUISize();
|
||||
cardArea = new JLayeredPane();
|
||||
scrollPane.setViewportView(cardArea);
|
||||
yTextOffset = 10;
|
||||
|
@ -84,7 +85,25 @@ public class CardArea extends JPanel implements MouseListener {
|
|||
}
|
||||
}
|
||||
|
||||
public void loadCards(CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId) {
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
for (Component component : cardArea.getComponents()) {
|
||||
if (component instanceof CardPanel) {
|
||||
((CardPanel) component).setBounds(0, 0, cardDimension.width, cardDimension.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
setCardDimension(GUISizeHelper.otherZonesCardDimension, GUISizeHelper.otherZonesCardVerticalOffset);
|
||||
}
|
||||
|
||||
public void setCardDimension(Dimension dimension, int verticalCardOffset) {
|
||||
this.cardDimension = dimension;
|
||||
this.verticalCardOffset = verticalCardOffset;
|
||||
}
|
||||
|
||||
public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId) {
|
||||
this.reloaded = true;
|
||||
cardArea.removeAll();
|
||||
if (showCards != null && showCards.size() < 10) {
|
||||
|
@ -92,7 +111,7 @@ public class CardArea extends JPanel implements MouseListener {
|
|||
loadCardsFew(showCards, bigCard, gameId);
|
||||
} else {
|
||||
yTextOffset = 0;
|
||||
loadCardsMany(showCards, bigCard, gameId, dimension);
|
||||
loadCardsMany(showCards, bigCard, gameId);
|
||||
}
|
||||
cardArea.revalidate();
|
||||
|
||||
|
@ -100,11 +119,11 @@ public class CardArea extends JPanel implements MouseListener {
|
|||
this.repaint();
|
||||
}
|
||||
|
||||
public void loadCardsNarrow(CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId) {
|
||||
public void loadCardsNarrow(CardsView showCards, BigCard bigCard, UUID gameId) {
|
||||
this.reloaded = true;
|
||||
cardArea.removeAll();
|
||||
yTextOffset = 0;
|
||||
loadCardsMany(showCards, bigCard, gameId, dimension);
|
||||
loadCardsMany(showCards, bigCard, gameId);
|
||||
cardArea.revalidate();
|
||||
|
||||
this.revalidate();
|
||||
|
@ -112,16 +131,15 @@ public class CardArea extends JPanel implements MouseListener {
|
|||
}
|
||||
|
||||
private void loadCardsFew(CardsView showCards, BigCard bigCard, UUID gameId) {
|
||||
Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
Dimension dimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
Rectangle rectangle = new Rectangle(cardDimension.width, cardDimension.height);
|
||||
for (CardView card : showCards.values()) {
|
||||
addCard(card, bigCard, gameId, rectangle, dimension, Config.dimensions);
|
||||
rectangle.translate(Config.dimensions.frameWidth, 0);
|
||||
addCard(card, bigCard, gameId, rectangle);
|
||||
rectangle.translate(cardDimension.width, 0);
|
||||
}
|
||||
cardArea.setPreferredSize(new Dimension(Config.dimensions.frameWidth * showCards.size(), Config.dimensions.frameHeight));
|
||||
cardArea.setPreferredSize(new Dimension(cardDimension.width * showCards.size(), cardDimension.height));
|
||||
}
|
||||
|
||||
private void addCard(CardView card, BigCard bigCard, UUID gameId, Rectangle rectangle, Dimension dimension, CardDimensions cardDimensions) {
|
||||
private void addCard(CardView card, BigCard bigCard, UUID gameId, Rectangle rectangle) {
|
||||
if (card instanceof AbilityView) {
|
||||
CardView tmp = ((AbilityView) card).getSourceCard();
|
||||
tmp.overrideRules(card.getRules());
|
||||
|
@ -130,37 +148,37 @@ public class CardArea extends JPanel implements MouseListener {
|
|||
tmp.setAbility(card); // cross-reference, required for ability picker
|
||||
card = tmp;
|
||||
}
|
||||
MageCard cardPanel = Plugins.getInstance().getMageCard(card, bigCard, dimension, gameId, true);
|
||||
MageCard cardPanel = Plugins.getInstance().getMageCard(card, bigCard, cardDimension, gameId, true);
|
||||
|
||||
cardPanel.setBounds(rectangle);
|
||||
cardPanel.addMouseListener(this);
|
||||
cardArea.add(cardPanel);
|
||||
cardArea.moveToFront(cardPanel);
|
||||
cardPanel.update(card);
|
||||
cardPanel.setCardBounds(rectangle.x, rectangle.y, cardDimensions.frameWidth, cardDimensions.frameHeight);
|
||||
cardPanel.setCardBounds(rectangle.x, rectangle.y, cardDimension.width, cardDimension.height);
|
||||
cardPanel.setTextOffset(yTextOffset);
|
||||
cardPanel.showCardTitle();
|
||||
}
|
||||
|
||||
private void loadCardsMany(CardsView showCards, BigCard bigCard, UUID gameId, CardDimensions cardDimensions) {
|
||||
private void loadCardsMany(CardsView showCards, BigCard bigCard, UUID gameId) {
|
||||
int rowsOfCards = 20;
|
||||
int columns = 1;
|
||||
if (showCards != null && showCards.size() > 0) {
|
||||
Rectangle rectangle = new Rectangle(cardDimensions.frameWidth, cardDimensions.frameHeight);
|
||||
Dimension dimension = new Dimension(cardDimensions.frameWidth, cardDimensions.frameHeight);
|
||||
Rectangle rectangle = new Rectangle(cardDimension.width, cardDimension.height);
|
||||
int count = 0;
|
||||
for (CardView card : showCards.values()) {
|
||||
addCard(card, bigCard, gameId, rectangle, dimension, cardDimensions);
|
||||
if (count >= 20) {
|
||||
rectangle.translate(cardDimensions.frameWidth, -400);
|
||||
addCard(card, bigCard, gameId, rectangle);
|
||||
if (count >= rowsOfCards) {
|
||||
rectangle.translate(cardDimension.width, -(rowsOfCards * verticalCardOffset));
|
||||
columns++;
|
||||
count = 0;
|
||||
} else {
|
||||
rectangle.translate(0, 20);
|
||||
rectangle.translate(0, verticalCardOffset);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
cardArea.setPreferredSize(new Dimension(cardDimensions.frameWidth * columns, cardDimensions.frameHeight + 400));
|
||||
cardArea.setPreferredSize(new Dimension(cardDimension.width * columns, cardDimension.height + (rowsOfCards * verticalCardOffset)));
|
||||
}
|
||||
|
||||
public boolean isReloaded() {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* CardGrid.java
|
||||
*
|
||||
* Created on 30-Mar-2010, 9:25:40 PM
|
||||
|
@ -50,8 +50,8 @@ import java.util.UUID;
|
|||
import mage.cards.MageCard;
|
||||
import mage.client.deckeditor.SortSetting;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.Listener;
|
||||
import mage.utils.CardUtil;
|
||||
import mage.view.CardView;
|
||||
|
@ -126,7 +126,7 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
|
||||
private void addCard(CardView card, BigCard bigCard, UUID gameId, boolean drawImage) {
|
||||
if (cardDimension == null) {
|
||||
cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
cardDimension = GUISizeHelper.editorCardDimension;
|
||||
}
|
||||
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, cardDimension, gameId, drawImage);
|
||||
cards.put(card.getId(), cardImg);
|
||||
|
@ -139,11 +139,12 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
@Override
|
||||
public void drawCards(SortSetting sortSetting) {
|
||||
int maxWidth = this.getParent().getWidth();
|
||||
int numColumns = maxWidth / Config.dimensions.frameWidth;
|
||||
int cardVerticalOffset = GUISizeHelper.editorCardOffsetSize;
|
||||
int numColumns = maxWidth / cardDimension.width;
|
||||
int curColumn = 0;
|
||||
int curRow = 0;
|
||||
if (cards.size() > 0) {
|
||||
Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
Rectangle rectangle = new Rectangle(cardDimension.width, cardDimension.height);
|
||||
List<MageCard> sortedCards = new ArrayList<>(cards.values());
|
||||
switch (sortSetting.getSortBy()) {
|
||||
case NAME:
|
||||
|
@ -202,16 +203,16 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
}
|
||||
break;
|
||||
}
|
||||
rectangle.setLocation(curColumn * Config.dimensions.frameWidth, curRow * 20);
|
||||
rectangle.setLocation(curColumn * cardDimension.width, curRow * cardVerticalOffset);
|
||||
cardImg.setBounds(rectangle);
|
||||
cardImg.setCardBounds(rectangle.x, rectangle.y, Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
cardImg.setCardBounds(rectangle.x, rectangle.y, cardDimension.width, cardDimension.height);
|
||||
moveToFront(cardImg);
|
||||
curRow++;
|
||||
lastCard = cardImg;
|
||||
} else {
|
||||
rectangle.setLocation(curColumn * Config.dimensions.frameWidth, curRow * 20);
|
||||
rectangle.setLocation(curColumn * cardDimension.width, curRow * cardVerticalOffset);
|
||||
cardImg.setBounds(rectangle);
|
||||
cardImg.setCardBounds(rectangle.x, rectangle.y, Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
cardImg.setCardBounds(rectangle.x, rectangle.y, cardDimension.width, cardDimension.height);
|
||||
moveToFront(cardImg);
|
||||
curColumn++;
|
||||
if (curColumn == numColumns) {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* Cards.java
|
||||
*
|
||||
* Created on Dec 18, 2009, 10:40:12 AM
|
||||
|
@ -50,6 +50,7 @@ import mage.cards.MageCard;
|
|||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.CardsViewUtil;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CardsView;
|
||||
import mage.view.PermanentView;
|
||||
|
@ -64,15 +65,14 @@ import org.mage.card.arcane.CardPanel;
|
|||
*/
|
||||
public class Cards extends javax.swing.JPanel {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(Cards.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(Cards.class);
|
||||
private static final Border EMPTY_BORDER = new EmptyBorder(0, 0, 0, 0);
|
||||
|
||||
private final Map<UUID, MageCard> cards = new LinkedHashMap<>();
|
||||
private boolean dontDisplayTapped = false;
|
||||
private static final int GAP_X = 5; // needed for marking cards with coloured fram (e.g. on hand)
|
||||
private String zone;
|
||||
|
||||
private static final Border emptyBorder = new EmptyBorder(0, 0, 0, 0);
|
||||
|
||||
private int minOffsetY = 0;
|
||||
|
||||
/**
|
||||
|
@ -98,17 +98,36 @@ public class Cards extends javax.swing.JPanel {
|
|||
if (!skipAddingScrollPane) {
|
||||
jScrollPane1.setOpaque(false);
|
||||
jScrollPane1.getViewport().setOpaque(false);
|
||||
jScrollPane1.setBorder(emptyBorder);
|
||||
jScrollPane1.setBorder(EMPTY_BORDER);
|
||||
}
|
||||
if (Plugins.getInstance().isCardPluginLoaded()) {
|
||||
cardArea.setLayout(null);
|
||||
}
|
||||
cardArea.setBorder(emptyBorder);
|
||||
cardArea.setBorder(EMPTY_BORDER);
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
for (MageCard mageCard : cards.values()) {
|
||||
mageCard.setCardBounds(0, 0, getCardDimension().width, getCardDimension().height);
|
||||
mageCard.updateImage();
|
||||
mageCard.doLayout();
|
||||
}
|
||||
layoutCards();
|
||||
sizeCards(cardDimension);
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
if (jScrollPane1 != null) {
|
||||
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
|
||||
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets components background color
|
||||
*
|
||||
|
@ -151,18 +170,18 @@ public class Cards extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
// Workaround for bug leaving display of objects on the stack (issue #213 https://github.com/magefree/mage/issues/213)
|
||||
if (cardsView.size() == 0 && countCards() > 0) {
|
||||
if (cardsView.isEmpty() && countCards() > 0) {
|
||||
// problem happens with transformable cards
|
||||
logger.fatal("Card object on the cards panel was not removed");
|
||||
LOGGER.fatal("Card object on the cards panel was not removed");
|
||||
for (Component comp : cardArea.getComponents()) {
|
||||
if (comp instanceof Card) {
|
||||
Card card = (Card) comp;
|
||||
logger.fatal("Card name:" + card.getName() + " type:" + card.getType(null));
|
||||
LOGGER.fatal("Card name:" + card.getName() + " type:" + card.getType(null));
|
||||
} else if (comp instanceof MageCard) {
|
||||
MageCard mageCard = (MageCard) comp;
|
||||
logger.fatal("MageCard name:" + mageCard.getName() + " toolTiptext:" + mageCard.getToolTipText());
|
||||
LOGGER.fatal("MageCard name:" + mageCard.getName() + " toolTiptext:" + mageCard.getToolTipText());
|
||||
} else {
|
||||
logger.fatal("Unknown object:" + comp.getName() + " className:" + comp.getClass().getName());
|
||||
LOGGER.fatal("Unknown object:" + comp.getName() + " className:" + comp.getClass().getName());
|
||||
}
|
||||
cardArea.remove(comp);
|
||||
}
|
||||
|
@ -235,15 +254,25 @@ public class Cards extends javax.swing.JPanel {
|
|||
return cardDimension;
|
||||
}
|
||||
|
||||
private void addCard(CardView card, BigCard bigCard, UUID gameId) {
|
||||
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, getCardDimension(), gameId, true);
|
||||
if (zone != null) {
|
||||
cardImg.setZone(zone);
|
||||
public void setCardDimension(Dimension dimension) {
|
||||
this.cardDimension = dimension;
|
||||
for (Component component : cardArea.getComponents()) {
|
||||
if (component instanceof CardPanel) {
|
||||
((CardPanel) component).setBounds(0, 0, dimension.width, dimension.height);
|
||||
}
|
||||
}
|
||||
cards.put(card.getId(), cardImg);
|
||||
cardArea.add(cardImg);
|
||||
definePosition(cardImg);
|
||||
cardImg.setCardAreaRef(cardArea);
|
||||
layoutCards();
|
||||
}
|
||||
|
||||
private void addCard(CardView card, BigCard bigCard, UUID gameId) {
|
||||
MageCard mageCard = Plugins.getInstance().getMageCard(card, bigCard, getCardDimension(), gameId, true);
|
||||
if (zone != null) {
|
||||
mageCard.setZone(zone);
|
||||
}
|
||||
cards.put(card.getId(), mageCard);
|
||||
cardArea.add(mageCard);
|
||||
definePosition(mageCard);
|
||||
mageCard.setCardAreaRef(cardArea);
|
||||
}
|
||||
|
||||
private void definePosition(MageCard card) {
|
||||
|
@ -320,28 +349,24 @@ public class Cards extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
public void setCardDimension(Dimension dimension) {
|
||||
this.cardDimension = dimension;
|
||||
layoutCards();
|
||||
}
|
||||
|
||||
private void layoutCards() {
|
||||
java.util.List<CardPanel> cards = new ArrayList<>();
|
||||
|
||||
java.util.List<CardPanel> cardsToLayout = new ArrayList<>();
|
||||
// get all the card panels
|
||||
for (Component component : cardArea.getComponents()) {
|
||||
if (component instanceof CardPanel) {
|
||||
cards.add((CardPanel) component);
|
||||
cardsToLayout.add((CardPanel) component);
|
||||
}
|
||||
}
|
||||
Collections.sort(cards, new Comparator<CardPanel>() {
|
||||
// sort the cards
|
||||
Collections.sort(cardsToLayout, new Comparator<CardPanel>() {
|
||||
@Override
|
||||
public int compare(CardPanel cp1, CardPanel cp2) {
|
||||
return Integer.valueOf(cp1.getLocation().x).compareTo(cp2.getLocation().x);
|
||||
}
|
||||
});
|
||||
|
||||
// relocate the cards
|
||||
int dx = 0;
|
||||
for (Component component : cards) {
|
||||
for (Component component : cardsToLayout) {
|
||||
component.setLocation(dx, Math.max(component.getLocation().y, minOffsetY));
|
||||
dx += ((CardPanel) component).getCardWidth() + GAP_X;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<Dimension value="[30, 30]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="(!Beans.isDesignTime())?
(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight))
:(new Dimension(600, 600))" type="code"/>
|
||||
<Connection code="(!Beans.isDesignTime())?
(GUISizeHelper.editorCardDimension)
:(new Dimension(600, 600))" type="code"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
|
@ -261,7 +261,7 @@
|
|||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbSortByActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<SortBy>"/>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value=""/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToggleButton" name="jToggleListView">
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* CardsList.java
|
||||
*
|
||||
* Created on Dec 18, 2009, 10:40:12 AM
|
||||
|
@ -70,8 +70,8 @@ import mage.client.util.CardViewColorIdentityComparator;
|
|||
import mage.client.util.CardViewCostComparator;
|
||||
import mage.client.util.CardViewNameComparator;
|
||||
import mage.client.util.CardViewRarityComparator;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.Listener;
|
||||
import mage.client.util.gui.TableSpinnerEditor;
|
||||
import mage.constants.CardType;
|
||||
|
@ -88,6 +88,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
|
||||
protected CardEventSource cardEventSource = new CardEventSource();
|
||||
private Dimension cardDimension;
|
||||
private int rowHeight;
|
||||
private CardsView cards;
|
||||
private Map<UUID, MageCard> mageCards = new LinkedHashMap<>();
|
||||
protected BigCard bigCard;
|
||||
|
@ -105,6 +106,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
initComponents();
|
||||
makeTransparent();
|
||||
initListViewComponents();
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
|
@ -140,6 +142,20 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
redrawCards();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
mainTable.getTableHeader().setFont(GUISizeHelper.tableFont);
|
||||
mainTable.getTableHeader().setPreferredSize(new Dimension(GUISizeHelper.tableHeaderHeight, GUISizeHelper.tableHeaderHeight));
|
||||
mainTable.setFont(GUISizeHelper.tableFont);
|
||||
mainTable.setRowHeight(GUISizeHelper.getTableRowHeight());
|
||||
cardDimension = GUISizeHelper.editorCardDimension;
|
||||
rowHeight = GUISizeHelper.editorCardOffsetSize;
|
||||
}
|
||||
|
||||
private void makeTransparent() {
|
||||
panelCardArea.setOpaque(false);
|
||||
cardArea.setOpaque(false);
|
||||
|
@ -287,7 +303,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
@Override
|
||||
public void drawCards(SortSetting sortSetting) {
|
||||
int maxWidth = this.getParent().getWidth();
|
||||
int numColumns = maxWidth / Config.dimensions.frameWidth;
|
||||
int numColumns = maxWidth / cardDimension.width;
|
||||
int curColumn = 0;
|
||||
int curRow = 0;
|
||||
int maxRow = 0;
|
||||
|
@ -311,7 +327,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
}
|
||||
|
||||
if (cards != null && cards.size() > 0) {
|
||||
Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
Rectangle rectangle = new Rectangle(cardDimension.width, cardDimension.height);
|
||||
List<CardView> sortedCards = new ArrayList<>(cards.values());
|
||||
switch (sortSetting.getSortBy()) {
|
||||
case NAME:
|
||||
|
@ -347,13 +363,13 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
curRow = 0;
|
||||
}
|
||||
}
|
||||
rectangle.setLocation(curColumn * Config.dimensions.frameWidth, curRow * 20);
|
||||
rectangle.setLocation(curColumn * cardDimension.width, curRow * rowHeight);
|
||||
setCardBounds(mageCards.get(card.getId()), rectangle);
|
||||
|
||||
curRow++;
|
||||
lastCard = card;
|
||||
} else {
|
||||
rectangle.setLocation(curColumn * Config.dimensions.frameWidth, curRow * 20);
|
||||
rectangle.setLocation(curColumn * cardDimension.width, curRow * rowHeight);
|
||||
setCardBounds(mageCards.get(card.getId()), rectangle);
|
||||
curColumn++;
|
||||
if (curColumn == numColumns) {
|
||||
|
@ -367,7 +383,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
maxRow = Math.max(maxRow, curRow);
|
||||
maxColumn = Math.max(maxColumn, curColumn);
|
||||
updateCounts();
|
||||
cardArea.setPreferredSize(new Dimension((maxColumn + 1) * Config.dimensions.frameWidth, Config.dimensions.frameHeight + maxRow * 20));
|
||||
cardArea.setPreferredSize(new Dimension((maxColumn + 1) * cardDimension.width, cardDimension.height + maxRow * rowHeight));
|
||||
cardArea.revalidate();
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
|
@ -408,9 +424,6 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
}
|
||||
|
||||
private MageCard addCard(CardView card, BigCard bigCard, UUID gameId) {
|
||||
if (cardDimension == null) {
|
||||
cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
}
|
||||
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, cardDimension, gameId, true);
|
||||
cardArea.add(cardImg);
|
||||
cardImg.update(card);
|
||||
|
@ -420,7 +433,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
|
||||
private void setCardBounds(MageCard card, Rectangle rectangle) {
|
||||
card.setBounds(rectangle);
|
||||
card.setCardBounds(rectangle.x, rectangle.y, Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
card.setCardBounds(rectangle.x, rectangle.y, cardDimension.width, cardDimension.height);
|
||||
cardArea.moveToFront(card);
|
||||
}
|
||||
|
||||
|
@ -472,7 +485,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
lblInstantCount = new javax.swing.JLabel();
|
||||
lblEnchantmentCount = new javax.swing.JLabel();
|
||||
chkPiles = new javax.swing.JCheckBox();
|
||||
cbSortBy = new javax.swing.JComboBox<SortBy>();
|
||||
cbSortBy = new javax.swing.JComboBox();
|
||||
jToggleListView = new javax.swing.JToggleButton();
|
||||
jToggleCardView = new javax.swing.JToggleButton();
|
||||
panelCardArea = new javax.swing.JScrollPane();
|
||||
|
@ -481,7 +494,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
|
||||
setMinimumSize(new java.awt.Dimension(30, 30));
|
||||
setPreferredSize((!Beans.isDesignTime())?
|
||||
(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight))
|
||||
(GUISizeHelper.editorCardDimension)
|
||||
:(new Dimension(600, 600)));
|
||||
setRequestFocusEnabled(false);
|
||||
|
||||
|
@ -703,7 +716,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.ButtonGroup bgView;
|
||||
private javax.swing.JLayeredPane cardArea;
|
||||
private javax.swing.JComboBox<SortBy> cbSortBy;
|
||||
private javax.swing.JComboBox cbSortBy;
|
||||
private javax.swing.JCheckBox chkPiles;
|
||||
private javax.swing.JToggleButton jToggleCardView;
|
||||
private javax.swing.JToggleButton jToggleListView;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Form version="1.2" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
|
@ -16,17 +16,16 @@
|
|||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="txtMessage" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPaneTxt" pref="193" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPaneTxt" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="txtMessage" pref="400" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="jScrollPaneTxt" pref="175" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="txtMessage" min="-2" pref="30" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jScrollPaneTxt" pref="180" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="txtMessage" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
@ -35,7 +34,12 @@
|
|||
<Container class="javax.swing.JScrollPane" name="jScrollPaneTxt">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="null"/>
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
|
||||
<EmptyBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[32767, 32767]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
|
@ -61,6 +65,18 @@
|
|||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JTextField" name="txtMessage">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[5000, 70]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[6, 70]"/>
|
||||
</Property>
|
||||
<Property name="name" type="java.lang.String" value="" noResource="true"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[6, 70]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="txtMessageKeyTyped"/>
|
||||
</Events>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* ChatPanel.java
|
||||
*
|
||||
* Created on 15-Dec-2009, 11:04:31 PM
|
||||
|
@ -34,10 +34,13 @@
|
|||
package mage.client.chat;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.UUID;
|
||||
import javax.swing.JTextField;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.remote.Session;
|
||||
import mage.view.ChatMessage.MessageColor;
|
||||
import mage.view.ChatMessage.MessageType;
|
||||
|
@ -119,7 +122,7 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
|||
public ChatPanelBasic() {
|
||||
initComponents();
|
||||
setBackground(new Color(0, 0, 0, CHAT_ALPHA));
|
||||
|
||||
changeGUISize(GUISizeHelper.chatFont);
|
||||
if (jScrollPaneTxt != null) {
|
||||
jScrollPaneTxt.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
|
||||
jScrollPaneTxt.getViewport().setBackground(new Color(0, 0, 0, CHAT_ALPHA));
|
||||
|
@ -130,6 +133,27 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
|||
|
||||
}
|
||||
|
||||
public void changeGUISize(Font font) {
|
||||
txtConversation.setFont(font);
|
||||
txtMessage.setFont(font);
|
||||
if (jScrollPaneTxt != null) {
|
||||
jScrollPaneTxt.setFont(font);
|
||||
jScrollPaneTxt.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
|
||||
jScrollPaneTxt.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
|
||||
}
|
||||
int height = 30;
|
||||
if (font.getSize() > 20) {
|
||||
height = 30 + Math.min(font.getSize() - 10, 30);
|
||||
}
|
||||
txtMessage.setMinimumSize(new Dimension(20, height));
|
||||
txtMessage.setMaximumSize(new Dimension(txtMessage.getWidth(), height));
|
||||
txtMessage.setPreferredSize(new Dimension(txtMessage.getWidth(), height));
|
||||
txtMessage.setSize(new Dimension(txtMessage.getWidth(), height));
|
||||
if (connectedChat != null) {
|
||||
connectedChat.changeGUISize(font);
|
||||
}
|
||||
}
|
||||
|
||||
public ChatType getChatType() {
|
||||
return chatType;
|
||||
}
|
||||
|
@ -207,18 +231,12 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
|||
if (username != null && !username.isEmpty()) {
|
||||
text.append(getColoredText(userColor, username + userSeparator));
|
||||
}
|
||||
text.append(getColoredText(textColor, ManaSymbols.replaceSymbolsWithHTML(message, ManaSymbols.Type.PAY)));
|
||||
text.append(getColoredText(textColor, ManaSymbols.replaceSymbolsWithHTML(message, ManaSymbols.Type.CHAT)));
|
||||
this.txtConversation.append(text.toString());
|
||||
}
|
||||
|
||||
protected String getColoredText(String color, String text) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("<font color='");
|
||||
sb.append(color);
|
||||
sb.append("'>");
|
||||
sb.append(text);
|
||||
sb.append("</font>");
|
||||
return sb.toString();
|
||||
return "<font color='" + color + "'>" + text + "</font>";
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
|
@ -285,7 +303,8 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
|||
txtConversation = new mage.client.components.ColorPane();
|
||||
txtMessage = new javax.swing.JTextField();
|
||||
|
||||
jScrollPaneTxt.setBorder(null);
|
||||
jScrollPaneTxt.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
jScrollPaneTxt.setPreferredSize(new java.awt.Dimension(32767, 32767));
|
||||
|
||||
txtConversation.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
txtConversation.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
|
@ -294,6 +313,10 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
|||
txtConversation.setOpaque(false);
|
||||
jScrollPaneTxt.setViewportView(txtConversation);
|
||||
|
||||
txtMessage.setMaximumSize(new java.awt.Dimension(5000, 70));
|
||||
txtMessage.setMinimumSize(new java.awt.Dimension(6, 70));
|
||||
txtMessage.setName(""); // NOI18N
|
||||
txtMessage.setPreferredSize(new java.awt.Dimension(6, 70));
|
||||
txtMessage.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||
public void keyTyped(java.awt.event.KeyEvent evt) {
|
||||
txtMessageKeyTyped(evt);
|
||||
|
@ -304,18 +327,15 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
|||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtMessage)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)
|
||||
.addGap(0, 0, 0))
|
||||
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addComponent(txtMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(txtMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0))
|
||||
.addComponent(txtMessage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
|
|
@ -27,8 +27,10 @@
|
|||
*/
|
||||
package mage.client.chat;
|
||||
|
||||
import java.awt.Font;
|
||||
import static mage.client.chat.ChatPanelBasic.TIMESTAMP_COLOR;
|
||||
import mage.client.components.ColorPane;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.view.ChatMessage;
|
||||
import org.mage.card.arcane.ManaSymbols;
|
||||
|
||||
|
@ -93,7 +95,7 @@ public class ChatPanelSeparated extends ChatPanelBasic {
|
|||
if (username != null && !username.isEmpty()) {
|
||||
text.append(getColoredText(userColor, username + userSeparator));
|
||||
}
|
||||
text.append(getColoredText(textColor, ManaSymbols.replaceSymbolsWithHTML(message, ManaSymbols.Type.PAY)));
|
||||
text.append(getColoredText(textColor, ManaSymbols.replaceSymbolsWithHTML(message, ManaSymbols.Type.CHAT)));
|
||||
this.systemMessagesPane.append(text.toString());
|
||||
}
|
||||
|
||||
|
@ -103,6 +105,16 @@ public class ChatPanelSeparated extends ChatPanelBasic {
|
|||
|
||||
public void setSystemMessagesPane(ColorPane systemMessagesPane) {
|
||||
this.systemMessagesPane = systemMessagesPane;
|
||||
changeGUISize(GUISizeHelper.chatFont);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeGUISize(Font font) {
|
||||
if (systemMessagesPane != null) {
|
||||
systemMessagesPane.setFont(font);
|
||||
}
|
||||
|
||||
super.changeGUISize(font);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package mage.client.components;
|
|||
import java.awt.Color;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import org.mage.card.arcane.ManaSymbols;
|
||||
import org.mage.card.arcane.UI;
|
||||
|
||||
|
@ -35,7 +36,7 @@ public class MageTextArea extends JEditorPane {
|
|||
final StringBuilder buffer = new StringBuilder(512);
|
||||
// Dialog is a java logical font family, so it should work on all systems
|
||||
buffer.append("<html><body style='font-family:Dialog;font-size:");
|
||||
buffer.append(16);
|
||||
buffer.append(GUISizeHelper.gameDialogAreaFontSizeBig);
|
||||
buffer.append("pt;margin:3px 3px 3px 3px;color: #FFFFFF'><b><center>");
|
||||
|
||||
// Don't know what it does (easy italc?) but it bugs with multiple #HTML color codes (LevelX2)
|
||||
|
@ -43,7 +44,7 @@ public class MageTextArea extends JEditorPane {
|
|||
//text = text.replaceAll("\\s*//\\s*", "<hr width='50%'>");
|
||||
text = text.replace("\r\n", "<div style='font-size:5pt'></div>");
|
||||
|
||||
final String basicText = ManaSymbols.replaceSymbolsWithHTML(text, ManaSymbols.Type.PAY);
|
||||
final String basicText = ManaSymbols.replaceSymbolsWithHTML(text, ManaSymbols.Type.DIALOG);
|
||||
if (text.length() > 0) {
|
||||
buffer.append(basicText);
|
||||
}
|
||||
|
@ -57,10 +58,9 @@ public class MageTextArea extends JEditorPane {
|
|||
MageTextArea.super.setText(promptText);
|
||||
// in case the text don't fit in the panel a tooltip with the text is added
|
||||
if (panelWidth > 0 && MageTextArea.this.getPreferredSize().getWidth() > panelWidth) {
|
||||
// String tooltip = promptText
|
||||
// .replace("color: #FFFFFF'>", "color: #111111'><p width='400'>")
|
||||
// .replace("</body>", "</p></body>");
|
||||
String tooltip = "<html><center><body style='font-family:Dialog;font-size:14;color: #FFFFFF'><p width='500'>" + basicText + "</p></body></html>";
|
||||
String tooltip = "<html><center><body style='font-family:Dialog;font-size:"
|
||||
+ GUISizeHelper.gameDialogAreaFontSizeBig
|
||||
+ ";color: #FFFFFF'><p width='500'>" + basicText + "</p></body></html>";
|
||||
MageTextArea.super.setToolTipText(tooltip);
|
||||
} else {
|
||||
MageTextArea.super.setToolTipText(null);
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
package mage.client.components.ability;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import javax.swing.*;
|
||||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.SettingsManager;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
|
@ -12,12 +17,6 @@ import org.jdesktop.swingx.JXPanel;
|
|||
import org.mage.card.arcane.ManaSymbols;
|
||||
import org.mage.card.arcane.UI;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Dialog for choosing abilities.
|
||||
*
|
||||
|
@ -48,8 +47,8 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
|
|||
private static final String IMAGE_RIGHT_PATH = "/game/right.png";
|
||||
private static final String IMAGE_RIGHT_HOVERED_PATH = "/game/right_hovered.png";
|
||||
|
||||
private static Color SELECTED_COLOR = new Color(64,147,208);
|
||||
private static Color BORDER_COLOR = new Color(0,0,0,50);
|
||||
private static Color SELECTED_COLOR = new Color(64, 147, 208);
|
||||
private static Color BORDER_COLOR = new Color(0, 0, 0, 50);
|
||||
|
||||
private boolean selected = false;
|
||||
|
||||
|
@ -59,7 +58,7 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
|
|||
|
||||
jScrollPane2.setOpaque(false);
|
||||
jScrollPane2.getViewport().setOpaque(false);
|
||||
UIManager.put( "ScrollBar.width", 17);
|
||||
UIManager.put("ScrollBar.width", 17);
|
||||
jScrollPane2.getHorizontalScrollBar().setUI(new MageScrollbarUI());
|
||||
jScrollPane2.getVerticalScrollBar().setUI(new MageScrollbarUI());
|
||||
}
|
||||
|
@ -67,13 +66,13 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
|
|||
public AbilityPicker(List<Object> choices, String message) {
|
||||
this.choices = choices;
|
||||
setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
|
||||
if (message!= null) {
|
||||
if (message != null) {
|
||||
this.message = message + " (single-click)";
|
||||
}
|
||||
initComponents();
|
||||
jScrollPane2.setOpaque(false);
|
||||
jScrollPane2.getViewport().setOpaque(false);
|
||||
UIManager.put( "ScrollBar.width", 17);
|
||||
UIManager.put("ScrollBar.width", 17);
|
||||
jScrollPane2.getHorizontalScrollBar().setUI(new MageScrollbarUI());
|
||||
jScrollPane2.getVerticalScrollBar().setUI(new MageScrollbarUI());
|
||||
}
|
||||
|
@ -84,7 +83,7 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
|
|||
}
|
||||
|
||||
public void cleanUp() {
|
||||
for(MouseListener ml: this.getMouseListeners()) {
|
||||
for (MouseListener ml : this.getMouseListeners()) {
|
||||
this.removeMouseListener(ml);
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +92,7 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
|
|||
this.choices = new ArrayList<Object>();
|
||||
this.selected = true; // to stop previous modal
|
||||
|
||||
for (Map.Entry<UUID, String> choice: choices.getChoices().entrySet()) {
|
||||
for (Map.Entry<UUID, String> choice : choices.getChoices().entrySet()) {
|
||||
this.choices.add(new AbilityPickerAction(choice.getKey(), choice.getValue()));
|
||||
}
|
||||
this.choices.add(new AbilityPickerAction(null, "Cancel"));
|
||||
|
@ -186,28 +185,28 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
|
|||
GroupLayout.TRAILING,
|
||||
layout.createSequentialGroup().addContainerGap().add(
|
||||
layout.createParallelGroup(GroupLayout.TRAILING).add(GroupLayout.LEADING, jScrollPane2, GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE).add(GroupLayout.LEADING,
|
||||
layout.createSequentialGroup().add(jLabel1).addPreferredGap(LayoutStyle.RELATED, 175, Short.MAX_VALUE).add(1, 1, 1)).add(
|
||||
GroupLayout.LEADING,
|
||||
layout.createSequentialGroup().add(layout.createParallelGroup(GroupLayout.LEADING)
|
||||
)
|
||||
.addPreferredGap(LayoutStyle.RELATED)
|
||||
.add(
|
||||
layout.createParallelGroup(GroupLayout.TRAILING)
|
||||
.add(
|
||||
GroupLayout.LEADING, layout.createParallelGroup(GroupLayout.LEADING))))).add(10, 10, 10)));
|
||||
layout.createSequentialGroup().add(jLabel1).addPreferredGap(LayoutStyle.RELATED, 175, Short.MAX_VALUE).add(1, 1, 1)).add(
|
||||
GroupLayout.LEADING,
|
||||
layout.createSequentialGroup().add(layout.createParallelGroup(GroupLayout.LEADING)
|
||||
)
|
||||
.addPreferredGap(LayoutStyle.RELATED)
|
||||
.add(
|
||||
layout.createParallelGroup(GroupLayout.TRAILING)
|
||||
.add(
|
||||
GroupLayout.LEADING, layout.createParallelGroup(GroupLayout.LEADING))))).add(10, 10, 10)));
|
||||
|
||||
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.LEADING).add(
|
||||
layout.createSequentialGroup().add(
|
||||
layout.createParallelGroup(GroupLayout.LEADING).add(
|
||||
layout.createSequentialGroup().add(jLabel1, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE)
|
||||
.add(5, 5, 5)
|
||||
.add(
|
||||
layout.createParallelGroup(GroupLayout.BASELINE)
|
||||
)
|
||||
).add(layout.createSequentialGroup().add(8, 8, 8)))
|
||||
.addPreferredGap(LayoutStyle.RELATED).add(layout.createParallelGroup(GroupLayout.BASELINE)).addPreferredGap(LayoutStyle.RELATED).add(
|
||||
layout.createParallelGroup(GroupLayout.BASELINE)).addPreferredGap(LayoutStyle.RELATED).add(layout.createParallelGroup(GroupLayout.LEADING)).addPreferredGap(
|
||||
LayoutStyle.RELATED).add(jScrollPane2, GroupLayout.PREFERRED_SIZE, 180, GroupLayout.PREFERRED_SIZE).addContainerGap(23, Short.MAX_VALUE)));
|
||||
layout.createSequentialGroup().add(jLabel1, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE)
|
||||
.add(5, 5, 5)
|
||||
.add(
|
||||
layout.createParallelGroup(GroupLayout.BASELINE)
|
||||
)
|
||||
).add(layout.createSequentialGroup().add(8, 8, 8)))
|
||||
.addPreferredGap(LayoutStyle.RELATED).add(layout.createParallelGroup(GroupLayout.BASELINE)).addPreferredGap(LayoutStyle.RELATED).add(
|
||||
layout.createParallelGroup(GroupLayout.BASELINE)).addPreferredGap(LayoutStyle.RELATED).add(layout.createParallelGroup(GroupLayout.LEADING)).addPreferredGap(
|
||||
LayoutStyle.RELATED).add(jScrollPane2, GroupLayout.PREFERRED_SIZE, 180, GroupLayout.PREFERRED_SIZE).addContainerGap(23, Short.MAX_VALUE)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -217,27 +216,25 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
|
|||
|
||||
if (notches < 0) {
|
||||
if (index > 0) {
|
||||
rows.setSelectedIndex(index-1);
|
||||
rows.repaint();
|
||||
}
|
||||
} else {
|
||||
if (index < choices.size() - 1) {
|
||||
rows.setSelectedIndex(index+1);
|
||||
rows.setSelectedIndex(index - 1);
|
||||
rows.repaint();
|
||||
}
|
||||
} else if (index < choices.size() - 1) {
|
||||
rows.setSelectedIndex(index + 1);
|
||||
rows.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
private void objectMouseClicked(MouseEvent event) {
|
||||
int index = rows.getSelectedIndex();
|
||||
AbilityPickerAction action = (AbilityPickerAction)choices.get(index);
|
||||
AbilityPickerAction action = (AbilityPickerAction) choices.get(index);
|
||||
action.actionPerformed(null);
|
||||
}
|
||||
|
||||
public class ImageRenderer2 extends JEditorPane implements ListCellRenderer {
|
||||
|
||||
public final Map<String, String> cache = new HashMap<String, String>();
|
||||
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(
|
||||
javax.swing.JList list,
|
||||
|
@ -252,7 +249,7 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
|
|||
UI.setHTMLEditorKit(this);
|
||||
|
||||
setOpaque(false);
|
||||
setBackground(new Color(0,0,0,0));
|
||||
setBackground(new Color(0, 0, 0, 0));
|
||||
|
||||
String text = value.toString();
|
||||
|
||||
|
@ -298,17 +295,15 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
|
|||
//text += "<br>";
|
||||
|
||||
if (text.length() > 0) {
|
||||
buffer.append(ManaSymbols.replaceSymbolsWithHTML(text, ManaSymbols.Type.PAY));
|
||||
buffer.append(ManaSymbols.replaceSymbolsWithHTML(text, ManaSymbols.Type.DIALOG));
|
||||
}
|
||||
|
||||
buffer.append("</b></body></html>");
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
class ImageRenderer extends DefaultListCellRenderer {
|
||||
|
||||
@Override
|
||||
|
@ -364,7 +359,6 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
|
|||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (event instanceof MouseEvent) {
|
||||
MouseEvent e = (MouseEvent) event;
|
||||
MouseEvent m = SwingUtilities.convertMouseEvent((Component) e.getSource(), e, this);
|
||||
|
@ -457,14 +451,14 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (String)getValue(Action.NAME);
|
||||
return (String) getValue(Action.NAME);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void cancel() {
|
||||
try {
|
||||
session.sendPlayerBoolean(gameId, false);
|
||||
session.sendPlayerBoolean(gameId, false);
|
||||
} catch (Exception e) {
|
||||
log.error("Couldn't cancel choose dialog: " + e, e);
|
||||
}
|
||||
|
|
|
@ -24,18 +24,18 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* CardSelector.java
|
||||
*
|
||||
* Created on Feb 18, 2010, 2:49:03 PM
|
||||
*/
|
||||
|
||||
package mage.client.deckeditor;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentEvent;
|
||||
|
@ -64,6 +64,7 @@ import mage.client.cards.CardGrid;
|
|||
import mage.client.cards.ICardGrid;
|
||||
import mage.client.constants.Constants.SortBy;
|
||||
import mage.client.deckeditor.table.TableModel;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.sets.ConstructedFormats;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.FilterCard;
|
||||
|
@ -76,7 +77,6 @@ import mage.filter.predicate.other.CardTextPredicate;
|
|||
import mage.filter.predicate.other.ExpansionSetPredicate;
|
||||
import mage.view.CardsView;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com, nantuko
|
||||
|
@ -95,22 +95,25 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}
|
||||
};
|
||||
|
||||
/** Creates new form CardSelector */
|
||||
/**
|
||||
* Creates new form CardSelector
|
||||
*/
|
||||
public CardSelector() {
|
||||
sortSetting = SortSettingBase.getInstance();
|
||||
initComponents();
|
||||
cardGrid = new CardGrid();
|
||||
makeTransparent();
|
||||
initListViewComponents();
|
||||
currentView = mainModel; // by default we use List View
|
||||
setGUISize();
|
||||
currentView = mainModel; // by default we use List View
|
||||
}
|
||||
|
||||
private void makeTransparent() {
|
||||
this.addComponentListener(this);
|
||||
setOpaque(false);
|
||||
|
||||
|
||||
cardGrid.setOpaque(false);
|
||||
|
||||
|
||||
cardSelectorScrollPane.setOpaque(false);
|
||||
cardSelectorScrollPane.getViewport().setOpaque(false);
|
||||
cbSortBy.setModel(new DefaultComboBoxModel<>(SortBy.values()));
|
||||
|
@ -158,27 +161,39 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
if (e.getClickCount() == 2 && !e.isConsumed()) {
|
||||
e.consume();
|
||||
if (e.isAltDown()) {
|
||||
jButtonAddToSideboardActionPerformed(null);
|
||||
jButtonAddToSideboardActionPerformed(null);
|
||||
} else {
|
||||
jButtonAddToMainActionPerformed(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
jToggleCardView.setToolTipText(jToggleCardView.getToolTipText() + " (works only up to " + CardGrid.MAX_IMAGES + " cards).");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Free all references
|
||||
*
|
||||
*
|
||||
*/
|
||||
public void cleanUp() {
|
||||
this.cardGrid.clear();
|
||||
this.mainModel.clear();
|
||||
}
|
||||
|
||||
public void switchToGrid(){
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
mainTable.getTableHeader().setFont(GUISizeHelper.tableFont);
|
||||
mainTable.getTableHeader().setPreferredSize(new Dimension(GUISizeHelper.tableHeaderHeight, GUISizeHelper.tableHeaderHeight));
|
||||
mainTable.setFont(GUISizeHelper.tableFont);
|
||||
mainTable.setRowHeight(GUISizeHelper.getTableRowHeight());
|
||||
|
||||
}
|
||||
|
||||
public void switchToGrid() {
|
||||
jToggleListView.setSelected(false);
|
||||
jToggleCardView.setSelected(true);
|
||||
currentView = cardGrid;
|
||||
|
@ -199,7 +214,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
this.cbExpansionSet.setVisible(false);
|
||||
this.limited = true;
|
||||
this.cards.clear();
|
||||
for (Card card: sideboard) {
|
||||
for (Card card : sideboard) {
|
||||
this.cards.add(card);
|
||||
}
|
||||
filterCards();
|
||||
|
@ -268,7 +283,6 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}
|
||||
filter.add(Predicates.or(predicates));
|
||||
|
||||
|
||||
if (this.cbExpansionSet.isVisible()) {
|
||||
String expansionSelection = this.cbExpansionSet.getSelectedItem().toString();
|
||||
if (!expansionSelection.equals("- All Sets")) {
|
||||
|
@ -313,11 +327,9 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}
|
||||
if (this.tbPlaneswalkers.isSelected()) {
|
||||
criteria.types(CardType.PLANESWALKER);
|
||||
}
|
||||
}
|
||||
// criteria.types(CardType.TRIBAL);
|
||||
// criteria.types(CardType.CONSPIRACY);
|
||||
|
||||
|
||||
|
||||
if (this.cbExpansionSet.isVisible()) {
|
||||
String expansionSelection = this.cbExpansionSet.getSelectedItem().toString();
|
||||
|
@ -337,7 +349,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
return !string1.equals(string2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void filterCardsColor(int modifiers, String actionCommand) {
|
||||
// ALT or CTRL button was pushed
|
||||
if ((modifiers & ActionEvent.ALT_MASK) == ActionEvent.ALT_MASK || (modifiers & ActionEvent.CTRL_MASK) == ActionEvent.CTRL_MASK) {
|
||||
|
@ -348,10 +360,10 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
tbGreen.setSelected(inverter(invert, tbGreen.getActionCommand(), actionCommand));
|
||||
tbRed.setSelected(inverter(invert, tbRed.getActionCommand(), actionCommand));
|
||||
tbWhite.setSelected(inverter(invert, tbWhite.getActionCommand(), actionCommand));
|
||||
}
|
||||
filterCards();
|
||||
}
|
||||
filterCards();
|
||||
}
|
||||
|
||||
|
||||
private void filterCardsType(int modifiers, String actionCommand) {
|
||||
// ALT or CTRL button was pushed
|
||||
if ((modifiers & ActionEvent.ALT_MASK) == ActionEvent.ALT_MASK || (modifiers & ActionEvent.CTRL_MASK) == ActionEvent.CTRL_MASK) {
|
||||
|
@ -363,38 +375,36 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
tbLand.setSelected(inverter(invert, tbLand.getActionCommand(), actionCommand));
|
||||
tbPlaneswalkers.setSelected(inverter(invert, tbPlaneswalkers.getActionCommand(), actionCommand));
|
||||
tbSorceries.setSelected(inverter(invert, tbSorceries.getActionCommand(), actionCommand));
|
||||
}
|
||||
filterCards();
|
||||
}
|
||||
filterCards();
|
||||
}
|
||||
|
||||
|
||||
private void filterCards() {
|
||||
FilterCard filter = buildFilter();
|
||||
try {
|
||||
List<Card> filteredCards = new ArrayList<>();
|
||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||
if (limited) {
|
||||
for (Card card: cards) {
|
||||
for (Card card : cards) {
|
||||
if (filter.match(card, null)) {
|
||||
filteredCards.add(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
List<CardInfo> foundCards = CardRepository.instance.findCards(buildCriteria());
|
||||
for (CardInfo cardInfo : foundCards) {
|
||||
Card card = cardInfo.getMockCard();
|
||||
if (filter.match(card, null)) {
|
||||
filteredCards.add(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currentView instanceof CardGrid && filteredCards.size() > CardGrid.MAX_IMAGES) {
|
||||
this.toggleViewMode();
|
||||
}
|
||||
this.currentView.loadCards(new CardsView(filteredCards), sortSetting, bigCard, null, false);
|
||||
this.cardCount.setText(String.valueOf(filteredCards.size()));
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
}
|
||||
|
@ -413,7 +423,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
public void removeCard(UUID cardId) {
|
||||
this.mainModel.removeCard(cardId);
|
||||
this.cardGrid.removeCard(cardId);
|
||||
for (Card card: cards) {
|
||||
for (Card card : cards) {
|
||||
if (card.getId().equals(cardId)) {
|
||||
cards.remove(card);
|
||||
break;
|
||||
|
@ -421,10 +431,10 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
@ -1032,7 +1042,6 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
mainModel.removeFromSideEvent(0);
|
||||
}//GEN-LAST:event_jButtonRemoveFromSideboardActionPerformed
|
||||
|
||||
|
||||
private void jButtonSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSearchActionPerformed
|
||||
filterCards();
|
||||
}//GEN-LAST:event_jButtonSearchActionPerformed
|
||||
|
@ -1059,11 +1068,11 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}//GEN-LAST:event_tbBlackActionPerformed
|
||||
|
||||
private void tbWhiteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbWhiteActionPerformed
|
||||
filterCardsColor(evt.getModifiers(), evt.getActionCommand());
|
||||
filterCardsColor(evt.getModifiers(), evt.getActionCommand());
|
||||
}//GEN-LAST:event_tbWhiteActionPerformed
|
||||
|
||||
private void tbColorlessActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbColorlessActionPerformed
|
||||
filterCardsColor(evt.getModifiers(), evt.getActionCommand());
|
||||
filterCardsColor(evt.getModifiers(), evt.getActionCommand());
|
||||
}//GEN-LAST:event_tbColorlessActionPerformed
|
||||
|
||||
private void tbCreaturesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbCreaturesActionPerformed
|
||||
|
@ -1103,7 +1112,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
cbSortBy.setEnabled(false);
|
||||
chkPiles.setEnabled(false);
|
||||
jButtonAddToMain.setEnabled(true);
|
||||
jButtonAddToSideboard.setEnabled(true);
|
||||
jButtonAddToSideboard.setEnabled(true);
|
||||
} else {
|
||||
jToggleCardView.setSelected(true);
|
||||
jToggleListView.setSelected(false);
|
||||
|
@ -1112,7 +1121,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
cbSortBy.setEnabled(true);
|
||||
chkPiles.setEnabled(true);
|
||||
jButtonAddToMain.setEnabled(false);
|
||||
jButtonAddToSideboard.setEnabled(false);
|
||||
jButtonAddToSideboard.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,15 +24,12 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* DeckArea.java
|
||||
*
|
||||
* Created on Feb 18, 2010, 3:10:39 PM
|
||||
*/
|
||||
|
||||
package mage.client.deckeditor;
|
||||
|
||||
import mage.cards.decks.Deck;
|
||||
|
@ -40,6 +37,7 @@ import mage.client.cards.BigCard;
|
|||
import mage.client.cards.CardsList;
|
||||
import mage.client.constants.Constants.DeckEditorMode;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.Listener;
|
||||
import mage.view.CardsView;
|
||||
|
||||
|
@ -49,7 +47,9 @@ import mage.view.CardsView;
|
|||
*/
|
||||
public class DeckArea extends javax.swing.JPanel {
|
||||
|
||||
/** Creates new form DeckArea */
|
||||
/**
|
||||
* Creates new form DeckArea
|
||||
*/
|
||||
public DeckArea() {
|
||||
initComponents();
|
||||
deckAreaSplitPane.setOpaque(false);
|
||||
|
@ -66,6 +66,16 @@ public class DeckArea extends javax.swing.JPanel {
|
|||
sideboardList.cleanUp();
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
deckList.changeGUISize();
|
||||
sideboardList.changeGUISize();
|
||||
deckAreaSplitPane.setDividerSize(GUISizeHelper.dividerBarSize);
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
}
|
||||
|
||||
public void showSideboard(boolean show) {
|
||||
this.sideboardList.setVisible(show);
|
||||
}
|
||||
|
@ -74,7 +84,7 @@ public class DeckArea extends javax.swing.JPanel {
|
|||
this.deckList.setDeckEditorMode(mode);
|
||||
this.sideboardList.setDeckEditorMode(mode);
|
||||
}
|
||||
|
||||
|
||||
public void loadDeck(Deck deck, BigCard bigCard) {
|
||||
deckList.loadCards(new CardsView(deck.getCards()), bigCard, null);
|
||||
if (sideboardList.isVisible()) {
|
||||
|
@ -98,10 +108,10 @@ public class DeckArea extends javax.swing.JPanel {
|
|||
sideboardList.clearCardEventListeners();
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
|
|
@ -24,14 +24,13 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* DeckEditorPane.java
|
||||
*
|
||||
* Created on Dec 17, 2009, 9:21:42 AM
|
||||
*/
|
||||
|
||||
package mage.client.deckeditor;
|
||||
|
||||
import java.awt.Component;
|
||||
|
@ -44,14 +43,15 @@ import mage.client.MagePane;
|
|||
import mage.client.constants.Constants.DeckEditorMode;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class DeckEditorPane extends MagePane {
|
||||
|
||||
/** Creates new form TablesPane */
|
||||
/**
|
||||
* Creates new form TablesPane
|
||||
*/
|
||||
public DeckEditorPane() {
|
||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
boolean initialized = false;
|
||||
|
@ -72,17 +72,19 @@ public class DeckEditorPane extends MagePane {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeGUISize() {
|
||||
super.changeGUISize();
|
||||
deckEditorPanel1.changeGUISize();
|
||||
}
|
||||
|
||||
public void show(DeckEditorMode mode, Deck deck, String name, UUID tableId, int time) {
|
||||
if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING) {
|
||||
this.setTitle("Deck Editor - " + tableId.toString());
|
||||
}
|
||||
else {
|
||||
if (deck != null) {
|
||||
this.setTitle("Deck Editor - " + deck.getName());
|
||||
}
|
||||
else {
|
||||
this.setTitle("Deck Editor");
|
||||
}
|
||||
} else if (deck != null) {
|
||||
this.setTitle("Deck Editor - " + deck.getName());
|
||||
} else {
|
||||
this.setTitle("Deck Editor");
|
||||
}
|
||||
this.deckEditorPanel1.showDeckEditor(mode, deck, tableId, time);
|
||||
this.repaint();
|
||||
|
@ -92,10 +94,10 @@ public class DeckEditorPane extends MagePane {
|
|||
return this.deckEditorPanel1.getDeckEditorMode();
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
@ -122,17 +124,21 @@ public class DeckEditorPane extends MagePane {
|
|||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 885, Short.MAX_VALUE)
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 885, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
pack();
|
||||
}
|
||||
|
||||
public DeckEditorPanel getPanel() {
|
||||
return deckEditorPanel1;
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private mage.client.deckeditor.DeckEditorPanel deckEditorPanel1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
|
|
@ -109,20 +109,20 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
jSplitPane1.setOpaque(false);
|
||||
countdown = new Timer(1000,
|
||||
new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (--timeout > 0) {
|
||||
setTimeout(timeout);
|
||||
} else {
|
||||
if (updateDeckTask != null) {
|
||||
updateDeckTask.cancel(true);
|
||||
}
|
||||
setTimeout(0);
|
||||
countdown.stop();
|
||||
removeDeckEditor();
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (--timeout > 0) {
|
||||
setTimeout(timeout);
|
||||
} else {
|
||||
if (updateDeckTask != null) {
|
||||
updateDeckTask.cancel(true);
|
||||
}
|
||||
});
|
||||
setTimeout(0);
|
||||
countdown.stop();
|
||||
removeDeckEditor();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,6 +147,11 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
this.bigCard = null;
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
this.cardSelector.changeGUISize();
|
||||
this.deckArea.changeGUISize();
|
||||
}
|
||||
|
||||
public void showDeckEditor(DeckEditorMode mode, Deck deck, UUID tableId, int time) {
|
||||
if (deck != null) {
|
||||
this.deck = deck;
|
||||
|
@ -209,145 +214,145 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
component.clearCardEventListeners();
|
||||
component.addCardEventListener(
|
||||
new Listener<Event>() {
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
switch (event.getEventName()) {
|
||||
case "double-click":
|
||||
moveSelectorCardToDeck(event);
|
||||
break;
|
||||
case "alt-double-click":
|
||||
if (mode == DeckEditorMode.FREE_BUILDING) {
|
||||
moveSelectorCardToSideboard(event);
|
||||
} else {
|
||||
// because in match mode selector is used as sideboard the card goes to deck also for shift click
|
||||
moveSelectorCardToDeck(event);
|
||||
}
|
||||
break;
|
||||
case "remove-main":
|
||||
DeckEditorPanel.this.deckArea.getDeckList().handleDoubleClick();
|
||||
break;
|
||||
case "remove-sideboard":
|
||||
DeckEditorPanel.this.deckArea.getSideboardList().handleDoubleClick();
|
||||
break;
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
switch (event.getEventName()) {
|
||||
case "double-click":
|
||||
moveSelectorCardToDeck(event);
|
||||
break;
|
||||
case "alt-double-click":
|
||||
if (mode == DeckEditorMode.FREE_BUILDING) {
|
||||
moveSelectorCardToSideboard(event);
|
||||
} else {
|
||||
// because in match mode selector is used as sideboard the card goes to deck also for shift click
|
||||
moveSelectorCardToDeck(event);
|
||||
}
|
||||
refreshDeck();
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "remove-main":
|
||||
DeckEditorPanel.this.deckArea.getDeckList().handleDoubleClick();
|
||||
break;
|
||||
case "remove-sideboard":
|
||||
DeckEditorPanel.this.deckArea.getSideboardList().handleDoubleClick();
|
||||
break;
|
||||
}
|
||||
refreshDeck();
|
||||
}
|
||||
});
|
||||
}
|
||||
this.deckArea.clearDeckEventListeners();
|
||||
this.deckArea.addDeckEventListener(
|
||||
new Listener<Event>() {
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (mode.equals(DeckEditorMode.FREE_BUILDING)) {
|
||||
switch (event.getEventName()) {
|
||||
case "double-click": {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getCards().remove(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
break;
|
||||
}
|
||||
case "alt-double-click": {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getCards().remove(card);
|
||||
deck.getSideboard().add(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
break;
|
||||
}
|
||||
case "set-number": {
|
||||
setCardNumberToCardsList(event, deck.getCards());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// constructing phase or sideboarding during match -> card goes always to sideboard
|
||||
switch (event.getEventName()) {
|
||||
case "double-click":
|
||||
case "alt-double-click": {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getCards().remove(card);
|
||||
deck.getSideboard().add(card);
|
||||
cardSelector.loadSideboard(new ArrayList<>(deck.getSideboard()), getBigCard());
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (mode.equals(DeckEditorMode.FREE_BUILDING)) {
|
||||
switch (event.getEventName()) {
|
||||
case "double-click": {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getCards().remove(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
break;
|
||||
}
|
||||
case "alt-double-click": {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getCards().remove(card);
|
||||
deck.getSideboard().add(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
break;
|
||||
}
|
||||
case "set-number": {
|
||||
setCardNumberToCardsList(event, deck.getCards());
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// constructing phase or sideboarding during match -> card goes always to sideboard
|
||||
switch (event.getEventName()) {
|
||||
case "double-click":
|
||||
case "alt-double-click": {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getCards().remove(card);
|
||||
deck.getSideboard().add(card);
|
||||
cardSelector.loadSideboard(new ArrayList<>(deck.getSideboard()), getBigCard());
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.deckArea.addSideboardEventListener(
|
||||
new Listener<Event>() {
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (mode.equals(DeckEditorMode.FREE_BUILDING)) {
|
||||
// normal edit mode
|
||||
switch (event.getEventName()) {
|
||||
case "double-click":
|
||||
// remove card from sideboard (don't add it to deck)
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getSideboard().remove(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (mode.equals(DeckEditorMode.FREE_BUILDING)) {
|
||||
// normal edit mode
|
||||
switch (event.getEventName()) {
|
||||
case "double-click":
|
||||
// remove card from sideboard (don't add it to deck)
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getSideboard().remove(card);
|
||||
break;
|
||||
case "alt-double-click":
|
||||
// remove card from sideboard
|
||||
cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getSideboard().remove(card);
|
||||
deck.getCards().add(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
break;
|
||||
case "set-number": {
|
||||
setCardNumberToCardsList(event, deck.getSideboard());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// construct phase or sideboarding during match
|
||||
switch (event.getEventName()) {
|
||||
case "double-click":
|
||||
case "alt-double-click":
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getSideboard().remove(card);
|
||||
deck.getCards().add(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
break;
|
||||
case "alt-double-click":
|
||||
// remove card from sideboard
|
||||
cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getSideboard().remove(card);
|
||||
deck.getCards().add(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
break;
|
||||
case "set-number": {
|
||||
setCardNumberToCardsList(event, deck.getSideboard());
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// construct phase or sideboarding during match
|
||||
switch (event.getEventName()) {
|
||||
case "double-click":
|
||||
case "alt-double-click":
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getSideboard().remove(card);
|
||||
deck.getCards().add(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
refreshDeck();
|
||||
|
||||
this.setVisible(true);
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
|
@ -20,12 +20,11 @@
|
|||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.client.deckeditor.table;
|
||||
|
||||
import java.awt.Dimension;
|
||||
|
@ -69,7 +68,7 @@ import org.mage.card.arcane.UI;
|
|||
|
||||
/**
|
||||
* Table Model for card list.
|
||||
*
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class TableModel extends AbstractTableModel implements ICardGrid {
|
||||
|
@ -89,18 +88,18 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
private boolean displayNoCopies = false;
|
||||
private UpdateCountsCallback updateCountsCallback;
|
||||
|
||||
private final String column[] = { "Qty", "Name", "Cost", "Color", "Type", "Stats", "Rarity", "Set" };
|
||||
private final String column[] = {"Qty", "Name", "Cost", "Color", "Type", "Stats", "Rarity", "Set"};
|
||||
|
||||
private SortSetting sortSetting;
|
||||
private int recentSortedColumn;
|
||||
private boolean recentAscending;
|
||||
|
||||
private boolean numberEditable;
|
||||
|
||||
|
||||
public TableModel() {
|
||||
this.numberEditable = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.clearCardEventListeners();
|
||||
this.clearCards();
|
||||
|
@ -173,9 +172,9 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
if (cv.getId().equals(entry.getValue().getId())) {
|
||||
if (count > 0) {
|
||||
// replace by another card with the same name+setCode
|
||||
String key1 = cv.getName()+cv.getExpansionSetCode()+cv.getCardNumber();
|
||||
String key1 = cv.getName() + cv.getExpansionSetCode() + cv.getCardNumber();
|
||||
for (CardView cardView : cards.values()) {
|
||||
String key2 = cardView.getName()+cardView.getExpansionSetCode()+cardView.getCardNumber();
|
||||
String key2 = cardView.getName() + cardView.getExpansionSetCode() + cardView.getCardNumber();
|
||||
if ((key1).equals(key2)) {
|
||||
view.set(j, cardView);
|
||||
break;
|
||||
|
@ -241,36 +240,36 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
private Object getColumn(Object obj, int column) {
|
||||
CardView c = (CardView) obj;
|
||||
switch (column) {
|
||||
case 0:
|
||||
if (displayNoCopies) {
|
||||
String key = c.getName() + c.getExpansionSetCode() + c.getCardNumber();
|
||||
Integer count = cardsNoCopies.get(key);
|
||||
return count != null ? count : "";
|
||||
}
|
||||
return "";
|
||||
case 1:
|
||||
return c.getName();
|
||||
case 2:
|
||||
String manaCost = "";
|
||||
for (String m : c.getManaCost()) {
|
||||
manaCost += m;
|
||||
}
|
||||
String castingCost = UI.getDisplayManaCost(manaCost);
|
||||
castingCost = ManaSymbols.replaceSymbolsWithHTML(castingCost, ManaSymbols.Type.PAY);
|
||||
return "<html>" + castingCost + "</html>";
|
||||
case 3:
|
||||
return CardHelper.getColor(c);
|
||||
case 4:
|
||||
return CardHelper.getType(c);
|
||||
case 5:
|
||||
return CardHelper.isCreature(c) ? c.getPower() + "/"
|
||||
+ c.getToughness() : "-";
|
||||
case 6:
|
||||
return c.getRarity().toString();
|
||||
case 7:
|
||||
return c.getExpansionSetCode();
|
||||
default:
|
||||
return "error";
|
||||
case 0:
|
||||
if (displayNoCopies) {
|
||||
String key = c.getName() + c.getExpansionSetCode() + c.getCardNumber();
|
||||
Integer count = cardsNoCopies.get(key);
|
||||
return count != null ? count : "";
|
||||
}
|
||||
return "";
|
||||
case 1:
|
||||
return c.getName();
|
||||
case 2:
|
||||
String manaCost = "";
|
||||
for (String m : c.getManaCost()) {
|
||||
manaCost += m;
|
||||
}
|
||||
String castingCost = UI.getDisplayManaCost(manaCost);
|
||||
castingCost = ManaSymbols.replaceSymbolsWithHTML(castingCost, ManaSymbols.Type.TABLE);
|
||||
return "<html>" + castingCost + "</html>";
|
||||
case 3:
|
||||
return CardHelper.getColor(c);
|
||||
case 4:
|
||||
return CardHelper.getType(c);
|
||||
case 5:
|
||||
return CardHelper.isCreature(c) ? c.getPower() + "/"
|
||||
+ c.getToughness() : "-";
|
||||
case 6:
|
||||
return c.getRarity().toString();
|
||||
case 7:
|
||||
return c.getExpansionSetCode();
|
||||
default:
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,7 +281,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
cards.put(card.getId(), card);
|
||||
|
||||
if (displayNoCopies) {
|
||||
String key = card.getName()+card.getExpansionSetCode()+card.getCardNumber();
|
||||
String key = card.getName() + card.getExpansionSetCode() + card.getCardNumber();
|
||||
Integer count = 1;
|
||||
if (cardsNoCopies.containsKey(key)) {
|
||||
count = cardsNoCopies.get(key) + 1;
|
||||
|
@ -291,7 +290,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
}
|
||||
cardsNoCopies.put(key, count);
|
||||
} else {
|
||||
view.add(card);
|
||||
view.add(card);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -473,6 +472,5 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
}
|
||||
return super.isCellEditable(row, col); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
<Properties>
|
||||
<Property name="iconifiable" type="boolean" value="true"/>
|
||||
<Property name="resizable" type="boolean" value="true"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="new Dimension((int) Math.round(GUISizeHelper.otherZonesCardDimension.width * 1.3),
 (int) Math.round(GUISizeHelper.otherZonesCardDimension.height * 1.2))" type="code"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
|
@ -23,22 +26,26 @@
|
|||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="cards" alignment="1" pref="239" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="cards" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="cards" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="cards" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="mage.client.cards.Cards" name="cards">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 25)" type="code"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="CardInfoWindowDialog_cards"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
|
@ -26,13 +26,14 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* CardInfoWindowDialog.java
|
||||
*
|
||||
* Created on Feb 1, 2010, 3:00:35 PM
|
||||
*/
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.util.UUID;
|
||||
|
@ -41,7 +42,7 @@ import javax.swing.SwingUtilities;
|
|||
import javax.swing.event.InternalFrameAdapter;
|
||||
import javax.swing.event.InternalFrameEvent;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.SettingsManager;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
|
@ -57,10 +58,9 @@ import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
|||
*/
|
||||
public class CardInfoWindowDialog extends MageDialog {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(CardInfoWindowDialog.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(CardInfoWindowDialog.class);
|
||||
|
||||
public static enum ShowType {
|
||||
|
||||
REVEAL, REVEAL_TOP_LIBRARY, LOOKED_AT, EXILE, GRAVEYARD, OTHER
|
||||
};
|
||||
|
||||
|
@ -107,12 +107,26 @@ public class CardInfoWindowDialog extends MageDialog {
|
|||
// no icon yet
|
||||
}
|
||||
this.setTitelBarToolTip(name);
|
||||
setGUISize();
|
||||
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
cards.cleanUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
this.validate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
cards.setCardDimension(GUISizeHelper.otherZonesCardDimension);
|
||||
cards.changeGUISize();
|
||||
}
|
||||
|
||||
public void loadCards(ExileView exile, BigCard bigCard, UUID gameId) {
|
||||
boolean changed = cards.loadCards(exile, bigCard, gameId, true);
|
||||
String titel = name + " (" + exile.size() + ")";
|
||||
|
@ -124,7 +138,7 @@ public class CardInfoWindowDialog extends MageDialog {
|
|||
try {
|
||||
this.setIcon(false);
|
||||
} catch (PropertyVetoException ex) {
|
||||
logger.error(null, ex);
|
||||
LOGGER.error(null, ex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -198,21 +212,25 @@ public class CardInfoWindowDialog extends MageDialog {
|
|||
|
||||
setIconifiable(true);
|
||||
setResizable(true);
|
||||
setPreferredSize(new Dimension((int) Math.round(GUISizeHelper.otherZonesCardDimension.width * 1.3),
|
||||
(int) Math.round(GUISizeHelper.otherZonesCardDimension.height * 1.2)));
|
||||
|
||||
cards.setPreferredSize(new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 25));
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(cards, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(0, 0, 0))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(cards, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(0, 0, 0))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cards, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cards, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
);
|
||||
|
||||
pack();
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* MageDialog.java
|
||||
*
|
||||
* Created on 15-Dec-2009, 10:28:27 PM
|
||||
|
@ -56,7 +56,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class MageDialog extends javax.swing.JInternalFrame {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(MageDialog.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(MageDialog.class);
|
||||
|
||||
protected boolean modal = false;
|
||||
|
||||
|
@ -67,6 +67,10 @@ public class MageDialog extends javax.swing.JInternalFrame {
|
|||
initComponents();
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
|
@ -89,22 +93,20 @@ public class MageDialog extends javax.swing.JInternalFrame {
|
|||
this.setClosable(false);
|
||||
if (value) {
|
||||
startModal();
|
||||
} else if (SwingUtilities.isEventDispatchThread()) {
|
||||
stopModal();
|
||||
} else {
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
stopModal();
|
||||
} else {
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
stopModal();
|
||||
}
|
||||
});
|
||||
} catch (InterruptedException ex) {
|
||||
logger.fatal("MageDialog error", ex);
|
||||
} catch (InvocationTargetException ex) {
|
||||
logger.fatal("MageDialog error", ex);
|
||||
}
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
stopModal();
|
||||
}
|
||||
});
|
||||
} catch (InterruptedException ex) {
|
||||
LOGGER.fatal("MageDialog error", ex);
|
||||
} catch (InvocationTargetException ex) {
|
||||
LOGGER.fatal("MageDialog error", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +142,7 @@ public class MageDialog extends javax.swing.JInternalFrame {
|
|||
} else if (source instanceof MenuComponent) {
|
||||
((MenuComponent) source).dispatchEvent(event);
|
||||
} else {
|
||||
logger.warn("Unable to dispatch: " + event);
|
||||
LOGGER.warn("Unable to dispatch: " + event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,31 +32,33 @@
|
|||
<Component id="lblGameType" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="cbGameType" min="-2" pref="270" max="-2" attributes="1"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="chkRollbackTurnsAllowed" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="13" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
|
||||
<Component id="lblFreeMulligans" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnFreeMulligans" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="txtName" max="32767" attributes="0"/>
|
||||
<Component id="cbDeckType" pref="332" max="32767" attributes="1"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lbTimeLimit" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblPassword" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="txtName" min="-2" pref="178" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="txtPassword" min="-2" pref="125" max="-2" attributes="0"/>
|
||||
<Component id="cbTimeLimit" min="-2" pref="126" max="-2" attributes="1"/>
|
||||
</Group>
|
||||
<Component id="lbTimeLimit" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="cbTimeLimit" min="-2" pref="102" max="-2" attributes="1"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblPassword" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtPassword" min="-2" pref="125" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="cbDeckType" min="-2" pref="332" max="-2" attributes="1"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblQuitRatio" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnQuitRatio" min="-2" pref="60" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
|
@ -107,7 +109,7 @@
|
|||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jSeparator3" pref="586" max="32767" attributes="0"/>
|
||||
<Component id="jSeparator3" pref="660" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
|
@ -122,13 +124,15 @@
|
|||
<Component id="lblName" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="txtPassword" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblPassword" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lbTimeLimit" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="cbTimeLimit" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="cbDeckType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="cbTimeLimit" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lbDeckType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lbTimeLimit" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblQuitRatio" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnQuitRatio" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
|
@ -378,5 +382,12 @@
|
|||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCancelActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblQuitRatio">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Allowed quit %"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spnQuitRatio">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
|
@ -81,6 +81,7 @@ public class NewTableDialog extends MageDialog {
|
|||
player1Panel.showLevel(false);
|
||||
this.spnNumWins.setModel(new SpinnerNumberModel(1, 1, 5, 1));
|
||||
this.spnFreeMulligans.setModel(new SpinnerNumberModel(0, 0, 5, 1));
|
||||
this.spnQuitRatio.setModel(new SpinnerNumberModel(100, 0, 100, 5));
|
||||
MageFrame.getUI().addButton(MageComponents.NEW_TABLE_OK_BUTTON, btnOK);
|
||||
}
|
||||
|
||||
|
@ -125,6 +126,8 @@ public class NewTableDialog extends MageDialog {
|
|||
jSeparator1 = new javax.swing.JSeparator();
|
||||
btnOK = new javax.swing.JButton();
|
||||
btnCancel = new javax.swing.JButton();
|
||||
lblQuitRatio = new javax.swing.JLabel();
|
||||
spnQuitRatio = new javax.swing.JSpinner();
|
||||
|
||||
setTitle("New Table");
|
||||
|
||||
|
@ -209,6 +212,10 @@ public class NewTableDialog extends MageDialog {
|
|||
}
|
||||
});
|
||||
|
||||
lblQuitRatio.setText("Allowed quit %");
|
||||
|
||||
spnQuitRatio.setToolTipText("Players with quit % more than this value can't join this table");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
|
@ -227,22 +234,26 @@ public class NewTableDialog extends MageDialog {
|
|||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(chkRollbackTurnsAllowed)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
|
||||
.addGap(13, 13, 13)
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(txtName)
|
||||
.addComponent(cbDeckType, 0, 332, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lbTimeLimit, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblPassword, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addComponent(lbTimeLimit)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPassword)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, 332, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblQuitRatio)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
|
@ -280,7 +291,7 @@ public class NewTableDialog extends MageDialog {
|
|||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 586, Short.MAX_VALUE)
|
||||
.addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 660, Short.MAX_VALUE)
|
||||
.addContainerGap()))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
|
@ -291,13 +302,15 @@ public class NewTableDialog extends MageDialog {
|
|||
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblName)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblPassword))
|
||||
.addComponent(lblPassword)
|
||||
.addComponent(lbTimeLimit)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lbDeckType)
|
||||
.addComponent(lbTimeLimit))
|
||||
.addComponent(lblQuitRatio)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
|
@ -376,6 +389,7 @@ public class NewTableDialog extends MageDialog {
|
|||
options.setRollbackTurnsAllowed(chkRollbackTurnsAllowed.isSelected());
|
||||
options.setFreeMulligans((Integer) this.spnFreeMulligans.getValue());
|
||||
options.setPassword(this.txtPassword.getText());
|
||||
options.setQuitRatio((Integer) this.spnQuitRatio.getValue());
|
||||
if (!checkMatchOptions(options)) {
|
||||
return;
|
||||
}
|
||||
|
@ -613,6 +627,7 @@ public class NewTableDialog extends MageDialog {
|
|||
}
|
||||
this.spnNumWins.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_WINS, "2")));
|
||||
this.chkRollbackTurnsAllowed.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_ROLLBACK_TURNS_ALLOWED, "Yes").equals("Yes"));
|
||||
this.spnFreeMulligans.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_FREE_MULLIGANS, "0")));
|
||||
|
||||
int range = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_RANGE, "1"));
|
||||
for (RangeOfInfluence roi : RangeOfInfluence.values()) {
|
||||
|
@ -635,6 +650,8 @@ public class NewTableDialog extends MageDialog {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.spnQuitRatio.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_QUIT_RATIO, "100")));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -658,6 +675,7 @@ public class NewTableDialog extends MageDialog {
|
|||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_RANGE, Integer.toString(options.getRange().getRange()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_ATTACK_OPTION, options.getAttackOption().toString());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_SKILL_LEVEL, options.getSkillLevel().toString());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_QUIT_RATIO, Integer.toString(options.getQuitRatio()));
|
||||
StringBuilder playerTypesString = new StringBuilder();
|
||||
ListIterator iterator = players.listIterator();
|
||||
while (iterator.hasNext()) {
|
||||
|
@ -694,6 +712,7 @@ public class NewTableDialog extends MageDialog {
|
|||
private javax.swing.JLabel lblNumPlayers;
|
||||
private javax.swing.JLabel lblNumWins;
|
||||
private javax.swing.JLabel lblPassword;
|
||||
private javax.swing.JLabel lblQuitRatio;
|
||||
private javax.swing.JLabel lblRange;
|
||||
private javax.swing.JLabel lblSkillLevel;
|
||||
private mage.client.table.NewPlayerPanel player1Panel;
|
||||
|
@ -701,6 +720,7 @@ public class NewTableDialog extends MageDialog {
|
|||
private javax.swing.JSpinner spnFreeMulligans;
|
||||
private javax.swing.JSpinner spnNumPlayers;
|
||||
private javax.swing.JSpinner spnNumWins;
|
||||
private javax.swing.JSpinner spnQuitRatio;
|
||||
private javax.swing.JTextField txtName;
|
||||
private javax.swing.JTextField txtPassword;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" alignment="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="lblDraftCube" max="-2" attributes="0"/>
|
||||
<Component id="lblTournamentType" min="-2" max="-2" attributes="0"/>
|
||||
|
@ -85,16 +85,16 @@
|
|||
<Component id="cbDeckType" alignment="0" min="-2" pref="290" max="-2" attributes="1"/>
|
||||
<Component id="cbGameType" min="-2" pref="290" max="-2" attributes="1"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="cbTournamentType" min="-2" pref="290" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblFreeMulligans" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnFreeMulligans" min="-2" pref="41" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
|
||||
<Component id="lblNumWins" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnNumWins" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblQuitRatio" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnQuitRatio" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="cbTournamentType" min="-2" pref="290" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
|
@ -114,6 +114,11 @@
|
|||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtPassword" min="-2" pref="56" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lblFreeMulligans" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnFreeMulligans" min="-2" pref="41" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
|
@ -140,14 +145,19 @@
|
|||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lblTournamentType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="cbTournamentType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblNumWins" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnNumWins" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblQuitRatio" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnQuitRatio" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="cbTournamentType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblTournamentType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="cbDraftCube" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblDraftCube" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
|
@ -191,7 +201,7 @@
|
|||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="player1Panel" pref="61" max="32767" attributes="0"/>
|
||||
<Component id="player1Panel" min="-2" pref="62" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="pnlPlayers" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
|
@ -525,5 +535,15 @@
|
|||
<Property name="axis" type="int" value="1"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="lblQuitRatio">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Allow players with quit (%):"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spnQuitRatio">
|
||||
<Properties>
|
||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
|
@ -99,6 +99,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
this.spnFreeMulligans.setModel(new SpinnerNumberModel(0, 0, 5, 1));
|
||||
this.spnConstructTime.setModel(new SpinnerNumberModel(10, CONSTRUCTION_TIME_MIN, CONSTRUCTION_TIME_MAX, 2));
|
||||
this.spnNumRounds.setModel(new SpinnerNumberModel(2, 2, 10, 1));
|
||||
this.spnQuitRatio.setModel(new SpinnerNumberModel(100, 0, 100, 5));
|
||||
}
|
||||
|
||||
public void showDialog(UUID roomId) {
|
||||
|
@ -179,6 +180,8 @@ public class NewTournamentDialog extends MageDialog {
|
|||
btnOk = new javax.swing.JButton();
|
||||
btnCancel = new javax.swing.JButton();
|
||||
pnlRandomPacks = new javax.swing.JPanel();
|
||||
lblQuitRatio = new javax.swing.JLabel();
|
||||
spnQuitRatio = new javax.swing.JSpinner();
|
||||
|
||||
setTitle("New Tournament");
|
||||
|
||||
|
@ -345,6 +348,10 @@ public class NewTournamentDialog extends MageDialog {
|
|||
pnlRandomPacks.setToolTipText("");
|
||||
pnlRandomPacks.setLayout(new javax.swing.BoxLayout(pnlRandomPacks, javax.swing.BoxLayout.Y_AXIS));
|
||||
|
||||
lblQuitRatio.setText("Allowed quit %:");
|
||||
|
||||
spnQuitRatio.setToolTipText("Players with quit % more than this value can't join this table");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
|
@ -401,15 +408,15 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGap(28, 28, 28)
|
||||
.addComponent(lblNumWins)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblQuitRatio)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblName)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
|
@ -425,7 +432,11 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPassword)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(pnlRandomPacks, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
|
@ -445,12 +456,16 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblTournamentType)
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblNumWins)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblQuitRatio)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblTournamentType))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbDraftCube, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
|
@ -487,7 +502,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addComponent(lblConstructionTime)
|
||||
.addComponent(chkRollbackTurnsAllowed)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(pnlPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
|
@ -513,6 +528,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
tOptions.setPassword(txtPassword.getText());
|
||||
tOptions.getPlayerTypes().add("Human");
|
||||
tOptions.setWatchingAllowed(cbAllowSpectators.isSelected());
|
||||
tOptions.setQuitRatio((Integer)spnQuitRatio.getValue());
|
||||
for (TournamentPlayerPanel player: players) {
|
||||
tOptions.getPlayerTypes().add((String) player.getPlayerType().getSelectedItem());
|
||||
}
|
||||
|
@ -689,7 +705,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
|
||||
this.lblConstructionTime.setVisible(tournamentType.isLimited());
|
||||
this.spnConstructTime.setVisible(tournamentType.isLimited());
|
||||
|
||||
|
||||
this.lbDeckType.setVisible(!tournamentType.isLimited());
|
||||
this.cbDeckType.setVisible(!tournamentType.isLimited());
|
||||
this.lblGameType.setVisible(!tournamentType.isLimited());
|
||||
|
@ -914,7 +930,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
}
|
||||
this.spnFreeMulligans.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_FREE_MULLIGANS, "0")));
|
||||
this.spnNumWins.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_WINS, "2")));
|
||||
|
||||
this.spnQuitRatio.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_QUIT_RATIO, "100")));
|
||||
|
||||
TournamentTypeView tournamentType = (TournamentTypeView) cbTournamentType.getSelectedItem();
|
||||
activatePanelElements(tournamentType);
|
||||
|
@ -985,6 +1001,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_TYPE, tOptions.getTournamentType());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_FREE_MULLIGANS, Integer.toString(tOptions.getMatchOptions().getFreeMulligans()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_WINS, Integer.toString(tOptions.getMatchOptions().getWinsNeeded()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_QUIT_RATIO, Integer.toString(tOptions.getQuitRatio()));
|
||||
|
||||
if (tOptions.getTournamentType().startsWith("Sealed")) {
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_SEALED, tOptions.getLimitedOptions().getSetCodes().toString());
|
||||
|
@ -1050,6 +1067,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
private javax.swing.JLabel lblPacks;
|
||||
private javax.swing.JLabel lblPassword;
|
||||
private javax.swing.JLabel lblPlayer1;
|
||||
private javax.swing.JLabel lblQuitRatio;
|
||||
private javax.swing.JLabel lblTournamentType;
|
||||
private mage.client.table.NewPlayerPanel player1Panel;
|
||||
private javax.swing.JPanel pnlDraftOptions;
|
||||
|
@ -1062,6 +1080,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
private javax.swing.JSpinner spnNumPlayers;
|
||||
private javax.swing.JSpinner spnNumRounds;
|
||||
private javax.swing.JSpinner spnNumWins;
|
||||
private javax.swing.JSpinner spnQuitRatio;
|
||||
private javax.swing.JTextField txtName;
|
||||
private javax.swing.JTextField txtPassword;
|
||||
private org.jdesktop.beansbinding.BindingGroup bindingGroup;
|
||||
|
|
|
@ -36,7 +36,6 @@ import java.util.UUID;
|
|||
import javax.swing.JButton;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JPanel;
|
||||
import mage.cards.CardDimensions;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.cards.CardArea;
|
||||
|
@ -110,10 +109,10 @@ public class PickPileDialog extends MageDialog {
|
|||
}
|
||||
}
|
||||
|
||||
public void loadCards(String name, CardsView pile1, CardsView pile2, BigCard bigCard, CardDimensions dimension, UUID gameId) {
|
||||
public void loadCards(String name, CardsView pile1, CardsView pile2, BigCard bigCard, UUID gameId) {
|
||||
this.title = name;
|
||||
this.pile1.loadCardsNarrow(pile1, bigCard, dimension, gameId);
|
||||
this.pile2.loadCardsNarrow(pile2, bigCard, dimension, gameId);
|
||||
this.pile1.loadCardsNarrow(pile1, bigCard, gameId);
|
||||
this.pile2.loadCardsNarrow(pile2, bigCard, gameId);
|
||||
|
||||
if (getParent() != MageFrame.getDesktop() /*|| this.isClosed*/) {
|
||||
MageFrame.getDesktop().add(this, JLayeredPane.MODAL_LAYER);
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* ShowCardsDialog.java
|
||||
*
|
||||
* Created on 3-Feb-2010, 8:59:11 PM
|
||||
|
@ -41,7 +41,6 @@ import java.util.UUID;
|
|||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.SwingUtilities;
|
||||
import mage.cards.CardDimensions;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.cards.CardArea;
|
||||
|
@ -69,6 +68,7 @@ public class ShowCardsDialog extends MageDialog {
|
|||
|
||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
initComponents();
|
||||
|
||||
this.setModal(false);
|
||||
|
||||
}
|
||||
|
@ -83,13 +83,23 @@ public class ShowCardsDialog extends MageDialog {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
cardArea.changeGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
|
||||
}
|
||||
|
||||
public void loadCards(String name, CardsView showCards, BigCard bigCard,
|
||||
CardDimensions dimension, UUID gameId, boolean modal, Map<String, Serializable> options,
|
||||
UUID gameId, boolean modal, Map<String, Serializable> options,
|
||||
JPopupMenu popupMenu, Listener<Event> eventListener) {
|
||||
this.title = name;
|
||||
this.setTitelBarToolTip(name);
|
||||
cardArea.clearCardEventListeners();
|
||||
cardArea.loadCards(showCards, bigCard, dimension, gameId);
|
||||
cardArea.loadCards(showCards, bigCard, gameId);
|
||||
if (options != null) {
|
||||
if (options.containsKey("chosen")) {
|
||||
java.util.List<UUID> chosenCards = (java.util.List<UUID>) options.get("chosen");
|
||||
|
@ -145,7 +155,7 @@ public class ShowCardsDialog extends MageDialog {
|
|||
setResizable(true);
|
||||
getContentPane().setLayout(new java.awt.BorderLayout());
|
||||
getContentPane().add(cardArea, java.awt.BorderLayout.CENTER);
|
||||
|
||||
setGUISize();
|
||||
pack();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
*/
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CancellationException;
|
||||
|
@ -46,6 +47,7 @@ import mage.client.components.MageComponents;
|
|||
import mage.client.components.tray.MageTray;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLE_WAITING_COLUMNS_ORDER;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLE_WAITING_COLUMNS_WIDTH;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.gui.TableUtil;
|
||||
import mage.client.util.gui.countryBox.CountryCellRenderer;
|
||||
|
@ -60,7 +62,8 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class TableWaitingDialog extends MageDialog {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(TableWaitingDialog.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(TableWaitingDialog.class);
|
||||
private static final int[] DEFAULT_COLUMS_WIDTH = {20, 50, 100, 100, 100};
|
||||
|
||||
private UUID tableId;
|
||||
private UUID roomId;
|
||||
|
@ -68,7 +71,6 @@ public class TableWaitingDialog extends MageDialog {
|
|||
private Session session;
|
||||
private final TableWaitModel tableWaitModel;
|
||||
private UpdateSeatsTask updateTask;
|
||||
private static final int[] defaultColumnsWidth = {20, 50, 100, 100, 100};
|
||||
|
||||
/**
|
||||
* Creates new form TableWaitingDialog
|
||||
|
@ -88,12 +90,29 @@ public class TableWaitingDialog extends MageDialog {
|
|||
|
||||
chatPanel.useExtendedView(ChatPanelBasic.VIEW_MODE.NONE);
|
||||
tableSeats.createDefaultColumnsFromModel();
|
||||
TableUtil.setColumnWidthAndOrder(tableSeats, defaultColumnsWidth, KEY_TABLE_WAITING_COLUMNS_WIDTH, KEY_TABLE_WAITING_COLUMNS_ORDER);
|
||||
TableUtil.setColumnWidthAndOrder(tableSeats, DEFAULT_COLUMS_WIDTH, KEY_TABLE_WAITING_COLUMNS_WIDTH, KEY_TABLE_WAITING_COLUMNS_ORDER);
|
||||
tableSeats.setDefaultRenderer(Icon.class, new CountryCellRenderer());
|
||||
setGUISize();
|
||||
|
||||
MageFrame.getUI().addButton(MageComponents.TABLE_WAITING_START_BUTTON, btnStart);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
tableSeats.getTableHeader().setFont(GUISizeHelper.tableFont);
|
||||
tableSeats.getTableHeader().setPreferredSize(new Dimension(GUISizeHelper.tableHeaderHeight, GUISizeHelper.tableHeaderHeight));
|
||||
tableSeats.setFont(GUISizeHelper.tableFont);
|
||||
tableSeats.setRowHeight(GUISizeHelper.getTableRowHeight());
|
||||
|
||||
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
|
||||
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
|
||||
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
|
||||
}
|
||||
|
||||
public void update(TableView table) {
|
||||
try {
|
||||
if (table != null) {
|
||||
|
@ -280,7 +299,7 @@ public class TableWaitingDialog extends MageDialog {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
//swallow exception
|
||||
logger.error(e);
|
||||
LOGGER.error(e);
|
||||
}
|
||||
closeDialog();
|
||||
}//GEN-LAST:event_btnCancelActionPerformed
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<Properties>
|
||||
<Property name="resizable" type="boolean" value="true"/>
|
||||
<Property name="title" type="java.lang.String" value="UserRequestMessage"/>
|
||||
<Property name="modal" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
|
@ -28,12 +29,11 @@
|
|||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="lblText" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="289" max="32767" attributes="0"/>
|
||||
<Component id="btn3" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
<Component id="btn3" pref="0" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btn2" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
<Component id="btn2" pref="0" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btn1" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
<Component id="btn1" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
|
@ -44,12 +44,12 @@
|
|||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblText" pref="96" max="32767" attributes="0"/>
|
||||
<Component id="lblText" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="btn1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btn2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btn3" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btn1" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="btn2" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="btn3" alignment="3" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
|
@ -61,11 +61,29 @@
|
|||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="message to the user"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1000, 500]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[400, 60]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[400, 60]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btn3">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="btn3"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[150, 50]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[75, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[150, 50]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btn3ActionPerformed"/>
|
||||
|
@ -74,6 +92,15 @@
|
|||
<Component class="javax.swing.JButton" name="btn2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="btn2"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[150, 50]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[75, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[150, 50]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btn2ActionPerformed"/>
|
||||
|
@ -82,6 +109,15 @@
|
|||
<Component class="javax.swing.JButton" name="btn1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="btn1"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[150, 50]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[75, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[150, 50]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btn1ActionPerformed"/>
|
||||
|
|
|
@ -24,20 +24,22 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* ErrorDialog.java
|
||||
*
|
||||
* Created on Dec 23, 2009, 11:01:32 AM
|
||||
*/
|
||||
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
|
||||
import javax.swing.plaf.basic.BasicInternalFrameUI;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.remote.Session;
|
||||
import mage.view.UserRequestMessage;
|
||||
|
||||
/**
|
||||
|
@ -48,15 +50,43 @@ public class UserRequestDialog extends MageDialog {
|
|||
|
||||
private UserRequestMessage userRequestMessage;
|
||||
|
||||
/** Creates new form AskDialog */
|
||||
/**
|
||||
* Creates new form AskDialog
|
||||
*/
|
||||
public UserRequestDialog() {
|
||||
initComponents();
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
Font font = GUISizeHelper.gameRequestsFont;
|
||||
lblText.setFont(font);
|
||||
lblText.setMaximumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
|
||||
lblText.setMinimumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
|
||||
lblText.setPreferredSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
|
||||
btn1.setFont(font);
|
||||
btn1.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn1.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn1.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn2.setFont(font);
|
||||
btn2.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn2.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn2.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn3.setFont(font);
|
||||
btn3.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn3.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
btn3.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||
JComponent c = (BasicInternalFrameTitlePane) ((BasicInternalFrameUI) this.getUI()).getNorthPane();
|
||||
c.setMinimumSize(new Dimension(c.getMinimumSize().width, font.getSize() + 10));
|
||||
c.setMaximumSize(new Dimension(c.getMaximumSize().width, font.getSize() + 10));
|
||||
c.setPreferredSize(new Dimension(c.getPreferredSize().width, font.getSize() + 10));
|
||||
c.setFont(font);
|
||||
}
|
||||
|
||||
public void showDialog(UserRequestMessage userRequestMessage) {
|
||||
this.userRequestMessage = userRequestMessage;
|
||||
this.setTitle(userRequestMessage.getTitel());
|
||||
String text = "<html><p style=\"text-align:center; margin-left:50px; margin-right:50px\">" + userRequestMessage.getMessage() + "</p></html>";
|
||||
String text = "<html><p style=\"text-align:center; margin-left:10px; margin-right:10px\">" + userRequestMessage.getMessage() + "</p></html>";
|
||||
this.lblText.setText(text);
|
||||
if (userRequestMessage.getButton1Text() != null) {
|
||||
this.btn1.setText(userRequestMessage.getButton1Text());
|
||||
|
@ -80,10 +110,10 @@ public class UserRequestDialog extends MageDialog {
|
|||
this.setVisible(true);
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
@ -96,11 +126,18 @@ public class UserRequestDialog extends MageDialog {
|
|||
|
||||
setResizable(true);
|
||||
setTitle("UserRequestMessage");
|
||||
setModal(true);
|
||||
|
||||
lblText.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
lblText.setText("message to the user");
|
||||
lblText.setMaximumSize(new java.awt.Dimension(1000, 500));
|
||||
lblText.setMinimumSize(new java.awt.Dimension(400, 60));
|
||||
lblText.setPreferredSize(new java.awt.Dimension(400, 60));
|
||||
|
||||
btn3.setText("btn3");
|
||||
btn3.setMaximumSize(new java.awt.Dimension(150, 50));
|
||||
btn3.setMinimumSize(new java.awt.Dimension(75, 25));
|
||||
btn3.setPreferredSize(new java.awt.Dimension(150, 50));
|
||||
btn3.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btn3ActionPerformed(evt);
|
||||
|
@ -108,6 +145,9 @@ public class UserRequestDialog extends MageDialog {
|
|||
});
|
||||
|
||||
btn2.setText("btn2");
|
||||
btn2.setMaximumSize(new java.awt.Dimension(150, 50));
|
||||
btn2.setMinimumSize(new java.awt.Dimension(75, 25));
|
||||
btn2.setPreferredSize(new java.awt.Dimension(150, 50));
|
||||
btn2.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btn2ActionPerformed(evt);
|
||||
|
@ -115,6 +155,9 @@ public class UserRequestDialog extends MageDialog {
|
|||
});
|
||||
|
||||
btn1.setText("btn1");
|
||||
btn1.setMaximumSize(new java.awt.Dimension(150, 50));
|
||||
btn1.setMinimumSize(new java.awt.Dimension(75, 25));
|
||||
btn1.setPreferredSize(new java.awt.Dimension(150, 50));
|
||||
btn1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btn1ActionPerformed(evt);
|
||||
|
@ -130,24 +173,23 @@ public class UserRequestDialog extends MageDialog {
|
|||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(0, 289, Short.MAX_VALUE)
|
||||
.addComponent(btn3, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(btn3, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btn2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(btn2, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btn1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(btn1, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(lblText, javax.swing.GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE)
|
||||
.addComponent(lblText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btn1)
|
||||
.addComponent(btn2)
|
||||
.addComponent(btn3))
|
||||
.addComponent(btn1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btn2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btn3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(12, 12, 12))
|
||||
);
|
||||
|
||||
|
@ -176,10 +218,7 @@ public class UserRequestDialog extends MageDialog {
|
|||
}//GEN-LAST:event_btn3ActionPerformed
|
||||
|
||||
private void sendUserReplay(PlayerAction playerAction) {
|
||||
Session session = MageFrame.getSession();
|
||||
if (session != null && playerAction != null) {
|
||||
session.sendPlayerAction(playerAction, userRequestMessage.getGameId(), userRequestMessage.getRelatedUserId());
|
||||
}
|
||||
MageFrame.getInstance().sendUserReplay(playerAction, userRequestMessage);
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
|
||||
<SyntheticProperties>
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* DraftPane.java
|
||||
*
|
||||
* Created on Jan 7, 2011, 2:11:44 PM
|
||||
*/
|
||||
|
||||
package mage.client.draft;
|
||||
|
||||
import java.awt.Component;
|
||||
|
@ -48,11 +47,13 @@ import mage.client.plugins.impl.Plugins;
|
|||
*/
|
||||
public class DraftPane extends MagePane {
|
||||
|
||||
/** Creates new form DraftPane */
|
||||
/**
|
||||
* Creates new form DraftPane
|
||||
*/
|
||||
public DraftPane() {
|
||||
boolean initialized = false;
|
||||
if (Plugins.getInstance().isThemePluginLoaded()) {
|
||||
Map<String, JComponent> uiComponents = new HashMap<String, JComponent>();
|
||||
Map<String, JComponent> uiComponents = new HashMap<>();
|
||||
JComponent container = Plugins.getInstance().updateTablePanel(uiComponents);
|
||||
if (container != null) {
|
||||
draftPanel1 = new mage.client.draft.DraftPanel();
|
||||
|
@ -68,20 +69,26 @@ public class DraftPane extends MagePane {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeGUISize() {
|
||||
super.changeGUISize(); //To change body of generated methods, choose Tools | Templates.
|
||||
draftPanel1.changeGUISize();
|
||||
}
|
||||
|
||||
public void showDraft(UUID draftId) {
|
||||
this.setTitle("Draft - " + draftId);
|
||||
this.draftPanel1.showDraft(draftId);
|
||||
}
|
||||
|
||||
|
||||
public void removeDraft() {
|
||||
draftPanel1.cleanUp();
|
||||
this.removeFrame();
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
@ -112,11 +119,11 @@ public class DraftPane extends MagePane {
|
|||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 885, Short.MAX_VALUE)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 885, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
pack();
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* DraftPanel.java
|
||||
*
|
||||
* Created on Jan 7, 2011, 2:15:48 PM
|
||||
|
@ -57,7 +57,6 @@ import javax.swing.AbstractAction;
|
|||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.Timer;
|
||||
|
@ -70,16 +69,19 @@ import mage.client.dialog.PreferencesDialog;
|
|||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.CardsViewUtil;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.Listener;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.gui.BufferedImageBuilder;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.remote.Session;
|
||||
import mage.view.CardsView;
|
||||
import mage.view.DraftPickView;
|
||||
import mage.view.DraftView;
|
||||
import mage.view.SimpleCardView;
|
||||
import mage.view.SimpleCardsView;
|
||||
import mage.view.UserRequestMessage;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
@ -88,7 +90,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class DraftPanel extends javax.swing.JPanel {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(DraftPanel.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(DraftPanel.class);
|
||||
|
||||
private UUID draftId;
|
||||
private Session session;
|
||||
|
@ -121,7 +123,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
private String currentBoosterHeader;
|
||||
private String[] currentBooster;
|
||||
|
||||
private static final CardsView emptyView = new CardsView();
|
||||
private static final CardsView EMPTY_VIEW = new CardsView();
|
||||
|
||||
/**
|
||||
* Creates new form DraftPanel
|
||||
|
@ -145,16 +147,16 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
|
||||
countdown = new Timer(1000,
|
||||
new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (--timeout > 0) {
|
||||
setTimeout(timeout);
|
||||
} else {
|
||||
setTimeout(0);
|
||||
countdown.stop();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (--timeout > 0) {
|
||||
setTimeout(timeout);
|
||||
} else {
|
||||
setTimeout(0);
|
||||
countdown.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -170,6 +172,15 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
draftPicks.changeGUISize();
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
GUISizeHelper.changePopupMenuFont(popupMenuPickedArea);
|
||||
}
|
||||
|
||||
public synchronized void showDraft(UUID draftId) {
|
||||
this.draftId = draftId;
|
||||
session = MageFrame.getSession();
|
||||
|
@ -186,7 +197,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
try {
|
||||
Files.write(pathToDraftLog(), "".getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
|
||||
} catch (IOException ex) {
|
||||
logger.error(null, ex);
|
||||
LOGGER.error(null, ex);
|
||||
}
|
||||
} else {
|
||||
logFilename = null;
|
||||
|
@ -319,24 +330,24 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
this.draftBooster.clearCardEventListeners();
|
||||
this.draftBooster.addCardEventListener(
|
||||
new Listener<Event>() {
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (event.getEventName().equals("pick-a-card")) {
|
||||
SimpleCardView source = (SimpleCardView) event.getSource();
|
||||
DraftPickView view = session.sendCardPick(draftId, source.getId(), cardsHidden);
|
||||
if (view != null) {
|
||||
loadCardsToPickedCardsArea(view.getPicks());
|
||||
draftBooster.loadBooster(emptyView, bigCard);
|
||||
Plugins.getInstance().getActionCallback().hideTooltipPopup();
|
||||
setMessage("Waiting for other players");
|
||||
}
|
||||
}
|
||||
if (event.getEventName().equals("mark-a-card")) {
|
||||
SimpleCardView source = (SimpleCardView) event.getSource();
|
||||
session.sendCardMark(draftId, source.getId());
|
||||
}
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (event.getEventName().equals("pick-a-card")) {
|
||||
SimpleCardView source = (SimpleCardView) event.getSource();
|
||||
DraftPickView view = session.sendCardPick(draftId, source.getId(), cardsHidden);
|
||||
if (view != null) {
|
||||
loadCardsToPickedCardsArea(view.getPicks());
|
||||
draftBooster.loadBooster(EMPTY_VIEW, bigCard);
|
||||
Plugins.getInstance().getActionCallback().hideTooltipPopup();
|
||||
setMessage("Waiting for other players");
|
||||
}
|
||||
}
|
||||
if (event.getEventName().equals("mark-a-card")) {
|
||||
SimpleCardView source = (SimpleCardView) event.getSource();
|
||||
session.sendCardMark(draftId, source.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
setMessage("Pick a card");
|
||||
if (!MageFrame.getInstance().isActive()) {
|
||||
|
@ -524,7 +535,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
try {
|
||||
Files.write(pathToDraftLog(), data.getBytes(), StandardOpenOption.APPEND);
|
||||
} catch (IOException ex) {
|
||||
logger.error(null, ex);
|
||||
LOGGER.error(null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -901,10 +912,11 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void btnQuitTournamentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitTournamentActionPerformed
|
||||
if (JOptionPane.showConfirmDialog(this, "Are you sure you want to quit the tournament?", "Confirm quit tournament", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
MageFrame.getSession().quitDraft(draftId);
|
||||
MageFrame.removeDraft(draftId);
|
||||
}
|
||||
UserRequestMessage message = new UserRequestMessage("Confirm quit tournament", "Are you sure you want to quit the draft tournament?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_QUIT_DRAFT_TOURNAMENT);
|
||||
message.setTournamentId(draftId);
|
||||
MageFrame.getInstance().showUserRequestDialog(message);
|
||||
}//GEN-LAST:event_btnQuitTournamentActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
|
|
@ -24,38 +24,37 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* BattlefieldPanel.java
|
||||
*
|
||||
* Created on 10-Jan-2010, 10:43:14 PM
|
||||
*/
|
||||
|
||||
package mage.client.game;
|
||||
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.cards.Permanent;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.layout.CardLayoutStrategy;
|
||||
import mage.constants.CardType;
|
||||
import mage.utils.CardUtil;
|
||||
import mage.view.CounterView;
|
||||
import mage.view.PermanentView;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.cards.Permanent;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.layout.CardLayoutStrategy;
|
||||
import mage.client.util.layout.impl.OldCardLayoutStrategy;
|
||||
import mage.constants.CardType;
|
||||
import mage.utils.CardUtil;
|
||||
import mage.view.CounterView;
|
||||
import mage.view.PermanentView;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -78,18 +77,20 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
private final CardLayoutStrategy layoutStrategy = new OldCardLayoutStrategy();
|
||||
|
||||
//private static int iCounter = 0;
|
||||
|
||||
private boolean addedPermanent;
|
||||
private boolean addedArtifact;
|
||||
private boolean addedCreature;
|
||||
|
||||
private boolean removedCreature;
|
||||
|
||||
/** Creates new form BattlefieldPanel */
|
||||
/**
|
||||
* Creates new form BattlefieldPanel
|
||||
*/
|
||||
public BattlefieldPanel() {
|
||||
uiComponentsList.put("battlefieldPanel", this);
|
||||
initComponents();
|
||||
uiComponentsList.put("jPanel", jPanel);
|
||||
setGUISize();
|
||||
|
||||
addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
|
@ -109,7 +110,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
}
|
||||
|
||||
public void cleanUp() {
|
||||
for (Component c: this.jPanel.getComponents()) {
|
||||
for (Component c : this.jPanel.getComponents()) {
|
||||
if (c instanceof Permanent || c instanceof MagePermanent) {
|
||||
this.jPanel.remove(c);
|
||||
}
|
||||
|
@ -119,11 +120,22 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
this.bigCard = null;
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
sortLayout();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
jScrollPane.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
|
||||
jScrollPane.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
|
||||
cardDimension = GUISizeHelper.battlefieldCardDimension;
|
||||
}
|
||||
|
||||
public void update(Map<UUID, PermanentView> battlefield) {
|
||||
boolean changed = false;
|
||||
|
||||
List<PermanentView> permanentsToAdd = new ArrayList<>();
|
||||
for (PermanentView permanent: battlefield.values()) {
|
||||
for (PermanentView permanent : battlefield.values()) {
|
||||
if (!permanent.isPhasedIn()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -131,7 +143,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
if (oldMagePermanent == null) {
|
||||
permanentsToAdd.add(permanent);
|
||||
changed = true;
|
||||
} else {
|
||||
} else {
|
||||
if (!changed) {
|
||||
changed = CardUtil.isCreature(oldMagePermanent.getOriginalPermanent()) != CardUtil.isCreature(permanent);
|
||||
if (!changed) {
|
||||
|
@ -158,7 +170,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
UUID u1 = oldMagePermanent.getOriginalPermanent().getAttachedTo();
|
||||
UUID u2 = permanent.getAttachedTo();
|
||||
if (u1 == null && u2 != null || u2 == null && u1 != null
|
||||
|| (u1 != null && !u1.equals(u2)) ) {
|
||||
|| (u1 != null && !u1.equals(u2))) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
@ -214,7 +226,9 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
}
|
||||
|
||||
public void sortLayout() {
|
||||
if (battlefield == null) {return;}
|
||||
if (battlefield == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
layoutStrategy.doLayout(this, width);
|
||||
|
||||
|
@ -266,26 +280,26 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
}
|
||||
|
||||
private void removePermanent(UUID permanentId, final int count) {
|
||||
for (Component c: this.jPanel.getComponents()) {
|
||||
for (Component c : this.jPanel.getComponents()) {
|
||||
final Component comp = c;
|
||||
if (comp instanceof Permanent) {
|
||||
if (((Permanent)comp).getPermanentId().equals(permanentId)) {
|
||||
if (((Permanent) comp).getPermanentId().equals(permanentId)) {
|
||||
comp.setVisible(false);
|
||||
this.jPanel.remove(comp);
|
||||
}
|
||||
} else if (comp instanceof MagePermanent) {
|
||||
if (((MagePermanent)comp).getOriginal().getId().equals(permanentId)) {
|
||||
if (((MagePermanent) comp).getOriginal().getId().equals(permanentId)) {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Plugins.getInstance().onRemoveCard((MagePermanent)comp, count);
|
||||
Plugins.getInstance().onRemoveCard((MagePermanent) comp, count);
|
||||
comp.setVisible(false);
|
||||
BattlefieldPanel.this.jPanel.remove(comp);
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
}
|
||||
if (((MagePermanent)comp).getOriginal().getCardTypes().contains(CardType.CREATURE)) {
|
||||
if (((MagePermanent) comp).getOriginal().getCardTypes().contains(CardType.CREATURE)) {
|
||||
removedCreature = true;
|
||||
}
|
||||
}
|
||||
|
@ -293,7 +307,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isOptimizedDrawingEnabled () {
|
||||
public boolean isOptimizedDrawingEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -309,7 +323,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
jPanel.setOpaque(false);
|
||||
jScrollPane = new JScrollPane(jPanel);
|
||||
|
||||
Border empty = new EmptyBorder(0,0,0,0);
|
||||
Border empty = new EmptyBorder(0, 0, 0, 0);
|
||||
jScrollPane.setBorder(empty);
|
||||
jScrollPane.setViewportBorder(empty);
|
||||
jScrollPane.setOpaque(false);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* FeedbackPanel.java
|
||||
*
|
||||
* Created on 23-Dec-2009, 9:54:01 PM
|
||||
|
@ -45,6 +45,7 @@ import mage.client.MageFrame;
|
|||
import mage.client.chat.ChatPanelBasic;
|
||||
import mage.client.components.MageTextArea;
|
||||
import mage.client.dialog.MageDialog;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import static mage.constants.Constants.Option.ORIGINAL_ID;
|
||||
|
@ -60,7 +61,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class FeedbackPanel extends javax.swing.JPanel {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(FeedbackPanel.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(FeedbackPanel.class);
|
||||
|
||||
public enum FeedbackMode {
|
||||
|
||||
|
@ -74,7 +75,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
private ChatPanelBasic connectedChatPanel;
|
||||
private int lastMessageId;
|
||||
|
||||
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
||||
private static final ScheduledExecutorService WORKER = Executors.newSingleThreadScheduledExecutor();
|
||||
|
||||
/**
|
||||
* Creates new form FeedbackPanel
|
||||
|
@ -88,12 +89,21 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
this.gameId = gameId;
|
||||
session = MageFrame.getSession();
|
||||
helper.init(gameId);
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
helper.changeGUISize();
|
||||
}
|
||||
|
||||
public void getFeedback(FeedbackMode mode, String message, boolean special, Map<String, Serializable> options, int messageId) {
|
||||
synchronized (this) {
|
||||
if (messageId < this.lastMessageId) {
|
||||
logger.warn("ignoring message from later source: " + messageId + ", text=" + message);
|
||||
LOGGER.warn("ignoring message from later source: " + messageId + ", text=" + message);
|
||||
return;
|
||||
}
|
||||
this.lastMessageId = messageId;
|
||||
|
@ -162,8 +172,8 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
protected String getSmallText(String text) {
|
||||
return "<div style='font-size:11pt'>" + text + "</div>";
|
||||
protected static String getSmallText(String text) {
|
||||
return "<div style='font-size:" + GUISizeHelper.gameDialogAreaFontSizeSmall + "pt'>" + text + "</div>";
|
||||
}
|
||||
|
||||
private void setSpecial(String text, boolean visible) {
|
||||
|
@ -179,7 +189,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
Runnable task = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
logger.info("Ending game...");
|
||||
LOGGER.info("Ending game...");
|
||||
Component c = MageFrame.getGame(gameId);
|
||||
while (c != null && !(c instanceof GamePane)) {
|
||||
c = c.getParent();
|
||||
|
@ -189,7 +199,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
};
|
||||
worker.schedule(task, 8, TimeUnit.SECONDS);
|
||||
WORKER.schedule(task, 8, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private void handleOptions(Map<String, Serializable> options) {
|
||||
|
|
|
@ -24,14 +24,13 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* GamePane.java
|
||||
*
|
||||
* Created on Dec 17, 2009, 9:34:10 AM
|
||||
*/
|
||||
|
||||
package mage.client.game;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -44,8 +43,10 @@ import mage.client.MagePane;
|
|||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class GamePane extends MagePane {
|
||||
|
||||
/** Creates new form GamePane */
|
||||
|
||||
/**
|
||||
* Creates new form GamePane
|
||||
*/
|
||||
public GamePane() {
|
||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
initComponents();
|
||||
|
@ -66,7 +67,15 @@ public class GamePane extends MagePane {
|
|||
}
|
||||
|
||||
public void cleanUp() {
|
||||
gamePanel.cleanUp();
|
||||
gamePanel.cleanUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeGUISize() {
|
||||
super.changeGUISize();
|
||||
gamePanel.changeGUISize();
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
public void removeGame() {
|
||||
|
@ -97,14 +106,14 @@ public class GamePane extends MagePane {
|
|||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)
|
||||
.addGap(0, 600, Short.MAX_VALUE)
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)
|
||||
.addGap(0, 600, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
|
||||
.addGap(0, 400, Short.MAX_VALUE)
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
|
||||
.addGap(0, 400, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
pack();
|
||||
|
@ -123,7 +132,7 @@ public class GamePane extends MagePane {
|
|||
public void activated() {
|
||||
gamePanel.activated();
|
||||
}
|
||||
|
||||
|
||||
private mage.client.game.GamePanel gamePanel;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private UUID gameId;
|
||||
|
|
|
@ -71,6 +71,7 @@ import javax.swing.JOptionPane;
|
|||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
@ -101,8 +102,8 @@ import mage.client.game.FeedbackPanel.FeedbackMode;
|
|||
import mage.client.plugins.adapters.MageActionCallback;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.CardsViewUtil;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.GameManager;
|
||||
import mage.client.util.Listener;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
|
@ -140,6 +141,7 @@ import mage.view.MatchView;
|
|||
import mage.view.PlayerView;
|
||||
import mage.view.RevealedView;
|
||||
import mage.view.SimpleCardsView;
|
||||
import mage.view.UserRequestMessage;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.card.arcane.CardPanel;
|
||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||
|
@ -153,7 +155,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
private static final Logger logger = Logger.getLogger(GamePanel.class);
|
||||
private static final String YOUR_HAND = "Your hand";
|
||||
private static final int X_PHASE_WIDTH = 55;
|
||||
private static final int STACK_MIN_CARDS_OFFSET_Y = 7;
|
||||
private static final int STACK_MIN_CARDS_OFFSET_Y = 7; // TODO: Size bui GUISize value
|
||||
|
||||
private static final String CMD_AUTO_ORDER_FIRST = "cmdAutoOrderFirst";
|
||||
private static final String CMD_AUTO_ORDER_LAST = "cmdAutoOrderLast";
|
||||
|
@ -192,6 +194,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
|
||||
private MageDialogState choiceWindowState;
|
||||
|
||||
private int feedbackAreaHeight;
|
||||
private boolean initComponents;
|
||||
|
||||
private enum PopUpMenuType {
|
||||
|
||||
TRIGGER_ORDER
|
||||
|
@ -203,17 +208,18 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
private JPopupMenu popupMenuTriggerOrder;
|
||||
|
||||
public GamePanel() {
|
||||
initComponents = true;
|
||||
initComponents();
|
||||
|
||||
initPopupMenuTriggerOrder();
|
||||
//this.add(popupMenuTriggerOrder);
|
||||
|
||||
setGUISize();
|
||||
|
||||
pickNumber = new PickNumberDialog();
|
||||
MageFrame.getDesktop().add(pickNumber, JLayeredPane.MODAL_LAYER);
|
||||
|
||||
this.feedbackPanel.setConnectedChatPanel(this.userChatPanel);
|
||||
|
||||
this.stack.setMinOffsetY(STACK_MIN_CARDS_OFFSET_Y);
|
||||
this.stackObjects.setMinOffsetY(STACK_MIN_CARDS_OFFSET_Y);
|
||||
|
||||
// Override layout (I can't edit generated code)
|
||||
this.setLayout(new BorderLayout());
|
||||
|
@ -225,7 +231,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
Map<String, JComponent> myUi = getUIComponents(jLayeredBackgroundPane);
|
||||
Plugins.getInstance().updateGamePanel(myUi);
|
||||
|
||||
// Enlarge jlayeredpane on resize
|
||||
// Enlarge jlayeredpane on resize of game panel
|
||||
addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
|
@ -251,6 +257,29 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
|
||||
}
|
||||
});
|
||||
// Resize the width of the stack area if the size of the play area is chnaged
|
||||
ComponentAdapter componentAdapterPlayField = new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
Thread worker = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!initComponents) {
|
||||
setGUISize();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
worker.start();
|
||||
|
||||
}
|
||||
};
|
||||
jPanel3.addComponentListener(componentAdapterPlayField);
|
||||
initComponents = false;
|
||||
}
|
||||
|
||||
private Map<String, JComponent> getUIComponents(JLayeredPane jLayeredPane) {
|
||||
|
@ -277,7 +306,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
this.removeListener();
|
||||
|
||||
this.handContainer.cleanUp();
|
||||
this.stack.cleanUp();
|
||||
this.stackObjects.cleanUp();
|
||||
for (Map.Entry<UUID, PlayAreaPanel> playAreaPanelEntry : players.entrySet()) {
|
||||
playAreaPanelEntry.getValue().CleanUp();
|
||||
}
|
||||
|
@ -323,6 +352,64 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
this.bigCard = null;
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
initComponents = true;
|
||||
setGUISize();
|
||||
stackObjects.changeGUISize();
|
||||
feedbackPanel.changeGUISize();
|
||||
handContainer.changeGUISize();
|
||||
for (PlayAreaPanel playAreaPanel : players.values()) {
|
||||
playAreaPanel.changeGUISize();
|
||||
}
|
||||
|
||||
for (CardInfoWindowDialog cardInfoWindowDialog : exiles.values()) {
|
||||
cardInfoWindowDialog.changeGUISize();
|
||||
}
|
||||
for (CardInfoWindowDialog cardInfoWindowDialog : revealed.values()) {
|
||||
cardInfoWindowDialog.changeGUISize();
|
||||
}
|
||||
for (CardInfoWindowDialog cardInfoWindowDialog : lookedAt.values()) {
|
||||
cardInfoWindowDialog.changeGUISize();
|
||||
}
|
||||
for (CardInfoWindowDialog cardInfoWindowDialog : graveyardWindows.values()) {
|
||||
cardInfoWindowDialog.changeGUISize();
|
||||
}
|
||||
for (ShowCardsDialog showCardsDialog : pickTarget) {
|
||||
showCardsDialog.changeGUISize();
|
||||
}
|
||||
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
initComponents = false;
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
jSplitPane0.setDividerSize(GUISizeHelper.dividerBarSize);
|
||||
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
|
||||
jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize);
|
||||
|
||||
feedbackAreaHeight = GUISizeHelper.gameDialogAreaFontSizeBig + GUISizeHelper.gameDialogAreaFontSizeSmall + GUISizeHelper.gameDialogAreaButtonHigh + 60;
|
||||
helper.setPreferredSize(new Dimension(100, feedbackAreaHeight));
|
||||
stackObjects.setCardDimension(GUISizeHelper.handCardDimension);
|
||||
int newStackWidth = jPanel3.getWidth() * GUISizeHelper.stackWidth / 100;
|
||||
if (newStackWidth < 360) {
|
||||
newStackWidth = 360;
|
||||
}
|
||||
Dimension newDimension = new Dimension(jPanel3.getWidth() - newStackWidth, GUISizeHelper.handCardDimension.height + GUISizeHelper.scrollBarSize);
|
||||
handContainer.setPreferredSize(newDimension);
|
||||
handContainer.setMaximumSize(newDimension);
|
||||
newDimension = new Dimension(newStackWidth, STACK_MIN_CARDS_OFFSET_Y + GUISizeHelper.handCardDimension.height + GUISizeHelper.scrollBarSize);
|
||||
stackObjects.setPreferredSize(newDimension);
|
||||
stackObjects.setMinimumSize(newDimension);
|
||||
stackObjects.setMaximumSize(newDimension);
|
||||
newDimension = new Dimension(newStackWidth, (int) pnlShortCuts.getPreferredSize().getHeight());
|
||||
pnlShortCuts.setPreferredSize(newDimension);
|
||||
pnlShortCuts.setMinimumSize(newDimension);
|
||||
pnlShortCuts.setMaximumSize(newDimension);
|
||||
|
||||
GUISizeHelper.changePopupMenuFont(popupMenuTriggerOrder);
|
||||
}
|
||||
|
||||
private void saveDividerLocations() {
|
||||
// save panel sizes and divider locations.
|
||||
Rectangle rec = MageFrame.getDesktop().getBounds();
|
||||
|
@ -369,24 +456,20 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
bigCard.setPreferredSize(bbDimension);
|
||||
pnlShortCuts.revalidate();
|
||||
pnlShortCuts.repaint();
|
||||
//this.handContainer.sizeHand(0.8, smallMode);
|
||||
for (PlayAreaPanel p : players.values()) {
|
||||
p.sizePlayer(smallMode);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (smallMode) {
|
||||
smallMode = false;
|
||||
Dimension bbDimension = new Dimension(256, 367);
|
||||
bigCard.setMaximumSize(bbDimension);
|
||||
bigCard.setMinimumSize(bbDimension);
|
||||
bigCard.setPreferredSize(bbDimension);
|
||||
pnlShortCuts.revalidate();
|
||||
pnlShortCuts.repaint();
|
||||
this.handContainer.sizeHand(1, smallMode);
|
||||
for (PlayAreaPanel p : players.values()) {
|
||||
p.sizePlayer(smallMode);
|
||||
}
|
||||
} else if (smallMode) {
|
||||
smallMode = false;
|
||||
Dimension bbDimension = new Dimension(256, 367);
|
||||
bigCard.setMaximumSize(bbDimension);
|
||||
bigCard.setMinimumSize(bbDimension);
|
||||
bigCard.setPreferredSize(bbDimension);
|
||||
pnlShortCuts.revalidate();
|
||||
pnlShortCuts.repaint();
|
||||
for (PlayAreaPanel p : players.values()) {
|
||||
p.sizePlayer(smallMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -801,7 +884,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
private void displayStack(GameView game, BigCard bigCard, FeedbackPanel feedbackPanel, UUID gameId) {
|
||||
this.stack.loadCards(game.getStack(), bigCard, gameId, true);
|
||||
this.stackObjects.loadCards(game.getStack(), bigCard, gameId, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1037,10 +1120,6 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
ArrowBuilder.getBuilder().removeAllArrows(gameId);
|
||||
}
|
||||
|
||||
public int modalQuestion(String message, String title) {
|
||||
return JOptionPane.showConfirmDialog(this, message, title, JOptionPane.YES_NO_OPTION);
|
||||
}
|
||||
|
||||
public void select(String message, GameView gameView, int messageId, Map<String, Serializable> options) {
|
||||
updateGame(gameView, options);
|
||||
boolean controllingPlayer = false;
|
||||
|
@ -1049,7 +1128,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
// magenoxx: because of uncaught bug with saving state, rolling back and stack
|
||||
// undo is allowed only for empty stack
|
||||
controllingPlayer = !gameView.getPriorityPlayerName().equals(playerView.getName());
|
||||
if (playerView.getStatesSavedSize() > 0 && gameView.getStack().size() == 0) {
|
||||
if (playerView.getStatesSavedSize() > 0 && gameView.getStack().isEmpty()) {
|
||||
feedbackPanel.allowUndo(playerView.getStatesSavedSize());
|
||||
}
|
||||
break;
|
||||
|
@ -1071,8 +1150,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
if (controllingPlayer) {
|
||||
priorityPlayerText = " / priority " + gameView.getPriorityPlayerName();
|
||||
}
|
||||
String messageToDisplay = message + "<div style='font-size:11pt'>" + activePlayerText + " / " + gameView.getStep().toString() + priorityPlayerText + "</div>";
|
||||
|
||||
String messageToDisplay = message + FeedbackPanel.getSmallText(activePlayerText + " / " + gameView.getStep().toString() + priorityPlayerText);
|
||||
this.feedbackPanel.getFeedback(FeedbackMode.SELECT, messageToDisplay, gameView.getSpecial(), panelOptions, messageId);
|
||||
}
|
||||
|
||||
|
@ -1110,7 +1188,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
if (PopUpMenuType.TRIGGER_ORDER.equals(popupMenuType)) {
|
||||
popupMenu = popupMenuTriggerOrder;
|
||||
}
|
||||
showCards.loadCards(title, cards, bigCard, Config.dimensionsEnlarged, gameId, required, options, popupMenu, getShowCardsEventListener(showCards));
|
||||
showCards.loadCards(title, cards, bigCard, gameId, required, options, popupMenu, getShowCardsEventListener(showCards));
|
||||
return showCards;
|
||||
}
|
||||
|
||||
|
@ -1143,7 +1221,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
public void pickPile(String message, CardsView pile1, CardsView pile2) {
|
||||
hideAll();
|
||||
PickPileDialog pickPileDialog = new PickPileDialog();
|
||||
pickPileDialog.loadCards(message, pile1, pile2, bigCard, Config.dimensions, gameId);
|
||||
pickPileDialog.loadCards(message, pile1, pile2, bigCard, gameId);
|
||||
session.sendPlayerBoolean(gameId, pickPileDialog.isPickedPile1());
|
||||
pickPileDialog.cleanUp();
|
||||
pickPileDialog.removeDialog();
|
||||
|
@ -1196,7 +1274,6 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
btnStopWatching = new javax.swing.JButton();
|
||||
|
||||
bigCard = new mage.client.cards.BigCard();
|
||||
stack = new mage.client.cards.Cards();
|
||||
pnlReplay = new javax.swing.JPanel();
|
||||
btnStopReplay = new javax.swing.JButton();
|
||||
btnNextPlay = new javax.swing.JButton();
|
||||
|
@ -1215,9 +1292,13 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
gameChatPanel.setMinimumSize(new java.awt.Dimension(100, 48));
|
||||
jSplitPane2 = new javax.swing.JSplitPane();
|
||||
handContainer = new HandPanel();
|
||||
|
||||
handCards = new HashMap<>();
|
||||
|
||||
pnlShortCuts.setOpaque(false);
|
||||
pnlShortCuts.setPreferredSize(new Dimension(400, 72));
|
||||
|
||||
stackObjects = new mage.client.cards.Cards();
|
||||
|
||||
jSplitPane1.setBorder(null);
|
||||
jSplitPane1.setDividerSize(7);
|
||||
jSplitPane1.setResizeWeight(1.0);
|
||||
|
@ -1231,8 +1312,6 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
|
||||
restoreDividerLocations();
|
||||
|
||||
pnlShortCuts.setOpaque(false);
|
||||
pnlShortCuts.setPreferredSize(new Dimension(400, 72));
|
||||
lblPhase.setLabelFor(txtPhase);
|
||||
lblPhase.setText("Phase:");
|
||||
|
||||
|
@ -1268,10 +1347,10 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
lblPriority.setLabelFor(txtPriority);
|
||||
lblPriority.setText("Priority Player:");
|
||||
|
||||
feedbackPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(150, 50, 50), 2));
|
||||
feedbackPanel.setMaximumSize(new java.awt.Dimension(208, 121));
|
||||
feedbackPanel.setMinimumSize(new java.awt.Dimension(208, 121));
|
||||
|
||||
// feedbackPanel.setBorder(javax.swing.BorderFactory.createLineBorder(Color.MAGENTA, 5));
|
||||
// feedbackPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(150, 50, 50), 2));
|
||||
// feedbackPanel.setMaximumSize(new java.awt.Dimension(208, 121));
|
||||
// feedbackPanel.setMinimumSize(new java.awt.Dimension(208, 121));
|
||||
bigCard.setBorder(new LineBorder(Color.black, 1, true));
|
||||
|
||||
int c = JComponent.WHEN_IN_FOCUSED_WINDOW;
|
||||
|
@ -1532,8 +1611,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
});
|
||||
|
||||
stack.setPreferredSize(new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 25));
|
||||
stack.setBackgroundColor(new Color(0, 0, 0, 0));
|
||||
stackObjects.setBackgroundColor(new Color(0, 0, 0, 40));
|
||||
|
||||
btnStopReplay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/control_stop.png")));
|
||||
btnStopReplay.addActionListener(new java.awt.event.ActionListener() {
|
||||
|
@ -1684,7 +1762,8 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
jPhases.addMouseListener(phasesMouseAdapter);
|
||||
|
||||
pnlReplay.setOpaque(false);
|
||||
HelperPanel helper = new HelperPanel();
|
||||
helper = new HelperPanel();
|
||||
// helper.setBorder(new LineBorder(Color.MAGENTA, 2));
|
||||
helper.setPreferredSize(new Dimension(100, 90));
|
||||
feedbackPanel.setHelperPanel(helper);
|
||||
|
||||
|
@ -1714,8 +1793,8 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
.addComponent(handContainer, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
)
|
||||
.addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(pnlShortCuts, 400, 400, 400)
|
||||
.addComponent(stack, 400, 400, 400)
|
||||
.addComponent(pnlShortCuts, 360, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(stackObjects, 360, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
|
||||
)
|
||||
)
|
||||
.addGap(0)
|
||||
|
@ -1737,7 +1816,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
.addGroup(gl_jPanel3.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(pnlShortCuts, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(stack, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(stackObjects, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
.addGroup(gl_jPanel3.createSequentialGroup()
|
||||
.addComponent(helper, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
|
@ -1861,9 +1940,11 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
private void btnConcedeActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if (modalQuestion("Are you sure you want to concede?", "Confirm concede") == JOptionPane.YES_OPTION) {
|
||||
session.sendPlayerAction(PlayerAction.CONCEDE, gameId, null);
|
||||
}
|
||||
UserRequestMessage message = new UserRequestMessage("Confirm concede", "Are you sure you want to concede?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_CONCEDE_GAME);
|
||||
message.setGameId(gameId);
|
||||
MageFrame.getInstance().showUserRequestDialog(message);
|
||||
}
|
||||
|
||||
private void btnEndTurnActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
@ -1927,17 +2008,22 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
private void btnStopWatchingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStopWatchingActionPerformed
|
||||
if (modalQuestion("Are you sure you want to stop watching?", "Stop watching") == JOptionPane.YES_OPTION) {
|
||||
session.stopWatching(gameId);
|
||||
this.removeGame();
|
||||
}
|
||||
UserRequestMessage message = new UserRequestMessage("Stop watching", "Are you sure you want to stop watching?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_STOP_WATCHING);
|
||||
message.setGameId(gameId);
|
||||
MageFrame.getInstance().showUserRequestDialog(message);
|
||||
}//GEN-LAST:event_btnStopWatchingActionPerformed
|
||||
|
||||
private void btnStopReplayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStopReplayActionPerformed
|
||||
if (replayTask != null && !replayTask.isDone()) {
|
||||
replayTask.cancel(true);
|
||||
} else if (modalQuestion("Are you sure you want to stop replay?", "Stop replay") == JOptionPane.YES_OPTION) {
|
||||
session.stopReplay(gameId);
|
||||
} else {
|
||||
UserRequestMessage message = new UserRequestMessage("Stop replay", "Are you sure you want to stop replay?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_REPLAY_ACTION);
|
||||
message.setGameId(gameId);
|
||||
MageFrame.getInstance().showUserRequestDialog(message);
|
||||
}
|
||||
}//GEN-LAST:event_btnStopReplayActionPerformed
|
||||
|
||||
|
@ -2127,6 +2213,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
|
||||
private mage.client.chat.ChatPanelBasic gameChatPanel;
|
||||
private mage.client.game.FeedbackPanel feedbackPanel;
|
||||
private HelperPanel helper;
|
||||
private mage.client.chat.ChatPanelBasic userChatPanel;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
|
@ -2147,7 +2234,8 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
private javax.swing.JLabel txtTurn;
|
||||
|
||||
private Map<String, CardsView> handCards;
|
||||
private mage.client.cards.Cards stack;
|
||||
|
||||
private mage.client.cards.Cards stackObjects;
|
||||
private HandPanel handContainer;
|
||||
|
||||
private javax.swing.JSplitPane jSplitPane2;
|
||||
|
|
|
@ -1,37 +1,28 @@
|
|||
package mage.client.game;
|
||||
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.util.Config;
|
||||
import mage.constants.Zone;
|
||||
import mage.view.CardsView;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.UUID;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.util.UUID;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.constants.Zone;
|
||||
import mage.view.CardsView;
|
||||
|
||||
public class HandPanel extends JPanel {
|
||||
|
||||
private static final int CARD_WIDTH = 75;
|
||||
private static final double ASPECT_RATIO = 3.5 / 2.5;
|
||||
private static final int HAND_MIN_CARDS_OFFSET_Y = -10;
|
||||
|
||||
private boolean smallMode = false;
|
||||
private Dimension handCardDimensionBig;
|
||||
private Dimension handCardDimension;
|
||||
|
||||
public HandPanel() {
|
||||
double factor = 1;
|
||||
initComponents();
|
||||
sizeHand(factor, false);
|
||||
changeGUISize();
|
||||
}
|
||||
|
||||
public void initComponents() {
|
||||
hand = new mage.client.cards.Cards(true);
|
||||
hand.setCardDimension(getHandCardDimension());
|
||||
hand.setMinOffsetY(HAND_MIN_CARDS_OFFSET_Y);
|
||||
hand.setCardDimension(GUISizeHelper.handCardDimension);
|
||||
|
||||
jPanel = new JPanel();
|
||||
jScrollPane1 = new JScrollPane(jPanel);
|
||||
|
@ -45,11 +36,11 @@ public class HandPanel extends JPanel {
|
|||
jPanel.setOpaque(false);
|
||||
jScrollPane1.setOpaque(false);
|
||||
|
||||
jPanel.setBorder(emptyBorder);
|
||||
jScrollPane1.setBorder(emptyBorder);
|
||||
jPanel.setBorder(EMPTY_BORDER);
|
||||
jScrollPane1.setBorder(EMPTY_BORDER);
|
||||
jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
|
||||
jScrollPane1.getHorizontalScrollBar().setUnitIncrement(8);
|
||||
jScrollPane1.setViewportBorder(emptyBorder);
|
||||
jScrollPane1.setViewportBorder(EMPTY_BORDER);
|
||||
|
||||
setLayout(new BorderLayout());
|
||||
add(jScrollPane1, BorderLayout.CENTER);
|
||||
|
@ -57,7 +48,7 @@ public class HandPanel extends JPanel {
|
|||
hand.setHScrollSpeed(8);
|
||||
hand.setBackgroundColor(new Color(0, 0, 0, 0));
|
||||
hand.setVisibleIfEmpty(false);
|
||||
hand.setBorder(emptyBorder);
|
||||
hand.setBorder(EMPTY_BORDER);
|
||||
hand.setZone(Zone.HAND.toString());
|
||||
}
|
||||
|
||||
|
@ -65,32 +56,24 @@ public class HandPanel extends JPanel {
|
|||
hand.cleanUp();
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
|
||||
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
|
||||
hand.setCardDimension(GUISizeHelper.handCardDimension);
|
||||
hand.changeGUISize();
|
||||
}
|
||||
|
||||
public void loadCards(CardsView cards, BigCard bigCard, UUID gameId) {
|
||||
hand.loadCards(cards, bigCard, gameId, true);
|
||||
hand.sizeCards(getHandCardDimension());
|
||||
}
|
||||
|
||||
private Dimension getHandCardDimension() {
|
||||
String useBigCards = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_HAND_USE_BIG_CARDS, "true");
|
||||
if (!smallMode && useBigCards.equals("true")) {
|
||||
return handCardDimensionBig;
|
||||
}
|
||||
return handCardDimension;
|
||||
}
|
||||
|
||||
public void sizeHand(double factor, boolean smallMode) {
|
||||
this.smallMode = smallMode;
|
||||
int width = (int) (factor * CARD_WIDTH);
|
||||
int bigWidth = (int) (Config.handScalingFactor * CARD_WIDTH);
|
||||
handCardDimension = new Dimension(width, (int) (width * ASPECT_RATIO));
|
||||
handCardDimensionBig = new Dimension(bigWidth, (int) (bigWidth * ASPECT_RATIO));
|
||||
hand.setCardDimension(getHandCardDimension());
|
||||
hand.sizeCards(getHandCardDimension());
|
||||
}
|
||||
|
||||
private JPanel jPanel;
|
||||
private JScrollPane jScrollPane1;
|
||||
private static final Border emptyBorder = new EmptyBorder(0, 0, 0, 0);
|
||||
private static final Border EMPTY_BORDER = new EmptyBorder(0, 0, 0, 0);
|
||||
private mage.client.cards.Cards hand;
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ package mage.client.game;
|
|||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
@ -50,6 +50,7 @@ import mage.client.MageFrame;
|
|||
import mage.client.components.MageTextArea;
|
||||
import mage.client.game.FeedbackPanel.FeedbackMode;
|
||||
import static mage.client.game.FeedbackPanel.FeedbackMode.QUESTION;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_ID_NO;
|
||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_ID_YES;
|
||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_RESET_ALL;
|
||||
|
@ -68,10 +69,11 @@ public class HelperPanel extends JPanel {
|
|||
private javax.swing.JButton btnRight;
|
||||
private javax.swing.JButton btnSpecial;
|
||||
private javax.swing.JButton btnUndo;
|
||||
|
||||
//private javax.swing.JButton btnEndTurn;
|
||||
//private javax.swing.JButton btnStopTimer;
|
||||
|
||||
private MageTextArea textArea;
|
||||
JPanel buttonContainer;
|
||||
|
||||
private javax.swing.JButton linkLeft;
|
||||
private javax.swing.JButton linkRight;
|
||||
|
@ -107,45 +109,74 @@ public class HelperPanel extends JPanel {
|
|||
session = MageFrame.getSession();
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
buttonContainer.setPreferredSize(new Dimension(getWidth(), GUISizeHelper.gameDialogButtonHeight + 20));
|
||||
buttonContainer.setMinimumSize(new Dimension(160, GUISizeHelper.gameDialogButtonHeight + 20));
|
||||
buttonContainer.setMaximumSize(new Dimension(Integer.MAX_VALUE, GUISizeHelper.gameDialogButtonHeight + 20));
|
||||
|
||||
Dimension buttonDimension = new Dimension(GUISizeHelper.gameDialogButtonWidth, GUISizeHelper.gameDialogButtonHeight);
|
||||
btnLeft.setFont(GUISizeHelper.gameDialogAreaFont);
|
||||
btnRight.setFont(GUISizeHelper.gameDialogAreaFont);
|
||||
btnSpecial.setFont(GUISizeHelper.gameDialogAreaFont);
|
||||
btnUndo.setFont(GUISizeHelper.gameDialogAreaFont);
|
||||
|
||||
if (message != null) {
|
||||
int pos = this.message.indexOf("font-size:");
|
||||
if (pos > 0) {
|
||||
String newMessage = this.message.substring(0, pos + 10) + GUISizeHelper.gameDialogAreaFontSizeBig + this.message.substring(pos + 12);
|
||||
pos = this.message.indexOf("font-size:", pos + 10);
|
||||
if (pos > 0) {
|
||||
newMessage = this.message.substring(0, pos + 10) + GUISizeHelper.gameDialogAreaFontSizeSmall + this.message.substring(pos + 12);
|
||||
}
|
||||
setBasicMessage(newMessage);
|
||||
}
|
||||
}
|
||||
|
||||
GUISizeHelper.changePopupMenuFont(popupMenuAskNo);
|
||||
GUISizeHelper.changePopupMenuFont(popupMenuAskYes);
|
||||
revalidate();
|
||||
repaint();
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
initPopupMenuTriggerOrder();
|
||||
setBackground(new Color(0, 0, 0, 100));
|
||||
//setLayout(new GridBagLayout());
|
||||
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
|
||||
// setBorder(new LineBorder(Color.WHITE, 1));
|
||||
|
||||
setOpaque(false);
|
||||
|
||||
JPanel container = new JPanel();
|
||||
|
||||
container.setPreferredSize(new Dimension(100, 30));
|
||||
container.setMinimumSize(new Dimension(20, 20));
|
||||
container.setMaximumSize(new Dimension(2000, 100));
|
||||
container.setLayout(new GridBagLayout());
|
||||
container.setOpaque(false);
|
||||
|
||||
JPanel jPanel = new JPanel();
|
||||
|
||||
textArea = new MageTextArea();
|
||||
// textArea.setBorder(new LineBorder(Color.GREEN, 1));
|
||||
textArea.setText("<Empty>");
|
||||
add(textArea);
|
||||
|
||||
jPanel.setOpaque(false);
|
||||
jPanel.setBackground(new Color(0, 0, 0, 80));
|
||||
jPanel.add(textArea);
|
||||
add(jPanel);
|
||||
buttonContainer = new JPanel();
|
||||
// buttonContainer.setBorder(new LineBorder(Color.RED, 1));
|
||||
buttonContainer.setLayout(new FlowLayout(FlowLayout.CENTER, 15, 0));
|
||||
buttonContainer.setOpaque(false);
|
||||
add(buttonContainer);
|
||||
|
||||
add(container);
|
||||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
|
||||
btnSpecial = new JButton("Special");
|
||||
btnSpecial.setVisible(false);
|
||||
container.add(btnSpecial);
|
||||
buttonContainer.add(btnSpecial);
|
||||
|
||||
btnLeft = new JButton("OK");
|
||||
btnLeft.setVisible(false);
|
||||
container.add(btnLeft);
|
||||
buttonContainer.add(btnLeft);
|
||||
|
||||
btnRight = new JButton("Cancel");
|
||||
btnRight.setVisible(false);
|
||||
container.add(btnRight);
|
||||
buttonContainer.add(btnRight);
|
||||
|
||||
btnUndo = new JButton("Undo");
|
||||
btnUndo.setVisible(false);
|
||||
container.add(btnUndo);
|
||||
buttonContainer.add(btnUndo);
|
||||
|
||||
MouseListener checkPopupAdapter = new MouseAdapter() {
|
||||
@Override
|
||||
|
|
|
@ -43,7 +43,6 @@ import javax.swing.GroupLayout.Alignment;
|
|||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
import javax.swing.MenuSelectionManager;
|
||||
|
@ -55,8 +54,10 @@ import mage.client.dialog.PreferencesDialog;
|
|||
import static mage.client.dialog.PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_GAME_MANA_AUTOPAYMENT;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_GAME_MANA_AUTOPAYMENT_ONLY_ONE;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.view.PlayerView;
|
||||
import mage.view.UserRequestMessage;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -103,6 +104,8 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
addPopupMenuWatcher();
|
||||
}
|
||||
this.add(popupMenu);
|
||||
setGUISize();
|
||||
|
||||
init(player, bigCard, gameId, priorityTime);
|
||||
update(player);
|
||||
}
|
||||
|
@ -137,6 +140,16 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
battlefieldPanel.changeGUISize();
|
||||
playerPanel.changeGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
GUISizeHelper.changePopupMenuFont(popupMenu);
|
||||
}
|
||||
|
||||
private void addPopupMenuPlayer(boolean allowRequestToShowHandCards) {
|
||||
|
||||
JMenuItem menuItem;
|
||||
|
@ -397,15 +410,19 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
public void actionPerformed(ActionEvent e) {
|
||||
switch (e.getActionCommand()) {
|
||||
case "Game": {
|
||||
if (JOptionPane.showConfirmDialog(PlayAreaPanel.this, "Are you sure you want to concede the game?", "Confirm concede game", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
MageFrame.getSession().sendPlayerAction(PlayerAction.CONCEDE, gameId, null);
|
||||
}
|
||||
UserRequestMessage message = new UserRequestMessage("Confirm concede game", "Are you sure you want to concede the game?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_CONCEDE_GAME);
|
||||
message.setGameId(gameId);
|
||||
MageFrame.getInstance().showUserRequestDialog(message);
|
||||
break;
|
||||
}
|
||||
case "Match": {
|
||||
if (JOptionPane.showConfirmDialog(PlayAreaPanel.this, "Are you sure you want to concede the complete match?", "Confirm concede match", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
MageFrame.getSession().quitMatch(gameId);
|
||||
}
|
||||
UserRequestMessage message = new UserRequestMessage("Confirm concede match", "Are you sure you want to concede the complete match?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_CONCEDE_MATCH);
|
||||
message.setGameId(gameId);
|
||||
MageFrame.getInstance().showUserRequestDialog(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -459,10 +476,11 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (JOptionPane.showConfirmDialog(PlayAreaPanel.this, "Are you sure you want to stop watching the game?", "Confirm stop watching game", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
gamePanel.getSession().stopWatching(gameId);
|
||||
gamePanel.removeGame();
|
||||
}
|
||||
UserRequestMessage message = new UserRequestMessage("Confirm stop watching game", "Are you sure you want to stop watching the game?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_STOP_WATCHING);
|
||||
message.setGameId(gameId);
|
||||
MageFrame.getInstance().showUserRequestDialog(message);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -502,8 +520,8 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
this.playerPanel.init(gameId, player.getPlayerId(), bigCard, priorityTime);
|
||||
this.battlefieldPanel.init(gameId, bigCard);
|
||||
this.gameId = gameId;
|
||||
this.playerId = player.getPlayerId();
|
||||
if (MageFrame.getSession().isTestMode()) {
|
||||
this.playerId = player.getPlayerId();
|
||||
this.btnCheat.setVisible(true);
|
||||
} else {
|
||||
this.btnCheat.setVisible(false);
|
||||
|
@ -530,8 +548,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0, 0)));
|
||||
playerPanel = new PlayerPanelExt();
|
||||
btnCheat = new javax.swing.JButton();
|
||||
//jScrollPane1 = new javax.swing.JScrollPane();
|
||||
//battlefieldPanel = new mage.client.game.BattlefieldPanel(jScrollPane1);
|
||||
battlefieldPanel = new mage.client.game.BattlefieldPanel();
|
||||
|
||||
btnCheat.setText("Cheat");
|
||||
|
@ -542,10 +558,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
}
|
||||
});
|
||||
|
||||
//jScrollPane1.setViewportView(battlefieldPanel);
|
||||
//Border empty = new EmptyBorder(0,0,0,0);
|
||||
//jScrollPane1.setBorder(empty);
|
||||
//jScrollPane1.setViewportBorder(empty);
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createSequentialGroup()
|
||||
|
|
|
@ -102,9 +102,9 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
private static final int PANEL_HEIGHT_SMALL = 212;
|
||||
private static final int MANA_LABEL_SIZE_HORIZONTAL = 20;
|
||||
|
||||
private static final Border greenBorder = new LineBorder(Color.green, 3);
|
||||
private static final Border redBorder = new LineBorder(Color.red, 2);
|
||||
private static final Border emptyBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0);
|
||||
private static final Border GREEN_BORDER = new LineBorder(Color.green, 3);
|
||||
private static final Border RED_BORDER = new LineBorder(Color.red, 2);
|
||||
private static final Border EMPTY_BORDER = BorderFactory.createEmptyBorder(0, 0, 0, 0);
|
||||
|
||||
private int avatarId = -1;
|
||||
private String flagName;
|
||||
|
@ -118,6 +118,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
public PlayerPanelExt() {
|
||||
setPreferredSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
|
||||
initComponents();
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
public void init(UUID gameId, UUID playerId, BigCard bigCard, int priorityTime) {
|
||||
|
@ -158,6 +159,14 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
|
||||
}
|
||||
|
||||
public void update(PlayerView player) {
|
||||
this.player = player;
|
||||
updateAvatar();
|
||||
|
@ -257,14 +266,14 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
if (player.isActive()) {
|
||||
this.avatar.setBorder(greenBorder);
|
||||
this.btnPlayer.setBorder(greenBorder);
|
||||
this.avatar.setBorder(GREEN_BORDER);
|
||||
this.btnPlayer.setBorder(GREEN_BORDER);
|
||||
} else if (player.hasLeft()) {
|
||||
this.avatar.setBorder(redBorder);
|
||||
this.btnPlayer.setBorder(redBorder);
|
||||
this.avatar.setBorder(RED_BORDER);
|
||||
this.btnPlayer.setBorder(RED_BORDER);
|
||||
} else {
|
||||
this.avatar.setBorder(emptyBorder);
|
||||
this.btnPlayer.setBorder(emptyBorder);
|
||||
this.avatar.setBorder(EMPTY_BORDER);
|
||||
this.btnPlayer.setBorder(EMPTY_BORDER);
|
||||
}
|
||||
|
||||
update(player.getManaPool());
|
||||
|
@ -501,7 +510,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
manaCountLabelW.setText("0");
|
||||
manaLabels.put("W", manaCountLabelW);
|
||||
r = new Rectangle(12, 12);
|
||||
BufferedImage imageManaW = ManaSymbols.getManaSymbolImageSmall("W");
|
||||
BufferedImage imageManaW = ManaSymbols.getSizedManaSymbol("W");
|
||||
HoverButton btnWhiteMana = new HoverButton(null, imageManaW, imageManaW, imageManaW, r);
|
||||
btnWhiteMana.setToolTipText("White mana");
|
||||
btnWhiteMana.setOpaque(false);
|
||||
|
@ -517,7 +526,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
manaCountLabelU.setText("0");
|
||||
manaLabels.put("U", manaCountLabelU);
|
||||
r = new Rectangle(12, 12);
|
||||
BufferedImage imageManaU = ManaSymbols.getManaSymbolImageSmall("U");
|
||||
BufferedImage imageManaU = ManaSymbols.getSizedManaSymbol("U");
|
||||
HoverButton btnBlueMana = new HoverButton(null, imageManaU, imageManaU, imageManaU, r);
|
||||
btnBlueMana.setToolTipText("Blue mana");
|
||||
btnBlueMana.setOpaque(false);
|
||||
|
@ -533,7 +542,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
manaCountLabelB.setText("0");
|
||||
manaLabels.put("B", manaCountLabelB);
|
||||
r = new Rectangle(12, 12);
|
||||
BufferedImage imageManaB = ManaSymbols.getManaSymbolImageSmall("B");
|
||||
BufferedImage imageManaB = ManaSymbols.getSizedManaSymbol("B");
|
||||
HoverButton btnBlackMana = new HoverButton(null, imageManaB, imageManaB, imageManaB, r);
|
||||
btnBlackMana.setToolTipText("Black mana");
|
||||
btnBlackMana.setOpaque(false);
|
||||
|
@ -549,7 +558,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
manaCountLabelR.setText("0");
|
||||
manaLabels.put("R", manaCountLabelR);
|
||||
r = new Rectangle(12, 12);
|
||||
BufferedImage imageManaR = ManaSymbols.getManaSymbolImageSmall("R");
|
||||
BufferedImage imageManaR = ManaSymbols.getSizedManaSymbol("R");
|
||||
HoverButton btnRedMana = new HoverButton(null, imageManaR, imageManaR, imageManaR, r);
|
||||
btnRedMana.setToolTipText("Red mana");
|
||||
btnRedMana.setOpaque(false);
|
||||
|
@ -565,7 +574,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
manaCountLabelG.setText("0");
|
||||
manaLabels.put("G", manaCountLabelG);
|
||||
r = new Rectangle(12, 12);
|
||||
BufferedImage imageManaG = ManaSymbols.getManaSymbolImageSmall("G");
|
||||
BufferedImage imageManaG = ManaSymbols.getSizedManaSymbol("G");
|
||||
HoverButton btnGreenMana = new HoverButton(null, imageManaG, imageManaG, imageManaG, r);
|
||||
btnGreenMana.setToolTipText("Green mana");
|
||||
btnGreenMana.setOpaque(false);
|
||||
|
@ -581,7 +590,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
manaCountLabelX.setText("0");
|
||||
manaLabels.put("X", manaCountLabelX);
|
||||
r = new Rectangle(12, 12);
|
||||
BufferedImage imageManaX = ManaSymbols.getManaSymbolImageSmall("C");
|
||||
BufferedImage imageManaX = ManaSymbols.getSizedManaSymbol("C");
|
||||
HoverButton btnColorlessMana = new HoverButton(null, imageManaX, imageManaX, imageManaX, r);
|
||||
btnColorlessMana.setToolTipText("Colorless mana");
|
||||
btnColorlessMana.setOpaque(false);
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
package mage.client.plugins;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import javax.swing.*;
|
||||
import mage.cards.MageCard;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.cards.action.ActionCallback;
|
||||
|
@ -7,31 +13,43 @@ import mage.client.cards.BigCard;
|
|||
import mage.view.CardView;
|
||||
import mage.view.PermanentView;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface MagePlugins {
|
||||
|
||||
void loadPlugins();
|
||||
|
||||
void shutdown();
|
||||
|
||||
void updateGamePanel(Map<String, JComponent> ui);
|
||||
|
||||
JComponent updateTablePanel(Map<String, JComponent> ui);
|
||||
|
||||
MagePermanent getMagePermanent(PermanentView card, BigCard bigCard, Dimension dimension, UUID gameId, boolean loadImage);
|
||||
|
||||
MageCard getMageCard(CardView card, BigCard bigCard, Dimension dimension, UUID gameId, boolean loadImage);
|
||||
|
||||
boolean isThemePluginLoaded();
|
||||
|
||||
boolean isCardPluginLoaded();
|
||||
|
||||
boolean isCounterPluginLoaded();
|
||||
|
||||
int sortPermanents(Map<String, JComponent> ui, Collection<MagePermanent> permanents);
|
||||
|
||||
void downloadSymbols();
|
||||
|
||||
int getGamesPlayed();
|
||||
|
||||
void addGamesPlayed();
|
||||
Image getManaSymbolImage(String symbol);
|
||||
|
||||
void onAddCard(MagePermanent card, int count);
|
||||
|
||||
void onRemoveCard(MagePermanent card, int count);
|
||||
|
||||
JComponent getCardInfoPane();
|
||||
|
||||
BufferedImage getOriginalImage(CardView card);
|
||||
|
||||
ActionCallback getActionCallback();
|
||||
|
||||
void changeGUISize();
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ import org.mage.plugins.card.images.ImageCache;
|
|||
*/
|
||||
public class MageActionCallback implements ActionCallback {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ActionCallback.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(ActionCallback.class);
|
||||
public static final int GAP_X = 5;
|
||||
public static final double COMPARE_GAP_X = 30;
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
private static final ScheduledExecutorService timeoutExecutor = Executors.newScheduledThreadPool(1);
|
||||
private ScheduledFuture<?> hideTimeout;
|
||||
|
||||
private CardPanel prevCard;
|
||||
private CardPanel prevCardPanel;
|
||||
private boolean startedDragging;
|
||||
private boolean isDragging;
|
||||
private Point initialCardPos;
|
||||
|
@ -207,7 +207,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
);
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
logger.warn(e.getMessage());
|
||||
LOGGER.warn(e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -219,11 +219,11 @@ public class MageActionCallback implements ActionCallback {
|
|||
|
||||
// for some reason sometime mouseRelease happens before numerous Mouse_Dragged events
|
||||
// that results in not finished dragging
|
||||
clearDragging(this.prevCard);
|
||||
clearDragging(this.prevCardPanel);
|
||||
|
||||
isDragging = false;
|
||||
startedDragging = false;
|
||||
prevCard = null;
|
||||
prevCardPanel = null;
|
||||
cardPanels.clear();
|
||||
Point mouse = new Point(e.getX(), e.getY());
|
||||
SwingUtilities.convertPointToScreen(mouse, data.component);
|
||||
|
@ -266,7 +266,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
}
|
||||
|
||||
private void clearDragging(CardPanel card) {
|
||||
if (this.startedDragging && prevCard != null && card != null) {
|
||||
if (this.startedDragging && prevCardPanel != null && card != null) {
|
||||
for (Component component : card.getCardArea().getComponents()) {
|
||||
if (component instanceof CardPanel) {
|
||||
if (cardPanels.contains((CardPanel) component)) {
|
||||
|
@ -278,7 +278,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
sort(card, card.getCardArea(), true);
|
||||
cardPanels.clear();
|
||||
}
|
||||
prevCard = null;
|
||||
prevCardPanel = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -288,8 +288,8 @@ public class MageActionCallback implements ActionCallback {
|
|||
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e, TransferData transferData) {
|
||||
CardPanel card = ((CardPanel) transferData.component);
|
||||
if (card.getZone() == null || !card.getZone().equalsIgnoreCase("hand")) {
|
||||
CardPanel cardPanel = ((CardPanel) transferData.component);
|
||||
if (cardPanel.getZone() == null || !cardPanel.getZone().equalsIgnoreCase("hand")) {
|
||||
// drag'n'drop is allowed for HAND zone only
|
||||
return;
|
||||
}
|
||||
|
@ -298,19 +298,19 @@ public class MageActionCallback implements ActionCallback {
|
|||
return;
|
||||
}
|
||||
isDragging = true;
|
||||
prevCard = card;
|
||||
Point p = card.getCardLocation();
|
||||
prevCardPanel = cardPanel;
|
||||
Point cardPanelLocationOld = cardPanel.getLocation();
|
||||
Point mouse = new Point(e.getX(), e.getY());
|
||||
SwingUtilities.convertPointToScreen(mouse, transferData.component);
|
||||
int xOffset = card.getXOffset(card.getCardWidth());
|
||||
int xOffset = cardPanel.getXOffset(cardPanel.getCardWidth());
|
||||
int newX = Math.max(initialCardPos.x + (int) (mouse.getX() - initialMousePos.x) - xOffset, 0);
|
||||
card.setCardBounds(
|
||||
cardPanel.setCardBounds(
|
||||
newX,
|
||||
p.y,
|
||||
card.getCardWidth(),
|
||||
card.getCardHeight());
|
||||
card.getCardArea().setComponentZOrder(card, 0);
|
||||
sort(card, card.getCardArea(), false);
|
||||
cardPanelLocationOld.y + cardPanel.getCardYOffset(),
|
||||
cardPanel.getCardWidth(),
|
||||
cardPanel.getCardHeight());
|
||||
cardPanel.getCardArea().setComponentZOrder(cardPanel, 0);
|
||||
sort(cardPanel, cardPanel.getCardArea(), false);
|
||||
|
||||
if (!this.startedDragging) {
|
||||
this.startedDragging = true;
|
||||
|
@ -336,10 +336,8 @@ public class MageActionCallback implements ActionCallback {
|
|||
component.setLocation(component.getLocation().x, component.getLocation().y + GO_DOWN_ON_DRAG_Y_OFFSET);
|
||||
}
|
||||
cardPanels.add((CardPanel) component);
|
||||
} else {
|
||||
if (!startedDragging) {
|
||||
component.setLocation(component.getLocation().x, component.getLocation().y - GO_UP_ON_DRAG_Y_OFFSET);
|
||||
}
|
||||
} else if (!startedDragging) {
|
||||
component.setLocation(component.getLocation().x, component.getLocation().y - GO_UP_ON_DRAG_Y_OFFSET);
|
||||
}
|
||||
cards.add((CardPanel) component);
|
||||
}
|
||||
|
@ -430,7 +428,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
Component popupContainer = MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER);
|
||||
popupContainer.setVisible(false);
|
||||
} catch (Exception e2) {
|
||||
logger.warn("Can't set tooltip to visible = false", e2);
|
||||
LOGGER.warn("Can't set tooltip to visible = false", e2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,10 +460,8 @@ public class MageActionCallback implements ActionCallback {
|
|||
if (notches > 0) {
|
||||
hideEnlargedCard();
|
||||
}
|
||||
} else {
|
||||
if (notches < 0) {
|
||||
hideEnlargedCard();
|
||||
}
|
||||
} else if (notches < 0) {
|
||||
hideEnlargedCard();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -515,7 +511,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
cardPreviewContainer.setVisible(false);
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
logger.warn("Can't hide enlarged card", e);
|
||||
LOGGER.warn("Can't hide enlarged card", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -587,11 +583,11 @@ public class MageActionCallback implements ActionCallback {
|
|||
displayCardInfo(mageCard, image, bigCard);
|
||||
|
||||
} else {
|
||||
logger.warn("No Card preview Pane in Mage Frame defined. Card: " + cardView.getName());
|
||||
LOGGER.warn("No Card preview Pane in Mage Frame defined. Card: " + cardView.getName());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.warn("Problem dring display of enlarged card", e);
|
||||
LOGGER.warn("Problem dring display of enlarged card", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package mage.client.plugins.impl;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Image;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
|
@ -32,13 +31,12 @@ import org.apache.log4j.Logger;
|
|||
import org.mage.plugins.card.CardPluginImpl;
|
||||
import org.mage.plugins.theme.ThemePluginImpl;
|
||||
|
||||
|
||||
public class Plugins implements MagePlugins {
|
||||
|
||||
public static final String PLUGINS_DIRECTORY = "plugins/";
|
||||
|
||||
private static final MagePlugins fINSTANCE = new Plugins();
|
||||
private static final Logger logger = Logger.getLogger(Plugins.class);
|
||||
private static final MagePlugins fINSTANCE = new Plugins();
|
||||
private static final Logger LOGGER = Logger.getLogger(Plugins.class);
|
||||
private static PluginManager pm;
|
||||
|
||||
private ThemePlugin themePlugin = null;
|
||||
|
@ -53,13 +51,13 @@ public class Plugins implements MagePlugins {
|
|||
|
||||
@Override
|
||||
public void loadPlugins() {
|
||||
logger.info("Loading plugins...");
|
||||
LOGGER.info("Loading plugins...");
|
||||
pm = PluginManagerFactory.createPluginManager();
|
||||
pm.addPluginsFrom(new File(PLUGINS_DIRECTORY).toURI());
|
||||
this.cardPlugin = new CardPluginImpl();
|
||||
this.counterPlugin = pm.getPlugin(CounterPlugin.class);
|
||||
this.themePlugin = new ThemePluginImpl();
|
||||
logger.info("Done.");
|
||||
LOGGER.info("Done.");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,6 +67,18 @@ public class Plugins implements MagePlugins {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
if (this.cardPlugin != null) {
|
||||
cardPlugin.changeGUISize();
|
||||
}
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGamePanel(Map<String, JComponent> ui) {
|
||||
if (MageFrame.isLite() || MageFrame.isGray() || themePlugin == null) {
|
||||
|
@ -107,8 +117,6 @@ public class Plugins implements MagePlugins {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCardPluginLoaded() {
|
||||
return this.cardPlugin != null;
|
||||
|
@ -135,11 +143,11 @@ public class Plugins implements MagePlugins {
|
|||
@Override
|
||||
public int getGamesPlayed() {
|
||||
if (this.counterPlugin != null) {
|
||||
synchronized(Plugins.class) {
|
||||
synchronized (Plugins.class) {
|
||||
try {
|
||||
return this.counterPlugin.getGamePlayed();
|
||||
} catch (PluginException e) {
|
||||
logger.fatal(e.getMessage());
|
||||
LOGGER.fatal(e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
@ -150,11 +158,11 @@ public class Plugins implements MagePlugins {
|
|||
@Override
|
||||
public void addGamesPlayed() {
|
||||
if (this.counterPlugin != null) {
|
||||
synchronized(Plugins.class) {
|
||||
synchronized (Plugins.class) {
|
||||
try {
|
||||
this.counterPlugin.addGamePlayed();
|
||||
} catch (PluginException e) {
|
||||
logger.fatal(e.getMessage());
|
||||
LOGGER.fatal(e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
@ -171,14 +179,6 @@ public class Plugins implements MagePlugins {
|
|||
return this.themePlugin != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getManaSymbolImage(String symbol) {
|
||||
if (this.cardPlugin != null) {
|
||||
return this.cardPlugin.getManaSymbolImage(symbol);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAddCard(MagePermanent card, int count) {
|
||||
if (this.cardPlugin != null) {
|
||||
|
|
|
@ -72,19 +72,20 @@
|
|||
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
|
||||
<Color id="Standardcursor"/>
|
||||
</Property>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="gridColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="ff" green="ff" red="ff" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
<Property name="rowSelectionAllowed" type="boolean" value="false"/>
|
||||
<Property name="showHorizontalLines" type="boolean" value="false"/>
|
||||
<Property name="showVerticalLines" type="boolean" value="false"/>
|
||||
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
|
||||
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
|
||||
</Property>
|
||||
<Property name="updateSelectionOnSort" type="boolean" value="false"/>
|
||||
<Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<AccessibilityProperties>
|
||||
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value=""/>
|
||||
</AccessibilityProperties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
|
|
|
@ -34,24 +34,35 @@
|
|||
package mage.client.table;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseMotionAdapter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.JTableHeader;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
import static mage.client.chat.ChatPanelBasic.CHAT_ALPHA;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_ORDER;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_WIDTH;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.MageTableRowSorter;
|
||||
import mage.client.util.gui.TableUtil;
|
||||
import mage.client.util.gui.countryBox.CountryCellRenderer;
|
||||
import mage.remote.MageRemoteException;
|
||||
import mage.view.RoomUsersView;
|
||||
import mage.view.UsersView;
|
||||
import net.java.balloontip.utils.ToolTipUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -61,7 +72,7 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
|
||||
private final List<String> players = new ArrayList<>();
|
||||
private final UserTableModel userTableModel;
|
||||
private static final int[] DEFAULT_COLUMNS_WIDTH = {20, 100, 100, 80, 80};
|
||||
private static final int[] DEFAULT_COLUMNS_WIDTH = {20, 100, 40, 100, 40, 100, 80, 80};
|
||||
|
||||
|
||||
/*
|
||||
|
@ -77,8 +88,11 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
jTablePlayers.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
|
||||
jTablePlayers.setForeground(Color.white);
|
||||
jTablePlayers.setRowSorter(new MageTableRowSorter(userTableModel));
|
||||
setGUISize();
|
||||
|
||||
TableUtil.setColumnWidthAndOrder(jTablePlayers, DEFAULT_COLUMNS_WIDTH, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
|
||||
userTableModel.initHeaderTooltips();
|
||||
|
||||
jTablePlayers.setDefaultRenderer(Icon.class, new CountryCellRenderer());
|
||||
|
||||
jScrollPaneTalk.setSystemMessagesPane(colorPaneSystem);
|
||||
|
@ -103,6 +117,24 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
jScrollPaneTalk.cleanUp();
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
jTablePlayers.getTableHeader().setFont(GUISizeHelper.tableFont);
|
||||
jTablePlayers.getTableHeader().setPreferredSize(new Dimension((int) jTablePlayers.getTableHeader().getPreferredSize().getWidth(), GUISizeHelper.tableHeaderHeight));
|
||||
jTablePlayers.setFont(GUISizeHelper.tableFont);
|
||||
jTablePlayers.setRowHeight(GUISizeHelper.getTableRowHeight());
|
||||
jScrollPanePlayers.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
|
||||
jScrollPanePlayers.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
|
||||
jScrollPaneSystem.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
|
||||
jScrollPaneSystem.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
|
||||
|
||||
jTabbedPaneText.setFont(GUISizeHelper.getTabFont());
|
||||
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
|
||||
}
|
||||
|
||||
public void setSplitDividerLocation(int location) {
|
||||
if (jSplitPane1 != null) {
|
||||
jSplitPane1.setDividerLocation(location);
|
||||
|
@ -118,7 +150,7 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
|
||||
class UserTableModel extends AbstractTableModel {
|
||||
|
||||
private final String[] columnNames = new String[]{"Loc", "Players", "History", "Games", "Connection"};
|
||||
private final String[] columnNames = new String[]{"Loc", "Players", "Matches", "MQP", "Tourneys", "TQP", "Games", "Connection"};
|
||||
private UsersView[] players = new UsersView[0];
|
||||
|
||||
public void loadData(Collection<RoomUsersView> roomUserInfoList) throws MageRemoteException {
|
||||
|
@ -128,7 +160,7 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
TableColumnModel tcm = th.getColumnModel();
|
||||
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(1)).setHeaderValue("Players (" + this.players.length + ")");
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(3)).setHeaderValue(
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(6)).setHeaderValue(
|
||||
"Games " + roomUserInfo.getNumberActiveGames()
|
||||
+ (roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " (T:" + roomUserInfo.getNumberGameThreads() : " (")
|
||||
+ " limit: " + roomUserInfo.getNumberMaxGames() + ")");
|
||||
|
@ -154,19 +186,76 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
case 1:
|
||||
return players[arg0].getUserName();
|
||||
case 2:
|
||||
return players[arg0].getHistory();
|
||||
return players[arg0].getMatchHistory();
|
||||
case 3:
|
||||
return players[arg0].getInfoGames();
|
||||
return players[arg0].getMatchQuitRatio();
|
||||
case 4:
|
||||
return players[arg0].getTourneyHistory();
|
||||
case 5:
|
||||
return players[arg0].getTourneyQuitRatio();
|
||||
case 6:
|
||||
return players[arg0].getInfoGames();
|
||||
case 7:
|
||||
return players[arg0].getInfoPing();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public void initHeaderTooltips() {
|
||||
ColumnHeaderToolTips tips = new ColumnHeaderToolTips();
|
||||
for (int c = 0; c < jTablePlayers.getColumnCount(); c++) {
|
||||
String tooltipText = "";
|
||||
switch (c) {
|
||||
case 0:
|
||||
tooltipText = "<HTML><b>The flag the user has assigned to his profile</b>"
|
||||
+ "<br>You can assign the flag in the connect to server dialog window";
|
||||
break;
|
||||
case 1:
|
||||
tooltipText = "<HTML><b>Name of the user</b>"
|
||||
+ "<br>(the number behind the header text is the number of currently connected users to the server)";
|
||||
break;
|
||||
case 2:
|
||||
tooltipText = "<HTML><b>Number of matches the user played so far</b>"
|
||||
+ "<br>Q = number of matches quit"
|
||||
+ "<br>I = number of matches lost because of idle timeout"
|
||||
+ "<br>T = number of matches lost because of match timeout";
|
||||
break;
|
||||
case 3:
|
||||
tooltipText = "<HTML><b>Percent-Ratio of matches played related to matches quit</b>"
|
||||
+ "<br>this calculation does not include tournament matches";
|
||||
break;
|
||||
case 4:
|
||||
tooltipText = "<HTML><b>Number of tournaments the user played so far</b>"
|
||||
+ "<br>D = number of tournaments left during draft phase"
|
||||
+ "<br>C = number of tournaments left during constructing phase"
|
||||
+ "<br>R = number of tournaments left during rounds";
|
||||
break;
|
||||
case 5:
|
||||
tooltipText = "<HTML><b>Percent-Ratio of tournament matches played related to tournament matches quit</b>"
|
||||
+ "<br>this calculation does not include non tournament matches";
|
||||
break;
|
||||
case 6:
|
||||
tooltipText = "<HTML><b>Current activities of the player</b>"
|
||||
+ "<BR>the header itself shows the number of currently active games"
|
||||
+ "<BR>T: = number of games threads "
|
||||
+ "<BR><i>(that can vary from active games because of sideboarding or crashed games)</i>"
|
||||
+ "<BR>limt: the maximum of games the server is configured to"
|
||||
+ "<BR><i>(if the number of started games exceed that limit, the games have to wait"
|
||||
+ "<BR>until active games end)</i>";
|
||||
break;
|
||||
case 7:
|
||||
tooltipText = "<HTML><b>Latency of the user's connection to the server</b>";
|
||||
break;
|
||||
}
|
||||
tips.setToolTip(c, tooltipText);
|
||||
}
|
||||
JTableHeader header = jTablePlayers.getTableHeader();
|
||||
header.addMouseMotionListener(tips);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int columnIndex) {
|
||||
String colName = "";
|
||||
|
||||
if (columnIndex <= getColumnCount()) {
|
||||
colName = columnNames[columnIndex];
|
||||
}
|
||||
|
@ -179,6 +268,9 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
switch (columnIndex) {
|
||||
case 0:
|
||||
return Icon.class;
|
||||
case 3:
|
||||
case 5:
|
||||
return Integer.class;
|
||||
default:
|
||||
return String.class;
|
||||
}
|
||||
|
@ -199,7 +291,6 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
java.awt.GridBagConstraints gridBagConstraints;
|
||||
|
||||
jSpinner1 = new javax.swing.JSpinner();
|
||||
jSplitPane1 = new javax.swing.JSplitPane();
|
||||
|
@ -221,14 +312,15 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
jTablePlayers.setToolTipText("Connected players");
|
||||
jTablePlayers.setAutoscrolls(false);
|
||||
jTablePlayers.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
|
||||
jTablePlayers.setFocusable(false);
|
||||
jTablePlayers.setGridColor(new java.awt.Color(255, 255, 255));
|
||||
jTablePlayers.setOpaque(false);
|
||||
jTablePlayers.setRequestFocusEnabled(false);
|
||||
jTablePlayers.setRowSelectionAllowed(false);
|
||||
jTablePlayers.setShowHorizontalLines(false);
|
||||
jTablePlayers.setShowVerticalLines(false);
|
||||
jTablePlayers.setUpdateSelectionOnSort(false);
|
||||
jTablePlayers.setVerifyInputWhenFocusTarget(false);
|
||||
jScrollPanePlayers.setViewportView(jTablePlayers);
|
||||
jTablePlayers.getAccessibleContext().setAccessibleDescription("");
|
||||
|
||||
jSplitPane1.setTopComponent(jScrollPanePlayers);
|
||||
|
||||
|
@ -284,4 +376,43 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
private javax.swing.JTabbedPane jTabbedPaneText;
|
||||
private javax.swing.JTable jTablePlayers;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
class ColumnHeaderToolTips extends MouseMotionAdapter {
|
||||
|
||||
int curCol;
|
||||
Map<Integer, String> tips = new HashMap<>();
|
||||
|
||||
public void setToolTip(Integer mCol, String tooltip) {
|
||||
if (tooltip == null) {
|
||||
tips.remove(mCol);
|
||||
} else {
|
||||
tips.put(mCol, tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent evt) {
|
||||
JTableHeader header = (JTableHeader) evt.getSource();
|
||||
JTable table = header.getTable();
|
||||
TableColumnModel colModel = table.getColumnModel();
|
||||
int vColIndex = colModel.getColumnIndexAtX(evt.getX());
|
||||
TableColumn col = null;
|
||||
if (vColIndex >= 0) {
|
||||
col = colModel.getColumn(table.convertColumnIndexToModel(vColIndex));
|
||||
}
|
||||
if (table.convertColumnIndexToModel(vColIndex) != curCol) {
|
||||
if (col != null) {
|
||||
MageFrame.getInstance().getBalloonTip().setAttachedComponent(header);
|
||||
JLabel content = new JLabel(tips.get(table.convertColumnIndexToModel(vColIndex)));
|
||||
content.setFont(GUISizeHelper.balloonTooltipFont);
|
||||
MageFrame.getInstance().getBalloonTip().setContents(content);
|
||||
ToolTipUtils.balloonToToolTip(MageFrame.getInstance().getBalloonTip(), 600, 10000);
|
||||
} else {
|
||||
MageFrame.getInstance().getBalloonTip().setTextContents("");
|
||||
}
|
||||
curCol = table.convertColumnIndexToModel(vColIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
*/
|
||||
package mage.client.table;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -39,7 +39,9 @@ import mage.client.plugins.impl.Plugins;
|
|||
*/
|
||||
public class TablesPane extends MagePane {
|
||||
|
||||
/** Creates new form TablesPane */
|
||||
/**
|
||||
* Creates new form TablesPane
|
||||
*/
|
||||
public TablesPane() {
|
||||
boolean initialized = false;
|
||||
if (Plugins.getInstance().isThemePluginLoaded()) {
|
||||
|
@ -56,11 +58,17 @@ public class TablesPane extends MagePane {
|
|||
initComponents();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void cleanUp() {
|
||||
tablesPanel.cleanUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeGUISize() {
|
||||
super.changeGUISize();
|
||||
tablesPanel.changeGUISize();
|
||||
}
|
||||
|
||||
public void showTables() {
|
||||
UUID roomId = MageFrame.getSession().getMainRoomId();
|
||||
if (roomId != null) {
|
||||
|
@ -79,10 +87,10 @@ public class TablesPane extends MagePane {
|
|||
tablesPanel.getChatPanel().clear();
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
@ -108,17 +116,16 @@ public class TablesPane extends MagePane {
|
|||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 471, Short.MAX_VALUE)
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 471, Short.MAX_VALUE)
|
||||
);
|
||||
pack();
|
||||
}
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private mage.client.table.TablesPanel tablesPanel;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
|
|
@ -674,4 +674,4 @@
|
|||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
</Form>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* TablesPanel.java
|
||||
*
|
||||
* Created on 15-Dec-2009, 10:54:01 PM
|
||||
|
@ -35,6 +35,7 @@ package mage.client.table;
|
|||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.HeadlessException;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
|
@ -79,11 +80,13 @@ import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_ORDER;
|
|||
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH;
|
||||
import mage.client.dialog.TableWaitingDialog;
|
||||
import mage.client.util.ButtonColumn;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.MageTableRowSorter;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.client.util.gui.TableUtil;
|
||||
import mage.constants.MatchTimeLimit;
|
||||
import mage.constants.MultiplayerAttackOption;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.constants.SkillLevel;
|
||||
import mage.game.match.MatchOptions;
|
||||
|
@ -92,6 +95,7 @@ import mage.remote.Session;
|
|||
import mage.view.MatchView;
|
||||
import mage.view.RoomUsersView;
|
||||
import mage.view.TableView;
|
||||
import mage.view.UserRequestMessage;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
@ -100,7 +104,8 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class TablesPanel extends javax.swing.JPanel {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(TablesPanel.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(TablesPanel.class);
|
||||
private static final int[] DEFAULT_COLUMNS_WIDTH = {35, 150, 120, 180, 80, 120, 80, 60, 40, 60};
|
||||
|
||||
private TableTableModel tableModel;
|
||||
private MatchesTableModel matchesModel;
|
||||
|
@ -117,9 +122,10 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
private int currentMessage;
|
||||
private MageTableRowSorter activeTablesSorter;
|
||||
|
||||
JToggleButton[] filterButtons;
|
||||
private final ButtonColumn actionButton1;
|
||||
private final ButtonColumn actionButton2;
|
||||
|
||||
private static final int[] defaultColumnsWidth = {35, 150, 120, 180, 80, 120, 80, 60, 60};
|
||||
JToggleButton[] filterButtons;
|
||||
|
||||
/**
|
||||
* Creates new form TablesPanel
|
||||
|
@ -138,10 +144,11 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
activeTablesSorter = new MageTableRowSorter(tableModel);
|
||||
tableTables.setRowSorter(activeTablesSorter);
|
||||
|
||||
TableUtil.setColumnWidthAndOrder(tableTables, defaultColumnsWidth,
|
||||
TableUtil.setColumnWidthAndOrder(tableTables, DEFAULT_COLUMNS_WIDTH,
|
||||
PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH, PreferencesDialog.KEY_TABLES_COLUMNS_ORDER);
|
||||
|
||||
tableCompleted.setRowSorter(new MageTableRowSorter(matchesModel));
|
||||
setGUISize();
|
||||
|
||||
chatPanelMain.getUserChatPanel().useExtendedView(ChatPanelBasic.VIEW_MODE.NONE);
|
||||
chatPanelMain.getUserChatPanel().setBorder(null);
|
||||
|
@ -187,18 +194,18 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
try {
|
||||
frame.setSelected(true);
|
||||
} catch (PropertyVetoException ve) {
|
||||
logger.error(ve);
|
||||
LOGGER.error(ve);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
logger.error(ex);
|
||||
LOGGER.error(ex);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (isTournament) {
|
||||
logger.info("Joining tournament " + tableId);
|
||||
LOGGER.info("Joining tournament " + tableId);
|
||||
if (deckType.startsWith("Limited")) {
|
||||
if (!status.endsWith("PW")) {
|
||||
session.joinTournamentTable(roomId, tableId, session.getUserName(), "Human", 1, null, "");
|
||||
|
@ -209,29 +216,30 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
joinTableDialog.showDialog(roomId, tableId, true, deckType.startsWith("Limited"));
|
||||
}
|
||||
} else {
|
||||
logger.info("Joining table " + tableId);
|
||||
LOGGER.info("Joining table " + tableId);
|
||||
joinTableDialog.showDialog(roomId, tableId, false, false);
|
||||
}
|
||||
break;
|
||||
case "Remove":
|
||||
if (JOptionPane.showConfirmDialog(null, "Are you sure you want to remove table?", "Removing table", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
session.removeTable(roomId, tableId);
|
||||
}
|
||||
UserRequestMessage message = new UserRequestMessage("Removing table", "Are you sure you want to remove table?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_REMOVE_TABLE);
|
||||
MageFrame.getInstance().showUserRequestDialog(message);
|
||||
break;
|
||||
case "Show":
|
||||
if (isTournament) {
|
||||
logger.info("Showing tournament table " + tableId);
|
||||
LOGGER.info("Showing tournament table " + tableId);
|
||||
session.watchTable(roomId, tableId);
|
||||
}
|
||||
break;
|
||||
case "Watch":
|
||||
if (!isTournament) {
|
||||
logger.info("Watching table " + tableId);
|
||||
LOGGER.info("Watching table " + tableId);
|
||||
session.watchTable(roomId, tableId);
|
||||
}
|
||||
break;
|
||||
case "Replay":
|
||||
logger.info("Replaying game " + gameId);
|
||||
LOGGER.info("Replaying game " + gameId);
|
||||
session.replayGame(gameId);
|
||||
break;
|
||||
}
|
||||
|
@ -258,7 +266,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
break;
|
||||
case "Show":;
|
||||
if (matchesModel.isTournament(modelRow)) {
|
||||
logger.info("Showing tournament table " + matchesModel.getTableId(modelRow));
|
||||
LOGGER.info("Showing tournament table " + matchesModel.getTableId(modelRow));
|
||||
session.watchTable(roomId, matchesModel.getTableId(modelRow));
|
||||
}
|
||||
break;
|
||||
|
@ -267,8 +275,8 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
};
|
||||
|
||||
// !!!! adds action buttons to the table panel (don't delete this)
|
||||
new ButtonColumn(tableTables, openTableAction, tableTables.convertColumnIndexToView(TableTableModel.ACTION_COLUMN));
|
||||
new ButtonColumn(tableCompleted, closedTableAction, tableCompleted.convertColumnIndexToView(MatchesTableModel.ACTION_COLUMN));
|
||||
actionButton1 = new ButtonColumn(tableTables, openTableAction, tableTables.convertColumnIndexToView(TableTableModel.ACTION_COLUMN));
|
||||
actionButton2 = new ButtonColumn(tableCompleted, closedTableAction, tableCompleted.convertColumnIndexToView(MatchesTableModel.ACTION_COLUMN));
|
||||
// !!!!
|
||||
}
|
||||
|
||||
|
@ -277,6 +285,30 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
chatPanelMain.cleanUp();
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
chatPanelMain.changeGUISize();
|
||||
actionButton1.changeGUISize();
|
||||
actionButton2.changeGUISize();
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
tableTables.getTableHeader().setFont(GUISizeHelper.tableFont);
|
||||
tableTables.getTableHeader().setPreferredSize(new Dimension(GUISizeHelper.tableHeaderHeight, GUISizeHelper.tableHeaderHeight));
|
||||
tableTables.setFont(GUISizeHelper.tableFont);
|
||||
tableTables.setRowHeight(GUISizeHelper.getTableRowHeight());
|
||||
|
||||
tableCompleted.getTableHeader().setFont(GUISizeHelper.tableFont);
|
||||
tableCompleted.getTableHeader().setPreferredSize(new Dimension(GUISizeHelper.tableHeaderHeight, GUISizeHelper.tableHeaderHeight));
|
||||
tableCompleted.setFont(GUISizeHelper.tableFont);
|
||||
tableCompleted.setRowHeight(GUISizeHelper.getTableRowHeight());
|
||||
|
||||
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
|
||||
jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize);
|
||||
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
|
||||
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
|
||||
}
|
||||
|
||||
private void saveDividerLocations() {
|
||||
// save panel sizes and divider locations.
|
||||
Rectangle rec = MageFrame.getDesktop().getBounds();
|
||||
|
@ -384,10 +416,8 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
updateMatchesTask = new UpdateMatchesTask(session, roomId, this);
|
||||
updateMatchesTask.execute();
|
||||
}
|
||||
} else {
|
||||
if (updateMatchesTask != null) {
|
||||
updateMatchesTask.cancel(true);
|
||||
}
|
||||
} else if (updateMatchesTask != null) {
|
||||
updateMatchesTask.cancel(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1138,6 +1168,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
options.setFreeMulligans(2);
|
||||
options.setSkillLevel(SkillLevel.CASUAL);
|
||||
options.setRollbackTurnsAllowed(true);
|
||||
options.setQuitRatio(100);
|
||||
table = session.createTable(roomId, options);
|
||||
|
||||
session.joinTable(roomId, table.getTableId(), "Human", "Human", 1, DeckImporterUtil.importDeck("test.dck"), "");
|
||||
|
@ -1178,7 +1209,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
}//GEN-LAST:event_btnStateFinishedActionPerformed
|
||||
|
||||
private void handleError(Exception ex) {
|
||||
logger.fatal("Error loading deck: ", ex);
|
||||
LOGGER.fatal("Error loading deck: ", ex);
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error loading deck.", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
|
@ -1239,9 +1270,10 @@ class TableTableModel extends AbstractTableModel {
|
|||
public static final int COLUMN_INFO = 4;
|
||||
public static final int COLUMN_STATUS = 5;
|
||||
public static final int COLUMN_SKILL = 7;
|
||||
public static final int ACTION_COLUMN = 8; // column the action is located (starting with 0)
|
||||
public static final int COLUMN_QUIT_RATIO = 8;
|
||||
public static final int ACTION_COLUMN = 9; // column the action is located (starting with 0)
|
||||
|
||||
private final String[] columnNames = new String[]{"M/T", "Deck Type", "Owner / Players", "Game Type", "Info", "Status", "Created / Started", "Skill Level", "Action"};
|
||||
private final String[] columnNames = new String[]{"M/T", "Deck Type", "Owner / Players", "Game Type", "Info", "Status", "Created / Started", "Skill Level", "Quit %", "Action"};
|
||||
|
||||
private TableView[] tables = new TableView[0];
|
||||
private static final DateFormat timeFormatter = new SimpleDateFormat("HH:mm:ss");
|
||||
|
@ -1288,6 +1320,8 @@ class TableTableModel extends AbstractTableModel {
|
|||
case 7:
|
||||
return tables[arg0].getSkillLevel();
|
||||
case 8:
|
||||
return tables[arg0].getQuitRatio();
|
||||
case 9:
|
||||
switch (tables[arg0].getTableState()) {
|
||||
|
||||
case WAITING:
|
||||
|
@ -1314,14 +1348,14 @@ class TableTableModel extends AbstractTableModel {
|
|||
default:
|
||||
return "";
|
||||
}
|
||||
case 9:
|
||||
return tables[arg0].isTournament();
|
||||
case 10:
|
||||
return tables[arg0].isTournament();
|
||||
case 11:
|
||||
if (!tables[arg0].getGames().isEmpty()) {
|
||||
return tables[arg0].getGames().get(0);
|
||||
}
|
||||
return null;
|
||||
case 11:
|
||||
case 12:
|
||||
return tables[arg0].getTableId();
|
||||
}
|
||||
return "";
|
||||
|
@ -1496,12 +1530,10 @@ class MatchesTableModel extends AbstractTableModel {
|
|||
case 6:
|
||||
if (matches[arg0].isTournament()) {
|
||||
return "Show";
|
||||
} else if (matches[arg0].isReplayAvailable()) {
|
||||
return "Replay";
|
||||
} else {
|
||||
if (matches[arg0].isReplayAvailable()) {
|
||||
return "Replay";
|
||||
} else {
|
||||
return "None";
|
||||
}
|
||||
return "None";
|
||||
}
|
||||
case 7:
|
||||
return matches[arg0].getGames();
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* TournamentPane.java
|
||||
*
|
||||
* Created on 22-Jan-2011, 11:41:47 PM
|
||||
*/
|
||||
|
||||
package mage.client.tournament;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -43,7 +42,9 @@ import mage.client.MagePane;
|
|||
*/
|
||||
public class TournamentPane extends MagePane {
|
||||
|
||||
/** Creates new form TournamentPane */
|
||||
/**
|
||||
* Creates new form TournamentPane
|
||||
*/
|
||||
public TournamentPane() {
|
||||
initComponents();
|
||||
}
|
||||
|
@ -59,6 +60,11 @@ public class TournamentPane extends MagePane {
|
|||
removeFrame();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeGUISize() {
|
||||
tournamentPanel.changeGUISize();
|
||||
}
|
||||
|
||||
public UUID getTournamentId() {
|
||||
if (this.tournamentPanel == null) {
|
||||
return null;
|
||||
|
@ -66,10 +72,10 @@ public class TournamentPane extends MagePane {
|
|||
return tournamentPanel.getTournamentId();
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
@ -91,7 +97,6 @@ public class TournamentPane extends MagePane {
|
|||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private mage.client.tournament.TournamentPanel tournamentPanel;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* TournamentPanel.java
|
||||
*
|
||||
* Created on 20-Jan-2011, 9:18:30 PM
|
||||
|
@ -34,6 +34,7 @@
|
|||
package mage.client.tournament;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.text.DateFormat;
|
||||
|
@ -45,7 +46,6 @@ import java.util.concurrent.ExecutionException;
|
|||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import mage.client.MageFrame;
|
||||
|
@ -57,13 +57,16 @@ import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_PLAYER_COLUMNS
|
|||
import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_PLAYER_COLUMNS_WIDTH;
|
||||
import mage.client.util.ButtonColumn;
|
||||
import mage.client.util.Format;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.gui.TableUtil;
|
||||
import mage.client.util.gui.countryBox.CountryCellRenderer;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.remote.Session;
|
||||
import mage.view.RoundView;
|
||||
import mage.view.TournamentGameView;
|
||||
import mage.view.TournamentPlayerView;
|
||||
import mage.view.TournamentView;
|
||||
import mage.view.UserRequestMessage;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
@ -72,7 +75,10 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class TournamentPanel extends javax.swing.JPanel {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(TournamentPanel.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(TournamentPanel.class);
|
||||
|
||||
private static final int[] DEFAULT_COLUMNS_WIDTH_PLAYERS = {30, 150, 150, 60, 400, 100};
|
||||
private static final int[] DEFAULT_COLUMNS_WIDTH_MATCHES = {60, 140, 140, 400, 80};
|
||||
|
||||
private UUID tournamentId;
|
||||
private boolean firstInitDone = false;
|
||||
|
@ -82,8 +88,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
private UpdateTournamentTask updateTask;
|
||||
private final DateFormat df;
|
||||
|
||||
private static final int[] defaultColumnsWidthPlayers = {30, 150, 150, 60, 400};
|
||||
private static final int[] defaultColumnsWidthMatches = {60, 140, 140, 400, 80};
|
||||
private final ButtonColumn actionButtonColumn1;
|
||||
|
||||
/**
|
||||
* Creates new form TournamentPanel
|
||||
|
@ -99,11 +104,11 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
df = DateFormat.getDateTimeInstance();
|
||||
|
||||
tablePlayers.createDefaultColumnsFromModel();
|
||||
TableUtil.setColumnWidthAndOrder(tablePlayers, defaultColumnsWidthPlayers, KEY_TOURNAMENT_PLAYER_COLUMNS_WIDTH, KEY_TOURNAMENT_PLAYER_COLUMNS_ORDER);
|
||||
TableUtil.setColumnWidthAndOrder(tablePlayers, DEFAULT_COLUMNS_WIDTH_PLAYERS, KEY_TOURNAMENT_PLAYER_COLUMNS_WIDTH, KEY_TOURNAMENT_PLAYER_COLUMNS_ORDER);
|
||||
tablePlayers.setDefaultRenderer(Icon.class, new CountryCellRenderer());
|
||||
|
||||
tableMatches.createDefaultColumnsFromModel();
|
||||
TableUtil.setColumnWidthAndOrder(tableMatches, defaultColumnsWidthMatches, KEY_TOURNAMENT_MATCH_COLUMNS_WIDTH, KEY_TOURNAMENT_MATCH_COLUMNS_ORDER);
|
||||
TableUtil.setColumnWidthAndOrder(tableMatches, DEFAULT_COLUMNS_WIDTH_MATCHES, KEY_TOURNAMENT_MATCH_COLUMNS_WIDTH, KEY_TOURNAMENT_MATCH_COLUMNS_ORDER);
|
||||
|
||||
chatPanel1.useExtendedView(ChatPanelBasic.VIEW_MODE.NONE);
|
||||
chatPanel1.setChatType(ChatPanelBasic.ChatType.TOURNAMENT);
|
||||
|
@ -123,14 +128,15 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
// session.replayGame(gameId);
|
||||
// }
|
||||
if (state.startsWith("Dueling") && actionText.equals("Watch")) {
|
||||
logger.info("Watching game " + gameId);
|
||||
LOGGER.info("Watching game " + gameId);
|
||||
session.watchTournamentTable(tableId);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// action button, don't delete this
|
||||
ButtonColumn buttonColumn = new ButtonColumn(tableMatches, action, tableMatches.convertColumnIndexToView(TournamentMatchesTableModel.ACTION_COLUMN));
|
||||
actionButtonColumn1 = new ButtonColumn(tableMatches, action, tableMatches.convertColumnIndexToView(TournamentMatchesTableModel.ACTION_COLUMN));
|
||||
setGUISize();
|
||||
|
||||
}
|
||||
|
||||
|
@ -142,6 +148,31 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
tablePlayers.getTableHeader().setFont(GUISizeHelper.tableFont);
|
||||
tablePlayers.getTableHeader().setPreferredSize(new Dimension(GUISizeHelper.tableHeaderHeight, GUISizeHelper.tableHeaderHeight));
|
||||
tablePlayers.setFont(GUISizeHelper.tableFont);
|
||||
tablePlayers.setRowHeight(GUISizeHelper.getTableRowHeight());
|
||||
|
||||
tableMatches.getTableHeader().setFont(GUISizeHelper.tableFont);
|
||||
tableMatches.getTableHeader().setPreferredSize(new Dimension(GUISizeHelper.tableHeaderHeight, GUISizeHelper.tableHeaderHeight));
|
||||
tableMatches.setFont(GUISizeHelper.tableFont);
|
||||
tableMatches.setRowHeight(GUISizeHelper.getTableRowHeight());
|
||||
|
||||
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
|
||||
jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize);
|
||||
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
|
||||
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
|
||||
jScrollPane2.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
|
||||
jScrollPane2.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
|
||||
|
||||
actionButtonColumn1.changeGUISize();
|
||||
}
|
||||
|
||||
private void saveDividerLocations() {
|
||||
// save panel sizes and divider locations.
|
||||
Rectangle rec = MageFrame.getDesktop().getBounds();
|
||||
|
@ -508,10 +539,10 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
}//GEN-LAST:event_btnCloseWindowActionPerformed
|
||||
|
||||
private void btnQuitTournamentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitTournamentActionPerformed
|
||||
if (JOptionPane.showConfirmDialog(this, "Are you sure you want to quit the tournament?", "Confirm quit tournament", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
MageFrame.getSession().quitTournament(tournamentId);
|
||||
}
|
||||
|
||||
UserRequestMessage message = new UserRequestMessage("Confirm quit tournament", "Are you sure you want to quit the tournament?");
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_QUIT_TOURNAMENT);
|
||||
MageFrame.getInstance().showUserRequestDialog(message);
|
||||
}//GEN-LAST:event_btnQuitTournamentActionPerformed
|
||||
|
||||
private void txtNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNameActionPerformed
|
||||
|
@ -545,7 +576,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
|
||||
class TournamentPlayersTableModel extends AbstractTableModel {
|
||||
|
||||
private final String[] columnNames = new String[]{"Loc", "Player Name", "State", "Points", "Results"};
|
||||
private final String[] columnNames = new String[]{"Loc", "Player Name", "State", "Points", "Results", "History"};
|
||||
private TournamentPlayerView[] players = new TournamentPlayerView[0];
|
||||
|
||||
public void loadData(TournamentView tournament) {
|
||||
|
@ -576,6 +607,8 @@ class TournamentPlayersTableModel extends AbstractTableModel {
|
|||
return Integer.toString(players[arg0].getPoints());
|
||||
case 4:
|
||||
return players[arg0].getResults();
|
||||
case 5:
|
||||
return players[arg0].getHistory();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* CombatGroup.java
|
||||
*
|
||||
* Created on Feb 10, 2010, 3:36:55 PM
|
||||
|
@ -37,6 +37,7 @@ package mage.client.unusedFiles;
|
|||
import java.util.UUID;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.view.CombatGroupView;
|
||||
|
||||
/**
|
||||
|
@ -63,10 +64,12 @@ public class CombatGroup extends javax.swing.JPanel {
|
|||
|
||||
public void update(CombatGroupView combatGroup) {
|
||||
this.lblDefender.setText(combatGroup.getDefenderName());
|
||||
attackers.setCardDimension(GUISizeHelper.otherZonesCardDimension);
|
||||
this.attackers.loadCards(combatGroup.getAttackers(), bigCard, gameId, true);
|
||||
// attackers.setPreferredSize(new Dimension(Config.dimensions.frameWidth + 6, Config.dimensions.frameHeight + 6));
|
||||
|
||||
blockers.setCardDimension(GUISizeHelper.otherZonesCardDimension);
|
||||
this.blockers.loadCards(combatGroup.getBlockers(), bigCard, gameId, true);
|
||||
// blockers.setPreferredSize(new Dimension(Config.dimensions.frameWidth + 6, Config.dimensions.frameHeight + 6));
|
||||
|
||||
this.attackers.setVisible(true);
|
||||
this.blockers.setVisible(true);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* PlayerPanel.java
|
||||
*
|
||||
* Created on Nov 18, 2009, 3:01:31 PM
|
||||
|
@ -39,7 +39,6 @@ import java.util.UUID;
|
|||
import mage.client.MageFrame;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.dialog.ShowCardsDialog;
|
||||
import mage.client.util.Config;
|
||||
import mage.remote.Session;
|
||||
import mage.view.PlayerView;
|
||||
|
||||
|
@ -200,7 +199,7 @@ public class PlayerPanel extends javax.swing.JPanel {
|
|||
if (graveyard == null) {
|
||||
graveyard = new ShowCardsDialog();
|
||||
}
|
||||
graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, Config.dimensions, gameId, false, null, null, null);
|
||||
graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, gameId, false, null, null, null);
|
||||
}//GEN-LAST:event_btnGraveActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
|
|
@ -63,6 +63,7 @@ public class ButtonColumn extends AbstractCellEditor implements TableCellRendere
|
|||
editButton = new JButton();
|
||||
editButton.setFocusPainted(false);
|
||||
editButton.addActionListener(this);
|
||||
setGUISize();
|
||||
|
||||
TableColumnModel columnModel = table.getColumnModel();
|
||||
columnModel.getColumn(column).setCellRenderer(this);
|
||||
|
@ -70,6 +71,15 @@ public class ButtonColumn extends AbstractCellEditor implements TableCellRendere
|
|||
table.addMouseListener(this);
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
renderButton.setFont(GUISizeHelper.tableFont);
|
||||
editButton.setFont(GUISizeHelper.tableFont);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCellEditorValue() {
|
||||
return text;
|
||||
|
|
163
Mage.Client/src/main/java/mage/client/util/GUISizeHelper.java
Normal file
163
Mage.Client/src/main/java/mage/client/util/GUISizeHelper.java
Normal file
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.client.util;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class GUISizeHelper {
|
||||
|
||||
// relate the native image card size to a value of the size scale
|
||||
final static int CARD_IMAGE_WIDTH = 312;
|
||||
final static int CARD_IMAGE_HEIGHT = 445;
|
||||
final static int CARD_IMAG_VALUE = 42;
|
||||
|
||||
public static String basicSymbolSize = "small";
|
||||
|
||||
public static int symbolCardSize = 15;
|
||||
public static int symbolTableSize = 15;
|
||||
public static int symbolChatSize = 15;
|
||||
public static int symbolDialogSize = 15;
|
||||
public static int symbolTooltipSize = 15;
|
||||
public static int symbolPaySize = 15;
|
||||
public static int symbolEditorSize = 15;
|
||||
|
||||
public static int tableHeaderHeight = 24;
|
||||
public static int tableRowHeight = 20;
|
||||
|
||||
public static int dividerBarSize;
|
||||
public static int scrollBarSize;
|
||||
|
||||
public static int flagHeight;
|
||||
|
||||
public static int cardTooltipFontSize = 15;
|
||||
|
||||
public static Font chatFont = new java.awt.Font("Arial", 0, 12);
|
||||
public static Font tableFont = new java.awt.Font("Arial", 0, 12);
|
||||
public static Font balloonTooltipFont = new java.awt.Font("Arial", 0, 12);
|
||||
public static Font menuFont = new java.awt.Font("Arial", 0, 12);
|
||||
|
||||
public static Font gameRequestsFont = new java.awt.Font("Arial", 0, 12);
|
||||
|
||||
public static int gameDialogAreaFontSizeBig = 16;
|
||||
public static int gameDialogAreaFontSizeTooltip = 14;
|
||||
public static int gameDialogAreaFontSizeSmall = 11;
|
||||
public static int gameDialogAreaButtonHigh = 16;
|
||||
public static Font gameDialogAreaFont = new java.awt.Font("Arial", 0, 12);
|
||||
public static int gameDialogButtonHeight;
|
||||
public static int gameDialogButtonWidth;
|
||||
|
||||
public static Dimension handCardDimension;
|
||||
public static int stackWidth;
|
||||
|
||||
public static Dimension otherZonesCardDimension;
|
||||
public static int otherZonesCardVerticalOffset;
|
||||
|
||||
public static Dimension battlefieldCardDimension;
|
||||
|
||||
public static Dimension editorCardDimension;
|
||||
public static int editorCardOffsetSize;
|
||||
|
||||
public static int getTableRowHeight() {
|
||||
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_TABLE_FONT_SIZE, 14);
|
||||
return fontSize + 6;
|
||||
}
|
||||
|
||||
public static Font getTabFont() {
|
||||
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_TABLE_FONT_SIZE, 14);
|
||||
return new java.awt.Font("Arial", 0, fontSize);
|
||||
}
|
||||
|
||||
public static void changeGUISize() {
|
||||
calculateGUISizes();
|
||||
MageFrame.getInstance().changeGUISize();
|
||||
}
|
||||
|
||||
public static void calculateGUISizes() {
|
||||
int tableFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_TABLE_FONT_SIZE, 14);
|
||||
tableFont = new java.awt.Font("Arial", 0, tableFontSize);
|
||||
tableRowHeight = tableFontSize + 4;
|
||||
tableHeaderHeight = tableFontSize + 10;
|
||||
symbolTableSize = tableFontSize;
|
||||
flagHeight = tableFontSize - 2;
|
||||
balloonTooltipFont = new Font("Arial", 0, tableFontSize);
|
||||
if (tableFontSize > 15) {
|
||||
symbolEditorSize = tableFontSize - 5;
|
||||
dividerBarSize = 10 + (tableFontSize / 4);
|
||||
scrollBarSize = 14 + (tableFontSize / 4);
|
||||
} else {
|
||||
symbolEditorSize = tableFontSize;
|
||||
dividerBarSize = 10;
|
||||
scrollBarSize = 14;
|
||||
}
|
||||
|
||||
// used for popup menus
|
||||
int dialogFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_DIALOG_FONT_SIZE, 14);
|
||||
menuFont = new Font("Arial", 0, dialogFontSize);
|
||||
gameRequestsFont = new Font("Arial", 0, dialogFontSize);
|
||||
|
||||
// used in the feedback area of the game panel
|
||||
int feedbackFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FEEDBACK_AREA_SIZE, 14);
|
||||
gameDialogAreaFontSizeBig = feedbackFontSize;
|
||||
gameDialogAreaFontSizeTooltip = feedbackFontSize - 2;
|
||||
gameDialogAreaFontSizeSmall = (feedbackFontSize / 2) + 2;
|
||||
gameDialogAreaButtonHigh = feedbackFontSize;
|
||||
gameDialogAreaFont = new Font("Arial", 0, feedbackFontSize);
|
||||
gameDialogButtonHeight = feedbackFontSize + 6;
|
||||
gameDialogButtonWidth = feedbackFontSize * 2 + 40;
|
||||
symbolDialogSize = feedbackFontSize;
|
||||
|
||||
int chatFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CHAT_FONT_SIZE, 14);
|
||||
chatFont = new java.awt.Font("Arial", 0, chatFontSize);
|
||||
symbolChatSize = chatFontSize;
|
||||
|
||||
cardTooltipFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_TOOLTIP_SIZE, 14);
|
||||
symbolTooltipSize = cardTooltipFontSize;
|
||||
|
||||
int handCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_HAND_SIZE, 14);
|
||||
handCardDimension = new Dimension(CARD_IMAGE_WIDTH * handCardSize / 42, CARD_IMAGE_HEIGHT * handCardSize / 42);
|
||||
stackWidth = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_STACK_WIDTH, 30);
|
||||
|
||||
int otherZonesCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_OTHER_ZONES_SIZE, 14);
|
||||
otherZonesCardDimension = new Dimension(CARD_IMAGE_WIDTH * otherZonesCardSize / 42, CARD_IMAGE_HEIGHT * otherZonesCardSize / 42);
|
||||
if (otherZonesCardSize > 29) {
|
||||
otherZonesCardVerticalOffset = otherZonesCardDimension.height / 8;
|
||||
} else {
|
||||
otherZonesCardVerticalOffset = otherZonesCardDimension.height / 10;
|
||||
}
|
||||
|
||||
int battlefieldCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_BATTLEFIELD_SIZE, 14);
|
||||
battlefieldCardDimension = new Dimension(CARD_IMAGE_WIDTH * battlefieldCardSize / 42, CARD_IMAGE_HEIGHT * battlefieldCardSize / 42);
|
||||
|
||||
int editorCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_EDITOR_SIZE, 14);
|
||||
editorCardDimension = new Dimension(CARD_IMAGE_WIDTH * editorCardSize / 42, CARD_IMAGE_HEIGHT * editorCardSize / 42);
|
||||
editorCardOffsetSize = 2 * PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_OFFSET_SIZE, 14) - 10;
|
||||
}
|
||||
|
||||
public static void changePopupMenuFont(JPopupMenu popupMenu) {
|
||||
for (Component comp : popupMenu.getComponents()) {
|
||||
if (comp instanceof JMenuItem) {
|
||||
comp.setFont(GUISizeHelper.menuFont);
|
||||
if (comp instanceof JMenu) {
|
||||
comp.setFont(GUISizeHelper.menuFont);
|
||||
for (Component subComp : ((JMenu) comp).getMenuComponents()) {
|
||||
subComp.setFont(GUISizeHelper.menuFont);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,8 +24,7 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
*/
|
||||
package mage.client.util;
|
||||
|
||||
import com.mortennobel.imagescaling.ResampleOp;
|
||||
|
@ -37,6 +36,7 @@ import java.awt.Image;
|
|||
import java.awt.Rectangle;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Transparency;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ImageObserver;
|
||||
import java.awt.image.MemoryImageSource;
|
||||
|
@ -58,6 +58,7 @@ import org.mage.card.arcane.UI;
|
|||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class ImageHelper {
|
||||
|
||||
protected static HashMap<String, BufferedImage> images = new HashMap<>();
|
||||
protected static HashMap<String, BufferedImage> backgrounds = new HashMap<>();
|
||||
|
||||
|
@ -73,7 +74,8 @@ public class ImageHelper {
|
|||
*
|
||||
* @param ref - image name
|
||||
* @param height - height after scaling
|
||||
* @return a scaled image that preserves the original aspect ratio, with a specified height
|
||||
* @return a scaled image that preserves the original aspect ratio, with a
|
||||
* specified height
|
||||
*/
|
||||
public static BufferedImage loadImage(String ref, int height) {
|
||||
BufferedImage image = loadImage(ref);
|
||||
|
@ -104,7 +106,6 @@ public class ImageHelper {
|
|||
return background;
|
||||
}
|
||||
|
||||
|
||||
public static BufferedImage scaleImage(BufferedImage image, int width, int height) {
|
||||
BufferedImage scaledImage = image;
|
||||
int w = image.getWidth();
|
||||
|
@ -127,7 +128,7 @@ public class ImageHelper {
|
|||
}
|
||||
|
||||
public static BufferedImage scaleImage(BufferedImage image, int height) {
|
||||
double ratio = height / (double)image.getHeight();
|
||||
double ratio = height / (double) image.getHeight();
|
||||
int width = (int) (image.getWidth() * ratio);
|
||||
return scaleImage(image, width, height);
|
||||
}
|
||||
|
@ -138,13 +139,12 @@ public class ImageHelper {
|
|||
PixelGrabber grabber = new PixelGrabber(image, 0, 0, dimensions.frameWidth, dimensions.frameHeight, buffer, 0, dimensions.frameWidth);
|
||||
try {
|
||||
grabber.grabPixels();
|
||||
}
|
||||
catch(InterruptedException e) {
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
for(int y = 0; y < dimensions.frameHeight; y++) {
|
||||
for(int x = 0; x < dimensions.frameWidth; x++) {
|
||||
rotate[((dimensions.frameWidth - x - 1) *dimensions.frameHeight)+y] = buffer[(y*dimensions.frameWidth)+x];
|
||||
for (int y = 0; y < dimensions.frameHeight; y++) {
|
||||
for (int x = 0; x < dimensions.frameWidth; x++) {
|
||||
rotate[((dimensions.frameWidth - x - 1) * dimensions.frameHeight) + y] = buffer[(y * dimensions.frameWidth) + x];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class ImageHelper {
|
|||
public static BufferedImage rotate(BufferedImage image, double angle) {
|
||||
double sin = Math.abs(Math.sin(angle)), cos = Math.abs(Math.cos(angle));
|
||||
int w = image.getWidth(), h = image.getHeight();
|
||||
int neww = (int)Math.floor(w*cos+h*sin), newh = (int)Math.floor(h*cos+w*sin);
|
||||
int neww = (int) Math.floor(w * cos + h * sin), newh = (int) Math.floor(h * cos + w * sin);
|
||||
|
||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
GraphicsDevice gs = ge.getDefaultScreenDevice();
|
||||
|
@ -163,8 +163,8 @@ public class ImageHelper {
|
|||
|
||||
BufferedImage result = gc.createCompatibleImage(neww, newh, Transparency.TRANSLUCENT);
|
||||
Graphics2D g = result.createGraphics();
|
||||
g.translate((neww-w)/2, (newh-h)/2);
|
||||
g.rotate(angle, w/2, h/2);
|
||||
g.translate((neww - w) / 2, (newh - h) / 2);
|
||||
g.rotate(angle, w / 2, h / 2);
|
||||
g.drawRenderedImage(image, null);
|
||||
g.dispose();
|
||||
return result;
|
||||
|
@ -184,6 +184,7 @@ public class ImageHelper {
|
|||
/**
|
||||
* Returns an image scaled to the size appropriate for the card picture
|
||||
* panel
|
||||
*
|
||||
* @param original
|
||||
* @param width
|
||||
* @param height
|
||||
|
@ -196,8 +197,8 @@ public class ImageHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an image scaled to fit width
|
||||
* panel
|
||||
* Returns an image scaled to fit width panel
|
||||
*
|
||||
* @param original
|
||||
* @param width
|
||||
* @return
|
||||
|
@ -212,8 +213,32 @@ public class ImageHelper {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* scale image
|
||||
*
|
||||
* @param sbi image to scale
|
||||
* @param imageType type of image
|
||||
* @param dWidth width of destination image
|
||||
* @param dHeight height of destination image
|
||||
* @return scaled image
|
||||
*/
|
||||
public static BufferedImage scale(BufferedImage sbi, int imageType, int dWidth, int dHeight) {
|
||||
BufferedImage dbi = null;
|
||||
if (sbi != null) {
|
||||
double fWidth = dWidth / sbi.getWidth();
|
||||
double fHeight = dHeight / sbi.getHeight();
|
||||
dbi = new BufferedImage(dWidth, dHeight, imageType);
|
||||
Graphics2D g = dbi.createGraphics();
|
||||
AffineTransform at = AffineTransform.getScaleInstance(fWidth, fHeight);
|
||||
g.drawRenderedImage(sbi, at);
|
||||
g.dispose();
|
||||
}
|
||||
return dbi;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an image scaled to the needed size
|
||||
*
|
||||
* @param original
|
||||
* @param sizeNeed
|
||||
* @return
|
||||
|
@ -226,6 +251,7 @@ public class ImageHelper {
|
|||
|
||||
/**
|
||||
* Get image using relative path in resources.
|
||||
*
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.awt.FlowLayout;
|
|||
import java.awt.Image;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JComboBox;
|
||||
|
@ -14,9 +13,8 @@ import javax.swing.JLabel;
|
|||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.ListCellRenderer;
|
||||
|
||||
import mage.client.constants.Constants;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import org.mage.card.arcane.ManaSymbols;
|
||||
|
||||
public class ColorsChooser extends JComboBox implements ListCellRenderer {
|
||||
|
||||
|
@ -82,7 +80,7 @@ public class ColorsChooser extends JComboBox implements ListCellRenderer {
|
|||
value = value.toUpperCase();
|
||||
for (int i = 0; i < value.length(); i++) {
|
||||
char symbol = value.charAt(i);
|
||||
Image image = Plugins.getInstance().getManaSymbolImage(String.valueOf(symbol));
|
||||
Image image = ManaSymbols.getSizedManaSymbol(String.valueOf(symbol));
|
||||
if (image != null) {
|
||||
images.add(image);
|
||||
}
|
||||
|
@ -101,7 +99,7 @@ public class ColorsChooser extends JComboBox implements ListCellRenderer {
|
|||
}
|
||||
} else {
|
||||
String s = value.replace("B", "{B}").replace("R", "{R}").replace("G", "{G}").replace("W", "{W}").replace("U", "{U}").replace("X", "{X}");
|
||||
panel.add(new JLabel(s));
|
||||
panel.add(new JLabel(s));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import javax.swing.JButton;
|
|||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.MageObjectType;
|
||||
import mage.constants.Rarity;
|
||||
|
@ -157,10 +158,8 @@ public class GuiDisplayUtil {
|
|||
if (((PermanentView) card).getCounters() != null) {
|
||||
counters = new ArrayList<>(((PermanentView) card).getCounters());
|
||||
}
|
||||
} else {
|
||||
if (card.getCounters() != null) {
|
||||
counters = new ArrayList<>(card.getCounters());
|
||||
}
|
||||
} else if (card.getCounters() != null) {
|
||||
counters = new ArrayList<>(card.getCounters());
|
||||
}
|
||||
if (!counters.isEmpty()) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -196,7 +195,7 @@ public class GuiDisplayUtil {
|
|||
manaCost += m;
|
||||
}
|
||||
String castingCost = UI.getDisplayManaCost(manaCost);
|
||||
castingCost = ManaSymbols.replaceSymbolsWithHTML(castingCost, ManaSymbols.Type.CARD);
|
||||
castingCost = ManaSymbols.replaceSymbolsWithHTML(castingCost, ManaSymbols.Type.TOOLTIP);
|
||||
|
||||
int symbolCount = 0;
|
||||
int offset = 0;
|
||||
|
@ -204,15 +203,14 @@ public class GuiDisplayUtil {
|
|||
symbolCount++;
|
||||
}
|
||||
|
||||
int fontSize = 11;
|
||||
|
||||
String fontFamily = "tahoma";
|
||||
int fontSize = GUISizeHelper.cardTooltipFontSize;
|
||||
|
||||
/*if (prefs.fontFamily == CardFontFamily.arial)
|
||||
fontFamily = "arial";
|
||||
else if (prefs.fontFamily == CardFontFamily.verdana) {
|
||||
fontFamily = "verdana";
|
||||
}*/
|
||||
|
||||
final StringBuilder buffer = new StringBuilder(512);
|
||||
buffer.append("<html><body style='font-family:");
|
||||
buffer.append(fontFamily);
|
||||
|
@ -226,27 +224,28 @@ public class GuiDisplayUtil {
|
|||
buffer.append(" [").append(card.getId().toString().substring(0, 3)).append("]");
|
||||
}
|
||||
buffer.append("</b></td><td align='right' valign='top' style='width:");
|
||||
buffer.append(symbolCount * 11 + 1);
|
||||
buffer.append(symbolCount * GUISizeHelper.cardTooltipFontSize);
|
||||
buffer.append("px'>");
|
||||
if (!card.isSplitCard()) {
|
||||
buffer.append(castingCost);
|
||||
}
|
||||
buffer.append("</td></tr></table>");
|
||||
buffer.append("<table cellspacing=0 cellpadding=0 border=0 width='100%'><tr><td style='margin-left: 1px'>");
|
||||
String imageSize = " width=" + GUISizeHelper.cardTooltipFontSize + " height=" + GUISizeHelper.cardTooltipFontSize + ">";
|
||||
if (card.getColor().isWhite()) {
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_white.png")).append("' alt='W'>");
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_white.png")).append("' alt='W' ").append(imageSize);
|
||||
}
|
||||
if (card.getColor().isBlue()) {
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_blue.png")).append("' alt='U'>");
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_blue.png")).append("' alt='U' ").append(imageSize);
|
||||
}
|
||||
if (card.getColor().isBlack()) {
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_black.png")).append("' alt='B'>");
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_black.png")).append("' alt='B' ").append(imageSize);
|
||||
}
|
||||
if (card.getColor().isRed()) {
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_red.png")).append("' alt='R'>");
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_red.png")).append("' alt='R' ").append(imageSize);
|
||||
}
|
||||
if (card.getColor().isGreen()) {
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_green.png")).append("' alt='G'>");
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_green.png")).append("' alt='G' ").append(imageSize);
|
||||
}
|
||||
if (!card.getColor().isColorless()) {
|
||||
buffer.append(" ");
|
||||
|
@ -275,7 +274,7 @@ public class GuiDisplayUtil {
|
|||
rarity = card.getRarity().getCode();
|
||||
}
|
||||
if (card.getExpansionSetCode() != null) {
|
||||
buffer.append(ManaSymbols.replaceSetCodeWithHTML(card.getExpansionSetCode().toUpperCase(), rarity));
|
||||
buffer.append(ManaSymbols.replaceSetCodeWithHTML(card.getExpansionSetCode().toUpperCase(), rarity, GUISizeHelper.symbolTooltipSize));
|
||||
}
|
||||
buffer.append("</td></tr></table>");
|
||||
|
||||
|
@ -307,7 +306,7 @@ public class GuiDisplayUtil {
|
|||
rule.append("<tr><td valign='top'><b>");
|
||||
rule.append(card.getLeftSplitName());
|
||||
rule.append("</b></td><td align='right' valign='top' style='width:");
|
||||
rule.append(card.getLeftSplitCosts().getSymbols().size() * 11 + 1);
|
||||
rule.append(card.getLeftSplitCosts().getSymbols().size() * GUISizeHelper.symbolTooltipSize + 1);
|
||||
rule.append("px'>");
|
||||
rule.append(card.getLeftSplitCosts().getText());
|
||||
rule.append("</td></tr></table>");
|
||||
|
@ -320,7 +319,7 @@ public class GuiDisplayUtil {
|
|||
rule.append("<tr><td valign='top'><b>");
|
||||
rule.append(card.getRightSplitName());
|
||||
rule.append("</b></td><td align='right' valign='top' style='width:");
|
||||
rule.append(card.getRightSplitCosts().getSymbols().size() * 11 + 1);
|
||||
rule.append(card.getRightSplitCosts().getSymbols().size() * GUISizeHelper.symbolTooltipSize + 1);
|
||||
rule.append("px'>");
|
||||
rule.append(card.getRightSplitCosts().getText());
|
||||
rule.append("</td></tr></table>");
|
||||
|
@ -340,13 +339,9 @@ public class GuiDisplayUtil {
|
|||
|
||||
String legal = rule.toString();
|
||||
if (legal.length() > 0) {
|
||||
// this 2 replaces were only done with the empty string, is it any longer needed? (LevelX2)
|
||||
// legal = legal.replaceAll("#([^#]+)#", "<i>$1</i>");
|
||||
// legal = legal.replaceAll("\\s*//\\s*", "<hr width='50%'>");
|
||||
// legal = legal.replace("\r\n", "<div style='font-size:5pt'></div>");
|
||||
legal = legal.replaceAll("\\{this\\}", card.getName().isEmpty() ? "this" : card.getName());
|
||||
legal = legal.replaceAll("\\{source\\}", card.getName().isEmpty() ? "this" : card.getName());
|
||||
buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.CARD));
|
||||
buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.TOOLTIP));
|
||||
}
|
||||
|
||||
buffer.append("<br></body></html>");
|
||||
|
|
|
@ -5,10 +5,13 @@
|
|||
*/
|
||||
package mage.client.util.gui.countryBox;
|
||||
|
||||
import java.net.URL;
|
||||
import java.awt.Image;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.swing.ImageIcon;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.ImageHelper;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
@ -17,33 +20,44 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class CountryUtil {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(CountryUtil.class);
|
||||
private static final Map<String, ImageIcon> flagIconCache = new HashMap<>();
|
||||
private static final Map<String, String> countryMap = new HashMap<>();
|
||||
private static final Logger LOGGER = Logger.getLogger(CountryUtil.class);
|
||||
private static final Map<String, ImageIcon> FLAG_ICON_CACHE = new HashMap<>();
|
||||
private static final Map<String, String> COUNTRY_MAP = new HashMap<>();
|
||||
|
||||
public static ImageIcon getCountryFlagIcon(String countryCode) {
|
||||
ImageIcon flagIcon = flagIconCache.get(countryCode);
|
||||
ImageIcon flagIcon = FLAG_ICON_CACHE.get(countryCode);
|
||||
if (flagIcon == null) {
|
||||
URL url = CountryUtil.class.getResource("/flags/" + countryCode + (countryCode.endsWith(".png") ? "" : ".png"));
|
||||
if (url != null) {
|
||||
flagIcon = new javax.swing.ImageIcon(url);
|
||||
// URL url = CountryUtil.class.getResource("/flags/" + countryCode + (countryCode.endsWith(".png") ? "" : ".png"));
|
||||
Image flagImage = ImageHelper.getImageFromResources("/flags/" + countryCode + (countryCode.endsWith(".png") ? "" : ".png"));
|
||||
if (flagImage != null) {
|
||||
if (GUISizeHelper.flagHeight > 11) {
|
||||
int width = Math.round(GUISizeHelper.flagHeight * flagImage.getWidth(null) / flagImage.getHeight(null));
|
||||
BufferedImage resized = ImageHelper.scale((BufferedImage) flagImage, BufferedImage.TYPE_4BYTE_ABGR, width, GUISizeHelper.flagHeight);
|
||||
flagIcon = new ImageIcon(resized);
|
||||
} else {
|
||||
flagIcon = new ImageIcon(flagImage);
|
||||
}
|
||||
}
|
||||
if (flagIcon == null || flagIcon.getImage() == null) {
|
||||
logger.warn("Country flag resource not found: " + countryCode);
|
||||
flagIconCache.put(countryCode, flagIcon);
|
||||
LOGGER.warn("Country flag resource not found: " + countryCode);
|
||||
FLAG_ICON_CACHE.put(countryCode, flagIcon);
|
||||
} else {
|
||||
flagIconCache.put(countryCode, flagIcon);
|
||||
FLAG_ICON_CACHE.put(countryCode, flagIcon);
|
||||
}
|
||||
}
|
||||
return flagIcon;
|
||||
}
|
||||
|
||||
public static void changeGUISize() {
|
||||
FLAG_ICON_CACHE.clear();
|
||||
}
|
||||
|
||||
public static String getCountryName(String countryCode) {
|
||||
if (countryMap.isEmpty()) {
|
||||
if (COUNTRY_MAP.isEmpty()) {
|
||||
for (int i = 0; i <= CountryComboBox.countryList.length - 1; i++) {
|
||||
countryMap.put(CountryComboBox.countryList[i][1], CountryComboBox.countryList[i][0]);
|
||||
COUNTRY_MAP.put(CountryComboBox.countryList[i][1], CountryComboBox.countryList[i][0]);
|
||||
}
|
||||
}
|
||||
return countryMap.get(countryCode);
|
||||
return COUNTRY_MAP.get(countryCode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package mage.client.util.stats;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import javax.swing.*;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* This updates the mem usage info in the Mage client every MEM_USAGE_UPDATE_TIME ms.
|
||||
* This updates the mem usage info in the Mage client every
|
||||
* MEM_USAGE_UPDATE_TIME ms.
|
||||
*
|
||||
* @author noxx
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ public class UpdateMemUsageTask extends SwingWorker<Void, Float> {
|
|||
|
||||
private static final int MEM_USAGE_UPDATE_TIME = 2000;
|
||||
|
||||
private JLabel jLabelToDisplayInfo;
|
||||
private final JLabel jLabelToDisplayInfo;
|
||||
|
||||
private static final Logger logger = Logger.getLogger(UpdateMemUsageTask.class);
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class UpdateMemUsageTask extends SwingWorker<Void, Float> {
|
|||
protected Void doInBackground() throws Exception {
|
||||
while (!isCancelled()) {
|
||||
float memUsage = MemoryUsageStatUtil.getMemoryFreeStatPercentage();
|
||||
this.publish(memUsage >= 0 ? Float.valueOf(memUsage) : null);
|
||||
this.publish(memUsage >= 0 ? memUsage : null);
|
||||
Thread.sleep(MEM_USAGE_UPDATE_TIME);
|
||||
}
|
||||
return null;
|
||||
|
@ -52,7 +52,8 @@ public class UpdateMemUsageTask extends SwingWorker<Void, Float> {
|
|||
get();
|
||||
} catch (InterruptedException | ExecutionException ex) {
|
||||
logger.fatal("Update Memory Usage error", ex);
|
||||
} catch (CancellationException ex) {}
|
||||
} catch (CancellationException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.awt.image.BufferedImage;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.UUID;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ImageIcon;
|
||||
|
@ -53,6 +54,7 @@ import net.java.truevfs.access.TFile;
|
|||
import org.apache.log4j.Logger;
|
||||
import org.mage.card.arcane.ScaledImagePanel.MultipassType;
|
||||
import org.mage.card.arcane.ScaledImagePanel.ScalingType;
|
||||
import static org.mage.plugins.card.constants.Constants.THUMBNAIL_SIZE_FULL;
|
||||
import org.mage.plugins.card.dl.sources.DirectLinksForDownload;
|
||||
import org.mage.plugins.card.images.ImageCache;
|
||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||
|
@ -67,7 +69,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
|
||||
private static final long serialVersionUID = -3272134219262184410L;
|
||||
|
||||
private static final Logger logger = Logger.getLogger(CardPanel.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(CardPanel.class);
|
||||
|
||||
private static final int WIDTH_LIMIT = 90; // card width limit to create smaller counter
|
||||
public static final double TAPPED_ANGLE = Math.PI / 2;
|
||||
|
@ -123,6 +125,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
private boolean displayEnabled = true;
|
||||
private boolean isAnimationPanel;
|
||||
public int cardXOffset, cardYOffset, cardWidth, cardHeight;
|
||||
private int symbolWidth;
|
||||
|
||||
private boolean isSelected;
|
||||
private boolean isPlayable;
|
||||
|
@ -161,13 +164,14 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
this.gameCard = newGameCard;
|
||||
this.callback = callback;
|
||||
this.gameId = gameId;
|
||||
this.setCardBounds(0, 0, dimension.width, dimension.height);
|
||||
this.isPermanent = this.gameCard instanceof PermanentView;
|
||||
|
||||
this.isPermanent = this.gameCard instanceof PermanentView;
|
||||
if (isPermanent) {
|
||||
this.hasSickness = ((PermanentView) this.gameCard).hasSummoningSickness();
|
||||
}
|
||||
|
||||
this.setCardBounds(0, 0, dimension.width, dimension.height);
|
||||
|
||||
//for container debug (don't remove)
|
||||
//setBorder(BorderFactory.createLineBorder(Color.green));
|
||||
if (this.gameCard.canTransform()) {
|
||||
|
@ -271,9 +275,11 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
addComponentListener(this);
|
||||
|
||||
displayTitleAnyway = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_CARD_NAMES, "true").equals("true");
|
||||
|
||||
titleText = new GlowText();
|
||||
setText(gameCard);
|
||||
titleText.setFont(getFont().deriveFont(Font.BOLD, 13f));
|
||||
// int fontSize = (int) cardHeight / 11;
|
||||
// titleText.setFont(getFont().deriveFont(Font.BOLD, fontSize));
|
||||
titleText.setForeground(Color.white);
|
||||
titleText.setGlow(Color.black, TEXT_GLOW_SIZE, TEXT_GLOW_INTENSITY);
|
||||
titleText.setWrap(true);
|
||||
|
@ -285,7 +291,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
} else if (CardUtil.isPlaneswalker(gameCard)) {
|
||||
ptText.setText(gameCard.getLoyalty());
|
||||
}
|
||||
ptText.setFont(getFont().deriveFont(Font.BOLD, 13f));
|
||||
// ptText.setFont(getFont().deriveFont(Font.BOLD, fontSize));
|
||||
ptText.setForeground(Color.white);
|
||||
ptText.setGlow(Color.black, TEXT_GLOW_SIZE, TEXT_GLOW_INTENSITY);
|
||||
add(ptText);
|
||||
|
@ -330,9 +336,9 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
}
|
||||
setText(gameCard);
|
||||
} catch (Exception e) {
|
||||
logger.fatal("Problem during image animation", e);
|
||||
LOGGER.fatal("Problem during image animation", e);
|
||||
} catch (Error err) {
|
||||
logger.error("Problem during image animation", err);
|
||||
LOGGER.error("Problem during image animation", err);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -526,15 +532,26 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
|
||||
if (showCastingCost && !isAnimationPanel && cardWidth < 200 && cardWidth > 60) {
|
||||
String manaCost = ManaSymbols.getStringManaCost(gameCard.getManaCost());
|
||||
int width = ManaSymbols.getWidth(manaCost);
|
||||
int width = getWidth(manaCost);
|
||||
if (hasImage) {
|
||||
ManaSymbols.draw(g, manaCost, cardXOffset + cardWidth - width - 5, cardYOffset + 5);
|
||||
ManaSymbols.draw(g, manaCost, cardXOffset + cardWidth - width - 5, cardYOffset + 5, symbolWidth);
|
||||
} else {
|
||||
ManaSymbols.draw(g, manaCost, cardXOffset + 8, cardHeight - 9);
|
||||
ManaSymbols.draw(g, manaCost, cardXOffset + 8, cardHeight - 9, symbolWidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getWidth(String manaCost) {
|
||||
int width = 0;
|
||||
manaCost = manaCost.replace("\\", "");
|
||||
StringTokenizer tok = new StringTokenizer(manaCost, " ");
|
||||
while (tok.hasMoreTokens()) {
|
||||
tok.nextToken();
|
||||
width += symbolWidth;
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doLayout() {
|
||||
int borderSize = Math.round(cardWidth * BLACK_BORDER_SIZE);
|
||||
|
@ -584,18 +601,24 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
titleText.setVisible(showText);
|
||||
ptText.setVisible(showText);
|
||||
|
||||
int titleX = Math.round(cardWidth * (20f / 480));
|
||||
int titleY = Math.round(cardHeight * (9f / 680)) + yTextOffset;
|
||||
titleText.setBounds(cardXOffset + titleX, cardYOffset + titleY, cardWidth - titleX, cardHeight - titleY);
|
||||
if (showText) {
|
||||
int fontSize = (int) cardHeight / 11;
|
||||
titleText.setFont(getFont().deriveFont(Font.BOLD, fontSize));
|
||||
|
||||
Dimension ptSize = ptText.getPreferredSize();
|
||||
ptText.setSize(ptSize.width, ptSize.height);
|
||||
int ptX = Math.round(cardWidth * (420f / 480)) - ptSize.width / 2;
|
||||
int ptY = Math.round(cardHeight * (675f / 680)) - ptSize.height;
|
||||
int titleX = Math.round(cardWidth * (20f / 480));
|
||||
int titleY = Math.round(cardHeight * (9f / 680)) + yTextOffset;
|
||||
titleText.setBounds(cardXOffset + titleX, cardYOffset + titleY, cardWidth - titleX, cardHeight - titleY);
|
||||
|
||||
int offsetX = Math.round((CARD_SIZE_FULL.width - cardWidth) / 10.0f);
|
||||
ptText.setFont(getFont().deriveFont(Font.BOLD, fontSize));
|
||||
Dimension ptSize = ptText.getPreferredSize();
|
||||
ptText.setSize(ptSize.width, ptSize.height);
|
||||
int ptX = Math.round(cardWidth * (420f / 480)) - ptSize.width / 2;
|
||||
int ptY = Math.round(cardHeight * (675f / 680)) - ptSize.height;
|
||||
|
||||
ptText.setLocation(cardXOffset + ptX - TEXT_GLOW_SIZE / 2 - offsetX, cardYOffset + ptY - TEXT_GLOW_SIZE / 2);
|
||||
int offsetX = Math.round((CARD_SIZE_FULL.width - cardWidth) / 10.0f);
|
||||
|
||||
ptText.setLocation(cardXOffset + ptX - TEXT_GLOW_SIZE / 2 - offsetX, cardYOffset + ptY - TEXT_GLOW_SIZE / 2);
|
||||
}
|
||||
|
||||
if (isAnimationPanel || cardWidth < 200) {
|
||||
imagePanel.setScalingType(ScalingType.nearestNeighbor);
|
||||
|
@ -612,33 +635,51 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
@Override
|
||||
public final void setCardBounds(int x, int y, int cardWidth, int cardHeight) {
|
||||
this.cardWidth = cardWidth;
|
||||
this.symbolWidth = cardWidth / 7;
|
||||
this.cardHeight = cardHeight;
|
||||
int rotCenterX = Math.round(cardWidth / 2f);
|
||||
int rotCenterY = cardHeight - rotCenterX;
|
||||
int rotCenterToTopCorner = Math.round(cardWidth * CardPanel.ROT_CENTER_TO_TOP_CORNER);
|
||||
int rotCenterToBottomCorner = Math.round(cardWidth * CardPanel.ROT_CENTER_TO_BOTTOM_CORNER);
|
||||
int xOffset = getXOffset(cardWidth);
|
||||
int yOffset = getYOffset(cardWidth, cardHeight);
|
||||
cardXOffset = -xOffset;
|
||||
cardYOffset = -yOffset;
|
||||
int width = -xOffset + rotCenterX + rotCenterToTopCorner;
|
||||
int height = -yOffset + rotCenterY + rotCenterToBottomCorner;
|
||||
setBounds(x + xOffset, y + yOffset, width, height);
|
||||
if (this.isPermanent) {
|
||||
int rotCenterX = Math.round(cardWidth / 2f);
|
||||
int rotCenterY = cardHeight - rotCenterX;
|
||||
int rotCenterToTopCorner = Math.round(cardWidth * CardPanel.ROT_CENTER_TO_TOP_CORNER);
|
||||
int rotCenterToBottomCorner = Math.round(cardWidth * CardPanel.ROT_CENTER_TO_BOTTOM_CORNER);
|
||||
int xOffset = getXOffset(cardWidth);
|
||||
int yOffset = getYOffset(cardWidth, cardHeight);
|
||||
cardXOffset = -xOffset;
|
||||
cardYOffset = -yOffset;
|
||||
int width = -xOffset + rotCenterX + rotCenterToTopCorner;
|
||||
int height = -yOffset + rotCenterY + rotCenterToBottomCorner;
|
||||
setBounds(x + xOffset, y + yOffset, width, height);
|
||||
} else {
|
||||
cardXOffset = 5;
|
||||
cardYOffset = 5;
|
||||
int width = cardXOffset * 2 + cardWidth;
|
||||
int height = cardYOffset * 2 + cardHeight;
|
||||
setBounds(x - cardXOffset, y - cardYOffset, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
public int getXOffset(int cardWidth) {
|
||||
int rotCenterX = Math.round(cardWidth / 2f);
|
||||
int rotCenterToBottomCorner = Math.round(cardWidth * CardPanel.ROT_CENTER_TO_BOTTOM_CORNER);
|
||||
int xOffset = rotCenterX - rotCenterToBottomCorner;
|
||||
return xOffset;
|
||||
if (this.isPermanent) {
|
||||
int rotCenterX = Math.round(cardWidth / 2f);
|
||||
int rotCenterToBottomCorner = Math.round(cardWidth * CardPanel.ROT_CENTER_TO_BOTTOM_CORNER);
|
||||
int xOffset = rotCenterX - rotCenterToBottomCorner;
|
||||
return xOffset;
|
||||
} else {
|
||||
return cardXOffset;
|
||||
}
|
||||
}
|
||||
|
||||
public int getYOffset(int cardWidth, int cardHeight) {
|
||||
int rotCenterX = Math.round(cardWidth / 2f);
|
||||
int rotCenterY = cardHeight - rotCenterX;
|
||||
int rotCenterToTopCorner = Math.round(cardWidth * CardPanel.ROT_CENTER_TO_TOP_CORNER);
|
||||
int yOffset = rotCenterY - rotCenterToTopCorner;
|
||||
return yOffset;
|
||||
if (this.isPermanent) {
|
||||
int rotCenterX = Math.round(cardWidth / 2f);
|
||||
int rotCenterY = cardHeight - rotCenterX;
|
||||
int rotCenterToTopCorner = Math.round(cardWidth * CardPanel.ROT_CENTER_TO_TOP_CORNER);
|
||||
int yOffset = rotCenterY - rotCenterToTopCorner;
|
||||
return yOffset;
|
||||
} else {
|
||||
return cardYOffset;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getCardX() {
|
||||
|
@ -704,6 +745,8 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
BufferedImage srcImage;
|
||||
if (gameCard.isFaceDown()) {
|
||||
srcImage = getFaceDownImage();
|
||||
} else if (cardWidth > THUMBNAIL_SIZE_FULL.width) {
|
||||
srcImage = ImageCache.getImage(gameCard, cardWidth, cardHeight);
|
||||
} else {
|
||||
srcImage = ImageCache.getThumbnail(gameCard);
|
||||
}
|
||||
|
@ -728,12 +771,10 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
} else {
|
||||
return ImageCache.getManifestImage();
|
||||
}
|
||||
} else if (this.gameCard instanceof StackAbilityView) {
|
||||
return ImageCache.getMorphImage();
|
||||
} else {
|
||||
if (this.gameCard instanceof StackAbilityView) {
|
||||
return ImageCache.getMorphImage();
|
||||
} else {
|
||||
return ImageCache.loadImage(new TFile(DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename));
|
||||
}
|
||||
return ImageCache.loadImage(new TFile(DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1145,7 +1186,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
dayNightButton.setIcon(new ImageIcon(night));
|
||||
}
|
||||
if (this.gameCard.getSecondCardFace() == null) {
|
||||
logger.error("no second side for card to transform!");
|
||||
LOGGER.error("no second side for card to transform!");
|
||||
return;
|
||||
}
|
||||
if (!isPermanent) { // use only for custom transformation (when pressing day-night button)
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.regex.Pattern;
|
|||
import javax.imageio.ImageIO;
|
||||
import mage.cards.repository.ExpansionRepository;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.gui.BufferedImageBuilder;
|
||||
import org.apache.log4j.Logger;
|
||||
|
@ -21,40 +22,27 @@ import org.mage.plugins.card.constants.Constants;
|
|||
|
||||
public class ManaSymbols {
|
||||
|
||||
private static final Logger log = Logger.getLogger(ManaSymbols.class);
|
||||
private static final Map<String, BufferedImage> manaImages = new HashMap<>();
|
||||
private static final Map<String, Image> manaImagesOriginal = new HashMap<>();
|
||||
private static final Logger LOGGER = Logger.getLogger(ManaSymbols.class);
|
||||
private static final Map<Integer, Map<String, BufferedImage>> manaImages = new HashMap<>();
|
||||
private static boolean smallSymbolsFound = false;
|
||||
private static boolean mediumSymbolsFound = false;
|
||||
|
||||
private static final Map<String, Image> setImages = new HashMap<>();
|
||||
private static final Map<String, Dimension> setImagesExist = new HashMap<>();
|
||||
private static final Pattern replaceSymbolsPattern = Pattern.compile("\\{([^}/]*)/?([^}]*)\\}");
|
||||
private static final Pattern REPLACE_SYMBOLS_PATTERN = Pattern.compile("\\{([^}/]*)/?([^}]*)\\}");
|
||||
private static String cachedPath;
|
||||
private static final String[] symbols = new String[]{"0", "1", "10", "11", "12", "15", "16", "2", "3", "4", "5", "6", "7", "8", "9", "B", "BG",
|
||||
"BR", "G", "GU", "GW", "R", "RG", "RW", "S", "T", "U", "UB", "UR", "W", "WB", "WU",
|
||||
"WP", "UP", "BP", "RP", "GP", "X", "C"};
|
||||
|
||||
public static void loadImages() {
|
||||
String[] symbols = new String[]{"0", "1", "10", "11", "12", "15", "16", "2", "3", "4", "5", "6", "7", "8", "9", "B", "BG",
|
||||
"BR", "G", "GU", "GW", "R", "RG", "RW", "S", "T", "U", "UB", "UR", "W", "WB", "WU",
|
||||
"WP", "UP", "BP", "RP", "GP", "X", "C" /*, "Y", "Z", "slash"*/};
|
||||
smallSymbolsFound = loadSymbolsImages(15);
|
||||
mediumSymbolsFound = loadSymbolsImages(25);
|
||||
|
||||
for (String symbol : symbols) {
|
||||
File file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_MANA_MEDIUM + "/" + symbol + ".jpg");
|
||||
Rectangle r = new Rectangle(11, 11);
|
||||
try {
|
||||
Image image = UI.getImageIcon(file.getAbsolutePath()).getImage();
|
||||
BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||
manaImages.put(symbol, resized);
|
||||
} catch (Exception e) {
|
||||
log.error("Error for symbol:" + symbol);
|
||||
}
|
||||
file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_MANA_MEDIUM + "/" + symbol + ".jpg");
|
||||
try {
|
||||
Image image = UI.getImageIcon(file.getAbsolutePath()).getImage();
|
||||
manaImagesOriginal.put(symbol, image);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
List<String> setCodes = ExpansionRepository.instance.getSetCodes();
|
||||
if (setCodes == null) {
|
||||
// the cards db file is probaly not included in the client. It will be created after the first connect to a server.
|
||||
log.warn("No db information for sets found. Connect to a server to create database file on client side. Then try to restart the client.");
|
||||
LOGGER.warn("No db information for sets found. Connect to a server to create database file on client side. Then try to restart the client.");
|
||||
return;
|
||||
}
|
||||
for (String set : setCodes) {
|
||||
|
@ -129,6 +117,37 @@ public class ManaSymbols {
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean loadSymbolsImages(int size) {
|
||||
boolean fileErrors = false;
|
||||
HashMap<String, BufferedImage> sizedSymbols = new HashMap<>();
|
||||
for (String symbol : symbols) {
|
||||
String resourcePath = Constants.RESOURCE_PATH_MANA_SMALL;
|
||||
if (size > 25) {
|
||||
resourcePath = Constants.RESOURCE_PATH_MANA_LARGE;
|
||||
} else if (size > 15) {
|
||||
resourcePath = Constants.RESOURCE_PATH_MANA_MEDIUM;
|
||||
}
|
||||
File file = new File(getSymbolsPath() + resourcePath + "/" + symbol + ".jpg");
|
||||
try {
|
||||
|
||||
if (size == 15 || size == 25) {
|
||||
BufferedImage notResized = ImageIO.read(file);
|
||||
sizedSymbols.put(symbol, notResized);
|
||||
} else {
|
||||
Rectangle r = new Rectangle(size, size);
|
||||
Image image = UI.getImageIcon(file.getAbsolutePath()).getImage();
|
||||
BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||
sizedSymbols.put(symbol, resized);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error for symbol:" + symbol);
|
||||
fileErrors = true;
|
||||
}
|
||||
}
|
||||
manaImages.put(size, sizedSymbols);
|
||||
return !fileErrors;
|
||||
}
|
||||
|
||||
private static String getSymbolsPath() {
|
||||
return getSymbolsPath(false);
|
||||
}
|
||||
|
@ -157,11 +176,11 @@ public class ManaSymbols {
|
|||
return path;
|
||||
}
|
||||
|
||||
public static Image getManaSymbolImage(String symbol) {
|
||||
return manaImagesOriginal.get(symbol);
|
||||
}
|
||||
|
||||
public static void draw(Graphics g, String manaCost, int x, int y) {
|
||||
public static void draw(Graphics g, String manaCost, int x, int y, int symbolWidth) {
|
||||
if (!manaImages.containsKey(symbolWidth)) {
|
||||
loadSymbolsImages(symbolWidth);
|
||||
}
|
||||
Map<String, BufferedImage> sizedSymbols = manaImages.get(symbolWidth);
|
||||
if (manaCost.length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -170,13 +189,14 @@ public class ManaSymbols {
|
|||
StringTokenizer tok = new StringTokenizer(manaCost, " ");
|
||||
while (tok.hasMoreTokens()) {
|
||||
String symbol = tok.nextToken().substring(0);
|
||||
Image image = manaImages.get(symbol);
|
||||
// Check and load symbol in the width
|
||||
Image image = sizedSymbols.get(symbol);
|
||||
if (image == null) {
|
||||
//log.error("Symbol not recognized \"" + symbol + "\" in mana cost: " + manaCost);
|
||||
continue;
|
||||
}
|
||||
g.drawImage(image, x, y, null);
|
||||
x += symbol.length() > 2 ? 10 : 12; // slash.png is only 10 pixels wide.
|
||||
x += symbolWidth;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,50 +208,61 @@ public class ManaSymbols {
|
|||
return sb.toString().replace("{", "").replace("}", " ").trim();
|
||||
}
|
||||
|
||||
public static int getWidth(String manaCost) {
|
||||
int width = 0;
|
||||
manaCost = manaCost.replace("\\", "");
|
||||
StringTokenizer tok = new StringTokenizer(manaCost, " ");
|
||||
while (tok.hasMoreTokens()) {
|
||||
String symbol = tok.nextToken().substring(0);
|
||||
width += symbol.length() > 2 ? 10 : 12; // slash.png is only 10 pixels wide.
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
|
||||
CARD,
|
||||
TABLE,
|
||||
CHAT,
|
||||
DIALOG,
|
||||
TOOLTIP,
|
||||
PAY
|
||||
}
|
||||
|
||||
public static synchronized String replaceSymbolsWithHTML(String value, Type type) {
|
||||
value = value.replace("{source}", "|source|");
|
||||
value = value.replace("{this}", "|this|");
|
||||
String replaced = value;
|
||||
if (!manaImages.isEmpty()) {
|
||||
if (type.equals(Type.TOOLTIP)) {
|
||||
replaced = replaceSymbolsPattern.matcher(value).replaceAll("<img src='file:" + getSymbolsPath(true) + "/symbols/small/$1$2.jpg' alt='$1$2' width=11 height=11>");
|
||||
} else if (type.equals(Type.CARD)) {
|
||||
value = value.replace("{slash}", "<img src='file:" + getSymbolsPath() + "/symbols/medium/slash.jpg' alt='slash' width=10 height=13>");
|
||||
replaced = replaceSymbolsPattern.matcher(value).replaceAll("<img src='file:" + getSymbolsPath(true) + "/symbols/medium/$1$2.jpg' alt='$1$2' width=12 height=12>");
|
||||
} else if (type.equals(Type.PAY)) {
|
||||
value = value.replace("{slash}", "<img src='file:" + getSymbolsPath() + "/symbols/medium/slash.jpg' alt='slash' width=10 height=13>");
|
||||
replaced = replaceSymbolsPattern.matcher(value).replaceAll("<img src='file:" + getSymbolsPath(true) + "/symbols/medium/$1$2.jpg' alt='$1$2' width=15 height=15>");
|
||||
}
|
||||
boolean symbolFilesFound;
|
||||
int symbolSize;
|
||||
switch (type) {
|
||||
case TABLE:
|
||||
symbolSize = GUISizeHelper.symbolTableSize;
|
||||
break;
|
||||
case CHAT:
|
||||
symbolSize = GUISizeHelper.symbolChatSize;
|
||||
break;
|
||||
case DIALOG:
|
||||
symbolSize = GUISizeHelper.symbolDialogSize;
|
||||
break;
|
||||
case TOOLTIP:
|
||||
symbolSize = GUISizeHelper.symbolTooltipSize;
|
||||
break;
|
||||
default:
|
||||
symbolSize = 11;
|
||||
break;
|
||||
}
|
||||
String resourcePath = "small";
|
||||
symbolFilesFound = smallSymbolsFound;
|
||||
if (symbolSize > 25) {
|
||||
resourcePath = "large";
|
||||
} else if (symbolSize > 15) {
|
||||
resourcePath = "medium";
|
||||
symbolFilesFound = mediumSymbolsFound;
|
||||
}
|
||||
if (symbolFilesFound) {
|
||||
replaced = REPLACE_SYMBOLS_PATTERN.matcher(value).replaceAll("<img src='file:" + getSymbolsPath(true)
|
||||
+ "/symbols/" + resourcePath + "/$1$2.jpg' alt='$1$2' width="
|
||||
+ symbolSize + " height=" + symbolSize + ">");
|
||||
}
|
||||
replaced = replaced.replace("|source|", "{source}");
|
||||
replaced = replaced.replace("|this|", "{this}");
|
||||
return replaced;
|
||||
}
|
||||
|
||||
public static String replaceSetCodeWithHTML(String set, String rarity) {
|
||||
public static String replaceSetCodeWithHTML(String set, String rarity, int size) {
|
||||
String _set = set;
|
||||
if (setImagesExist.containsKey(_set)) {
|
||||
Integer width = setImagesExist.get(_set).width;
|
||||
Integer height = setImagesExist.get(_set).height;
|
||||
return "<img src='file:" + getSymbolsPath() + "/sets/small/" + _set + "-" + rarity + ".png' alt='" + rarity + " ' width=" + width + " height=" + height + ">";
|
||||
int factor = size / 15 + 1;
|
||||
Integer width = setImagesExist.get(_set).width * factor;
|
||||
Integer height = setImagesExist.get(_set).height * factor;
|
||||
return "<img src='file:" + getSymbolsPath() + "/sets/small/" + _set + "-" + rarity + ".png' alt='" + rarity + "' height='" + height + "' width='" + width + "' >";
|
||||
} else {
|
||||
return set;
|
||||
}
|
||||
|
@ -241,7 +272,11 @@ public class ManaSymbols {
|
|||
return setImages.get(set);
|
||||
}
|
||||
|
||||
public static BufferedImage getManaSymbolImageSmall(String symbol) {
|
||||
return manaImages.get(symbol);
|
||||
public static BufferedImage getSizedManaSymbol(String symbol) {
|
||||
if (!manaImages.containsKey(GUISizeHelper.symbolDialogSize)) {
|
||||
loadSymbolsImages(GUISizeHelper.symbolDialogSize);
|
||||
}
|
||||
Map<String, BufferedImage> sizedSymbols = manaImages.get(GUISizeHelper.symbolDialogSize);
|
||||
return sizedSymbols.get(symbol);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.mage.plugins.card;
|
|||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
@ -18,6 +17,7 @@ import javax.swing.JDialog;
|
|||
import javax.swing.JLayeredPane;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.constants.Rarity;
|
||||
import mage.interfaces.plugin.CardPlugin;
|
||||
import mage.utils.CardUtil;
|
||||
|
@ -31,8 +31,6 @@ import net.xeoh.plugins.base.annotations.meta.Author;
|
|||
import org.apache.log4j.Logger;
|
||||
import org.mage.card.arcane.Animation;
|
||||
import org.mage.card.arcane.CardPanel;
|
||||
import org.mage.card.arcane.ManaSymbols;
|
||||
import org.mage.plugins.card.constants.Constants;
|
||||
import org.mage.plugins.card.dl.DownloadGui;
|
||||
import org.mage.plugins.card.dl.DownloadJob;
|
||||
import org.mage.plugins.card.dl.Downloader;
|
||||
|
@ -48,14 +46,15 @@ import org.mage.plugins.card.info.CardInfoPaneImpl;
|
|||
*
|
||||
* @author nantuko
|
||||
* @version 0.1 01.11.2010 Mage permanents. Sorting card layout.
|
||||
* @version 0.6 17.07.2011 #sortPermanents got option to display non-land permanents in one pile
|
||||
* @version 0.6 17.07.2011 #sortPermanents got option to display non-land
|
||||
* permanents in one pile
|
||||
* @version 0.7 29.07.2011 face down cards support
|
||||
*/
|
||||
@PluginImplementation
|
||||
@Author(name = "nantuko")
|
||||
public class CardPluginImpl implements CardPlugin {
|
||||
|
||||
private static final Logger log = Logger.getLogger(CardPluginImpl.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(CardPluginImpl.class);
|
||||
|
||||
private static final int GUTTER_Y = 15;
|
||||
private static final int GUTTER_X = 5;
|
||||
|
@ -66,7 +65,9 @@ public class CardPluginImpl implements CardPlugin {
|
|||
private static final float ATTACHMENT_SPACING_Y = 0.13f;
|
||||
|
||||
private int landStackMax = 5;
|
||||
private int cardWidthMin = 50, cardWidthMax = Constants.CARD_SIZE_FULL.width;
|
||||
// private int cardWidthMin = 50, cardWidthMax = Constants.CARD_SIZE_FULL.width;
|
||||
private int cardWidthMin = 50, cardWidthMax = (int) GUISizeHelper.battlefieldCardDimension.getWidth();
|
||||
|
||||
private boolean stackVertical = false;
|
||||
|
||||
private int playAreaWidth, playAreaHeight;
|
||||
|
@ -75,13 +76,17 @@ public class CardPluginImpl implements CardPlugin {
|
|||
private int stackSpacingX, stackSpacingY, attachmentSpacingY;
|
||||
private List<Row> rows = new ArrayList<>();
|
||||
|
||||
public CardPluginImpl() {
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
@Init
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@PluginLoaded
|
||||
public void newPlugin(CardPlugin plugin) {
|
||||
log.info(plugin.toString() + " has been loaded.");
|
||||
LOGGER.info(plugin.toString() + " has been loaded.");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -89,6 +94,16 @@ public class CardPluginImpl implements CardPlugin {
|
|||
return "[Card plugin, version 0.7]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
cardWidthMin = 50;
|
||||
cardWidthMax = (int) GUISizeHelper.battlefieldCardDimension.getWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MagePermanent getMagePermanent(PermanentView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage) {
|
||||
CardPanel cardPanel = new CardPanel(permanent, gameId, loadImage, callback, false, dimension);
|
||||
|
@ -98,9 +113,9 @@ public class CardPluginImpl implements CardPlugin {
|
|||
}
|
||||
|
||||
@Override
|
||||
public MagePermanent getMageCard(CardView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage) {
|
||||
CardPanel cardPanel = new CardPanel(permanent, gameId, loadImage, callback, false, dimension);
|
||||
boolean implemented = permanent.getRarity() != null && !permanent.getRarity().equals(Rarity.NA);
|
||||
public MagePermanent getMageCard(CardView cardView, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage) {
|
||||
CardPanel cardPanel = new CardPanel(cardView, gameId, loadImage, callback, false, dimension);
|
||||
boolean implemented = cardView.getRarity() != null && !cardView.getRarity().equals(Rarity.NA);
|
||||
cardPanel.setShowCastingCost(implemented);
|
||||
return cardPanel;
|
||||
}
|
||||
|
@ -398,6 +413,7 @@ public class CardPluginImpl implements CardPlugin {
|
|||
}
|
||||
|
||||
private class Row extends ArrayList<Stack> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Row() {
|
||||
|
@ -458,6 +474,7 @@ public class CardPluginImpl implements CardPlugin {
|
|||
}
|
||||
|
||||
private class Stack extends ArrayList<MagePermanent> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@ -474,7 +491,7 @@ public class CardPluginImpl implements CardPlugin {
|
|||
}
|
||||
|
||||
private int getHeight() {
|
||||
return cardHeight + (size() - 1) * stackSpacingY + cardSpacingY + attachmentSpacingY*maxAttachedCount;
|
||||
return cardHeight + (size() - 1) * stackSpacingY + cardSpacingY + attachmentSpacingY * maxAttachedCount;
|
||||
}
|
||||
|
||||
public int getMaxAttachedCount() {
|
||||
|
@ -489,7 +506,8 @@ public class CardPluginImpl implements CardPlugin {
|
|||
/**
|
||||
* Download various symbols (mana, tap, set).
|
||||
*
|
||||
* @param imagesPath Path to check in and store symbols to. Can be null, in such case default path should be used.
|
||||
* @param imagesPath Path to check in and store symbols to. Can be null, in
|
||||
* such case default path should be used.
|
||||
*/
|
||||
@Override
|
||||
public void downloadSymbols(String imagesPath) {
|
||||
|
@ -502,17 +520,17 @@ public class CardPluginImpl implements CardPlugin {
|
|||
}
|
||||
|
||||
it = new GathererSets(imagesPath);
|
||||
for(DownloadJob job:it) {
|
||||
g.getDownloader().add(job);
|
||||
for (DownloadJob job : it) {
|
||||
g.getDownloader().add(job);
|
||||
}
|
||||
|
||||
it = new CardFrames(imagesPath);
|
||||
for(DownloadJob job:it) {
|
||||
for (DownloadJob job : it) {
|
||||
g.getDownloader().add(job);
|
||||
}
|
||||
|
||||
it = new DirectLinksForDownload(imagesPath);
|
||||
for(DownloadJob job:it) {
|
||||
for (DownloadJob job : it) {
|
||||
g.getDownloader().add(job);
|
||||
}
|
||||
|
||||
|
@ -530,11 +548,6 @@ public class CardPluginImpl implements CardPlugin {
|
|||
d.setVisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getManaSymbolImage(String symbol) {
|
||||
return ManaSymbols.getManaSymbolImage(symbol);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAddCard(MagePermanent card, int count) {
|
||||
if (card != null) {
|
||||
|
|
|
@ -4,22 +4,20 @@ import java.awt.Rectangle;
|
|||
import java.io.File;
|
||||
|
||||
public class Constants {
|
||||
|
||||
public static final String RESOURCE_PATH_SET = File.separator + "sets" + File.separator;
|
||||
|
||||
public static final String RESOURCE_PATH_MANA_SMALL = File.separator + "symbols" + File.separator + "small";
|
||||
public static final String RESOURCE_PATH_MANA_LARGE = File.separator + "symbols" + File.separator + "large";
|
||||
public static final String RESOURCE_PATH_MANA_MEDIUM = File.separator + "symbols" + File.separator + "medium";
|
||||
|
||||
public static final String RESOURCE_PATH_SET = File.separator + "sets" + File.separator;
|
||||
public static final String RESOURCE_PATH_SET_SMALL = RESOURCE_PATH_SET + File.separator + "small" + File.separator;
|
||||
|
||||
public static final Rectangle CARD_SIZE_FULL = new Rectangle(101, 149);
|
||||
public static final Rectangle THUMBNAIL_SIZE_FULL = new Rectangle(102, 146);
|
||||
|
||||
public static final int TOOLTIP_WIDTH_MIN = 320;
|
||||
public static final int TOOLTIP_HEIGHT_MIN = 201;
|
||||
|
||||
public static final int TOOLTIP_HEIGHT_MAX = 401;
|
||||
public static final int TOOLTIP_BORDER_WIDTH = 80;
|
||||
public interface IO {
|
||||
|
||||
public interface IO {
|
||||
String imageBaseDir = "plugins" + File.separator + "images";
|
||||
String IMAGE_PROPERTIES_FILE = "image.url.properties";
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class GathererSets implements Iterable<DownloadJob> {
|
|||
|
||||
private static final String[] withMythics = {"M10", "M11", "M12", "M13", "M14", "M15", "ORI",
|
||||
"DDF", "DDG", "DDH", "DDI", "DDJ", "DDK", "DDL", "DDM", "DDN",
|
||||
"DD3", "DD3B", "DDO", "DDP",
|
||||
"DD3", "DD3B", "DDO", "DDP", "DDQ",
|
||||
"FVD", "FVE", "FVL", "FVR",
|
||||
"V12", "V13", "V14", "V15",
|
||||
"ALA", "CON", "ARB",
|
||||
|
@ -49,7 +49,9 @@ public class GathererSets implements Iterable<DownloadJob> {
|
|||
"THS", "BNG", "JOU",
|
||||
"CNS", "VMA", "TPR",
|
||||
"KTK", "FRF", "DTK",
|
||||
"BFZ", "EXP", "OGW"};
|
||||
"BFZ", "EXP", "OGW",
|
||||
"SOI", "EMN",
|
||||
"EMA"};
|
||||
private static final HashMap<String, String> symbolsReplacements = new HashMap<>();
|
||||
|
||||
static {
|
||||
|
|
|
@ -16,6 +16,10 @@ public class MagicCardsImageSource implements CardImageSource {
|
|||
|
||||
private static final Map<String, String> setNameTokenReplacement = new HashMap<String, String>() {
|
||||
{
|
||||
put("EMA", "eternal-masters");
|
||||
put("EMN", "eldritch-moon");
|
||||
put("SOI", "shadows-over-innistrad");
|
||||
put("OGW", "oath-of-the-gatewatch");
|
||||
put("CMA", "commanders-arsenal");
|
||||
put("ARENA", "arena-league");
|
||||
put("CP", "champs");
|
||||
|
@ -114,6 +118,7 @@ public class MagicCardsImageSource implements CardImageSource {
|
|||
put("DDN", "duel-decks-speed-vs-cunning");
|
||||
put("DDO", "duel-decks-elspeth-vs-kiora");
|
||||
put("DDP", "duel-decks-zendikar-vs-eldrazi");
|
||||
put("DDQ", "duel-decks-blessed-vs-cursed");
|
||||
}
|
||||
private static final long serialVersionUID = 1L;
|
||||
};
|
||||
|
|
|
@ -40,6 +40,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.prefs.Preferences;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.remote.Connection;
|
||||
import mage.remote.Connection.ProxyType;
|
||||
import org.jsoup.Jsoup;
|
||||
|
@ -56,6 +57,7 @@ public class WizardCardsImageSource implements CardImageSource {
|
|||
|
||||
private static CardImageSource instance;
|
||||
private static Map<String, String> setsAliases;
|
||||
private static Map<String, String> languageAliases;
|
||||
private final Map<String, Map<String, String>> sets;
|
||||
|
||||
public static CardImageSource getInstance() {
|
||||
|
@ -132,6 +134,7 @@ public class WizardCardsImageSource implements CardImageSource {
|
|||
setsAliases.put("DRK", "The Dark");
|
||||
setsAliases.put("DST", "Darksteel");
|
||||
setsAliases.put("DTK", "Dragons of Tarkir");
|
||||
setsAliases.put("EMN", "Eldritch Moon");
|
||||
setsAliases.put("EVE", "Eventide");
|
||||
setsAliases.put("EVG", "Duel Decks: Elves vs. Goblins");
|
||||
setsAliases.put("EXO", "Exodus");
|
||||
|
@ -184,6 +187,7 @@ public class WizardCardsImageSource implements CardImageSource {
|
|||
setsAliases.put("MRD", "Mirrodin");
|
||||
setsAliases.put("NMS", "Nemesis");
|
||||
setsAliases.put("NPH", "New Phyrexia");
|
||||
setsAliases.put("OGW", "Oath of the Gatewatch");
|
||||
setsAliases.put("ODY", "Odyssey");
|
||||
setsAliases.put("ONS", "Onslaught");
|
||||
setsAliases.put("ORI", "Magic Origins");
|
||||
|
@ -204,6 +208,7 @@ public class WizardCardsImageSource implements CardImageSource {
|
|||
setsAliases.put("S99", "Starter 1999");
|
||||
setsAliases.put("SCG", "Scourge");
|
||||
setsAliases.put("SHM", "Shadowmoor");
|
||||
setsAliases.put("SOI", "Shadows over Innistrad");
|
||||
setsAliases.put("SOK", "Saviors of Kamigawa");
|
||||
setsAliases.put("SOM", "Scars of Mirrodin");
|
||||
setsAliases.put("STH", "Stronghold");
|
||||
|
@ -233,42 +238,30 @@ public class WizardCardsImageSource implements CardImageSource {
|
|||
setsAliases.put("WTH", "Weatherlight");
|
||||
setsAliases.put("WWK", "Worldwake");
|
||||
setsAliases.put("ZEN", "Zendikar");
|
||||
|
||||
languageAliases = new HashMap<>();
|
||||
languageAliases.put("es", "Spanish");
|
||||
languageAliases.put("jp", "Japanese");
|
||||
languageAliases.put("it", "Italian");
|
||||
languageAliases.put("fr", "French");
|
||||
languageAliases.put("cn", "Chinese Simplified");
|
||||
languageAliases.put("de", "German");
|
||||
|
||||
}
|
||||
|
||||
private Map<String, String> getSetLinks(String cardSet) {
|
||||
Map<String, String> setLinks = new HashMap<>();
|
||||
try {
|
||||
String setNames = setsAliases.get(cardSet);
|
||||
Preferences prefs = MageFrame.getPreferences();
|
||||
Connection.ProxyType proxyType = Connection.ProxyType.valueByText(prefs.get("proxyType", "None"));
|
||||
String preferedLanguage = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PREF_LANGUAGE, "en");
|
||||
for (String setName : setNames.split("\\^")) {
|
||||
String URLSetName = URLEncoder.encode(setName, "UTF-8");
|
||||
String urlDocument;
|
||||
int page = 0;
|
||||
int firstMultiverseIdLastPage = 0;
|
||||
Pages:
|
||||
while (page < 999) {
|
||||
Document doc;
|
||||
if (proxyType.equals(ProxyType.NONE)) {
|
||||
urlDocument = "http://gatherer.wizards.com/Pages/Search/Default.aspx?page=" + page +"&output=spoiler&method=visual&action=advanced&set=+[%22" + URLSetName + "%22]";
|
||||
doc = Jsoup.connect(urlDocument).get();
|
||||
} else {
|
||||
String proxyServer = prefs.get("proxyAddress", "");
|
||||
int proxyPort = Integer.parseInt(prefs.get("proxyPort", "0"));
|
||||
URL url = new URL("http://gatherer.wizards.com/Pages/Search/Default.aspx?page=" + page +"&output=spoiler&method=visual&action=advanced&set=+[%22" + URLSetName + "%22]");
|
||||
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyServer, proxyPort));
|
||||
HttpURLConnection uc = (HttpURLConnection)url.openConnection(proxy);
|
||||
|
||||
uc.connect();
|
||||
|
||||
String line;
|
||||
StringBuffer tmp = new StringBuffer();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream()));
|
||||
while ((line = in.readLine()) != null) {
|
||||
tmp.append(line);
|
||||
}
|
||||
doc = Jsoup.parse(String.valueOf(tmp));
|
||||
}
|
||||
String searchUrl = "http://gatherer.wizards.com/Pages/Search/Default.aspx?page=" + page +"&output=spoiler&method=visual&action=advanced&set=+[%22" + URLSetName + "%22]";
|
||||
Document doc = getDocument(searchUrl);
|
||||
|
||||
Elements cardsImages = doc.select("img[src^=../../Handlers/]");
|
||||
if (cardsImages.isEmpty()) {
|
||||
|
@ -276,8 +269,8 @@ public class WizardCardsImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
for (int i = 0; i < cardsImages.size(); i++) {
|
||||
Integer multiverseId = Integer.parseInt(cardsImages.get(i).attr("src").replaceAll("[^\\d]", ""));
|
||||
if (i == 0) {
|
||||
Integer multiverseId = Integer.parseInt(cardsImages.get(i).attr("src").replaceAll("[^\\d]", ""));
|
||||
if (multiverseId == firstMultiverseIdLastPage) {
|
||||
break Pages;
|
||||
}
|
||||
|
@ -286,23 +279,10 @@ public class WizardCardsImageSource implements CardImageSource {
|
|||
String cardName = normalizeName(cardsImages.get(i).attr("alt"));
|
||||
if (cardName != null && !cardName.isEmpty()) {
|
||||
if (cardName.equals("Forest") || cardName.equals("Swamp") || cardName.equals("Mountain") || cardName.equals("Island") || cardName.equals("Plains")) {
|
||||
Integer multiverseId = Integer.parseInt(cardsImages.get(i).attr("src").replaceAll("[^\\d]", ""));
|
||||
String urlLandDocument = "http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=" + multiverseId;
|
||||
Document landDoc = Jsoup.connect(urlLandDocument).get();
|
||||
Elements variations = landDoc.select("a.variationlink");
|
||||
if(!variations.isEmpty()) {
|
||||
int landNumber = 1;
|
||||
for (Element variation : variations) {
|
||||
Integer landMultiverseId = Integer.parseInt(variation.attr("onclick").replaceAll("[^\\d]", ""));
|
||||
// ""
|
||||
setLinks.put((cardName + landNumber).toLowerCase(), "/Handlers/Image.ashx?multiverseid=" +landMultiverseId + "&type=card");
|
||||
landNumber++;
|
||||
}
|
||||
} else {
|
||||
setLinks.put(cardName.toLowerCase(), cardsImages.get(i).attr("src").substring(5));
|
||||
}
|
||||
setLinks.putAll(getLandVariations(multiverseId, cardName));
|
||||
} else {
|
||||
setLinks.put(cardName.toLowerCase(), cardsImages.get(i).attr("src").substring(5));
|
||||
Integer preferedMultiverseId = getLocalizedMultiverseId(preferedLanguage, multiverseId);
|
||||
setLinks.put(cardName.toLowerCase(), generateLink(preferedMultiverseId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -315,6 +295,85 @@ public class WizardCardsImageSource implements CardImageSource {
|
|||
return setLinks;
|
||||
}
|
||||
|
||||
private Document getDocument(String urlString) throws NumberFormatException, IOException {
|
||||
Preferences prefs = MageFrame.getPreferences();
|
||||
Connection.ProxyType proxyType = Connection.ProxyType.valueByText(prefs.get("proxyType", "None"));
|
||||
Document doc;
|
||||
if (proxyType.equals(ProxyType.NONE)) {
|
||||
doc = Jsoup.connect(urlString).get();
|
||||
} else {
|
||||
String proxyServer = prefs.get("proxyAddress", "");
|
||||
int proxyPort = Integer.parseInt(prefs.get("proxyPort", "0"));
|
||||
URL url = new URL(urlString);
|
||||
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyServer, proxyPort));
|
||||
HttpURLConnection uc = (HttpURLConnection)url.openConnection(proxy);
|
||||
|
||||
uc.connect();
|
||||
|
||||
String line;
|
||||
StringBuffer tmp = new StringBuffer();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream()));
|
||||
while ((line = in.readLine()) != null) {
|
||||
tmp.append(line);
|
||||
}
|
||||
doc = Jsoup.parse(String.valueOf(tmp));
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
||||
private Map<String, String> getLandVariations(Integer multiverseId, String cardName) throws IOException, NumberFormatException {
|
||||
String urlLandDocument = "http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=" + multiverseId;
|
||||
Document landDoc = getDocument(urlLandDocument);
|
||||
Elements variations = landDoc.select("a.variationlink");
|
||||
Map<String, String> links = new HashMap<>();
|
||||
if(!variations.isEmpty()) {
|
||||
int landNumber = 1;
|
||||
for (Element variation : variations) {
|
||||
Integer landMultiverseId = Integer.parseInt(variation.attr("onclick").replaceAll("[^\\d]", ""));
|
||||
links.put((cardName + landNumber).toLowerCase(), generateLink(landMultiverseId));
|
||||
landNumber++;
|
||||
}
|
||||
} else {
|
||||
links.put(cardName.toLowerCase(), generateLink(multiverseId));
|
||||
}
|
||||
|
||||
return links;
|
||||
}
|
||||
|
||||
private static String generateLink(Integer landMultiverseId) {
|
||||
return "/Handlers/Image.ashx?multiverseid=" +landMultiverseId + "&type=card";
|
||||
}
|
||||
|
||||
private Integer getLocalizedMultiverseId(String preferedLanguage, Integer multiverseId) throws IOException {
|
||||
if (preferedLanguage.equals("en")) {
|
||||
return multiverseId;
|
||||
}
|
||||
|
||||
String languageName = languageAliases.get(preferedLanguage);
|
||||
HashMap<String, Integer> localizedLanguageIds = getlocalizedMultiverseIds(multiverseId);
|
||||
if (localizedLanguageIds.containsKey(languageName)) {
|
||||
return localizedLanguageIds.get(languageName);
|
||||
} else {
|
||||
return multiverseId;
|
||||
}
|
||||
}
|
||||
|
||||
private HashMap<String, Integer> getlocalizedMultiverseIds(Integer englishMultiverseId) throws IOException {
|
||||
String cardLanguagesUrl = "http://gatherer.wizards.com/Pages/Card/Languages.aspx?multiverseid=" + englishMultiverseId;
|
||||
Document cardLanguagesDoc = getDocument(cardLanguagesUrl);
|
||||
Elements languageTableRows = cardLanguagesDoc.select("tr.cardItem");
|
||||
HashMap<String, Integer> localizedIds = new HashMap<>();
|
||||
if(!languageTableRows.isEmpty()) {
|
||||
for (Element languageTableRow : languageTableRows) {
|
||||
Elements languageTableColumns = languageTableRow.select("td");
|
||||
Integer localizedId = Integer.parseInt(languageTableColumns.get(0).select("a").first().attr("href").replaceAll("[^\\d]", ""));
|
||||
String languageName = languageTableColumns.get(1).text().trim();
|
||||
localizedIds.put(languageName, localizedId);
|
||||
}
|
||||
}
|
||||
return localizedIds;
|
||||
}
|
||||
|
||||
private String normalizeName(String name) {
|
||||
//Split card
|
||||
if(name.contains("//")) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import javax.imageio.IIOImage;
|
||||
|
@ -571,6 +572,8 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
|
||||
// Logger.getLogger(this.getClass()).info(url.toString());
|
||||
URLConnection httpConn = url.openConnection(p);
|
||||
// images download from magiccards.info may not work with default 'User-Agent: Java/1.x.x' request header
|
||||
httpConn.setRequestProperty("User-Agent", UUID.randomUUID().toString());
|
||||
httpConn.connect();
|
||||
int responseCode = ((HttpURLConnection) httpConn).getResponseCode();
|
||||
if (responseCode == 200) {
|
||||
|
|
|
@ -41,9 +41,9 @@ import org.mage.plugins.card.utils.CardImageUtils;
|
|||
*/
|
||||
public class ImageCache {
|
||||
|
||||
private static final Logger log = Logger.getLogger(ImageCache.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(ImageCache.class);
|
||||
|
||||
private static final Map<String, BufferedImage> imageCache;
|
||||
private static final Map<String, BufferedImage> IMAGE_CACHE;
|
||||
|
||||
/**
|
||||
* Common pattern for keys. Format: "<cardname>#<setname>#<collectorID>"
|
||||
|
@ -51,7 +51,7 @@ public class ImageCache {
|
|||
private static final Pattern KEY_PATTERN = Pattern.compile("(.*)#(.*)#(.*)#(.*)#(.*)");
|
||||
|
||||
static {
|
||||
imageCache = new MapMaker().softValues().makeComputingMap(new Function<String, BufferedImage>() {
|
||||
IMAGE_CACHE = new MapMaker().softValues().makeComputingMap(new Function<String, BufferedImage>() {
|
||||
@Override
|
||||
public BufferedImage apply(String key) {
|
||||
try {
|
||||
|
@ -112,7 +112,7 @@ public class ImageCache {
|
|||
}
|
||||
}
|
||||
if (exists) {
|
||||
log.debug("loading thumbnail for " + key + ", path=" + thumbnailPath);
|
||||
LOGGER.debug("loading thumbnail for " + key + ", path=" + thumbnailPath);
|
||||
return loadImage(thumbnailFile);
|
||||
} else {
|
||||
BufferedImage image = loadImage(file);
|
||||
|
@ -120,7 +120,7 @@ public class ImageCache {
|
|||
if (image == null) {
|
||||
return null;
|
||||
}
|
||||
log.debug("creating thumbnail for " + key);
|
||||
LOGGER.debug("creating thumbnail for " + key);
|
||||
return makeThumbnail(image, thumbnailPath);
|
||||
}
|
||||
} else {
|
||||
|
@ -202,7 +202,7 @@ public class ImageCache {
|
|||
*/
|
||||
private static BufferedImage getImage(String key) {
|
||||
try {
|
||||
BufferedImage image = imageCache.get(key);
|
||||
BufferedImage image = IMAGE_CACHE.get(key);
|
||||
return image;
|
||||
} catch (NullPointerException ex) {
|
||||
// unfortunately NullOutputException, thrown when apply() returns
|
||||
|
@ -214,7 +214,7 @@ public class ImageCache {
|
|||
if (ex.getCause() instanceof NullPointerException) {
|
||||
return null;
|
||||
}
|
||||
log.error(ex, ex);
|
||||
LOGGER.error(ex, ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ public class ImageCache {
|
|||
}
|
||||
BufferedImage image = null;
|
||||
if (!file.exists()) {
|
||||
log.debug("File does not exist: " + file.toString());
|
||||
LOGGER.debug("File does not exist: " + file.toString());
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
|
@ -257,7 +257,7 @@ public class ImageCache {
|
|||
image = ImageIO.read(inputStream);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e, e);
|
||||
LOGGER.error(e, e);
|
||||
}
|
||||
|
||||
return image;
|
||||
|
@ -274,7 +274,7 @@ public class ImageCache {
|
|||
ImageIO.write(image, "jpg", outputStream);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error(e, e);
|
||||
LOGGER.error(e, e);
|
||||
imageFile.delete();
|
||||
}
|
||||
return image;
|
||||
|
@ -345,10 +345,10 @@ public class ImageCache {
|
|||
if (Constants.THUMBNAIL_SIZE_FULL.width + 10 > width) {
|
||||
return getThumbnail(card);
|
||||
}
|
||||
String key = getKey(card, card.getName(), "");
|
||||
String key = getKey(card, card.getName(), Integer.toString(width));
|
||||
BufferedImage original = getImage(key);
|
||||
if (original == null) {
|
||||
log.debug(key + " not found");
|
||||
LOGGER.debug(key + " not found");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ public class ImageCache {
|
|||
TFile file = new TFile(path);
|
||||
return file;
|
||||
} catch (NullPointerException ex) {
|
||||
log.warn("Imagefile does not exist: " + path);
|
||||
LOGGER.warn("Imagefile does not exist: " + path);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package org.mage.plugins.card.info;
|
||||
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.client.util.gui.GuiDisplayUtil.TextLines;
|
||||
import mage.components.CardInfoPane;
|
||||
|
@ -13,20 +13,43 @@ import mage.view.CardView;
|
|||
import org.mage.card.arcane.UI;
|
||||
|
||||
/**
|
||||
* Card info pane for displaying card rules.
|
||||
* Supports drawing mana symbols.
|
||||
* Card info pane for displaying card rules. Supports drawing mana symbols.
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
|
||||
|
||||
public static final int TOOLTIP_WIDTH_MIN = 160;
|
||||
|
||||
public static final int TOOLTIP_HEIGHT_MIN = 120;
|
||||
public static final int TOOLTIP_HEIGHT_MAX = 300;
|
||||
|
||||
public static final int TOOLTIP_BORDER_WIDTH = 80;
|
||||
|
||||
private CardView currentCard;
|
||||
private int type;
|
||||
|
||||
private int addWidth;
|
||||
private int addHeight;
|
||||
private boolean setSize = false;
|
||||
|
||||
public CardInfoPaneImpl() {
|
||||
UI.setHTMLEditorKit(this);
|
||||
setEditable(false);
|
||||
setBackground(Color.white);
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
addWidth = 20 * GUISizeHelper.cardTooltipFontSize - 50;
|
||||
addHeight = 12 * GUISizeHelper.cardTooltipFontSize - 20;
|
||||
setSize = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,8 +65,8 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
|
|||
try {
|
||||
if (!card.equals(currentCard)) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -70,20 +93,29 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
|
|||
return;
|
||||
}
|
||||
boolean makeBig = (rules > 5 || ruleLength > 350);
|
||||
if (setSize) {
|
||||
if (makeBig) {
|
||||
type = 0;
|
||||
} else {
|
||||
type = 1;
|
||||
}
|
||||
}
|
||||
if (makeBig && type == 0) {
|
||||
type = 1;
|
||||
container.setSize(
|
||||
org.mage.plugins.card.constants.Constants.TOOLTIP_WIDTH_MIN + org.mage.plugins.card.constants.Constants.TOOLTIP_BORDER_WIDTH,
|
||||
org.mage.plugins.card.constants.Constants.TOOLTIP_HEIGHT_MAX + org.mage.plugins.card.constants.Constants.TOOLTIP_BORDER_WIDTH
|
||||
addWidth + TOOLTIP_WIDTH_MIN + TOOLTIP_BORDER_WIDTH,
|
||||
addHeight + TOOLTIP_HEIGHT_MAX + TOOLTIP_BORDER_WIDTH
|
||||
);
|
||||
this.setSize(org.mage.plugins.card.constants.Constants.TOOLTIP_WIDTH_MIN, org.mage.plugins.card.constants.Constants.TOOLTIP_HEIGHT_MAX);
|
||||
this.setSize(addWidth + TOOLTIP_WIDTH_MIN,
|
||||
addHeight + TOOLTIP_HEIGHT_MAX);
|
||||
} else if (!makeBig && type == 1) {
|
||||
type = 0;
|
||||
container.setSize(
|
||||
org.mage.plugins.card.constants.Constants.TOOLTIP_WIDTH_MIN + org.mage.plugins.card.constants.Constants.TOOLTIP_BORDER_WIDTH,
|
||||
org.mage.plugins.card.constants.Constants.TOOLTIP_HEIGHT_MIN + org.mage.plugins.card.constants.Constants.TOOLTIP_BORDER_WIDTH
|
||||
addWidth + TOOLTIP_WIDTH_MIN + TOOLTIP_BORDER_WIDTH,
|
||||
addHeight + TOOLTIP_HEIGHT_MIN + TOOLTIP_BORDER_WIDTH
|
||||
);
|
||||
this.setSize(org.mage.plugins.card.constants.Constants.TOOLTIP_WIDTH_MIN, org.mage.plugins.card.constants.Constants.TOOLTIP_HEIGHT_MIN);
|
||||
this.setSize(addWidth + TOOLTIP_WIDTH_MIN,
|
||||
addHeight + TOOLTIP_HEIGHT_MIN);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
|Generate}TOK:OGW|Angel||
|
||||
#|Generate|TOK:SOI|Clue||
|
||||
#|Generate|TOK:SOI|Devil||
|
||||
#|Generate|TOK:SOI|Wolf||
|
||||
|
||||
|Generate|TOK:OGW|Angel||
|
||||
|Generate|TOK:OGW|Elemental|1|
|
||||
|Generate|TOK:OGW|Elemental|2|
|
||||
|Generate}TOK:OGW|Eldrazi Scion|1|
|
||||
|
@ -11,6 +15,9 @@
|
|||
|Generate|TOK:OGW|Zombie||
|
||||
|
||||
#|Generate|TOK:DDQ|Angel||
|
||||
#|Generate|TOK:DDQ|Human||
|
||||
#|Generate|TOK:DDQ|Spirit||
|
||||
#|Generate|TOK:DDQ|Zombie||
|
||||
|
||||
|Generate|TOK:C15|Angel||
|
||||
|Generate|TOK:C15|Bear||
|
||||
|
|
|
@ -64,6 +64,6 @@ ddd=gvl
|
|||
unh=uh
|
||||
dde=pvc
|
||||
# Remove setname as soon as the images can be downloaded
|
||||
ignore.urls=TOK, DDQ
|
||||
ignore.urls=TOK, DDQ, EMN, EMA
|
||||
# sets ordered by release time (newest goes first)
|
||||
token.lookup.order=DDQ,CP,CMA,ARENA,SUS,APAC,EURO,UGIN,C15,OGW,EXP,DDP,BFZ,FVD,FVE,FVL,FVR,V12,V13,V14,V15,TPR,MPRP,DD3,DDO,ORI,MM2,PTC,DTK,FRF,KTK,M15,VMA,CNS,JOU,BNG,THS,DDL,M14,MMA,DGM,GTC,RTR,M13,AVR,DDI,DKA,ISD,M12,NPH,MBS,SOM,M11,ROE,DDE,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK,GRC
|
||||
token.lookup.order=EMA, EMN,SOI,DDQ,CP,CMA,ARENA,SUS,APAC,EURO,UGIN,C15,OGW,EXP,DDP,BFZ,FVD,FVE,FVL,FVR,V12,V13,V14,V15,TPR,MPRP,DD3,DDO,ORI,MM2,PTC,DTK,FRF,KTK,M15,VMA,CNS,JOU,BNG,THS,DDL,M14,MMA,DGM,GTC,RTR,M13,AVR,DDI,DKA,ISD,M12,NPH,MBS,SOM,M11,ROE,DDE,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK,GRC
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-root</artifactId>
|
||||
<version>1.4.8</version>
|
||||
<version>1.4.9</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mage-common</artifactId>
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
package mage.interfaces.plugin;
|
||||
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.view.CardView;
|
||||
import mage.view.PermanentView;
|
||||
import net.xeoh.plugins.base.Plugin;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import javax.swing.*;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.view.CardView;
|
||||
import mage.view.PermanentView;
|
||||
import net.xeoh.plugins.base.Plugin;
|
||||
|
||||
/**
|
||||
* Interface for card plugins
|
||||
|
@ -23,20 +22,28 @@ import java.util.UUID;
|
|||
* @author nantuko
|
||||
*/
|
||||
public interface CardPlugin extends Plugin {
|
||||
|
||||
MagePermanent getMagePermanent(PermanentView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage);
|
||||
|
||||
MagePermanent getMageCard(CardView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage);
|
||||
|
||||
int sortPermanents(Map<String, JComponent> ui, Collection<MagePermanent> cards, Map<String, String> options);
|
||||
|
||||
/**
|
||||
* Download various symbols (mana, tap, set).
|
||||
*
|
||||
* @param imagesPath Path to check in and store symbols to. Can be null, in such case default path should be used.
|
||||
* @param imagesPath Path to check in and store symbols to. Can be null, in
|
||||
* such case default path should be used.
|
||||
*/
|
||||
void downloadSymbols(String imagesPath);
|
||||
|
||||
Image getManaSymbolImage(String symbol);
|
||||
void onAddCard(MagePermanent card, int count);
|
||||
|
||||
void onRemoveCard(MagePermanent card, int count);
|
||||
|
||||
JComponent getCardInfoPane();
|
||||
|
||||
BufferedImage getOriginalImage(CardView card);
|
||||
|
||||
void changeGUISize();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
|
|||
*/
|
||||
public final static int MAGE_VERSION_MAJOR = 1;
|
||||
public final static int MAGE_VERSION_MINOR = 4;
|
||||
public final static int MAGE_VERSION_PATCH = 8;
|
||||
public final static int MAGE_VERSION_PATCH = 9;
|
||||
public final static String MAGE_VERSION_MINOR_PATCH = "v0";
|
||||
public final static String MAGE_VERSION_INFO = "";
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ import mage.game.GameState;
|
|||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackAbility;
|
||||
|
@ -62,7 +63,7 @@ public class GameView implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger logger = Logger.getLogger(GameView.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(GameView.class);
|
||||
|
||||
private final int priorityTime;
|
||||
private final List<PlayerView> players = new ArrayList<>();
|
||||
|
@ -101,6 +102,9 @@ public class GameView implements Serializable {
|
|||
// Stack Ability
|
||||
MageObject object = game.getObject(stackObject.getSourceId());
|
||||
Card card = game.getCard(stackObject.getSourceId());
|
||||
if (card == null && (object instanceof PermanentCard)) {
|
||||
card = ((PermanentCard) object).getCard();
|
||||
}
|
||||
if (card != null) {
|
||||
if (object != null) {
|
||||
if (object instanceof Permanent) {
|
||||
|
@ -139,19 +143,17 @@ public class GameView implements Serializable {
|
|||
stack.put(stackObject.getId(),
|
||||
new StackAbilityView(game, (StackAbility) stackObject, object.getName(), cardView));
|
||||
checkPaid(stackObject.getId(), ((StackAbility) stackObject));
|
||||
} else if (object instanceof StackAbility) {
|
||||
StackAbility stackAbility = ((StackAbility) object);
|
||||
stackAbility.newId();
|
||||
stack.put(stackObject.getId(), new CardView(((StackAbility) stackObject)));
|
||||
checkPaid(stackObject.getId(), ((StackAbility) stackObject));
|
||||
} else {
|
||||
if (object instanceof StackAbility) {
|
||||
StackAbility stackAbility = ((StackAbility) object);
|
||||
stackAbility.newId();
|
||||
stack.put(stackObject.getId(), new CardView(((StackAbility) stackObject)));
|
||||
checkPaid(stackObject.getId(), ((StackAbility) stackObject));
|
||||
} else {
|
||||
logger.fatal("Object can't be cast to StackAbility: " + object.getName() + " " + object.toString() + " " + object.getClass().toString());
|
||||
}
|
||||
LOGGER.fatal("Object can't be cast to StackAbility: " + object.getName() + " " + object.toString() + " " + object.getClass().toString());
|
||||
}
|
||||
} else {
|
||||
// can happen if a player times out while ability is on the stack
|
||||
logger.debug("Stack Object for stack ability not found: " + stackObject.getStackAbility().getRule());
|
||||
LOGGER.debug("Stack Object for stack ability not found: " + stackObject.getStackAbility().getRule());
|
||||
}
|
||||
} else {
|
||||
// Spell
|
||||
|
@ -186,7 +188,7 @@ public class GameView implements Serializable {
|
|||
}
|
||||
if (isPlayer) {
|
||||
// has only to be set for active palyer with priority (e.g. pay mana by delve or Quenchable Fire special action)
|
||||
if (createdForPlayer != null && createdForPlayerId.equals(state.getPriorityPlayerId())) {
|
||||
if (createdForPlayer != null && createdForPlayerId != null && createdForPlayerId.equals(state.getPriorityPlayerId())) {
|
||||
this.special = state.getSpecialActions().getControlledBy(state.getPriorityPlayerId(), createdForPlayer.isInPayManaMode()).size() > 0;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -92,7 +92,8 @@ public class PlayerView implements Serializable {
|
|||
this.experience = player.getCounters().getCount(CounterType.EXPERIENCE);
|
||||
this.wins = player.getMatchPlayer().getWins();
|
||||
this.winsNeeded = player.getMatchPlayer().getWinsNeeded();
|
||||
this.deckHashCode = player.getMatchPlayer().getDeck().getDeckHashCode();
|
||||
// If match ended immediately before, deck can be set to null so check is necessarry here
|
||||
this.deckHashCode = player.getMatchPlayer().getDeck() != null ? player.getMatchPlayer().getDeck().getDeckHashCode() : 0;
|
||||
this.libraryCount = player.getLibrary().size();
|
||||
this.handCount = player.getHand().size();
|
||||
this.manaPool = new ManaPoolView(player.getManaPool());
|
||||
|
|
|
@ -62,6 +62,7 @@ public class TableView implements Serializable {
|
|||
private boolean isTournament;
|
||||
private List<SeatView> seats = new ArrayList<>();
|
||||
private List<UUID> games = new ArrayList<>();
|
||||
private final String quitRatio;
|
||||
|
||||
public TableView(Table table) {
|
||||
this.tableId = table.getId();
|
||||
|
@ -130,6 +131,7 @@ public class TableView implements Serializable {
|
|||
}
|
||||
this.additionalInfo = addInfo.toString();
|
||||
this.skillLevel = table.getMatch().getOptions().getSkillLevel();
|
||||
this.quitRatio = Integer.toString(table.getMatch().getOptions().getQuitRatio());
|
||||
} else {
|
||||
// TOURNAMENT
|
||||
if (table.getTournament().getOptions().getNumberRounds() > 0) {
|
||||
|
@ -176,6 +178,7 @@ public class TableView implements Serializable {
|
|||
this.tableStateText = stateText.toString();
|
||||
this.deckType = table.getDeckType() + " " + table.getTournament().getBoosterInfo() + (tableNameInfo != null ? tableNameInfo : "");
|
||||
this.skillLevel = table.getTournament().getOptions().getMatchOptions().getSkillLevel();
|
||||
this.quitRatio = Integer.toString(table.getTournament().getOptions().getQuitRatio());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,4 +233,7 @@ public class TableView implements Serializable {
|
|||
return skillLevel;
|
||||
}
|
||||
|
||||
public String getQuitRatio() {
|
||||
return quitRatio;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ public class TournamentPlayerView implements Serializable, Comparable {
|
|||
private final String name;
|
||||
private final String state;
|
||||
private final String results;
|
||||
private final String history;
|
||||
private final int points;
|
||||
private final boolean quit;
|
||||
|
||||
|
@ -57,6 +58,7 @@ public class TournamentPlayerView implements Serializable, Comparable {
|
|||
this.points = tournamentPlayer.getPoints();
|
||||
this.results = tournamentPlayer.getResults();
|
||||
this.quit = !tournamentPlayer.isInTournament();
|
||||
this.history = tournamentPlayer.getPlayer().getUserData().getHistory();
|
||||
this.flagName = tournamentPlayer.getPlayer().getUserData().getFlagName();
|
||||
}
|
||||
|
||||
|
@ -88,4 +90,9 @@ public class TournamentPlayerView implements Serializable, Comparable {
|
|||
public String getFlagName() {
|
||||
return flagName;
|
||||
}
|
||||
|
||||
public String getHistory() {
|
||||
return history;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,32 +35,32 @@ import mage.constants.PlayerAction;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class UserRequestMessage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final String titel;
|
||||
private final String message;
|
||||
private final PlayerAction requestAction;
|
||||
private UUID relatedUserId;
|
||||
private String relatedUserName;
|
||||
private UUID matchId;
|
||||
private UUID gameId;
|
||||
private final String titel;
|
||||
private final String message;
|
||||
private UUID relatedUserId;
|
||||
private String relatedUserName;
|
||||
private UUID matchId;
|
||||
private UUID tournamentId;
|
||||
private UUID gameId;
|
||||
private UUID roomId;
|
||||
private UUID tableId;
|
||||
|
||||
private String button1Text;
|
||||
private String button1Text;
|
||||
private PlayerAction button1Action;
|
||||
|
||||
private String button2Text;
|
||||
private String button2Text;
|
||||
private PlayerAction button2Action;
|
||||
|
||||
private String button3Text;
|
||||
private String button3Text;
|
||||
private PlayerAction button3Action;
|
||||
|
||||
|
||||
public UserRequestMessage(String titel, String message, PlayerAction requestAction) {
|
||||
public UserRequestMessage(String titel, String message) {
|
||||
this.titel = titel;
|
||||
this.message = message;
|
||||
this.requestAction = requestAction;
|
||||
this.button1Action = null;
|
||||
this.button2Action = null;
|
||||
this.button3Action = null;
|
||||
|
@ -88,6 +88,7 @@ public class UserRequestMessage implements Serializable {
|
|||
this.button2Text = text;
|
||||
this.button2Action = buttonAction;
|
||||
}
|
||||
|
||||
public void setButton3(String text, PlayerAction buttonAction) {
|
||||
this.button3Text = text;
|
||||
this.button3Action = buttonAction;
|
||||
|
@ -105,10 +106,6 @@ public class UserRequestMessage implements Serializable {
|
|||
return message;
|
||||
}
|
||||
|
||||
public PlayerAction getRequestAction() {
|
||||
return requestAction;
|
||||
}
|
||||
|
||||
public UUID getRelatedUserId() {
|
||||
return relatedUserId;
|
||||
}
|
||||
|
@ -125,6 +122,30 @@ public class UserRequestMessage implements Serializable {
|
|||
return gameId;
|
||||
}
|
||||
|
||||
public UUID getTournamentId() {
|
||||
return tournamentId;
|
||||
}
|
||||
|
||||
public void setTournamentId(UUID tournamentId) {
|
||||
this.tournamentId = tournamentId;
|
||||
}
|
||||
|
||||
public UUID getRoomId() {
|
||||
return roomId;
|
||||
}
|
||||
|
||||
public void setRoomId(UUID roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
public UUID getTableId() {
|
||||
return tableId;
|
||||
}
|
||||
|
||||
public void setTableId(UUID tableId) {
|
||||
this.tableId = tableId;
|
||||
}
|
||||
|
||||
public String getButton1Text() {
|
||||
return button1Text;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue