mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Improved state handling of tournament panel.
This commit is contained in:
parent
469e9f3519
commit
ef811ff0bf
4 changed files with 10 additions and 14 deletions
|
@ -63,10 +63,7 @@ public class BoosterDraftEliminationTournament extends TournamentSingleEliminati
|
||||||
tableEventSource.fireTableEvent(EventType.START_DRAFT, null, draft);
|
tableEventSource.fireTableEvent(EventType.START_DRAFT, null, draft);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void winners() {
|
|
||||||
// TODO: Show winners and tournament result
|
|
||||||
// throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void nextStep() {
|
public void nextStep() {
|
||||||
|
|
|
@ -28,7 +28,9 @@
|
||||||
|
|
||||||
package mage.tournament;
|
package mage.tournament;
|
||||||
|
|
||||||
|
import mage.constants.TournamentPlayerState;
|
||||||
import mage.game.tournament.TournamentOptions;
|
import mage.game.tournament.TournamentOptions;
|
||||||
|
import mage.game.tournament.TournamentPlayer;
|
||||||
import mage.game.tournament.TournamentSingleElimination;
|
import mage.game.tournament.TournamentSingleElimination;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,11 +50,6 @@ public class SealedEliminationTournament extends TournamentSingleElimination {
|
||||||
currentStep = TournamentStep.START;
|
currentStep = TournamentStep.START;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void winners() {
|
|
||||||
// TODO: Show winners and tournament result
|
|
||||||
// throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void nextStep() {
|
public void nextStep() {
|
||||||
switch (currentStep) {
|
switch (currentStep) {
|
||||||
|
|
|
@ -147,11 +147,6 @@ public abstract class TournamentImpl implements Tournament {
|
||||||
Round round = new Round(rounds.size() + 1);
|
Round round = new Round(rounds.size() + 1);
|
||||||
rounds.add(round);
|
rounds.add(round);
|
||||||
List<TournamentPlayer> roundPlayers = getActivePlayers();
|
List<TournamentPlayer> roundPlayers = getActivePlayers();
|
||||||
if (roundPlayers.size() == 1) {
|
|
||||||
TournamentPlayer winner = roundPlayers.get(0);
|
|
||||||
winner.setState(TournamentPlayerState.FINISHED);
|
|
||||||
winner.setStateInfo("Winner");
|
|
||||||
}
|
|
||||||
while (roundPlayers.size() > 1) {
|
while (roundPlayers.size() > 1) {
|
||||||
int i = rnd.nextInt(roundPlayers.size());
|
int i = rnd.nextInt(roundPlayers.size());
|
||||||
TournamentPlayer player1 = roundPlayers.get(i);
|
TournamentPlayer player1 = roundPlayers.get(i);
|
||||||
|
|
|
@ -30,6 +30,7 @@ package mage.game.tournament;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.constants.TournamentPlayerState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -65,5 +66,11 @@ public abstract class TournamentSingleElimination extends TournamentImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void winners() {
|
||||||
|
for(TournamentPlayer winner: this.getActivePlayers()) {
|
||||||
|
winner.setState(TournamentPlayerState.FINISHED);
|
||||||
|
winner.setStateInfo("Winner");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue