PvP game over condition

This commit is contained in:
Anuken
2018-10-13 17:33:23 -04:00
parent 28b4ddfc72
commit 870f5caca9
7 changed files with 56 additions and 28 deletions

View File

@@ -1,12 +1,14 @@
package io.anuke.mindustry.ui.dialogs;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.game.EventType.GameOverEvent;
import io.anuke.mindustry.maps.Sector;
import io.anuke.ucore.util.Bundles;
import static io.anuke.mindustry.Vars.*;
public class RestartDialog extends FloatingDialog{
private GameOverEvent event;
public RestartDialog(){
super("$text.gameover");
@@ -14,13 +16,25 @@ public class RestartDialog extends FloatingDialog{
shown(this::rebuild);
}
public void show(GameOverEvent event){
this.event = event;
show();
}
void rebuild(){
buttons().clear();
content().clear();
buttons().margin(10);
if(world.getSector() == null){
if(state.mode.isPvp){
content().add(Bundles.format("text.gameover.pvp", event.winner.localized())).pad(6);
buttons().addButton("$text.menu", () -> {
hide();
state.set(State.menu);
logic.reset();
}).size(130f, 60f);
}else if(world.getSector() == null){
if(control.isHighScore()){
content().add("$text.highscore").pad(6);
content().row();