private void ProcessOverallMatchData(Packet data) { if (!matchStarted) { OnMatchStarted(); } OverallMatchStanding = DataSerializer.ReadSerializedData <OverallMatchStanding>(data.Data); matchStarted = true; OnOverallMatchStandingReceived(); Debug.WriteLine($"Standing: {OverallMatchStanding.Standing.HomeGoals}:{OverallMatchStanding.Standing.AwayGoals}"); }
internal static OverallMatchStanding Create(Game game, MatchTimer timer, bool isHome) { MatchStanding matchStanding = MatchStandingCreator.Create(game); var standing = new OverallMatchStanding { Scores = game.Scores, Standing = matchStanding, TimeElapsed = new MatchTime { Time = timer.RemainingTime }, PositionCollection = isHome ? game.HomePositions : game.AwayPositions, BallPosition = game.BallPosition }; return(standing); }
public ServerGameController() { int matchTime = random.Next(60, 120) * 1000; matchTimer = new MatchTimer(matchTime); matchStanding = new OverallMatchStanding { TimeElapsed = new MatchTime { Time = matchTime } }; matchTimer.TimeElapsed += MatchTimer_Elapsed; // The size of the Pith is fixed pitch = new Pitch { Width = 500, Height = 500 }; homeTeamData = new TeamData(); awayTeamData = new TeamData(); var dataController = new TeamDataController(homeTeamData, awayTeamData); dataController.TeamsAreReady += DataController_TeamsAreReady; }