use of com.faforever.client.preferences.event.MissingGamePathEvent in project downlords-faf-client by FAForever.
the class MissingGamePathNotifierTest method testPersistentNotificationOnDefaultEvent.
@Test
public void testPersistentNotificationOnDefaultEvent() {
eventBus.post(new MissingGamePathEvent());
verify(notificationService).addNotification(any(PersistentNotification.class));
}
use of com.faforever.client.preferences.event.MissingGamePathEvent in project downlords-faf-client by FAForever.
the class MissingGamePathNotifier method onMissingGamePathEvent.
@Subscribe
public void onMissingGamePathEvent(MissingGamePathEvent event) {
List<Action> actions = Collections.singletonList(new Action(i18n.get("missingGamePath.locate"), chooseEvent -> eventBus.post(new GameDirectoryChooseEvent())));
String notificationText = i18n.get("missingGamePath.notification");
if (event.isImmediateUserActionRequired()) {
notificationService.addNotification(new ImmediateNotification(notificationText, notificationText, Severity.WARN, actions));
} else {
notificationService.addNotification(new PersistentNotification(notificationText, Severity.WARN, actions));
}
}
use of com.faforever.client.preferences.event.MissingGamePathEvent in project downlords-faf-client by FAForever.
the class Ladder1v1Controller method onPlayButtonClicked.
public void onPlayButtonClicked() {
if (preferencesService.getPreferences().getForgedAlliance().getPath() == null) {
eventBus.post(new MissingGamePathEvent(true));
return;
}
setFactionButtonsDisabled(true);
ObservableList<Faction> factions = preferencesService.getPreferences().getLadder1v1Prefs().getFactions();
Faction randomFaction = factions.get(random.nextInt(factions.size()));
gameService.startSearchLadder1v1(randomFaction);
}
use of com.faforever.client.preferences.event.MissingGamePathEvent in project downlords-faf-client by FAForever.
the class MissingGamePathNotifierTest method testImmediateNotificationOnUrgentEvent.
@Test
public void testImmediateNotificationOnUrgentEvent() {
eventBus.post(new MissingGamePathEvent(true));
verify(notificationService).addNotification(any(ImmediateNotification.class));
}
use of com.faforever.client.preferences.event.MissingGamePathEvent in project downlords-faf-client by FAForever.
the class GamePathHandler method detectGamePath.
private void detectGamePath() {
for (Path path : USUAL_GAME_PATHS) {
if (preferencesService.isGamePathValid(path.resolve("bin"))) {
onGameDirectoryChosenEvent(new GameDirectoryChosenEvent(path));
return;
}
}
logger.info("Game path could not be detected");
eventBus.post(new MissingGamePathEvent());
}
Aggregations