I used Intellij IDEA to automatically refactor code to achive 3 goals.
1) get rid of anonymouse classes, and replace the with lamba to get more readeable and clean code (like in TableWaitingDialog).
2) make effectively final variables actually final to avoid inadvertent changes on it in further releases and keep objects as immutable, as possible.
3) Get rid of unused imports (most of the changes) in whole project classes.
Checking if image exist or not now parallel. It took 35-39 seconds to perform, now it takes 13-16 seconds. Planning to make all class method concurrent and reduce client loading time even more.
Images on magidex are referenced by url-escaped card name, so the
implementation was straightforward. Flipped and Two-faced cards didn’t
require any additional work to support.
I downloaded all the images, and the only missing cards I could see
were tokens. Seems to work pretty well.
Fixes issue #2153
* Fixed cards being blurry. The problem isn't completely fixed, but the fix will suffice in most cases. Card Images are only loaded in once, and the cards were loaded in initially at a small size instead of their eventual size after layout. Really they should reload images when resized, but I will tackle that later, and it's only noticable when significantly resizing cards within one usage of the editor anyways.
* Removed some of the unneeded UI on the sideboard half of the DeckView so that componently are less likely to overlap at a small size. Not sure how to ideally handle this, as Swing doesn't really provide an elegant way to hide components at small sizes, and I'm sure the user would rather the components overlap than be unable to resize the window as small as they want due to a minimum size requirement.
* Shift-Click / Shift-Drag now work as expected as far as multi-selection
* Deck editor saves split pane split positions
* Card layout and sort settings are now saved along side the a deck when saving to the .dck format, so that you have back the exact same deck layout when you re-load the deck.
* Fixed the symbol image downloader to work around some of the large-size symbol images being missing on gatherer. Falls back to the medium sized images currently for those symbols.
* On specific platforms (it seems Windows 7-10, JRT 7+), under our specific configuration, in the case where the user selects the exact same file as they chose during a previous selection, JFileChooser reports that the user selected a file, but returns chosen file = null. This commit works around that by assuming they chose the same file as last time in that case.
* Working standalone proof-of-concept application in DragCardGrid.
* Still needs listener functionality in order to integrate it into the existing DeckEditorPanel class.
* Rather than respecting the spacing setting from Preferences, the spacing is now calculated from the card size if characteristic based rendering is enabled, since from the renderer we know exactly what spacing is actually needed.
* Simply invalidating the image render is not enough, a repaint call is also needed in a few cases where a repaint hadn't already been scheduled by the same change that trigged the selectable/chosen status change.
* Turns out that drawing black borders on non-rendered cards, while it fixes what was probably a bug, has unintentional and undesirable implications. Needs further work in the future, but revert it for now.
* Basic lands have the mana symbol in their textbox rather than their actual text. That was erroneously being applied to other permanents like Elvish Mystics with only a single mana adding ability as text.
* Deck area orientation now changes depending on the context.
* In free building and sideboarding, the sideboard and maindeck are shown side by side.
* In limited deckbuilding, the sideboard (with your limited pool) is shown above the maindeck.
* Vehicles are rendered with a vehicle background and changed P/T box color
* Kaladesh Inventions are rendered with the invention frame
* Kaladesh Inventions use the full-frame art if they detect that you have that full art downloaded instead of normal card images.
* Changed land text-box colors to be a bit more saturated to make it clearer what colors they produce
* Added mana symbol in the textbox of basic lands instead of rules text as long as they have no additional abilities.
* Fixed problem with triggered abilities on the stack showing up with a type of "??? Ability". Not sure what the real cause is but those abilities have abilityType = null, just worked around it.
* Changed card rules text rendering to use 5 total possible text sizes to better support HD+ display resolutions.
* Made a P/T box be shown on vehicles.
* Small bugfixes, fixing crashes when characteristics like type line or name are missing for whatever reason.
* The problem was that they key for caching rendered cards did not take into account the full art / not full artness of the cards, so when someone has both full art and non-full art variants of a land from the same set it one would override the other.
* Added "frameStyle" tagging to relevant full art lands (ZEN, BFZ, UNG, UHG)
* Added support for rendering based off of frameStyle
* Outstanding bug that frameStyle doesn't seem to be replicated exactly properly
* Changed CardPanelRenderImpl to correctly invalidate its render when its panel has its isChoosable / isSelected override set. Before things like selecting cards in a draft view would not visibly have an effect as the render wasn't invalidated.
* Changed Name and Type line rendering to use Arial / Arial Narrow instead of Beleren. At small font sizes, those fonts are much more readable.
* The P/T box still uses the Beleren font, as the numbers in that font are quite readable even at small sizes.
* Changed the name / type lines to switch between Arial and Arial Narrow depending on whether there is space available using Arial or not.
* Fixed a small graphical mispositioning in rendering of keyword abilities.
* Added an option to hide set symbols entirely when rendering.
* Fixed flip walkers like Arlin Kord showing a "0" loyalty on their back face (when they should have no loyalty there).
* Removed some log files I accidentally committed.
* Fixed a bug in tokens, where they are missing their expansion symbol of they are created by another token
* Fixed the the new Rendering based CardPanel not returning the correct Image through getImage (resulting in a poor quality image in the card preview window)
In most cases, it is not useful to hold priority after doing something,
since the spell or ability added to the stack can just be performed
beforehand.
Hence, automatically passing priority is the only comfortable setting.
However, in some cases it is useful (chiefly for Infernal Tutor +
Lion's Eye Diamond and similar interaction), and currently players
have to open Preferences, change the option and then change it back
whenever they need to hold priority, which is very annoying.
This change allows to temporarily hold priority by simply holding
Control while performing an action, which solves the issue in a
manner similar to other clients.
A "Hold" indicator next to the spells cast indicator is displayed so
that the user knows his Control key holding was registered.
The code works by adding a new HOLD_PRIORITY player action that causes
the automatic priority pass options to be ignored until the player is
given priority again.
The client sends the message whenever it's not already holding priority
and Ctrl+click/space/enter happens anywhere.
This is somewhat "loose" as it means that Ctrl+click on the background
also holds priority, but this might actually be desirable and it greatly
simplifies the code, since only a global AWT event listener is required,
and there is no need to change every place in the code that could add
something to the stack.
It is also possible to hold priority and stop holding priority using
the context menu.
Skips everything until next turn, except for declare attackers and blockers.
F11 and F9 are a better design, but F6 is provided for compatibility with
established conventions.
There is currently no GUI button for it.
All the current behavior of ScaledImagePanel seems to be useless, since the source
images are static, so we can just use the highest quality scaling possible and
cache the result using TransformedImageCache.
RotatedResizedImageCache and MultiRotatedResizedImageCache contain the caching
machinery.
A cache of rotated and resized images is added to ImageCache, and is used by
the resizing functions there.
All the resizing and rotation functions in ImageHelper are redirected to the
ones in ImageCache.
This is slightly inefficient because it will cache some calls that are never
repeated, but it prevents developers from mistakenly using uncached functions
when calls are repeated, seriously impacting performance.
Also resizing functions that only take a width or an height have been removed,
and their calls fixed to provide the other dimension. It's still possible to
specify -1 as width or height to ignore constraints in that dimension, though.
Greatly speeds up UI performance.
Audio threads are busy while the sound plays, which could be several seconds,
potentially stalling other tasks competing for the thread pool.
So use a dedicated thread pool, which also allows to have it sized based
on the number of the audio lines.
The current code is broken, can't touch the UI in a thread pool thread,
UI.invokeLater must be used to get back on the UI thread.
Also, it must check whether the card has been changed again before setting
the image and do nothing in that case.
This commit makes passworded a first class property of
TableView as well as adds filtering capabilities
of open and passworded games. Useful for hiding
passworded games when looking for open play and
useful for hiding open games when playing vs
a friend on a busy server.
Currently they are not recognized, because getClickCount() will be
higher than 2 since Java interprets them as quadruple, sextuple, etc. clicks.
So, instead of checking for getClickCount() == 2, check for getClickCount()
being an even number.
This allows to quickly remove or add many cards to a deck.