-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Game server architectural changes (#196)
* Player update * PlayerLocation update * Match update and addition of MatchLocation * Replaced Scene class with a GameManager * Added classes to handle events * Added a ClientManager and removed the now useless Game class * Added an AntiCheat class * Updated Ball class * Added Server class * main now uses the new classes * Updated utils and settings * Updated documentation * Updated client to work with the new server * Fixed the test test_valid_tournament_request not sending a valid list of users
- Loading branch information
Showing
36 changed files
with
783 additions
and
675 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
import {Scene} from './Scene'; | ||
|
||
export class PlayerLocation { | ||
#isInAMatch; | ||
#matchIndex; | ||
#looser; | ||
#matchKey; | ||
#playerIndex; | ||
|
||
constructor(playerLocationJson) { | ||
this.#isInAMatch = playerLocationJson['is_in_a_match']; | ||
this.#matchIndex = playerLocationJson['match_index']; | ||
this.#looser = playerLocationJson['looser']; | ||
this.#matchKey = Scene.convertMatchLocationToKey(playerLocationJson['match_location']); | ||
this.#playerIndex = playerLocationJson['player_index']; | ||
} | ||
|
||
getPlayerFromScene(scene) { | ||
return scene.matches[this.#matchIndex].players[this.#playerIndex]; | ||
if (this.#looser) { | ||
return scene.loosers[this.#playerIndex]; | ||
} | ||
return scene.getMatchFromKey(this.#matchKey).players[this.#playerIndex]; | ||
} | ||
} |
Oops, something went wrong.