static void Main(string[] args) { while (EventCommands.ExecuteNextCommand()) { } Console.WriteLine(Messages.output); }
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; }
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); }
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)); } }
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); }
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; }
public EventCommandAttribute(EventCommands eventCommand) { var e = GetCommand(eventCommand); Name = e.Name; EventName = e.EventName; }