diff --git a/frontend/core/src/com/gameware/game/states/CreateNewTournamentState.java b/frontend/core/src/com/gameware/game/states/CreateNewTournamentState.java index cb40661bbb5f36a4dd84e83a82e19e5edadc1457..a048951125188e20afa831fcfada24e3f8d37b68 100644 --- a/frontend/core/src/com/gameware/game/states/CreateNewTournamentState.java +++ b/frontend/core/src/com/gameware/game/states/CreateNewTournamentState.java @@ -242,37 +242,6 @@ public class CreateNewTournamentState extends State { stage.addActor(rootTable); } - private Table makeRow(Label label, final Dialog dialog){ - Table table = new Table(); - table.add(label).spaceRight(spacingLittle/2); - Image questionMarkImage = new Image(questionMark); - questionMarkImage.addListener(new ClickListener(){ - @Override - public void clicked(InputEvent e, float x, float y){ - if(GameWare.getInstance().isSoundEffectsOn()){ checkBoxSound.play(); } - dialog.show(stage); - } - }); - table.add(questionMarkImage).width(questionMarkWidthAndHeight).height(questionMarkWidthAndHeight).top(); - return table; - } - - private Dialog makeDialog(Label label){ - Dialog dialog = new Dialog("", skin, "dialog") { - public void result(Object obj) { } - }; - - label.setAlignment(Align.center); - label.setWrap(true); - dialog.getContentTable().add(label).width(Gdx.graphics.getWidth()/1.5f).pad(dialog.getHeight()/5f).padBottom(0); - - dialog.button("Okay", true); //sends "true" as the result - dialog.getButtonTable().pad(dialog.getHeight()/2f); - - return dialog; - } - - private TextButton makeCreateBtn() { TextButton createBtn = new TextButton(createBtnText, skin); createBtn.addListener(new ClickListener() { diff --git a/frontend/core/src/com/gameware/game/states/SinglePlayerSelectGameState.java b/frontend/core/src/com/gameware/game/states/SinglePlayerSelectGameState.java index ed3cf5de56cceaed34a723ac003f1c9bd6fe6593..eb7467e2b32128cf3b22d6cbebf719edf268ffef 100644 --- a/frontend/core/src/com/gameware/game/states/SinglePlayerSelectGameState.java +++ b/frontend/core/src/com/gameware/game/states/SinglePlayerSelectGameState.java @@ -3,14 +3,12 @@ package com.gameware.game.states; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.scenes.scene2d.InputEvent; -import com.badlogic.gdx.scenes.scene2d.ui.Dialog; import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; -import com.badlogic.gdx.utils.Align; import com.gameware.game.GameWare; import com.gameware.game.models.Game; @@ -37,8 +35,6 @@ public class SinglePlayerSelectGameState extends State { private final float scrollPaneHeight = Gdx.graphics.getHeight()/2.3f; - - protected SinglePlayerSelectGameState(GameStateManager gsm) { super(gsm); try { @@ -102,36 +98,6 @@ public class SinglePlayerSelectGameState extends State { return innerTable; } - private Table makeRow(Label label, final Dialog dialog){ - Table table = new Table(); - table.add(label).spaceRight(spacingLittle/2); - Image questionMarkImage = new Image(questionMark); - questionMarkImage.addListener(new ClickListener(){ - @Override - public void clicked(InputEvent e, float x, float y){ - if(GameWare.getInstance().isSoundEffectsOn()){ checkBoxSound.play(); } - dialog.show(stage); - } - }); - table.add(questionMarkImage).width(questionMarkWidthAndHeight).height(questionMarkWidthAndHeight).top(); - return table; - } - - private Dialog makeDialog(Label label){ - Dialog dialog = new Dialog("", skin, "dialog") { - public void result(Object obj) { } - }; - - label.setAlignment(Align.center); - label.setWrap(true); - dialog.getContentTable().add(label).width(Gdx.graphics.getWidth()/1.5f).pad(dialog.getHeight()/5f).padBottom(0); - - dialog.button("Okay", true); //sends "true" as the result - dialog.getButtonTable().pad(dialog.getHeight()/2f); - - return dialog; - } - private TextButton makeBackBtn(){ TextButton backBtn = new TextButton(backBtnText, skin); backBtn.addListener(new ClickListener() { diff --git a/frontend/core/src/com/gameware/game/states/State.java b/frontend/core/src/com/gameware/game/states/State.java index 3c0d36062e08d5d467c740affa74deb2e31bfff5..3ca5b63d23336752f46351aadf4eb69726de092a 100644 --- a/frontend/core/src/com/gameware/game/states/State.java +++ b/frontend/core/src/com/gameware/game/states/State.java @@ -8,10 +8,16 @@ import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.Dialog; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; +import com.badlogic.gdx.utils.Align; import com.gameware.game.GameWare; public abstract class State { @@ -126,4 +132,37 @@ public abstract class State { bgPixmap.fill(); return new TextureRegionDrawable(new TextureRegion(new Texture(bgPixmap))); } + +// Dialog methods + + protected Table makeRow(Label label, final Dialog dialog){ + Table table = new Table(); + table.add(label).spaceRight(spacingLittle/2); + Image questionMarkImage = new Image(questionMark); + questionMarkImage.addListener(new ClickListener(){ + @Override + public void clicked(InputEvent e, float x, float y){ + if(GameWare.getInstance().isSoundEffectsOn()){ checkBoxSound.play(); } + dialog.show(stage); + } + }); + table.add(questionMarkImage).width(questionMarkWidthAndHeight).height(questionMarkWidthAndHeight).top(); + return table; + } + + protected Dialog makeDialog(Label label){ + Dialog dialog = new Dialog("", skin, "dialog") { + public void result(Object obj) { } + }; + + label.setAlignment(Align.center); + label.setWrap(true); + dialog.getContentTable().add(label).width(Gdx.graphics.getWidth()/1.5f).pad(dialog.getHeight()/5f).padBottom(0); + + dialog.button("Okay", true); //sends "true" as the result + dialog.getButtonTable().pad(dialog.getHeight()/2f); + + return dialog; + } + } diff --git a/frontend/core/src/com/gameware/game/states/TournamentHighScoreState.java b/frontend/core/src/com/gameware/game/states/TournamentHighScoreState.java index a16b98bc1d45a3be1528727c6a0b4f23d4e6ecc9..1e5afb17a5048c990963a4b119716f8729998e95 100644 --- a/frontend/core/src/com/gameware/game/states/TournamentHighScoreState.java +++ b/frontend/core/src/com/gameware/game/states/TournamentHighScoreState.java @@ -117,36 +117,6 @@ public class TournamentHighScoreState extends State{ return innerTable; } - private Table makeRow(Label label, final Dialog dialog){ - Table table = new Table(); - table.add(label).spaceRight(spacingLittle/2); - Image questionMarkImage = new Image(questionMark); - questionMarkImage.addListener(new ClickListener(){ - @Override - public void clicked(InputEvent e, float x, float y){ - if(GameWare.getInstance().isSoundEffectsOn()){ checkBoxSound.play(); } - dialog.show(stage); - } - }); - table.add(questionMarkImage).width(questionMarkWidthAndHeight).height(questionMarkWidthAndHeight).top(); - return table; - } - - private Dialog makeDialog(Label label){ - Dialog dialog = new Dialog("", skin, "dialog") { - public void result(Object obj) { } - }; - - label.setAlignment(Align.center); - label.setWrap(true); - dialog.getContentTable().add(label).width(Gdx.graphics.getWidth()/1.5f).pad(dialog.getHeight()/5f).padBottom(0); - - dialog.button("Okay", true); //sends "true" as the result - dialog.getButtonTable().pad(dialog.getHeight()/2f); - - return dialog; - } - private TextButton makeBackBtn(){ TextButton backBtn = new TextButton(backBtnText, skin); backBtn.addListener(new ClickListener() { diff --git a/frontend/core/src/com/gameware/game/states/ViewHighScoreState.java b/frontend/core/src/com/gameware/game/states/ViewHighScoreState.java index 6ec43e867f3275b938b9361dc1da2cad410a6146..07b7c3f22ac749933ae35bd9d42ab1b8c4bea49c 100644 --- a/frontend/core/src/com/gameware/game/states/ViewHighScoreState.java +++ b/frontend/core/src/com/gameware/game/states/ViewHighScoreState.java @@ -114,36 +114,6 @@ public class ViewHighScoreState extends State { return innerTable; } - private Table makeRow(Label label, final Dialog dialog){ - Table table = new Table(); - table.add(label).spaceRight(spacingLittle/2); - Image questionMarkImage = new Image(questionMark); - questionMarkImage.addListener(new ClickListener(){ - @Override - public void clicked(InputEvent e, float x, float y){ - if(GameWare.getInstance().isSoundEffectsOn()){ checkBoxSound.play(); } - dialog.show(stage); - } - }); - table.add(questionMarkImage).width(questionMarkWidthAndHeight).height(questionMarkWidthAndHeight).top(); - return table; - } - - private Dialog makeDialog(Label label){ - Dialog dialog = new Dialog("", skin, "dialog") { - public void result(Object obj) { } - }; - - label.setAlignment(Align.center); - label.setWrap(true); - dialog.getContentTable().add(label).width(Gdx.graphics.getWidth()/1.5f).pad(dialog.getHeight()/5f).padBottom(0); - - dialog.button("Okay", true); //sends "true" as the result - dialog.getButtonTable().pad(dialog.getHeight()/2f); - - return dialog; - } - private TextButton makeBackBtn(){ TextButton backBtn = new TextButton(backBtnText, skin); backBtn.addListener(new ClickListener() {