public static Table setupScrollpane( float x, float y, float paneWidth, float paneHeight, ScrollPane target, Texture scrollButton) { ScrollPane.ScrollPaneStyle scrollPaneStyle = new ScrollPane.ScrollPaneStyle(); scrollPaneStyle.vScrollKnob = new TextureRegionDrawable(new TextureRegion(scrollButton)); target.setStyle(scrollPaneStyle); target.setFadeScrollBars(false); target.setOverscroll(false, false); target.setFlickScroll(false); target.addListener(new GetScrollFocusWhenEntered(target)); Table scenarioPaneContainer = new Table(); scenarioPaneContainer.setX(x); scenarioPaneContainer.setY(y); scenarioPaneContainer.setWidth(paneWidth); scenarioPaneContainer.setHeight(paneHeight); scenarioPaneContainer.add(target).fill().expand(); return scenarioPaneContainer; }
@Override public void show() { super.show(); // retrieve the custom skin for our 2D widgets Skin skin = super.getSkin(); // create the table actor and add it to the stage table = super.getTable(); table.setWidth(stage.getWidth()); table.setHeight(stage.getHeight()); table.pad(10).defaults().spaceBottom(10).space(5); table.row().fill().expandX(); AtlasRegion splashRegion = getAtlas().findRegion("splash-screen/menulogo"); Image logo = new Image(splashRegion); table.add(logo).fill(false); table.row(); table.pad(10).defaults().spaceBottom(10); TextButton continueButton = new TextButton("Continue", skin); continueButton.setVisible(false); continueButton.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { // game.setScreen( new StartGameScreen( game ) ); } }); table.add(continueButton).size(300, 60).uniform().spaceBottom(10); table.row(); table.pad(10).defaults().spaceBottom(10); TextButton newGameButton = new TextButton("New game", skin); newGameButton.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { // TODO: Move it back to char select screen // game.setScreen( new CharSelectScreen( game ) ); if (Unsealed.DEBUG) game.setScreen(new BattleScreen(game)); else game.setScreen(new SplashScreen(game)); } }); table.add(newGameButton).size(300, 60).uniform().spaceBottom(10); table.row(); table.pad(10).defaults().spaceBottom(10); // TextButton optionsButton = new TextButton( "Options", skin ); // optionsButton.setDisabled(true); // optionsButton.addListener( new ClickListener() { // @Override // public void clicked(InputEvent event, float x, float y ) { // game.setScreen( new OptionsScreen( game ) ); // } // } ); // table.add(optionsButton).size( 300, 60 ).uniform().spaceBottom(10); }
public void initTable() { table = new Table(); table.setWidth(getWidth()); table.setFillParent(true); table.center(); table.debug(); titleLabel = new TransparentBackgroundLabel(this.game, "", skin, "default_label"); // Make it bigger titleLabel.setFontScale(1.0f); titleLabel.setWrap(true); titleLabel.setAlignment(Align.center); definitionLabel = new TransparentBackgroundLabel(this.game, "", skin, "default_label"); definitionLabel.setFontScale(0.6f); definitionLabel.setWrap(true); definitionLabel.setAlignment(Align.center); table .add(titleLabel) .center() .expand() .width(getWidth() * 0.9f) .padTop(70f) .height(getHeight() * 0.10f); table.row(); table .add(definitionLabel) .center() .top() .expand() .width(getWidth() * 0.9f) .maxHeight(getHeight() * 0.7f) .spaceBottom(150f); this.addActor(table); }
@Override public void show() { skin = new Skin(Gdx.files.internal("uiskin.json")); stage = new Stage(new ScreenViewport()); batch = new SpriteBatch(); Gdx.input.setInputProcessor(stage); // Adding the game title to the screen Sprite spriteTitle = new Sprite(Assets.zombieShooterTitle); Assets.spriteDefaultColorSolid(spriteTitle); SpriteDrawable spriteDrawableTitle = new SpriteDrawable(spriteTitle); imageTitle = new Image(spriteDrawableTitle); // Creating all the containers for the positioning and arranging of our stuff container = new Table(); container.setWidth(stage.getWidth()); container.align(Align.center | Align.top); container.setPosition(0, Constant.HEIGHT_SCREEN); containerFirstRow = new Table(); containerFirstRow.setWidth(stage.getWidth()); containerFirstRow.align(Align.center | Align.top); containerFirstRow.setPosition(0, Constant.HEIGHT_SCREEN); containerSecondRow = new Table(); containerSecondRow.setWidth(stage.getWidth()); containerSecondRow.align(Align.center | Align.top); containerSecondRow.setPosition(0, Constant.HEIGHT_SCREEN); creatingRegisterButton(); creatingTheTextFields(); // Setting the text field text to be on the center settingTextFieldsTextToCenter(); // Remove any text in hte text fields on click so that user can write his information cleaningTextFieldsToBlank(); // Adding all the object into the stage. First of all we add to the container // for the row then to the main container , finally into the main stage arrangingTheScreen(); // Creating the background backGroundSprite = new Sprite(Assets.backgroundMenu); backGroundSprite.setSize(Constant.WIDTH_SCREEN, Constant.HEIGHT_SCREEN); // Setting the back key on android to true, so it can accept interaction Gdx.input.setCatchBackKey(true); inizializiraneWarningMessage(); // When clicking on the register button we start the validation process. // It calls all the methods which are checking the user input registerButton.addListener( new ClickListener() { public void clicked(InputEvent e, float x, float y) { Assets.clickButton.play(); if ((checkUserField(userField.getText().toString())) && (checkPasswordField(passwordField.getText().toString())) && (checkPasswordAndRePassword( passwordField.getText().toString(), passwordCheckField.getText().toString())) && (checkEmailField(emailField.getText().toString()))) { registerJson(); } } }); }
@Override public void show() { super.show(); // retrieve the custom skin for our 2D widgets Skin skin = super.getSkin(); game.getMusicManager().play(UnsealedMusic.MENU); // create the table actor and add it to the stage table = super.getTable(); table.setWidth(stage.getWidth()); table.setHeight(stage.getHeight()); table.pad(10).defaults().spaceBottom(10).space(5); table.row().fill().expandX(); AtlasRegion splashRegion = getAtlas().findRegion("splash-screen/menulogo"); Image logo = new Image(splashRegion); table.add(logo).colspan(3).fill(false); table.row(); table.pad(10).defaults().spaceBottom(10); TextButton currentButton = new TextButton("Story Mode", skin); currentButton.setVisible(true); currentButton.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { game.setScreen(new ChapterSelectScreen(game)); } }); table.add(currentButton).colspan(3).size(300, 60).uniform().spaceBottom(10); table.row(); table.pad(10).defaults().spaceBottom(10); currentButton = new TextButton("Battle Arena", skin); currentButton.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (Unsealed.DEBUG) game.setScreen(new BattleScreen(game, false, "TownOne")); else if (Gdx.app.getType() != ApplicationType.Android) game.setScreen(new QuickTutorialScreen(game)); else game.setScreen(new BattleScreen(game, false, "TownOne")); } }); table.add(currentButton).colspan(3).size(300, 60).uniform().spaceBottom(10); table.row(); table.pad(10).defaults().spaceBottom(10); currentButton = new TextButton("Options", skin); currentButton.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { game.setScreen(new OptionsScreen(game)); } }); table.add(currentButton).uniform().spaceBottom(10); currentButton = new TextButton("Tutorial", skin); currentButton.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (Gdx.app.getType() == ApplicationType.Android) game.setScreen(new TutorialAndroidScreen(game)); else game.setScreen(new TutorialDesktopScreen(game)); } }); table.add(currentButton).uniform().spaceBottom(10); currentButton = new TextButton("Credits", skin); currentButton.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { game.setScreen(new CreditsScreen(game)); } }); table.add(currentButton).uniform().spaceBottom(10); table.pad(10).defaults().spaceBottom(10); }