import House from "./game-data-structure/House" ; import User from "../../server/User" ; import IngameGameState from "./IngameGameState" ; import { observable } from "mobx" ; export default class Player { user : User ; house : House ; @ observable note = "" ; constructor ( user , house ) { this . user = user ; this . house = house ; } serializeToClient ( admin , player ) { return { userId : this . user . id , houseId : this . house . id , note : admin ? this . note : player == this ? this . note : "" } ; } static deserializeFromServer ( ingame , data ) { const player = new Player ( ingame . entireGame . users . get ( data . userId ) , ingame . game . houses . get ( data . houseId ) ) ; player . note = data . note ; return player ; } } export interface SerializedPlayer { userId : string ; houseId : string ; note : string ; }