示例#1
0
 public PubSystem(IGameConfiguration configuration, IWorld world) {
   this.configuration = configuration;
   this.world = world;
   this.timer = new Timer(configuration.getPubInterval() * 60 * 1000, this);
   this.messages = CollectionUtils.toList(configuration.getPubMessages());
   this.messageColor = this.configuration.getPubColor();
   this.currentMessage = 0;
 }
示例#2
0
  @Override
  public void actionPerformed(ActionEvent e) {
    String message =
        StringUtils.format(PUB_MESSAGE_FORMAT, messageColor, messages.get(currentMessage));

    world.systemMessage(new SystemMessageEvent(message));

    ++currentMessage;
    if (currentMessage >= configuration.getPubMessages().length) {
      currentMessage = 0;
    }
  }