Ejemplo n.º 1
0
        void OnDataReceived(IPEndPoint endPoint, ICommand command)
        {
            var joinCharacterCommand = command as JoinCharacterCommand;
            if (joinCharacterCommand != null)
                joinCharacterCommand.Execute(endPoint, _serverContext);

            var keyPressedCommand = command as KeyPressedCommand;
            if (keyPressedCommand != null)
                keyPressedCommand.Execute(endPoint, _serverContext);
        }
Ejemplo n.º 2
0
        void OnDataReceived(ICommand command)
        {
            if (!Dispatcher.CheckAccess())
            {
                Dispatcher.InvokeAsync(() => { OnDataReceived(command); });
                return;
            }

            var characterJoinedCommand = command as CharacterJoinedCommand;
            if (characterJoinedCommand != null)
                CommandHandlers.OnCharacterJoined(characterJoinedCommand, _clientContext);

            var characterDetectedCommand = command as CharacterDetectedCommand;
            if (characterDetectedCommand != null)
                CommandHandlers.OnCharacterDetected(characterDetectedCommand, _locationControl, _clientContext);

            var positionChangedCommand = command as PositionChangedCommand;
            if (positionChangedCommand != null)
                CommandHandlers.OnPositionChanged(positionChangedCommand, _locationControl, _clientContext);
        }