mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
@@ -20,4 +20,5 @@ public class SettingData {
|
||||
public Float cardTooltipAdjLandscape;
|
||||
public boolean dayNightBG;
|
||||
public boolean disableWinLose;
|
||||
public boolean showShopOverlay;
|
||||
}
|
||||
|
||||
@@ -477,7 +477,7 @@ public class RewardScene extends UIScene {
|
||||
lastRowXAdjust = ((numberOfColumns * cardWidth) - (lastRowCount * cardWidth)) / 2;
|
||||
}
|
||||
|
||||
RewardActor actor = new RewardActor(reward, type == Type.Loot || type == Type.QuestReward, type);
|
||||
RewardActor actor = new RewardActor(reward, type == Type.Loot || type == Type.QuestReward, type, type == Type.Shop && (numberOfRows > 2 || numberOfColumns > 2));
|
||||
|
||||
actor.setBounds(lastRowXAdjust + xOff + cardWidth * (i % numberOfColumns) + spacing, yOff + cardHeight * currentRow + spacing, cardWidth - spacing * 2, cardHeight - spacing * 2);
|
||||
|
||||
|
||||
@@ -213,6 +213,13 @@ public class SettingsScene extends UIScene {
|
||||
Config.instance().saveSettings();
|
||||
}
|
||||
});
|
||||
addSettingField(Forge.getLocalizer().getMessage("lblShowShopOverlay"), Config.instance().getSettingData().showShopOverlay, new ChangeListener() {
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
Config.instance().getSettingData().showShopOverlay = ((CheckBox) actor).isChecked();
|
||||
Config.instance().saveSettings();
|
||||
}
|
||||
});
|
||||
addCheckBox(Forge.getLocalizer().getMessage("lblCardName"), ForgePreferences.FPref.UI_OVERLAY_CARD_NAME);
|
||||
addSettingSlider(Forge.getLocalizer().getMessage("cbAdjustMusicVolume"), ForgePreferences.FPref.UI_VOL_MUSIC, 0, 100);
|
||||
addSettingSlider(Forge.getLocalizer().getMessage("cbAdjustSoundsVolume"), ForgePreferences.FPref.UI_VOL_SOUNDS, 0, 100);
|
||||
|
||||
@@ -392,7 +392,7 @@ public class SpellSmithScene extends UIScene {
|
||||
if (Current.player().getGold() < currentPrice) pullUsingGold.setDisabled(true);
|
||||
if (Current.player().getShards() < currentShardPrice) pullUsingShards.setDisabled(true);
|
||||
if (rewardActor != null) rewardActor.remove();
|
||||
rewardActor = new RewardActor(R, true, null);
|
||||
rewardActor = new RewardActor(R, true, null, true);
|
||||
rewardActor.flip(); //Make it flip so it draws visual attention, why not.
|
||||
rewardActor.setBounds(rewardDummy.getX(), rewardDummy.getY(), rewardDummy.getWidth(), rewardDummy.getHeight());
|
||||
stage.addActor(rewardActor);
|
||||
|
||||
@@ -380,6 +380,10 @@ public class Controls {
|
||||
return newTextraLabel(name, getTextraFont());
|
||||
}
|
||||
|
||||
public static TextraLabel newRewardLabel(String name) {
|
||||
return newTextraLabel(name, getRewardHeaderFont());
|
||||
}
|
||||
|
||||
public static String colorIdToTypingString(ColorSet color) {
|
||||
return colorIdToTypingString(color, false);
|
||||
}
|
||||
@@ -425,6 +429,10 @@ public class Controls {
|
||||
return Forge.getAssets().getTextraFont(getSkin().getFont("default"), Config.instance().getAtlas(Paths.ITEMS_ATLAS), Config.instance().getAtlas(Paths.PIXELMANA_ATLAS));
|
||||
}
|
||||
|
||||
static public Font getRewardHeaderFont() {
|
||||
return Forge.getAssets().getGenericHeaderFont(getSkin().getFont("default"));
|
||||
}
|
||||
|
||||
static public Font getTextraFont(String name) {
|
||||
return Forge.getAssets().getTextraFont(name, getSkin().getFont(name), Config.instance().getAtlas(Paths.ITEMS_ATLAS));
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.Group;
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Tooltip;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||
@@ -44,6 +45,7 @@ import forge.item.SealedProduct;
|
||||
import forge.sound.SoundEffectType;
|
||||
import forge.sound.SoundSystem;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.CardTranslation;
|
||||
import forge.util.ImageFetcher;
|
||||
import forge.util.ImageUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -75,6 +77,8 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
||||
private boolean hover, hasbackface;
|
||||
boolean loaded = true;
|
||||
boolean alternate = false, shown = false;
|
||||
boolean isRewardShop, showOverlay;
|
||||
TextraLabel overlayLabel;
|
||||
|
||||
public int renderedCount = 0; //Counter for cards that require rendering a preview.
|
||||
static final ImageFetcher fetcher = GuiBase.getInterface().getImageFetcher();
|
||||
@@ -173,9 +177,11 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
||||
Gdx.graphics.requestRendering();
|
||||
}
|
||||
|
||||
public RewardActor(Reward reward, boolean flippable, RewardScene.Type type) {
|
||||
public RewardActor(Reward reward, boolean flippable, RewardScene.Type type, boolean showOverlay) {
|
||||
this.flipOnClick = flippable;
|
||||
this.reward = reward;
|
||||
this.isRewardShop = RewardScene.Type.Shop.equals(type);
|
||||
this.showOverlay = showOverlay;
|
||||
if (backTexture == null) {
|
||||
backTexture = FSkin.getSleeves().get(0);
|
||||
}
|
||||
@@ -351,9 +357,8 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
||||
Sprite backSprite = Config.instance().getItemSprite("CardBack");
|
||||
Sprite item = Config.instance().getItemSprite(reward.type.toString());
|
||||
setItemTooltips(item, backSprite, false);
|
||||
boolean isShop = RewardScene.Type.Shop.equals(type);
|
||||
processSprite(backSprite, item, isShop ? null :
|
||||
Controls.newTextraLabel("[%200]" + reward.getCount() + " " + reward.type), 0, isShop ? 0 : -10, false);
|
||||
processSprite(backSprite, item, isRewardShop ? null :
|
||||
Controls.newTextraLabel("[%200]" + reward.getCount() + " " + reward.type), 0, isRewardShop ? 0 : -10, false);
|
||||
needsToBeDisposed = true;
|
||||
break;
|
||||
}
|
||||
@@ -752,11 +757,9 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
||||
oldProjectionTransform.set(batch.getProjectionMatrix());
|
||||
applyProjectionMatrix(batch);
|
||||
|
||||
|
||||
if (hover | hasKeyboardFocus())
|
||||
batch.setColor(0.5f, 0.5f, 0.5f, 1);
|
||||
|
||||
|
||||
if (!frontSideUp()) {
|
||||
if (flipOnClick) {
|
||||
batch.draw(backTexture, -getWidth() / 2, -getHeight() / 2, getWidth(), getHeight());
|
||||
@@ -766,9 +769,58 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
||||
} else {
|
||||
drawFrontSide(batch);
|
||||
}
|
||||
|
||||
batch.setColor(1, 1, 1, 1);
|
||||
resetTransform(batch);
|
||||
batch.setProjectionMatrix(oldProjectionTransform);
|
||||
|
||||
if (showOverlay && Config.instance().getSettingData().showShopOverlay) {
|
||||
if (overlayLabel == null) {
|
||||
setOverlayLabel();
|
||||
}
|
||||
if (overlayLabel != null) {
|
||||
overlayLabel.draw(batch, parentAlpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setOverlayLabel() {
|
||||
String display = "";
|
||||
int alignment = Align.top;
|
||||
String labelStyle = "background";
|
||||
if (reward == null)
|
||||
return;
|
||||
Reward.Type rewardType = reward.getType();
|
||||
switch (rewardType) {
|
||||
case Card:
|
||||
display = reward.getCard() != null ? CardTranslation.getTranslatedName(reward.getCard().getName()) : "";
|
||||
//alignment = Align.topLeft;
|
||||
labelStyle = "dialog";
|
||||
break;
|
||||
case Life:
|
||||
case Gold:
|
||||
case Shards:
|
||||
display = reward.type.toString();
|
||||
break;
|
||||
case Item:
|
||||
display = reward.getItem() != null ? reward.getItem().name : "";
|
||||
break;
|
||||
case CardPack:
|
||||
display = reward.getDeck() != null ? "Card Pack (" + reward.getDeck().getComment() + ")" : "";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
overlayLabel = Controls.newRewardLabel("[%98]" + display);
|
||||
overlayLabel.setWidth(this.getWidth());
|
||||
overlayLabel.setWrap(true);
|
||||
overlayLabel.setAlignment(alignment);
|
||||
overlayLabel.style = (Controls.getSkin().get(labelStyle, Label.LabelStyle.class));
|
||||
//compute layout
|
||||
overlayLabel.layout();
|
||||
//get the layout values and apply
|
||||
overlayLabel.setHeight(overlayLabel.layout.getHeight());
|
||||
overlayLabel.setPosition(this.getX(), (this.getY(Align.top) - overlayLabel.layout.getHeight()));
|
||||
}
|
||||
|
||||
private void drawFrontSide(Batch batch) {
|
||||
|
||||
@@ -383,6 +383,17 @@ public class Assets implements Disposable {
|
||||
return textrafonts.get(name);
|
||||
}
|
||||
|
||||
public Font getGenericHeaderFont(BitmapFont bitmapFont) {
|
||||
if (textrafonts == null)
|
||||
textrafonts = new ObjectMap<>();
|
||||
if (!textrafonts.containsKey("GenericHeaderFont")) {
|
||||
Font font = new Font(bitmapFont, 0f, -0.5f, 0f, -2.5f);
|
||||
font.integerPosition = false;
|
||||
textrafonts.put("GenericHeaderFont", font);
|
||||
}
|
||||
return textrafonts.get("GenericHeaderFont");
|
||||
}
|
||||
|
||||
public Music getMusic(FileHandle file) {
|
||||
if (file == null || !file.exists() || !FileType.Absolute.equals(file.type())) {
|
||||
System.err.println("Failed to load: " + file + "!.");
|
||||
|
||||
@@ -2984,6 +2984,7 @@ lblChangelog=Änderungen
|
||||
lblToken=Spielstein
|
||||
lblBackToAdventure=Zurück zum Abenteuer
|
||||
lblDisableWinLose=Deaktivieren Sie Winslose Overlay
|
||||
lblShowShopOverlay=Shop -Artikelname anzeigen
|
||||
lblExitToWoldMap=Zurück zur Weltkarte?
|
||||
lblStartArena=Willst du in die Arena gehen?
|
||||
lblWouldYouLikeDestroy=Möchten Sie {0} zerstören?
|
||||
|
||||
@@ -2996,6 +2996,7 @@ lblBackToAdventure=Back to Adventure
|
||||
lblQuitAdventureEventMatch=Quit Match (will count as a loss)
|
||||
lblQuitAdventureEvent=You have matches left to play!\nLeaving the event early will forfeit your potential future winnings.\nYou will still receive winnings as if you conceded your remaining matches.\n\nWould you still like to quit the event?
|
||||
lblDisableWinLose=Disable WinLose Overlay
|
||||
lblShowShopOverlay=Display Shop Item names
|
||||
lblExitToWoldMap=Exit to the World Map?
|
||||
lblStartArena=Do you want to go into the Arena?
|
||||
lblWouldYouLikeDestroy=Would you like to destroy {0}?
|
||||
|
||||
@@ -2987,6 +2987,7 @@ lblChangelog=Cambios
|
||||
lblToken=Simbólico
|
||||
lblBackToAdventure=Volver a la aventura
|
||||
lblDisableWinLose=Desactivar WinLose Overlay
|
||||
lblShowShopOverlay=Nombre del artículo de la tienda de exhibición
|
||||
lblExitToWoldMap=Salir al mapa del mundo?
|
||||
lblStartArena=¿Quieres ir a la arena?
|
||||
lblWouldYouLikeDestroy=¿Le gustaría destruir {0}?
|
||||
|
||||
@@ -2991,6 +2991,7 @@ lblChangelog=Changements
|
||||
lblToken=Jeton
|
||||
lblBackToAdventure=Retour à l'aventure
|
||||
lblDisableWinLose=Désactiver la superposition Winlose
|
||||
lblShowShopOverlay=Nom de l'article de la boutique d'affichage
|
||||
lblExitToWoldMap=Sortir sur la carte du monde?
|
||||
lblStartArena=Voulez-vous entrer dans l''arène?
|
||||
lblWouldYouLikeDestroy=Souhaitez-vous détruire {0}?
|
||||
|
||||
@@ -2990,6 +2990,7 @@ lblChangelog=I cambiamenti
|
||||
lblToken=Gettone
|
||||
lblBackToAdventure=Torna all'avventura
|
||||
lblDisableWinLose=Disabilita overlay winlose
|
||||
lblShowShopOverlay=Visualizza il nome dell'articolo del negozio
|
||||
lblExitToWoldMap=Esci alla mappa del mondo?
|
||||
lblStartArena=Vuoi andare nell''arena?
|
||||
lblWouldYouLikeDestroy=Vorresti distruggere {0}?
|
||||
|
||||
@@ -2986,6 +2986,7 @@ lblChangelog=変更
|
||||
lblToken=トークン
|
||||
lblBackToAdventure=冒険に戻ります
|
||||
lblDisableWinLose=Winloseオーバーレイを無効にします
|
||||
lblShowShopOverlay=ショップアイテム名を表示します
|
||||
lblExitToWoldMap=世界地図に終了しますか?
|
||||
lblStartArena=アリーナに行きたいですか?
|
||||
lblWouldYouLikeDestroy={0}を破壊しますか?
|
||||
|
||||
@@ -3076,6 +3076,7 @@ lblChangelog=Mudanças
|
||||
lblToken=Símbolo
|
||||
lblBackToAdventure=De volta à aventura
|
||||
lblDisableWinLose=Desative a sobreposição de Winlose
|
||||
lblShowShopOverlay=Nome do item da loja de exibição
|
||||
lblExitToWoldMap=Sair para o mapa do mundo?
|
||||
lblStartArena=Você quer entrar na arena?
|
||||
lblWouldYouLikeDestroy=Você gostaria de destruir {0}?
|
||||
|
||||
@@ -2974,6 +2974,7 @@ lblChangelog=变化
|
||||
lblToken=令牌
|
||||
lblBackToAdventure=回到冒险
|
||||
lblDisableWinLose=禁用Winlose覆盖
|
||||
lblShowShopOverlay=展示商店项目名称
|
||||
lblExitToWoldMap=退出世界地图?
|
||||
lblStartArena=您想进入竞技场吗?
|
||||
lblWouldYouLikeDestroy=您想销毁{0}吗?
|
||||
|
||||
Reference in New Issue
Block a user