Skip to content

Commit

Permalink
Add MP Quit Coloring (#384)
Browse files Browse the repository at this point in the history
* Add MP quit coloring
* Add quit flag
  • Loading branch information
Sploder12 authored Jun 11, 2024
1 parent b9babb6 commit 22c758b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/game/controls/MPFFRScoreCompare.as
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ package game.controls
}
}

import classes.mp.MPColors;
import classes.mp.MPUser;
import classes.mp.Multiplayer;
import classes.mp.mode.ffr.MPMatchFFRUser;
Expand All @@ -118,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 @@ -164,6 +166,15 @@ internal class PlayerLabel extends Sprite
this.alpha = data.alive ? 1 : 0.5;
isAlive = data.alive;
}
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;
}
}
}

override public function get height():Number
Expand Down

0 comments on commit 22c758b

Please sign in to comment.