bot game result

This commit is contained in:
ntr 2019-03-20 14:36:55 +11:00
parent 4b848f1e02
commit 14c779f484
3 changed files with 6 additions and 7 deletions

View File

@ -262,7 +262,7 @@ class ItemList extends Phaser.Scene {
console.log(name);
const SCORE_X = ITEM_WIDTH * 11;
const SCORE_Y = ITEM_HEIGHT * 1.1 * (i + 2);
this.add.text(SCORE_X, SCORE_Y, `${name} | ${score.wins} - ${score.losses}`, TEXT.NORMAL);
this.add.text(SCORE_X, SCORE_Y, `${score.wins} - ${score.losses} | ${name}`, TEXT.NORMAL);
});
// Add Handlers

View File

@ -15,7 +15,6 @@
# WORK WORK
## NOW
scoreboard
cryp vbox
constants
change to ownership pattern

View File

@ -103,7 +103,7 @@ impl Instance {
Ok(self)
}
fn bot_vs_player_game(&self, player: &Player) -> Game {
fn bot_vs_player_game(&self, player: &Player) -> Result<Game, Error> {
let current_round = self.current_round(player);
let plr = self.players.clone().into_iter().find(|p| p.id == player.id).unwrap();
@ -125,12 +125,12 @@ impl Instance {
bot_team.set_bot();
game
.team_add(plr_team).unwrap()
.team_add(bot_team).unwrap();
.team_add(plr_team)?
.team_add(bot_team)?;
game.start();
game
Ok(game)
}
fn can_start(&self) -> bool {
@ -485,7 +485,7 @@ pub fn instance_ready(params: InstanceReadyParams, tx: &mut Transaction, account
true => match game_get(tx, game_id) {
Ok(g) => g,
Err(_) => {
let game = instance.bot_vs_player_game(&player);
let game = instance.bot_vs_player_game(&player)?;
game_write(&game, tx)?;
game
},