add option to be alerted on receipt of priority

Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
This commit is contained in:
Jamin W. Collins
2018-02-24 10:51:43 -07:00
parent 4d41ed60c9
commit fd35c8d862
11 changed files with 38 additions and 3 deletions

View File

@@ -37,12 +37,15 @@ public class SDisplayUtil {
* @param tab0 &emsp; {@link java.GuiBase.getInterface().framework.IVDoc}
*/
public static void remind(final IVDoc<? extends ICDoc> tab0) {
showTab(tab0);
final JPanel pnl = tab0.getParentCell().getBody();
// To adjust, only touch these two values.
final int steps = 5; // Number of delays
final int delay = 80; // Milliseconds between steps
remind(tab0, steps, delay);
}
public static void remind(final IVDoc<? extends ICDoc> tab0, final int steps, final int delay) {
showTab(tab0);
final JPanel pnl = tab0.getParentCell().getBody();
if (remindIsRunning) { return; }
if (pnl == null) { return; }

View File

@@ -121,6 +121,7 @@ public enum CSubmenuPreferences implements ICDoc {
lstControls.add(Pair.of(view.getCbDetailedPaymentDesc(), FPref.UI_DETAILED_SPELLDESC_IN_PROMPT));
lstControls.add(Pair.of(view.getCbPreselectPrevAbOrder(), FPref.UI_PRESELECT_PREVIOUS_ABILITY_ORDER));
lstControls.add(Pair.of(view.getCbShowStormCount(), FPref.UI_SHOW_STORM_COUNT_IN_PROMPT));
lstControls.add(Pair.of(view.getCbRemindOnPriority(), FPref.UI_REMIND_ON_PRIORITY));
lstControls.add(Pair.of(view.getCbFilterLandsByColorId(), FPref.UI_FILTER_LANDS_BY_COLOR_IDENTITY));

View File

@@ -93,6 +93,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final JCheckBox cbStackCreatures = new OptionsCheckBox("Stack Creatures");
private final JCheckBox cbFilterLandsByColorId = new OptionsCheckBox("Filter Lands by Color in Activated Abilities");
private final JCheckBox cbShowStormCount = new OptionsCheckBox("Show Storm Count in Prompt Pane");
private final JCheckBox cbRemindOnPriority = new OptionsCheckBox("Visually Alert on Receipt of Priority");
private final Map<FPref, KeyboardShortcutField> shortcutFields = new HashMap<>();
@@ -186,6 +187,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(cbShowStormCount, titleConstraints);
pnlPrefs.add(new NoteLabel("When enabled, displays the current storm count in the prompt pane."), descriptionConstraints);
pnlPrefs.add(cbRemindOnPriority, titleConstraints);
pnlPrefs.add(new NoteLabel("When enabled, flashes the player choice area upon receiving priority."), descriptionConstraints);
pnlPrefs.add(cbPreselectPrevAbOrder, titleConstraints);
pnlPrefs.add(new NoteLabel("When enabled, preselects the last defined simultaneous ability order in the ordering dialog."), descriptionConstraints);
@@ -684,6 +688,8 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return cbShowStormCount;
}
public final JCheckBox getCbRemindOnPriority() { return cbRemindOnPriority; }
public final JCheckBox getCbPreselectPrevAbOrder() {
return cbPreselectPrevAbOrder;
}

View File

@@ -601,6 +601,11 @@ public final class CMatchUI
getCPrompt().remind();
}
@Override
public void alertUser() {
getCPrompt().alert();
}
@Override
public void updatePhase() {
final PlayerView p = getGameView().getPlayerTurn();

View File

@@ -37,6 +37,8 @@ import forge.game.GameView;
import forge.game.card.CardView;
import forge.gui.framework.ICDoc;
import forge.gui.framework.SDisplayUtil;
import forge.model.FModel;
import forge.properties.ForgePreferences;
import forge.screens.match.CMatchUI;
import forge.screens.match.views.VPrompt;
import forge.toolbox.FSkin;
@@ -169,6 +171,12 @@ public class CPrompt implements ICDoc {
SDisplayUtil.remind(view);
}
public void alert() {
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_REMIND_ON_PRIORITY)) {
SDisplayUtil.remind(view, 15, 30);
}
}
@Override
public void register() {
}