Beispiel #1
0
        //method for sending proper info
        private void SendInfoMessageToClient(ClientInfoType messageType, IMakaoGameClientService proxy, object dataToSend)
        {
            var logger = NLog.LogManager.GetCurrentClassLogger();

            logger.Info("Sending info to specific player in the room: " + messageType.ToString());

            switch (messageType)
            {
            case ClientInfoType.PlayersDataChanged: proxy.UpdateTheCurrentListOfPlayers(); break;

            case ClientInfoType.ClosedByHost: proxy.RoomWasDeleted(DeletionReason.ClosedByHost); break;

            case ClientInfoType.PlayersReadinessChanged:
                proxy.UpdatePlayersGameReadinessData((ActualizedPlayersReadinessDataRequest)dataToSend); break;

            case ClientInfoType.JoiningTimeout: proxy.RoomWasDeleted(DeletionReason.JoiningTimeout); break;

            case ClientInfoType.ReadinessTimeout: proxy.RoomWasDeleted(DeletionReason.ReadinessTimeout); break;

            case ClientInfoType.CheckAliveness: CheckAlivenessOfPlayer(proxy); break;

            case ClientInfoType.LostConnectionToClient: proxy.RoomWasDeleted(DeletionReason.LostConnection); break;

            case ClientInfoType.PlayerLeftGame: proxy.RoomWasDeleted(DeletionReason.PlayerLeftGame); break;
            }
        }
Beispiel #2
0
        //send info to all clients
        private void SendInfoToAllCLients(ClientInfoType messageType, object dataToSend)
        {
            foreach (PlayerData item in MakaoEngineHostDataPlaceholders.PlayersData)
            {
                var logger = NLog.LogManager.GetCurrentClassLogger();
                logger.Info(string.Format("Sending message of type: {0}, to player: {1} [{2}], endpoint: {3}.",
                                          messageType.ToString(), item.PlayerName, item.PlayerNumber.ToString(), item.PlayerEndpoint));

                ChannelFactoryCreation(item.PlayerEndpoint, messageType, dataToSend);
            }
        }