mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Merge pull request #1271 from kevlahnota/master
setting for card display/tooltip on adventure rewards/shops
This commit is contained in:
@@ -14,4 +14,6 @@ public class SettingData {
|
||||
public boolean fullScreen;
|
||||
public String videomode;
|
||||
public String lastActiveSave;
|
||||
public Float rewardCardAdj;
|
||||
public Float cardTooltipAdj;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import forge.adventure.player.AdventurePlayer;
|
||||
import forge.adventure.pointofintrest.PointOfInterestChanges;
|
||||
import forge.adventure.stage.GameHUD;
|
||||
import forge.adventure.util.CardUtil;
|
||||
import forge.adventure.util.Config;
|
||||
import forge.adventure.util.Current;
|
||||
import forge.adventure.util.Reward;
|
||||
import forge.adventure.util.RewardActor;
|
||||
@@ -228,17 +229,21 @@ public class RewardScene extends UIScene {
|
||||
mul *= 0.8f;
|
||||
}
|
||||
cardHeight = bestCardHeight * 0.90f ;
|
||||
if (realX > x || realY > y) {
|
||||
mul *= Forge.isLandscapeMode() ? 0.95f : 1.05f;
|
||||
if (Config.instance().getSettingData().rewardCardAdj != 1f) {
|
||||
mul *= Config.instance().getSettingData().rewardCardAdj;
|
||||
} else {
|
||||
//immersive | no navigation and/or showing cutout cam
|
||||
if (fW/fH > 2.2f)
|
||||
mul *= Forge.isLandscapeMode() ? 1.1f : 1.6f;
|
||||
else if (fW/fH >= 2.1f)
|
||||
mul *= Forge.isLandscapeMode() ? 1.05f : 1.5f;
|
||||
else if (fW/fH >= 2f)
|
||||
mul *= Forge.isLandscapeMode() ? 1f : 1.4f;
|
||||
if (realX > x || realY > y) {
|
||||
mul *= Forge.isLandscapeMode() ? 0.95f : 1.05f;
|
||||
} else {
|
||||
//immersive | no navigation and/or showing cutout cam
|
||||
if (fW/fH > 2.2f)
|
||||
mul *= Forge.isLandscapeMode() ? 1.1f : 1.6f;
|
||||
else if (fW/fH >= 2.1f)
|
||||
mul *= Forge.isLandscapeMode() ? 1.05f : 1.5f;
|
||||
else if (fW/fH >= 2f)
|
||||
mul *= Forge.isLandscapeMode() ? 1f : 1.4f;
|
||||
|
||||
}
|
||||
}
|
||||
cardWidth = (cardHeight / CARD_WIDTH_TO_HEIGHT)*mul;
|
||||
|
||||
|
||||
@@ -188,6 +188,34 @@ public class SettingsScene extends UIScene {
|
||||
});
|
||||
addLabel(Forge.getLocalizer().getMessage("lblVideoMode"));
|
||||
settingGroup.add(videomode).align(Align.right).pad(2);
|
||||
}
|
||||
SelectBox rewardCardAdj = Controls.newComboBox(new Float[]{0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.8f, 1.9f, 2f}, Config.instance().getSettingData().rewardCardAdj, new Function<Object, Void>() {
|
||||
@Override
|
||||
public Void apply(Object o) {
|
||||
Float val = (Float) o;
|
||||
if (val == null || val == 0f)
|
||||
val = 1f;
|
||||
Config.instance().getSettingData().rewardCardAdj = val;
|
||||
Config.instance().saveSettings();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
addLabel("Reward/Shop Card Display Ratio");
|
||||
settingGroup.add(rewardCardAdj).align(Align.right).pad(2);
|
||||
SelectBox tooltipAdj = Controls.newComboBox(new Float[]{0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.8f, 1.9f, 2f}, Config.instance().getSettingData().cardTooltipAdj, new Function<Object, Void>() {
|
||||
@Override
|
||||
public Void apply(Object o) {
|
||||
Float val = (Float) o;
|
||||
if (val == null || val == 0f)
|
||||
val = 1f;
|
||||
Config.instance().getSettingData().cardTooltipAdj = val;
|
||||
Config.instance().saveSettings();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
addLabel("Reward/Shop Card Tooltip Ratio");
|
||||
settingGroup.add(tooltipAdj).align(Align.right).pad(2);
|
||||
if (!GuiBase.isAndroid()) {
|
||||
addSettingField(Forge.getLocalizer().getMessage("lblFullScreen"), Config.instance().getSettingData().fullScreen, new ChangeListener() {
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
@@ -202,6 +230,19 @@ public class SettingsScene extends UIScene {
|
||||
}
|
||||
});
|
||||
}
|
||||
addSettingField(Forge.getLocalizer().getMessage("lblFullScreen"), Config.instance().getSettingData().fullScreen, new ChangeListener() {
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
boolean value = ((CheckBox) actor).isChecked();
|
||||
Config.instance().getSettingData().fullScreen = value;
|
||||
Config.instance().saveSettings();
|
||||
//update
|
||||
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_FULLSCREEN_MODE) != value) {
|
||||
FModel.getPreferences().setPref(ForgePreferences.FPref.UI_LANDSCAPE_MODE, value);
|
||||
FModel.getPreferences().save();
|
||||
}
|
||||
}
|
||||
});
|
||||
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);
|
||||
|
||||
@@ -64,6 +64,12 @@ public class Config {
|
||||
}
|
||||
if(settingsData.videomode == null || settingsData.videomode.isEmpty())
|
||||
settingsData.videomode="720p";
|
||||
//reward card display fine tune
|
||||
if(settingsData.rewardCardAdj == null || settingsData.rewardCardAdj == 0f)
|
||||
settingsData.rewardCardAdj=1f;
|
||||
//tooltip fine tune
|
||||
if(settingsData.cardTooltipAdj == null || settingsData.cardTooltipAdj == 0f)
|
||||
settingsData.cardTooltipAdj=1f;
|
||||
|
||||
this.plane = settingsData.plane;
|
||||
currentConfig = this;
|
||||
|
||||
@@ -52,6 +52,27 @@ public class Controls {
|
||||
return ret;
|
||||
}
|
||||
|
||||
static public SelectBox newComboBox(Float[] text, float item, Function<Object, Void> func) {
|
||||
SelectBox ret = new SelectBox<Float>(GetSkin());
|
||||
ret.getStyle().listStyle.selection.setTopHeight(4);
|
||||
ret.setItems(text);
|
||||
ret.addListener(new ChangeListener() {
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
try {
|
||||
func.apply(((SelectBox) actor).getSelected());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
func.apply(item);
|
||||
ret.getList().setAlignment(Align.center);
|
||||
ret.setSelected(item);
|
||||
ret.setAlignment(Align.right);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static public TextField newTextField(String text) {
|
||||
return new TextField(text, GetSkin());
|
||||
}
|
||||
|
||||
@@ -361,12 +361,16 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
||||
float fW = x > y ? x : y;
|
||||
float fH = x > y ? y : x;
|
||||
float mul = fW/fH < AR ? AR/(fW/fH) : (fW/fH)/AR;
|
||||
if (fW/fH >= 2f) {//tall display
|
||||
mul = (fW/fH) - ((fW/fH)/AR);
|
||||
if ((fW/fH) >= 2.1f && (fW/fH) < 2.2f)
|
||||
mul *= 0.9f;
|
||||
else if ((fW/fH) > 2.2f) //ultrawide 21:9 Galaxy Fold, Huawei X2, Xperia 1
|
||||
mul *= 0.8f;
|
||||
if (Config.instance().getSettingData().cardTooltipAdj != 1f) {
|
||||
mul *= Config.instance().getSettingData().cardTooltipAdj;
|
||||
} else {
|
||||
if (fW/fH >= 2f) {//tall display
|
||||
mul = (fW/fH) - ((fW/fH)/AR);
|
||||
if ((fW/fH) >= 2.1f && (fW/fH) < 2.2f)
|
||||
mul *= 0.9f;
|
||||
else if ((fW/fH) > 2.2f) //ultrawide 21:9 Galaxy Fold, Huawei X2, Xperia 1
|
||||
mul *= 0.8f;
|
||||
}
|
||||
}
|
||||
if (Forge.isLandscapeMode())
|
||||
drawable.setMinSize(newW*mul, newH);
|
||||
|
||||
Reference in New Issue
Block a user