Search in sources :

Example 1 with ButtonClickListener

use of de.gg.game.input.ButtonClickListener in project ProjektGG by eskalon.

the class GameBallotScreen method onNewBallot.

@Subscribe
private void onNewBallot(NewBallotEvent ev) {
    if (ev.getNewBallot() == null) {
        application.getScreenManager().pushScreen("map", "circle_open");
        return;
    }
    World world = application.getClient().getSession().getWorld();
    Player localPlayer = application.getClient().getLocalPlayer();
    optionTable.clear();
    voterTable.clear();
    buttons.clear();
    infoText.setText(ev.getNewBallot().getInfoText());
    // Display the voters
    voterTable.add(new Label(Lang.get("screen.vote.voters"), skin, "title")).padBottom(12).row();
    for (short s : ev.getNewBallot().getVoters()) {
        // PositionType posT = world.getCharacter(s).getPosition();
        boolean isLocalPlayer = s == application.getClient().getLocalPlayer().getCurrentlyPlayedCharacterId();
        voterTable.add(new CharacterComponent(skin, world.getCharacter(s), isLocalPlayer ? -1 : application.getClient().getOpinionOfOtherCharacter(s))).left().padBottom(25).row();
    }
    // Display the options (if the player can vote)
    if (ev.getNewBallot().getVoters().contains(localPlayer.getCurrentlyPlayedCharacterId())) {
        for (BallotOption option : ev.getNewBallot().getOptions()) {
            ImageTextButton button = new OffsettableImageTextButton(Lang.get(option), skin, 5);
            button.addListener(new ButtonClickListener(application.getSoundManager()) {

                @Override
                protected void onClick() {
                    application.getClient().getActionHandler().castVote(option.getValue());
                    for (Button b : buttons) {
                        b.setDisabled(true);
                        b.setTouchable(Touchable.disabled);
                    }
                }
            });
            buttons.add(button);
            if (option.isCharacter() && option.getValue() != application.getClient().getLocalPlayer().getCurrentlyPlayedCharacterId()) {
                // PositionType posT = world.getCharacters()
                // .get((short) option.getValue()).getPosition();
                optionTable.add(new CharacterComponent(skin, world.getCharacter((short) option.getValue()), application.getClient().getOpinionOfOtherCharacter((short) option.getValue()))).right().padBottom(8).row();
            }
            optionTable.add(button).right().padBottom(15).row();
        }
    }
}
Also used : Player(de.gg.game.model.entities.Player) OffsettableImageTextButton(de.gg.engine.ui.components.OffsettableImageTextButton) ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) Button(com.badlogic.gdx.scenes.scene2d.ui.Button) OffsettableImageTextButton(de.gg.engine.ui.components.OffsettableImageTextButton) ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) ButtonClickListener(de.gg.game.input.ButtonClickListener) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) CharacterComponent(de.gg.game.ui.components.CharacterComponent) BallotOption(de.gg.game.model.votes.BallotOption) OffsettableImageTextButton(de.gg.engine.ui.components.OffsettableImageTextButton) World(de.gg.game.model.World) Subscribe(com.google.common.eventbus.Subscribe)

Example 2 with ButtonClickListener

use of de.gg.game.input.ButtonClickListener in project ProjektGG by eskalon.

the class ServerBrowserScreen method create.

@Override
protected void create() {
    super.create();
    setImage(backgroundTexture);
    BackInputProcessor backInput = new BackInputProcessor() {

        @Override
        public void onBackAction() {
            application.getScreenManager().pushScreen("main_menu", "blendingTransition");
        }
    };
    addInputProcessor(backInput);
    mainTable.addListener(new BackInputActorListener() {

        @Override
        public void onBackAction() {
            backInput.onBackAction();
        }
    });
    this.connectionCallback = new ISuccessCallback() {

        @Override
        public void onSuccess(Object param) {
        }

        @Override
        public void onFailure(Object param) {
            connectingDialog.setVisible(false);
            application.setClient(null);
            SimpleTextDialog.createAndShow(stage, skin, Lang.get("ui.generic.error"), (String) param);
        }
    };
    ImageTextButton backButton = new ImageTextButton(Lang.get("ui.generic.back"), skin);
    backButton.addListener(new ButtonClickListener(application.getSoundManager()) {

        @Override
        protected void onClick() {
            application.getScreenManager().pushScreen("main_menu", "blendingTransition");
        }
    });
    ImageTextButton createLobbyButton = new ImageTextButton(Lang.get("screen.server_browser.create_game"), skin);
    createLobbyButton.addListener(new ButtonClickListener(application.getSoundManager()) {

        @Override
        protected void onClick() {
            application.getScreenManager().pushScreen("lobby_creation", "shortBlendingTransition");
        }
    });
    ImageTextButton directConnectButton = new ImageTextButton(Lang.get("screen.server_browser.connect_directly"), skin);
    directConnectButton.addListener(new ButtonClickListener(application.getSoundManager()) {

        @Override
        protected void onClick() {
            OffsettableTextField portInputField = new OffsettableTextField(String.valueOf(BaseGameServer.DEFAULT_PORT), skin, 5);
            portInputField.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
            OffsettableTextField ipInputField = new OffsettableTextField("127.0.0.1", skin, 5);
            BasicDialog dialog = new BasicDialog(Lang.get("screen.server_browser.connect_directly"), skin) {

                @Override
                public void result(Object obj) {
                    if ((Boolean) obj) {
                        // Connect to client
                        application.setClient(new GameClient(application.getEventBus()));
                        application.getClient().connect(connectionCallback, application.VERSION, ipInputField.getText(), Integer.valueOf(portInputField.getText()));
                        connectingDialog = SimpleTextDialog.createAndShow(stage, skin, Lang.get("ui.generic.connecting"), Lang.get("screen.server_browser.joining"), false, null);
                    }
                }
            };
            dialog.text(Lang.get("screen.server_browser.ip")).button(Lang.get("ui.generic.back"), false).button(Lang.get("ui.generic.connect"), true).key(Keys.ENTER, true).key(Keys.ESCAPE, false);
            dialog.getContentTable().add(ipInputField).width(170).row();
            dialog.getContentTable().add(new Label(Lang.get("screen.server_browser.port"), skin, "dark_text"));
            dialog.getContentTable().add(portInputField).width(150).left();
            dialog.show(stage);
        }
    });
    ImageButton refreshButton = new ImageButton(skin, "refresh");
    refreshButton.addListener(new ButtonClickListener(application.getSoundManager()) {

        @Override
        protected void onClick() {
            discoverServers();
        }
    });
    Table titleTable = new Table();
    titleTable.add(new Label(Lang.get("screen.server_browser.title"), skin, "title")).padTop(25);
    Table serverHeaderTable = new Table();
    serverHeaderTable.add(new Label(Lang.get("screen.server_browser.header_status"), skin)).left().padLeft(10).padRight(158);
    serverHeaderTable.add(new Label(Lang.get("screen.server_browser.header_name"), skin)).left().expandX();
    serverHeaderTable.add(refreshButton).padLeft(15).padRight(10).row();
    serverTable = new Table();
    ScrollPane pane = new ScrollPane(serverTable);
    Table buttonTable = new Table();
    buttonTable.add(backButton);
    buttonTable.add(directConnectButton).width(158).padLeft(45);
    buttonTable.add(createLobbyButton).width(136).padLeft(45);
    Table mTable = new Table();
    mTable.setWidth(615);
    mTable.setHeight(475);
    mTable.setBackground(skin.getDrawable("parchment2"));
    mTable.add(titleTable).row();
    mTable.add(serverHeaderTable).width(580).padTop(25).row();
    mTable.add(new Image(skin.getDrawable("white_bar"))).padTop(2).center().expandX().row();
    mTable.add(pane).width(580).height(265).padTop(10).row();
    mTable.add(buttonTable).height(50).bottom();
    mainTable.add(mTable);
}
Also used : ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) GameClient(de.gg.game.network.GameClient) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) Image(com.badlogic.gdx.scenes.scene2d.ui.Image) BackInputActorListener(de.gg.game.input.BackInputProcessor.BackInputActorListener) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) BackInputProcessor(de.gg.game.input.BackInputProcessor) ButtonClickListener(de.gg.game.input.ButtonClickListener) ScrollPane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane) OffsettableTextField(de.gg.engine.ui.components.OffsettableTextField) TextField(com.badlogic.gdx.scenes.scene2d.ui.TextField) OffsettableTextField(de.gg.engine.ui.components.OffsettableTextField) ISuccessCallback(de.damios.guacamole.ISuccessCallback) BasicDialog(de.gg.game.ui.components.BasicDialog)

Example 3 with ButtonClickListener

use of de.gg.game.input.ButtonClickListener in project ProjektGG by eskalon.

the class LobbyCreationScreen method create.

@Override
protected void create() {
    super.create();
    setImage(backgroundTexture);
    BackInputProcessor backInput = new BackInputProcessor() {

        @Override
        public void onBackAction() {
            application.getScreenManager().pushScreen("server_browser", "shortBlendingTransition");
        }
    };
    addInputProcessor(backInput);
    mainTable.addListener(new BackInputActorListener() {

        @Override
        public void onBackAction() {
            backInput.onBackAction();
        }
    });
    this.playerStubs = playerStubsJson.getData(new TypeToken<ArrayList<PlayerStub>>() {
    }.getType());
    Label nameLabel = new Label(Lang.get("screen.lobby_creation.name"), skin);
    Label portLabel = new Label(Lang.get("screen.lobby_creation.port"), skin);
    nameField = new OffsettableTextField("", skin, 6);
    portField = new OffsettableTextField(String.valueOf(BaseGameServer.DEFAULT_PORT), skin, 6);
    portField.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
    Label difficultyLabel = new Label(Lang.get("screen.lobby_creation.difficulty"), skin);
    CheckBox easyDifficultyCheckbox = new CheckBox(Lang.get(GameDifficulty.EASY), skin);
    normalDifficultyCheckbox = new CheckBox(Lang.get(GameDifficulty.NORMAL), skin);
    CheckBox hardDifficultyCheckbox = new CheckBox(Lang.get(GameDifficulty.HARD), skin);
    ButtonGroup<CheckBox> speedGroup = new ButtonGroup<>();
    speedGroup.add(easyDifficultyCheckbox);
    speedGroup.add(normalDifficultyCheckbox);
    speedGroup.add(hardDifficultyCheckbox);
    ImageTextButton backButton = new ImageTextButton(Lang.get("ui.generic.back"), skin);
    backButton.addListener(new ButtonClickListener(application.getSoundManager()) {

        @Override
        protected void onClick() {
            application.getScreenManager().pushScreen("server_browser", "shortBlendingTransition");
        }
    });
    ImageTextButton createButton = new ImageTextButton(Lang.get("screen.lobby_creation.create"), skin);
    createButton.addListener(new ButtonClickListener(application.getSoundManager()) {

        @Override
        protected void onClick() {
            if (!nameField.getText().isEmpty() && !portField.getText().isEmpty()) {
                GameDifficulty difficulty = GameDifficulty.NORMAL;
                if (speedGroup.getChecked().equals(easyDifficultyCheckbox)) {
                    difficulty = GameDifficulty.EASY;
                } else if (speedGroup.getChecked().equals(normalDifficultyCheckbox)) {
                    difficulty = GameDifficulty.NORMAL;
                } else if (speedGroup.getChecked().equals(hardDifficultyCheckbox)) {
                    difficulty = GameDifficulty.HARD;
                }
                // Start Sever & Client
                ServerSetup serverSetup = new ServerSetup(nameField.getText(), 7, Integer.valueOf(portField.getText()), true, application.VERSION, true);
                GameSessionSetup sessionSetup = new GameSessionSetup(difficulty, GameMap.BAMBERG, System.currentTimeMillis());
                application.setServer(new GameServer(serverSetup, sessionSetup, null, playerStubs));
                application.getServer().start(new ISuccessCallback() {

                    @Override
                    public void onSuccess(Object param) {
                        // Connect client to server
                        application.setClient(new GameClient(application.getEventBus()));
                        application.getClient().connect(new ISuccessCallback() {

                            public void onSuccess(Object param) {
                            // wait for
                            // LobbyDataReceivedEvent
                            }

                            public void onFailure(Object param) {
                                onHostStartingFailed(((Exception) param).getMessage());
                            }
                        }, application.VERSION, "localhost", serverSetup.getPort());
                    }

                    public void onFailure(Object param) {
                        onHostStartingFailed(((Exception) param).getMessage());
                    }
                });
                connectingDialog = SimpleTextDialog.createAndShow(stage, skin, Lang.get("screen.lobby_creation.starting_server.title"), Lang.get("screen.lobby_creation.starting_server.text"), false, null);
                connectingDialog.show(stage);
            } else {
                SimpleTextDialog.createAndShow(stage, skin, Lang.get("screen.lobby_creation.fields_empty.title"), Lang.get("screen.lobby_creation.fields_empty.text"));
            }
        }
    });
    Table titleTable = new Table();
    Table settingsTable = new Table();
    Table settings2ColTable = new Table();
    Table settings3ColTable = new Table();
    Table buttonTable = new Table();
    titleTable.add(new Label(Lang.get("screen.lobby_creation.title"), skin, "title")).padTop(25);
    settings2ColTable.add(nameLabel).padLeft(100).padBottom(20).padRight(10).padTop(30);
    settings2ColTable.add(nameField).row();
    settings2ColTable.add(portLabel).padLeft(100).padRight(10);
    settings2ColTable.add(portField).row();
    settings3ColTable.add(difficultyLabel).colspan(3).padLeft(150).row();
    settings3ColTable.add(easyDifficultyCheckbox).padLeft(150).padRight(12);
    settings3ColTable.add(normalDifficultyCheckbox).padRight(12);
    settings3ColTable.add(hardDifficultyCheckbox);
    settingsTable.left().top().add(settings2ColTable).padBottom(27).row();
    settingsTable.add(settings3ColTable).row();
    buttonTable.add(backButton);
    buttonTable.add(createButton).padLeft(65);
    Table mTable = new Table();
    mTable.setWidth(615);
    mTable.setHeight(475);
    mTable.setBackground(skin.getDrawable("parchment2"));
    mTable.add(titleTable).row();
    mTable.add(settingsTable).width(580).height(215).row();
    mTable.add(buttonTable).height(50).bottom().padBottom(50);
    mainTable.add(mTable);
}
Also used : ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) GameClient(de.gg.game.network.GameClient) ArrayList(java.util.ArrayList) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) GameDifficulty(de.gg.game.model.types.GameDifficulty) BackInputActorListener(de.gg.game.input.BackInputProcessor.BackInputActorListener) ButtonGroup(com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup) GameSessionSetup(de.gg.game.session.GameSessionSetup) BackInputProcessor(de.gg.game.input.BackInputProcessor) CheckBox(com.badlogic.gdx.scenes.scene2d.ui.CheckBox) ButtonClickListener(de.gg.game.input.ButtonClickListener) ServerSetup(de.gg.engine.network.ServerSetup) OffsettableTextField(de.gg.engine.ui.components.OffsettableTextField) ISuccessCallback(de.damios.guacamole.ISuccessCallback) BaseGameServer(de.gg.engine.network.BaseGameServer) GameServer(de.gg.game.network.GameServer)

Example 4 with ButtonClickListener

use of de.gg.game.input.ButtonClickListener in project ProjektGG by eskalon.

the class MainMenuScreen method create.

@Override
protected void create() {
    super.create();
    setImage(backgroundImage);
    ImageTextButton multiplayerButton = new ImageTextButton(Lang.get("screen.main_menu.multiplayer"), skin, "large");
    multiplayerButton.addListener(new FadeOutUIClickListener(application.getSoundManager(), stage, "server_browser", "blendingTransition"));
    ImageTextButton settingsButton = new ImageTextButton(Lang.get("screen.main_menu.settings"), skin, "large");
    settingsButton.addListener(new FadeOutUIClickListener(application.getSoundManager(), stage, "settings", "blendingTransition"));
    ImageTextButton creditsButton = new ImageTextButton(Lang.get("screen.main_menu.credits"), skin, "large");
    creditsButton.addListener(new FadeOutUIClickListener(application.getSoundManager(), stage, "credits", "longBlendingTransition"));
    ImageTextButton exitButton = new ImageTextButton(Lang.get("screen.main_menu.quit"), skin, "large");
    exitButton.addListener(new ButtonClickListener(application.getSoundManager()) {

        @Override
        protected void onClick() {
            Gdx.app.exit();
        }
    });
    Image logoImage = new Image(skin.getDrawable("logo"));
    ImageButton githubRepoButton = new ImageButton(skin.getDrawable("icon_github"));
    githubRepoButton.addListener(new InputListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            Gdx.net.openURI("https://github.com/eskalon/ProjektGG");
            return true;
        }
    });
    mainTable.add(logoImage).padBottom(25f).padTop(-80f).row();
    mainTable.add(multiplayerButton).padBottom(11f).row();
    mainTable.add(settingsButton).padBottom(11f).row();
    mainTable.add(creditsButton).padBottom(11f).row();
    mainTable.add(exitButton).row();
    githubRepoButton.padLeft(3).padBottom(3).bottom().left();
    stage.addActor(githubRepoButton);
    stageInputWrapper.setEnabled(false);
}
Also used : ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) InputListener(com.badlogic.gdx.scenes.scene2d.InputListener) ButtonClickListener(de.gg.game.input.ButtonClickListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) Image(com.badlogic.gdx.scenes.scene2d.ui.Image)

Example 5 with ButtonClickListener

use of de.gg.game.input.ButtonClickListener in project ProjektGG by eskalon.

the class GameMapScreen method create.

@Override
protected void create() {
    super.create();
    camera = new CameraWrapper(67, application.getWidth(), application.getHeight());
    camera.setPosition(application.getWidth() / 2, application.getHeight() / 2, 0);
    postProcessor = new PostProcessingPipeline(application.getWidth(), application.getHeight(), true);
    pausePostProcessingEffect = new ColorBlendEffect(application.getUICamera(), new Color(0.4F, 0.4F, 0.4F, 0.4F));
    gameRenderer = new GameRenderer(camera.getCamera(), fragmentShader.getString());
    selectionInputController = new MapSelectionInputController(application.getEventBus(), camera.getCamera());
    addInputProcessor(selectionInputController);
    movementInputController = new MapMovementInputController(camera, application.getSettings());
    addInputProcessor(movementInputController);
    gameSpeedInputProcessor = new GameSpeedInputProcessor(application.getSettings());
    addInputProcessor(gameSpeedInputProcessor);
    // CHARACTER DIALOG
    BasicDialog characterMenuDialog = new BasicDialog(Lang.get("screen.map.character_config"), skin, "big");
    ImageTextButton closeCharacterMenuButton = new ImageTextButton(Lang.get("ui.generic.close"), skin);
    closeCharacterMenuButton.addListener(new ButtonClickListener(application.getSoundManager()) {

        @Override
        protected void onClick() {
            characterMenuDialog.hide();
        }
    });
    Table characterMenuTable = new Table();
    Table changeableCharacterMenuTable = new Table();
    ImageTextButton characterMenuTab1Button = new ImageTextButton(Lang.get("screen.map.character_config.character"), skin);
    ImageTextButton characterMenuTab2Button = new ImageTextButton(Lang.get("screen.map.character_config.privileges"), skin);
    characterMenuTab1Button.addListener(new ButtonClickListener(application.getSoundManager()) {

        @Override
        protected void onClick() {
            // CHARACTER & FAMILY
            changeableCharacterMenuTable.clear();
            changeableCharacterMenuTable.add(new Label(Lang.get("screen.map.character_config.name"), skin, "dark")).padBottom(50).row();
            changeableCharacterMenuTable.add(new Label(Lang.get("screen.map.character_config.family"), skin, "dark")).row();
            changeableCharacterMenuTable.add(new Label(Lang.get("screen.map.character_config.find_so"), skin, "dark"));
        }
    });
    characterMenuTab2Button.addListener(new ButtonClickListener(application.getSoundManager()) {

        @Override
        protected void onClick() {
            // PRIVILEGES
            changeableCharacterMenuTable.clear();
            changeableCharacterMenuTable.add(new Label(Lang.get("screen.map.character_config.privileges_list"), skin, "dark")).row();
            if (application.getClient().getLocalPlayerCharacter().getPosition() != null) {
                // TODO Position privileges
                // TODO Impeachment
                ImageTextButton kickButton = new ImageTextButton(Lang.get("screen.map.character_config.privilege.impeach"), skin);
                kickButton.addListener(new ButtonClickListener(application.getSoundManager()) {

                    @Override
                    protected void onClick() {
                        short mayor = application.getClient().getSession().getWorld().getPosition(PositionType.MAYOR).getCurrentHolder();
                        if (mayor != -1)
                            application.getClient().getActionHandler().arrangeImpeachmentVote(mayor, (param) -> {
                                if ((Boolean) param == true) {
                                    SimpleTextDialog.createAndShow(stage, skin, Lang.get("screen.map.character_config.privilege.success"), Lang.get("ui.generic.wip"));
                                } else {
                                    SimpleTextDialog.createAndShow(stage, skin, Lang.get("ui.generic.error"), Lang.get("ui.generic.rmi_error"));
                                }
                            });
                    }
                });
                changeableCharacterMenuTable.add(kickButton);
            }
        }
    });
    Table characterMenuTabTable = new Table();
    characterMenuTabTable.add(characterMenuTab1Button).padRight(5);
    characterMenuTabTable.add(characterMenuTab2Button);
    characterMenuTable.add(characterMenuTabTable).padRight(30).padBottom(15).center().top().row();
    characterMenuTable.add(changeableCharacterMenuTable).padBottom(15).top().height(315).row();
    characterMenuTable.add(closeCharacterMenuButton).padRight(30).center().top();
    characterMenuDialog.add(characterMenuTable).pad(30);
    // PLAYER ICON
    iconButton = new ImageButton(skin.getDrawable(PlayerIcon.values()[0].getShieldDrawableName()));
    iconButton.addListener(new ButtonClickListener(application.getSoundManager()) {

        @Override
        protected void onClick() {
            characterMenuDialog.show(stage);
            characterMenuDialog.setPosition(0, 103);
        }
    });
    Table iconTable = new Table();
    iconTable.setBackground(skin.getDrawable("icon_background"));
    iconTable.add(iconButton).padLeft(8).padRight(10).padBottom(1);
    // INFO STUFF
    Table infoTable = new Table();
    // Gold
    Table goldTable = new Table();
    goldTable.setBackground(skin.getDrawable("info_background"));
    goldTable.add(new Image(skin.getDrawable("icon_gold_coin"))).left().top().padLeft(4).padBottom(2).padRight(4);
    goldTable.add(new Label("19 Gulden", skin, "dark")).padBottom(5).expandX().left().top();
    // Name
    Table nameTable = new Table();
    nameTable.setBackground(skin.getDrawable("info_background"));
    nameTable.add(new Label("Freiherr  Franz  von  Woyzeck", skin, "big_dark")).padBottom(2).expandX().left();
    // Notifications
    Table notificationTable = new Table();
    infoTable.add(goldTable).row();
    infoTable.add(nameTable).left().row();
    infoTable.add(notificationTable).left().padLeft(2).padTop(2).row();
    // DATE STUFF
    Table dateTimeTable = new Table();
    // Date
    Table dateTable = new Table();
    dateLabel = new Label("", skin, "dark");
    dateTable.setBackground(skin.getDrawable("date_background"));
    dateTable.add(dateLabel).padLeft(9).padBottom(5).expandX().left();
    // Clock
    Table clockTable = new Table();
    clockTable.setBackground(skin.getDrawable("clock_background"));
    dateTimeTable.add(dateTable).row();
    dateTimeTable.add(clockTable).right();
    // MISC
    Table miscTable = new Table();
    Table misc2Table = new Table();
    // Inventory
    ImageButton inventoryButton = new ImageButton(skin, "inventory");
    // Book
    ImageButton bookButton = new ImageButton(skin, "leaning_book");
    // Minimap
    Table minimapTable = new Table();
    minimapTable.setBackground(skin.getDrawable("minimap_test"));
    misc2Table.add(inventoryButton).padRight(2);
    misc2Table.add(bookButton).padTop(2).row();
    miscTable.add(misc2Table).right().row();
    miscTable.add(minimapTable);
    mainTable.setSkin(skin);
    mainTable.setFillParent(true);
    mainTable.add(iconTable).top().left();
    mainTable.add(infoTable).top().left();
    mainTable.add(dateTimeTable).right().expandX().row();
    mainTable.add("").fill();
    mainTable.add("").expand().fill();
    mainTable.add(miscTable).expandY().bottom().right();
    // PAUSE DIALOG
    pauseDialog = new BasicDialog("", skin) {

        @Override
        protected void result(Object object) {
            pauseShown = false;
            postProcessor.removeEffect(pausePostProcessingEffect);
            if (object == (Integer) 1) {
                application.getScreenManager().pushScreen("settings", "blendingTransition");
            } else {
                Log.info("Client", "Verbindung wird getrennt");
                final GameClient client = application.getClient();
                final GameServer server = application.getServer();
                // Set stuff to null to stop updates
                application.setClient(null);
                application.setServer(null);
                ThreadHandler.getInstance().executeRunnable(() -> {
                    client.disconnect();
                    if (server != null) {
                        server.stop();
                    }
                });
                DiscordGGHandler.getInstance().setMenuPresence();
                application.getScreenManager().pushScreen("main_menu", null);
            }
        }
    };
    pauseDialog.button(Lang.get("screen.map.pause.settings"), 1).button(Lang.get("screen.map.pause.disconnect"), 2);
    houseSelectionDialog = new BasicDialog("", skin);
    houseSelectionDialog.button("Test");
    stage.addListener(new InputListener() {

        @Override
        public boolean keyDown(InputEvent event, int keycode) {
            if (keycode == Keys.ESCAPE) {
                if (pauseShown) {
                    pauseDialog.hide();
                    postProcessor.removeEffect(pausePostProcessingEffect);
                } else {
                    pauseDialog.show(stage);
                    postProcessor.addEffect(pausePostProcessingEffect);
                }
                pauseShown = !pauseShown;
                return true;
            }
            return false;
        }
    });
}
Also used : InputListener(com.badlogic.gdx.scenes.scene2d.InputListener) ButtonClickListener(de.gg.game.input.ButtonClickListener) SimpleTextDialog(de.gg.game.ui.components.SimpleTextDialog) ThreadHandler(de.damios.guacamole.concurrent.ThreadHandler) BasicDialog(de.gg.game.ui.components.BasicDialog) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) GameClient(de.gg.game.network.GameClient) MapSelectionInputController(de.gg.game.input.MapSelectionInputController) PlayerIcon(de.gg.game.model.types.PlayerIcon) Asset(de.eskalon.commons.asset.AnnotationAssetManager.Asset) Lang(de.eskalon.commons.lang.Lang) HouseSelectionEvent(de.gg.game.events.HouseSelectionEvent) GameSpeedInputProcessor(de.gg.game.input.GameSpeedInputProcessor) ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) GameSession(de.gg.game.session.GameSession) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) Log(de.damios.guacamole.gdx.Log) Subscribe(com.google.common.eventbus.Subscribe) PositionType(de.gg.game.model.types.PositionType) GameServer(de.gg.game.network.GameServer) Image(com.badlogic.gdx.scenes.scene2d.ui.Image) ColorBlendEffect(de.eskalon.commons.graphics.postproc.impl.ColorBlendEffect) HouseEnterEvent(de.gg.game.events.HouseEnterEvent) World(de.gg.game.model.World) CameraWrapper(de.gg.engine.ui.rendering.CameraWrapper) GameRenderer(de.gg.game.ui.rendering.GameRenderer) FullHourEvent(de.gg.game.events.FullHourEvent) DiscordGGHandler(de.gg.game.misc.DiscordGGHandler) Color(com.badlogic.gdx.graphics.Color) Text(de.damios.guacamole.gdx.assets.Text) ProjektGGApplication(de.gg.game.core.ProjektGGApplication) GameClock(de.gg.game.misc.GameClock) PostProcessingPipeline(de.eskalon.commons.graphics.postproc.PostProcessingPipeline) Keys(com.badlogic.gdx.Input.Keys) MapMovementInputController(de.gg.game.input.MapMovementInputController) Player(de.gg.game.model.entities.Player) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) GameClient(de.gg.game.network.GameClient) ColorBlendEffect(de.eskalon.commons.graphics.postproc.impl.ColorBlendEffect) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) Image(com.badlogic.gdx.scenes.scene2d.ui.Image) MapSelectionInputController(de.gg.game.input.MapSelectionInputController) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) InputListener(com.badlogic.gdx.scenes.scene2d.InputListener) ButtonClickListener(de.gg.game.input.ButtonClickListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) GameServer(de.gg.game.network.GameServer) GameSpeedInputProcessor(de.gg.game.input.GameSpeedInputProcessor) BasicDialog(de.gg.game.ui.components.BasicDialog) CameraWrapper(de.gg.engine.ui.rendering.CameraWrapper) PostProcessingPipeline(de.eskalon.commons.graphics.postproc.PostProcessingPipeline) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) MapMovementInputController(de.gg.game.input.MapMovementInputController) Color(com.badlogic.gdx.graphics.Color) GameRenderer(de.gg.game.ui.rendering.GameRenderer)

Aggregations

ImageTextButton (com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton)9 ButtonClickListener (de.gg.game.input.ButtonClickListener)9 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)7 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)5 GameClient (de.gg.game.network.GameClient)5 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)4 BackInputProcessor (de.gg.game.input.BackInputProcessor)4 ImageButton (com.badlogic.gdx.scenes.scene2d.ui.ImageButton)3 OffsettableTextField (de.gg.engine.ui.components.OffsettableTextField)3 BackInputActorListener (de.gg.game.input.BackInputProcessor.BackInputActorListener)3 GameServer (de.gg.game.network.GameServer)3 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)2 InputListener (com.badlogic.gdx.scenes.scene2d.InputListener)2 ScrollPane (com.badlogic.gdx.scenes.scene2d.ui.ScrollPane)2 TextField (com.badlogic.gdx.scenes.scene2d.ui.TextField)2 Subscribe (com.google.common.eventbus.Subscribe)2 ISuccessCallback (de.damios.guacamole.ISuccessCallback)2 Keys (com.badlogic.gdx.Input.Keys)1 Color (com.badlogic.gdx.graphics.Color)1 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1