private async void HandleIncomingCommandRequest(CommandRequestedMessage request, ISubscription subscription) { string[] requestData = request.Content.CommandData.Split(' '); if (requestData.Length == 0) { // If no message is given, such as the user just pressed enter, ignore it. return; } List <IActorCommand> targetCommandHistory; IActorCommand commandToExecute; if (this.commandsBeingExecuted.TryGetValue(request.Content.Target, out targetCommandHistory)) { commandToExecute = targetCommandHistory.Last(); if (await commandToExecute.CanProcessCommand(null, request.Content.Target, requestData)) { await commandToExecute.ProcessCommand(request.Content.Target, requestData); } return; } else { commandToExecute = this.commandAliasMapping[requestData[0].ToLower()]; } }
public PlayerCommandHistoryItem(IActorCommand command, CommandRequestedMessage requestedCommandMessage) { this.RequestedCommand = requestedCommandMessage; this.Command = command; }