Skip to content

Commit

Permalink
add quit flag
Browse files Browse the repository at this point in the history
comparing strings is slow and so is text rendering! (but mostly text rendering)
  • Loading branch information
Sploder12 committed Jun 8, 2024
1 parent 25a0c50 commit 6e5a204
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/game/controls/MPFFRScoreCompare.as
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ internal class PlayerLabel extends Sprite

private var _lastPosition:int = -1;
private var _lastScore:int = -1;
private var _hasQuit:Boolean = false;

public function PlayerLabel(room:MPRoomFFR, data:MPMatchFFRUser):void
{
Expand Down Expand Up @@ -165,12 +166,13 @@ internal class PlayerLabel extends Sprite
this.alpha = data.alive ? 1 : 0.5;
isAlive = data.alive;
}
else {
else if (!_hasQuit) {
// check if user has quit the match (but is still connected)
const gameState:String = data.room.player_state_map[data.user.uid].game_state;

if (gameState != "game" && gameState != "loading") {
txtUsername.fontColor = MPColors.USER_LEAVE;
_hasQuit = true;
}
}
}
Expand Down

0 comments on commit 6e5a204

Please sign in to comment.