static void Main(string[] args)
 {
     while (EventCommands.ExecuteNextCommand())
     {
     }
     Console.WriteLine(Messages.output);
 }
Exemplo n.º 2
0
 static EventCommandAttribute GetCommand(EventCommands cmd)
 {
     switch (cmd)
     {
         case EventCommands.Closed: return ClosedEvent;
         case EventCommands.Closing: return ClosingEvent;
         case EventCommands.Deserializing: return DeserializingEvent;
         case EventCommands.Loaded: return LoadedEvent;
         case EventCommands.Serializing: return SerializingEvent;
     }
     return null;
 }
Exemplo n.º 3
0
 public void RunEventCommand(EventCommands commands, OWPlayer player)
 {
     if (movement.turnable){
         if (player.GetDir() == Tile.Direction.NORTH)
             SetDir(Tile.Direction.SOUTH);
         else if (player.GetDir() == Tile.Direction.SOUTH)
             SetDir(Tile.Direction.NORTH);
         else if (player.GetDir() == Tile.Direction.EAST)
             SetDir(Tile.Direction.WEST);
         else if (player.GetDir() == Tile.Direction.WEST)
             SetDir(Tile.Direction.EAST);
     }
     sentRun = true;
     commands(player);
 }
Exemplo n.º 4
0
        public IResponse ProcessMessage(IRequest message)
        {
            var command  = message.Command;
            var personId = ((Person)message.Author).TelegramId;

            if (!UsersActiveSessions.ContainsKey(personId) || UsersActiveSessions[personId] == null)
            {
                if (EventCommands.ContainsKey(command))
                {
                    if (!UsersActiveSessions.ContainsKey(personId))
                    {
                        UsersCommand.Add(personId, GetSessionCommand());
                        UsersActiveSessions.Add(personId, UsersCommand[personId][command]);
                    }
                    else
                    {
                        UsersActiveSessions[personId] = UsersCommand[personId][command];
                    }
                }
                else
                {
                    return(new ButtonResponse(
                               "No such command implemented!",
                               EventCommands.Keys.ToArray(), ResponseStatus.Abort));
                }
            }
            try
            {
                var response = UsersActiveSessions[personId].Execute(message);
                if (response.Status == ResponseStatus.Expect)
                {
                    return(response);
                }
                UsersActiveSessions[personId] = null;
                return(new ButtonResponse(response.Text, EventCommands.Keys.ToArray(), ResponseStatus.Abort));
            }
            catch (ArgumentException)
            {
                return(new ButtonResponse(
                           "Incorrect command arguments!",
                           EventCommands.Keys.ToArray(), ResponseStatus.Abort));
            }
        }
Exemplo n.º 5
0
 public void RunEventCommand(EventCommands commands, OWPlayer player)
 {
     if (movement.turnable)
     {
         if (player.GetDir() == Tile.Direction.NORTH)
         {
             SetDir(Tile.Direction.SOUTH);
         }
         else if (player.GetDir() == Tile.Direction.SOUTH)
         {
             SetDir(Tile.Direction.NORTH);
         }
         else if (player.GetDir() == Tile.Direction.EAST)
         {
             SetDir(Tile.Direction.WEST);
         }
         else if (player.GetDir() == Tile.Direction.WEST)
         {
             SetDir(Tile.Direction.EAST);
         }
     }
     sentRun = true;
     commands(player);
 }
Exemplo n.º 6
0
 public EventPage(string texturePath, int[] mapPos, Tile.Direction dir, Movement movement, EventCommands script, string name)
     : base(texturePath, mapPos, dir, name)
 {
     this.movement = movement;
         this.script = script;
 }
Exemplo n.º 7
0
 public EventCommandAttribute(EventCommands eventCommand)
 {
     var e = GetCommand(eventCommand);
     Name = e.Name;
     EventName = e.EventName;
 }
Exemplo n.º 8
0
 public EventPage(string texturePath, int[] mapPos, Tile.Direction dir, Movement movement, EventCommands script, string name)
     : base(texturePath, mapPos, dir, name)
 {
     this.movement = movement;
     this.script   = script;
 }