Commit 2043933a authored by Drahomír Karchňák's avatar Drahomír Karchňák

#76 Added dialog when logging out the user

parent ffc92d4e
......@@ -22,6 +22,8 @@ mainmenu_panorama=Panorama
usermenu_newuser=+ Nový detektiv
user_logout_message=Opravdu chcete odhlásit stávajícího uživatele?
preloader_title=Jak hrát?
confirm_button=Rozumím
......@@ -151,4 +153,4 @@ user_consecutivelyallgames0stars_description=Za hraní všech her v jeden den
user_consecutivelyallgames2stars=Hlídací pes
user_consecutivelyallgames2stars_description=Za všechny hry po sobě na střední obtížnost a tři poháry
user_consecutivelyallgames3stars=Detektivní šelma
user_consecutivelyallgames3stars_description=Za všechny hry po sobě na těžkou obtížnost a tři poháry
\ No newline at end of file
user_consecutivelyallgames3stars_description=Za všechny hry po sobě na těžkou obtížnost a tři poháry
......@@ -22,6 +22,8 @@ mainmenu_panorama=Panorama
usermenu_newuser=+ Neuer Detektiv
user_logout_message=[DE] Opravdu chcete odhlásit stávajícího uživatele? [DE]
preloader_title=Wie spielt man?
confirm_button=Ich verstehe
......@@ -151,4 +153,4 @@ user_consecutivelyallgames0stars_description=Für das Spielen aller Spiele an ei
user_consecutivelyallgames2stars=Wachhund
user_consecutivelyallgames2stars_description=Für alle Spiele nacheinander auf der mittleren Stufe mit drei Pokalen
user_consecutivelyallgames3stars=Als Detektiv ein Raubtier
user_consecutivelyallgames3stars_description=Für alle Spiele nacheinander auf der schwierigen Stufe mit drei Pokalen
\ No newline at end of file
user_consecutivelyallgames3stars_description=Für alle Spiele nacheinander auf der schwierigen Stufe mit drei Pokalen
......@@ -10,6 +10,8 @@ system_retry=Znovu
zipassetloader_error=Chyba: Nemôžem stiahnuť dodatočná dáta! Skontrolujte prosím pripojenie k internetu.
user_logout_message=Naozaj chceš odhlásiť súčasného užívateľa?
mainmenu_games=Hry
mainmenu_halloffame=Sieň slávy
mainmenu_statistics=Štatistiky
......
......@@ -668,7 +668,6 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
gamePhase = GamePhase.FINISHED;
game.endGame();
Log.info(getClass(), "[DB] Ended game: " + game);
// (new VictoryDialog()).show(getStage());
showGameResultDialog();
}
......
......@@ -25,6 +25,7 @@ public class ApplicationTextManager extends TablexiaDataManager<I18NBundle> impl
public static final String VICTORYSCREEN_NEW_TROPHY = "victoryscreen_new_trophy";
public static final String USERMENU_NEWUSER = "usermenu_newuser";
public static final String USER_LOGOUT_MESSAGE = "user_logout_message";
public static final String PRELOADER_TITLE = "preloader_title";
public static final String CONFIRM_BUTTON = "confirm_button";
......
......@@ -14,18 +14,30 @@ import com.badlogic.gdx.utils.Align;
import net.engio.mbassy.listener.Handler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.bus.ApplicationBus;
import cz.nic.tablexia.bus.event.SubMenuControlEvent;
import cz.nic.tablexia.loader.application.ApplicationAtlasManager;
import cz.nic.tablexia.loader.application.ApplicationFontManager;
import cz.nic.tablexia.loader.application.ApplicationSoundManager;
import cz.nic.tablexia.loader.application.ApplicationTextManager;
import cz.nic.tablexia.menu.AbstractMenu;
import cz.nic.tablexia.menu.IMenuItem;
import cz.nic.tablexia.menu.main.locale.LocaleSelectBox;
import cz.nic.tablexia.menu.main.user.UserSelectBox;
import cz.nic.tablexia.util.ui.dialog_new.TablexiaComponentDialogFactory;
import cz.nic.tablexia.util.ui.dialog_new.components.AdaptiveSizeDialogComponent;
import cz.nic.tablexia.util.ui.dialog_new.components.CenterPositionDialogComponent;
import cz.nic.tablexia.util.ui.dialog_new.components.DimmerDialogComponent;
import cz.nic.tablexia.util.ui.dialog_new.components.FixedSpaceContentDialogComponent;
import cz.nic.tablexia.util.ui.dialog_new.components.ResizableSpaceContentDialogComponent;
import cz.nic.tablexia.util.ui.dialog_new.components.TablexiaDialogComponentAdapter;
import cz.nic.tablexia.util.ui.dialog_new.components.TextContentDialogComponent;
import cz.nic.tablexia.util.ui.dialog_new.components.YesNoButtonContentDialogComponent;
/**
* MainMenu container
......@@ -106,7 +118,10 @@ public class MainMenu extends AbstractMenu {
menuItemContainer.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
performMenuAction(menuItem);
if(menuItem == MainMenuDefinition.LOGOUT)
showLogoutUserDialog(menuItem);
else
performMenuAction(menuItem);
}
});
menuItemsLayout.addActor(menuItemContainer);
......@@ -133,6 +148,39 @@ public class MainMenu extends AbstractMenu {
layoutContainer.setActor(layoutTable);
}
public void showLogoutUserDialog(final IMenuItem item) {
ArrayList<TablexiaDialogComponentAdapter> adapters = new ArrayList<TablexiaDialogComponentAdapter>();
adapters.add(new AdaptiveSizeDialogComponent());
adapters.add(new CenterPositionDialogComponent());
adapters.add(new DimmerDialogComponent(0.4f));
adapters.add(new FixedSpaceContentDialogComponent());
adapters.add(new ResizableSpaceContentDialogComponent());
//TODO - Add Warning image/text
// adapters.add(new ImageContentDialogComponent(ApplicationAtlasManager.getInstance().getDiagnostics()));
System.out.println(ApplicationAtlasManager.getInstance().getDiagnostics());
adapters.add(new FixedSpaceContentDialogComponent());
adapters.add(new ResizableSpaceContentDialogComponent());
adapters.add(new TextContentDialogComponent(ApplicationTextManager.getInstance().getText(ApplicationTextManager.ApplicationTextsAssets.USER_LOGOUT_MESSAGE)));
adapters.add(new FixedSpaceContentDialogComponent());
adapters.add(new ResizableSpaceContentDialogComponent());
adapters.add(new YesNoButtonContentDialogComponent(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
performMenuAction(item);
}
}));
adapters.add(new ResizableSpaceContentDialogComponent());
adapters.add(new FixedSpaceContentDialogComponent());
TablexiaComponentDialogFactory.getInstance().createDialog(
adapters.toArray(new TablexiaDialogComponentAdapter[]{})).show(400, 300);
}
private void performMenuAction(IMenuItem menuItem) {
if (!isDisableControl()) {
ApplicationSoundManager.getInstance().getSound(ApplicationSoundManager.MAINMENU_BUTTON).play();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment