mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Refactor/Code Cleanup
This commit is contained in:
@@ -11,7 +11,7 @@ public enum AbilityEffect {
|
||||
private GifAnimation animation;
|
||||
private AudioClip soundClip;
|
||||
|
||||
private AbilityEffect(String gif0, String wav0) {
|
||||
AbilityEffect(String gif0, String wav0) {
|
||||
gif = gif0;
|
||||
wav = wav0;
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ public class GifDecoder {
|
||||
if (frameCount <= 0)
|
||||
return null;
|
||||
n = n % frameCount;
|
||||
return ((GifFrame) frames.elementAt(n)).image;
|
||||
return frames.elementAt(n).image;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -692,7 +692,7 @@ public class GifDecoder {
|
||||
Pixmap frame = getFrame(0);
|
||||
int width = frame.getWidth();
|
||||
int height = frame.getHeight();
|
||||
int vzones = (int)Math.sqrt((double)nrFrames);
|
||||
int vzones = (int)Math.sqrt(nrFrames);
|
||||
int hzones = vzones;
|
||||
|
||||
while(vzones * hzones < nrFrames) vzones++;
|
||||
|
||||
@@ -40,12 +40,12 @@ import com.badlogic.gdx.utils.Array;
|
||||
public class BitmapFontWriter {
|
||||
|
||||
/** The output format. */
|
||||
public static enum OutputFormat {
|
||||
public enum OutputFormat {
|
||||
|
||||
/** AngelCodeFont text format */
|
||||
Text,
|
||||
/** AngelCodeFont XML format */
|
||||
XML;
|
||||
XML
|
||||
}
|
||||
|
||||
/** The output format */
|
||||
|
||||
@@ -291,7 +291,7 @@ public class CardZoom extends FOverlay {
|
||||
protected void doLayout(float width, float height) {
|
||||
}
|
||||
|
||||
public static interface ActivateHandler {
|
||||
public interface ActivateHandler {
|
||||
String getActivateAction(int index);
|
||||
void setSelectedIndex(int index);
|
||||
void activate(int index);
|
||||
|
||||
@@ -135,7 +135,7 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
|
||||
return controller;
|
||||
}
|
||||
|
||||
private EditorType(DeckController<? extends DeckBase> controller0, Predicate<PaperCard> cardFilter0) {
|
||||
EditorType(DeckController<? extends DeckBase> controller0, Predicate<PaperCard> cardFilter0) {
|
||||
controller = controller0;
|
||||
cardFilter = cardFilter0;
|
||||
}
|
||||
|
||||
@@ -901,10 +901,7 @@ public abstract class ItemManager<T extends InventoryItem> extends FContainer im
|
||||
@Override
|
||||
protected boolean hideBackdropOnPress(float x, float y) {
|
||||
Rectangle bounds = currentView.getSelectionBounds();
|
||||
if (bounds == null || bounds.contains(x, y)) {
|
||||
return false; //don't hide on press if within selection bounds
|
||||
}
|
||||
return true;
|
||||
return bounds != null && !bounds.contains(x, y); //don't hide on press if within selection bounds
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -187,10 +187,7 @@ public abstract class FDropDown extends FScrollPane {
|
||||
|
||||
protected boolean hideBackdropOnPress(float x, float y) {
|
||||
FDisplayObject owner = getDropDownOwner();
|
||||
if (owner == null || !owner.screenPos.contains(x, y)) {
|
||||
return true; //auto-hide when backdrop pressed unless over owner
|
||||
}
|
||||
return false;
|
||||
return owner == null || !owner.screenPos.contains(x, y); //auto-hide when backdrop pressed unless over owner
|
||||
}
|
||||
|
||||
protected boolean preventOwnerHandlingBackupTap(float x, float y, int count) {
|
||||
|
||||
@@ -71,9 +71,6 @@ public abstract class FDropDownMenu extends FDropDown {
|
||||
@Override
|
||||
public boolean tap(float x, float y, int count) {
|
||||
super.tap(x, y, count);
|
||||
if (getDropDownOwner() instanceof FSubMenu) {
|
||||
return false; //return false so owning sub menu can be hidden
|
||||
}
|
||||
return true;
|
||||
return !(getDropDownOwner() instanceof FSubMenu); //return false so owning sub menu can be hidden
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,7 +719,7 @@ public class PlayerPanel extends FContainer {
|
||||
public Set<AIOption> getAiOptions() {
|
||||
return isSimulatedAi()
|
||||
? ImmutableSet.of(AIOption.USE_SIMULATION)
|
||||
: Collections.<AIOption>emptySet();
|
||||
: Collections.emptySet();
|
||||
}
|
||||
private boolean isSimulatedAi() {
|
||||
return isAi() && useAiSimulation;
|
||||
|
||||
@@ -82,8 +82,7 @@ public class NewGauntletScreen extends LaunchScreen {
|
||||
if (numOpponents == null) { return; }
|
||||
|
||||
ListChooser<DeckType> chooser = new ListChooser<DeckType>(
|
||||
"Choose allowed deck types for opponents", 0, 11, Arrays.asList(new DeckType[] {
|
||||
DeckType.CUSTOM_DECK,
|
||||
"Choose allowed deck types for opponents", 0, 11, Arrays.asList(DeckType.CUSTOM_DECK,
|
||||
DeckType.PRECONSTRUCTED_DECK,
|
||||
DeckType.QUEST_OPPONENT_DECK,
|
||||
DeckType.COLOR_DECK,
|
||||
@@ -93,8 +92,7 @@ public class NewGauntletScreen extends LaunchScreen {
|
||||
DeckType.MODERN_CARDGEN_DECK,
|
||||
DeckType.LEGACY_CARDGEN_DECK,
|
||||
DeckType.VINTAGE_CARDGEN_DECK,
|
||||
DeckType.THEME_DECK
|
||||
}), null, new Callback<List<DeckType>>() {
|
||||
DeckType.THEME_DECK), null, new Callback<List<DeckType>>() {
|
||||
@Override
|
||||
public void run(final List<DeckType> allowedDeckTypes) {
|
||||
if (allowedDeckTypes == null || allowedDeckTypes.isEmpty()) { return; }
|
||||
|
||||
@@ -32,7 +32,7 @@ public class LoadGameMenu extends FPopupMenu {
|
||||
private final Class<? extends FScreen> screenClass;
|
||||
private FScreen screen;
|
||||
|
||||
private LoadGameScreen(final String caption0, final FImage icon0, final Class<? extends FScreen> screenClass0) {
|
||||
LoadGameScreen(final String caption0, final FImage icon0, final Class<? extends FScreen> screenClass0) {
|
||||
screenClass = screenClass0;
|
||||
item = new FMenuItem(caption0, icon0, new FEventHandler() {
|
||||
@Override
|
||||
|
||||
@@ -36,7 +36,7 @@ public class NewGameMenu extends FPopupMenu {
|
||||
private final Class<? extends FScreen> screenClass;
|
||||
private FScreen screen;
|
||||
|
||||
private NewGameScreen(final String caption0, final FImage icon0, final Class<? extends FScreen> screenClass0) {
|
||||
NewGameScreen(final String caption0, final FImage icon0, final Class<? extends FScreen> screenClass0) {
|
||||
screenClass = screenClass0;
|
||||
item = new FMenuItem(caption0, icon0, new FEventHandler() {
|
||||
@Override
|
||||
|
||||
@@ -325,7 +325,7 @@ public class VStack extends FDropDown {
|
||||
CardZoom.show(stackInstance.getSourceCard());
|
||||
}
|
||||
}));
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
menu.show(this, x, y);
|
||||
|
||||
@@ -21,7 +21,7 @@ public class OnlineMenu extends FPopupMenu {
|
||||
private final Class<? extends FScreen> screenClass;
|
||||
private FScreen screen;
|
||||
|
||||
private OnlineScreen(final String caption0, final FImage icon0, final Class<? extends FScreen> screenClass0) {
|
||||
OnlineScreen(final String caption0, final FImage icon0, final Class<? extends FScreen> screenClass0) {
|
||||
screenClass = screenClass0;
|
||||
item = new FMenuItem(caption0, icon0, new FEventHandler() {
|
||||
@Override
|
||||
|
||||
@@ -74,9 +74,6 @@ public class AudioClip implements IAudioClip {
|
||||
}
|
||||
|
||||
public final boolean isDone() {
|
||||
if (clip == null) {
|
||||
return false;
|
||||
}
|
||||
return true; //TODO: Make this smarter if Sound supports marking as done
|
||||
return clip != null;//TODO: Make this smarter if Sound supports marking as done
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public abstract class FDialog extends FOverlay {
|
||||
|
||||
public boolean isButtonEnabled(int index) {
|
||||
FButton button = getButton(index);
|
||||
return button != null ? button.isEnabled() : false;
|
||||
return button != null && button.isEnabled();
|
||||
}
|
||||
|
||||
public void setButtonEnabled(int index, boolean enabled) {
|
||||
@@ -283,9 +283,7 @@ public abstract class FDialog extends FOverlay {
|
||||
if (revealPercent != newRevealPercent) {
|
||||
revealPercent = newRevealPercent;
|
||||
updateDisplayTop();
|
||||
if (physicsObj.isMoving()) {
|
||||
return true;
|
||||
}
|
||||
return physicsObj.isMoving();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class FEvent {
|
||||
return args;
|
||||
}
|
||||
|
||||
public static interface FEventHandler {
|
||||
public interface FEventHandler {
|
||||
void handleEvent(FEvent e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,9 +232,7 @@ public abstract class FScrollPane extends FContainer {
|
||||
if (physicsObj.isMoving()) { //avoid storing last fling stop time if scroll manually stopped
|
||||
physicsObj.advance(dt);
|
||||
Vector2 pos = physicsObj.getPosition();
|
||||
if (setScrollPositions(pos.x, pos.y) && physicsObj.isMoving()) {
|
||||
return true;
|
||||
}
|
||||
return setScrollPositions(pos.x, pos.y) && physicsObj.isMoving();
|
||||
}
|
||||
|
||||
//end fling animation if can't scroll anymore or physics object is no longer moving
|
||||
|
||||
Reference in New Issue
Block a user