//obtaining response which is send to clients - current data of players //readiness to play the new game private ActualizedPlayersReadinessDataRequest ObtainPlayersReadinessData() { List <ActualizedDataOfPlayersReadiness> ReadinessList = new List <ActualizedDataOfPlayersReadiness>(); foreach (PlayerData item in MakaoEngineHostDataPlaceholders.PlayersData) { ActualizedDataOfPlayersReadiness singlePlayerData = new ActualizedDataOfPlayersReadiness() { PlayerName = item.PlayerName, PlayerNumber = item.PlayerNumber, PlayerID = item.PlayerID, IsReadyToPlay = item.ReadyToPlay, }; ReadinessList.Add(singlePlayerData); } ActualizedPlayersReadinessDataRequest response = new ActualizedPlayersReadinessDataRequest() { ReadinessDataList = ReadinessList, }; return(response); }
//spread info about change in players readiness to game public void SendInfoToClientsAboutChangeOfReadiness(ActualizedPlayersReadinessDataRequest dataToSend) { Task.Run(() => SendInfoToAllCLients(ClientInfoType.PlayersReadinessChanged, (object)dataToSend)); }
//receiving information from host about players rediness to play void IMakaoGameClientService.UpdatePlayersGameReadinessData(ActualizedPlayersReadinessDataRequest request) { DataPlaceholder.OnPlayersReadinesChanged(request); }
public static void OnPlayersReadinesChanged(ActualizedPlayersReadinessDataRequest args) { PlayersReadinesChanged?.Invoke(null, new PlayersReadinessToPlayEventArgs { ReadinessData = args }); }