ecran de fin

This commit is contained in:
heurtet 2021-05-29 11:10:54 +02:00
parent 0ece22dc85
commit 37ea6086bf
3 changed files with 113 additions and 1 deletions

View file

@ -5,6 +5,8 @@ import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener;
import com.kotcrab.vis.ui.VisUI; import com.kotcrab.vis.ui.VisUI;
import com.kotcrab.vis.ui.widget.VisTable; import com.kotcrab.vis.ui.widget.VisTable;
import com.kotcrab.vis.ui.widget.VisTextButton;
import sagittarius.view.ButtonSounded.*; import sagittarius.view.ButtonSounded.*;
import sagittarius.SagittariusGame; import sagittarius.SagittariusGame;
@ -33,6 +35,11 @@ public class CreditScreen extends BaseScreen {
table.setFillParent(true); table.setFillParent(true);
uiStage.addActor(table); uiStage.addActor(table);
VisTextButton laurent = new VisTextButton("Laurent Fainsin");
VisTextButton damien = new VisTextButton("Damien Guillotin");
VisTextButton tom = new VisTextButton("Tom Heurtebise");
VisTextButton pierre = new VisTextButton("Pierre-Eliot Jourdan");
VisTextButton joan = new VisTextButton("Johan Guillemin");
// go back button // go back button
@ -45,6 +52,16 @@ public class CreditScreen extends BaseScreen {
} }
}); });
table.add(laurent).width(300);
table.row();
table.add(damien).width(300);
table.row();
table.add(tom).width(300);
table.row();
table.add(pierre).width(300);
table.row();
table.add(joan).width(300);
table.row();
table.add(returnButton).width(150); table.add(returnButton).width(150);
table.row(); table.row();
} }

View file

@ -0,0 +1,95 @@
package sagittarius.view;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.TextArea;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener;
import com.badlogic.gdx.utils.FloatArray;
import com.kotcrab.vis.ui.VisUI;
import com.kotcrab.vis.ui.widget.VisTable;
import com.kotcrab.vis.ui.widget.VisTextArea;
import com.kotcrab.vis.ui.widget.VisTextButton;
import com.kotcrab.vis.ui.widget.VisTextField;
import com.kotcrab.vis.ui.widget.spinner.SimpleFloatSpinnerModel;
import sagittarius.view.ButtonSounded.*;
import sagittarius.SagittariusGame;
public class EndScreen extends BaseScreen {
@Override
public void initialize() {
if (!SagittariusGame.disableMusic) {
SagittariusGame.music.stop();
SagittariusGame.music =
Gdx.audio.newMusic(Gdx.files.internal("sounds/music/resumeMenu_music.mp3"));
SagittariusGame.music.setLooping(true);
SagittariusGame.music.setVolume(SagittariusGame.musicVolume);
SagittariusGame.music.play();
}
Gdx.input.setInputProcessor(uiStage);
// Table creation
VisTable table = new VisTable(true);
table.setFillParent(true);
uiStage.addActor(table);
// Winner display
String win = GameScreen.playerCurrent.getColor().toString();
VisTextButton winnerDisplay = new VisTextButton(win);
// Restart button
ButtonTextSounded restartButton = new ButtonTextSounded("Restart");
restartButton.addListener(new ActorGestureListener() {
@Override
public void tap(InputEvent event, float x, float y, int count, int button) {
super.tap(event, x, y, count, button);
if (!SagittariusGame.disableMusic) {
SagittariusGame.music.stop();
SagittariusGame.music =
Gdx.audio.newMusic(Gdx.files.internal("sounds/music/game_music.mp3"));
SagittariusGame.music.setLooping(true);
SagittariusGame.music.setVolume(SagittariusGame.musicVolume);
SagittariusGame.music.play();
}
SagittariusGame.setActiveScreen(new GameScreen());
}
});
// go back to main menu
ButtonTextSounded returnMain = new ButtonTextSounded("Main Menu");
returnMain.addListener(new ActorGestureListener() {
@Override
public void tap(InputEvent event, float x, float y, int count, int button) {
super.tap(event, x, y, count, button);
SagittariusGame.setActiveScreen(new StartScreen());
}
});
// Table structure
table.add(winnerDisplay).width(250);
table.row();
table.add(restartButton).width(250);
table.row();
table.add(returnMain).width(250);
}
@Override
public void update(float dt) {}
@Override
public void dispose() {
VisUI.dispose();
super.dispose();
}
}

View file

@ -130,7 +130,7 @@ public class GameScreen extends BaseScreen implements InputProcessor {
worldCursor = new Vector2(unprojectedCursor.x, unprojectedCursor.y); worldCursor = new Vector2(unprojectedCursor.x, unprojectedCursor.y);
if (players.getChildren().size <= 1) { if (players.getChildren().size <= 1) {
SagittariusGame.setActiveScreen(new StartScreen()); SagittariusGame.setActiveScreen(new EndScreen());
} }
// camera zoom using keys // camera zoom using keys