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() {
}

View File

@@ -175,6 +175,10 @@ public class MatchController extends AbstractGuiGame {
public void flashIncorrectAction() {
//SDisplayUtil.remind(VPrompt.SINGLETON_INSTANCE); //TODO
}
@Override
public void alertUser() {
//TODO
}
@Override
public void updatePhase() {

View File

@@ -37,6 +37,7 @@ public interface IGuiGame {
void updateButtons(PlayerView owner, boolean okEnabled, boolean cancelEnabled, boolean focusOk);
void updateButtons(PlayerView owner, String label1, String label2, boolean enable1, boolean enable2, boolean focus1);
void flashIncorrectAction();
void alertUser();
void updatePhase();
void updateTurn(PlayerView player);
void updatePlayerControl();

View File

@@ -60,6 +60,8 @@ public class InputPassPriority extends InputSyncronizedBase {
else { //otherwise allow ending turn with cancel button
getController().getGui().updateButtons(getOwner(), "OK", "End Turn", true, true, true);
}
getController().getGui().alertUser();
}
/** {@inheritDoc} */

View File

@@ -35,6 +35,7 @@ public enum ProtocolMethod {
showPromptMessage (Mode.SERVER, Void.TYPE, PlayerView.class, String.class),
updateButtons (Mode.SERVER, Void.TYPE, PlayerView.class, String.class, String.class, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE),
flashIncorrectAction(Mode.SERVER),
alertUser (Mode.SERVER),
updatePhase (Mode.SERVER),
updateTurn (Mode.SERVER, Void.TYPE, PlayerView.class),
updatePlayerControl (Mode.SERVER),

View File

@@ -89,6 +89,9 @@ public class NetGuiGame extends AbstractGuiGame {
send(ProtocolMethod.flashIncorrectAction);
}
@Override
public void alertUser() { send(ProtocolMethod.alertUser); }
@Override
public void updatePhase() {
updateGameView();

View File

@@ -91,6 +91,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_PRESELECT_PREVIOUS_ABILITY_ORDER ("false"),
UI_AUTO_YIELD_MODE (ForgeConstants.AUTO_YIELD_PER_ABILITY),
UI_SHOW_STORM_COUNT_IN_PROMPT ("false"),
UI_REMIND_ON_PRIORITY ("false"),
UI_CARD_COUNTER_DISPLAY_TYPE(ForgeConstants.CounterDisplayType.TEXT.getName()),
UI_CARD_COUNTER_DISPLAY_LOCATION(ForgeConstants.CounterDisplayLocation.TOP.getName()),
UI_ANDROID_MINIMIZE_ON_SCRLOCK("false"),