Beispiel #1
0
        private void GenerateCunk(string cmdString)
        {
            TallyCommand();

            string commandInformation = "";
            // First break up the command string. The format is <name>:<commands>
            cmdString = cmdString.ToLower();
            string[] cmdStringParts = cmdString.Split(':');
            // Get the player the command is for.
            Player player = players.GetPlayerFromName(cmdStringParts[0]);
            // Only continue if the player is not paused and player is not set to All.
            if (!players.IsPaused(player) && player != Player.All)
            {
                commandInformation += cmdStringParts[0]+": ";
                #region Parse Commands
                // Get the individual commands.
                string[] commandsString = cmdStringParts[1].Split('+');
                List<Key> commands = new List<Key>();
                for (int i = 0; i < commandsString.Length; i++)
                {
                    commandInformation += commandsString[i] + "+";
                    switch (commandsString[i])
                    {
                        case "upright":
                            if (!disabledKeys.IsKeyDisabled(player, Key.AnalogUp))
                                commands.Add(Key.AnalogUp);
                            if (!disabledKeys.IsKeyDisabled(player, Key.AnalogRight))
                                commands.Add(Key.AnalogRight);
                            break;
                        case "downright":
                            if (!disabledKeys.IsKeyDisabled(player, Key.AnalogDown))
                                commands.Add(Key.AnalogDown);
                            if (!disabledKeys.IsKeyDisabled(player, Key.AnalogRight))
                                commands.Add(Key.AnalogRight);
                            break;
                        case "downleft":
                            if (!disabledKeys.IsKeyDisabled(player, Key.AnalogDown))
                                commands.Add(Key.AnalogDown);
                            if (!disabledKeys.IsKeyDisabled(player, Key.AnalogLeft))
                                commands.Add(Key.AnalogLeft);
                            break;
                        case "upleft":
                            if (!disabledKeys.IsKeyDisabled(player, Key.AnalogUp))
                                commands.Add(Key.AnalogUp);
                            if (!disabledKeys.IsKeyDisabled(player, Key.AnalogLeft))
                                commands.Add(Key.AnalogLeft);
                            break;
                        default:
                            Key tempKey = keyLookupDictionary[commandsString[i]];
                            if (!disabledKeys.IsKeyDisabled(player, tempKey))
                                commands.Add(tempKey);
                            break;
                    }
                }

                commandInformation = commandInformation.Substring(0, commandInformation.Length - 1);
                Messenger<CommandInfo>.Broadcast("DisplayCommandInformation", new CommandInfo(commandInformation, commandColors[(int)player]));
                //TODO: figure this shit out right here!!! ---------------^^^^^^^^

                CommandCunk cmdChunk = new CommandCunk();
                cmdChunk.Window = gameWindowTitle;

                //This needs to be rewritten.... Should be working with the new KeyPressProfile data
                // Still need to get Scaling Delay working
                cmdChunk.Commands = ProcessCommands(commands.ToArray());
                #endregion

                #region Send Commands
                // Now that we have the correct Player and the commands for that play to use
                // we send them to the appropriate command processor for the emulator.
                switch (player)
                {
                    case Player.Player1:
                        Messenger<CommandCunk>.Broadcast("Player1ProcessCommands", cmdChunk);
                        break;
                    case Player.Player2:
                        Messenger<CommandCunk>.Broadcast("Player2ProcessCommands", cmdChunk);
                        break;
                    case Player.Player3:
                        Messenger<CommandCunk>.Broadcast("Player3ProcessCommands", cmdChunk);
                        break;
                    case Player.Player4:
                        Messenger<CommandCunk>.Broadcast("Player4ProcessCommands", cmdChunk);
                        break;
                    default:
                        break;
                }
                #endregion
            }
        }
Beispiel #2
0
 private void RunPlayer4(CommandCunk chunk)
 {
     if (!Player4ProcessorWorker.IsBusy)
         Player4ProcessorWorker.RunWorkerAsync(chunk);
 }