PvP game over condition
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user