当前位置: 首页>>代码示例>>Java>>正文


Java Chatter类代码示例

本文整理汇总了Java中VASSAL.build.module.Chatter的典型用法代码示例。如果您正苦于以下问题:Java Chatter类的具体用法?Java Chatter怎么用?Java Chatter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Chatter类属于VASSAL.build.module包,在下文中一共展示了Chatter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LogBadGridLocation

import VASSAL.build.module.Chatter; //导入依赖的package包/类
private void LogBadGridLocation ( Point p) {
  String s = "* " + Decorator.getOutermost(this).getName();
  if (getMap() == null) {
    s += "getMap is null";
  }
  else if ( p == null) {
    s += "p is null";
  }
  else {
    s += "getMap: " + getMap().getMapName() +
         "; p: (" + p.x + "," + p.y +
         "; Position: (" + getPosition().x + "," + getPosition().y +
         "); map: " + map.getMapName() + ";";
  }
  new Chatter.DisplayText(
      GameModule.getGameModule().getChatter(),s).execute();
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:18,代码来源:SendToLocation.java

示例2: apply

import VASSAL.build.module.Chatter; //导入依赖的package包/类
public Command apply(Deck d, PieceFilter filter) {
  String reportText = reportFormat.getText(source);
  Command c;
  if (reportText.length() > 0) {
    c = new Chatter.DisplayText(GameModule.getGameModule().getChatter(), "*" + reportText);
    c.execute();
  }
  else {
    c = new NullCommand();
  }
  Visitor visitor = new Visitor(c, filter, keyStroke);
  DeckVisitorDispatcher dispatcher = new DeckVisitorDispatcher(visitor);

  dispatcher.accept(d);
  visitor.getTracker().repaint();

  c = visitor.getCommand();
  return c;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:20,代码来源:DeckGlobalKeyCommand.java

示例3: launch

import VASSAL.build.module.Chatter; //导入依赖的package包/类
public void launch() {
  String oldValue = property.getPropertyValue();
  String newValue = getNewValue();
  if (newValue != null && !newValue.equals(oldValue)) {
    Command c = property.setPropertyValue(newValue);
    if (report.getFormat().length() > 0) {
      report.setProperty(OLD_VALUE_FORMAT, oldValue);
      report.setProperty(NEW_VALUE_FORMAT, property.getPropertyValue());
      report.setProperty(DESCRIPTION_FORMAT, property.getDescription());
      Chatter.DisplayText chatCommand = new Chatter.DisplayText(GameModule.getGameModule().getChatter(), "* "+report.getLocalizedText());
      chatCommand.execute();
      c.append(chatCommand);
    }
    GameModule.getGameModule().sendAndLog(c);
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:17,代码来源:ChangePropertyButton.java

示例4: buildDefaultComponents

import VASSAL.build.module.Chatter; //导入依赖的package包/类
protected void buildDefaultComponents() {
  addComponent(BasicCommandEncoder.class);
  addComponent(Documentation.class);
  addComponent(PlayerRoster.class);
  addComponent(GlobalOptions.class);
  addComponent(Map.class);
  addComponent(GamePieceImageDefinitions.class);
  addComponent(GlobalProperties.class);
  addComponent(PrototypesContainer.class);
  addComponent(PieceWindow.class);
  addComponent(Chatter.class);
  addComponent(Language.class);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:14,代码来源:BasicModule.java

示例5: apply

import VASSAL.build.module.Chatter; //导入依赖的package包/类
/**
 * Apply the key command to all pieces that pass the given filter on all the given maps
 *
 * @param m
 * @param filter
 * @return a the corresponding {@link Command}
 */
public Command apply(Map[] m, PieceFilter filter) {
  Command c = new NullCommand();
  try {
    if (reportSingle) {
      Map.setChangeReportingEnabled(false);
    }
    RecursionLimiter.startExecution(owner);
    String reportText = reportFormat.getLocalizedText(source);
    if (reportText.length() > 0) {
      c = new Chatter.DisplayText(
        GameModule.getGameModule().getChatter(), "*" + reportText);
      c.execute();
    }
    for (int mapI = 0; mapI < m.length; ++mapI) {
      Visitor visitor = new Visitor(c, filter, keyStroke);
      DeckVisitorDispatcher dispatcher = new DeckVisitorDispatcher(visitor);
      GamePiece[] p = m[mapI].getPieces();
      for (int i = 0; i < p.length; ++i) {
        dispatcher.accept(p[i]);
      }
      visitor.getTracker().repaint();
      c = visitor.getCommand();
    }
  }
  catch (RecursionLimitException e) {
    RecursionLimiter.infiniteLoop(e);
  }
  finally {
    RecursionLimiter.endExecution();
    if (reportSingle) {
      Map.setChangeReportingEnabled(true);
    }
  }

  return c;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:44,代码来源:GlobalCommand.java

示例6: reportCommand

import VASSAL.build.module.Chatter; //导入依赖的package包/类
protected Command reportCommand(String format, String commandName) {
  Command c = null;
  FormattedString reportFormat = new FormattedString(format);
  reportFormat.setProperty(DrawPile.DECK_NAME, getLocalizedDeckName());
  reportFormat.setProperty(DrawPile.COMMAND_NAME, commandName);
  String rep = reportFormat.getLocalizedText();
  if (rep.length() > 0) {
    c = new Chatter.DisplayText(GameModule.getGameModule().getChatter(), "* " + rep); //$NON-NLS-1$
    c.execute();
  }

  return c;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:14,代码来源:Deck.java

示例7: showCHAT

import VASSAL.build.module.Chatter; //导入依赖的package包/类
public synchronized void showCHAT(PeerInfo pPeerInfo, String msg) {
  Player sender = new P2PPlayer(pPeerInfo);
  if (!sender.getName().startsWith(NAME)
    && msg.startsWith("CHAT")) { //$NON-NLS-1$
    msg = "<" + client.getUserInfo().getName() //$NON-NLS-1$
      + msg.substring(msg.indexOf("> -")); //$NON-NLS-1$
    Command c = new Chatter.DisplayText(null,msg);
    client.sendTo(sender, c);
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:11,代码来源:EchoClient.java

示例8: showHELO

import VASSAL.build.module.Chatter; //导入依赖的package包/类
public synchronized void showHELO(PeerInfo pPeerInfo) {
  // We have received a connection request
  final Chatter chatter = GameModule.getGameModule().getChatter();
  final ActivePeer peer = peerMgr.getPeerListenerByInfo(pPeerInfo);
  Properties props;
  String name, ip, details;
  try {
    props = new PropertiesEncoder(pPeerInfo.getChatName()).getProperties();
    name = props.getProperty(SimpleStatus.NAME);
    ip = props.getProperty(SimpleStatus.IP);
    details = name+" ("+ip+":"+pPeerInfo.getPort()+")";
  }
  catch (IOException ex) {
    details = "";
  }

  // Does the password of the new Peer match ours?
  if (! pPeerInfo.getNetworkPw().equals(params.getProperty(P2PClientFactory.P2P_SERVER_PW))) {
    new Chatter.DisplayText(chatter, Resources.getString("Peer2Peer.bad_password", details)).execute();
    peer.finish();
    return;
  }

  fireStatus(Resources.getString("Peer2Peer.connected", details));

  propSupport.firePropertyChange(AVAILABLE_ROOMS, null, roomMgr.update(pPeerInfo));
  propSupport.firePropertyChange(ROOM, null, getRoom());
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:29,代码来源:P2PClient.java

示例9: DummyClient

import VASSAL.build.module.Chatter; //导入依赖的package包/类
public DummyClient() {
  PeerPoolInfo publicInfo = new PeerPoolInfo() {
    public String getModuleName() {
      return GameModule.getGameModule() == null ? "<unnamed module>" : GameModule.getGameModule().getGameName(); //$NON-NLS-1$
    }

    public String getUserName() {
      return GameModule.getGameModule() == null ? "<"+Chatter.getAnonymousUserName()+">" : (String) GameModule.getGameModule().getPrefs().getValue(GameModule.REAL_NAME); //$NON-NLS-1$ //$NON-NLS-2$
    }
  };
  httpMessageServer = new HttpMessageServer(publicInfo);
  msgControls = new MessageBoardControlsInitializer(Resources.getString("Chat.messages"),httpMessageServer); //$NON-NLS-1$
  statusControls = new ServerStatusControlsInitializer(new CgiServerStatus());
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:15,代码来源:DummyClient.java

示例10: setInfo

import VASSAL.build.module.Chatter; //导入依赖的package包/类
public void setInfo(Properties p) {
  name = p.getProperty(SimpleStatus.NAME,"???"); //$NON-NLS-1$
  if (name == null || name.length() == 0 || name.trim().length() == 0 || name.equals("<nobody>")) {
    name = "("+Chatter.getAnonymousUserName()+")";
  }
  id = p.getProperty(ID,id);
  setStatus(new SimpleStatus(
                  "true".equals(p.getProperty(SimpleStatus.LOOKING)), //$NON-NLS-1$
                  "true".equals(p.getProperty(SimpleStatus.AWAY)), //$NON-NLS-1$
                  p.getProperty(SimpleStatus.PROFILE,""), //$NON-NLS-1$
                  p.getProperty(SimpleStatus.CLIENT, ""), //$NON-NLS-1$
                  p.getProperty(SimpleStatus.IP, ""), //$NON-NLS-1$
                  p.getProperty(SimpleStatus.MODULE_VERSION, ""), //$NON-NLS-1$
                  p.getProperty(SimpleStatus.CRC, ""))); //$NON-NLS-1$
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:16,代码来源:NodePlayer.java

示例11: apply

import VASSAL.build.module.Chatter; //导入依赖的package包/类
public void apply() {
  if (match.isNull() || match.accept(checkPiece)) {
    GameModule.getGameModule().fireKeyStroke(hotkey);
    String reportText = format.getLocalizedText();
    if (reportText.length() > 0) {
      Command c = new Chatter.DisplayText(GameModule.getGameModule().getChatter(), "* " + reportText);
      c.execute();
      GameModule.getGameModule().sendAndLog(c);
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:12,代码来源:TurnGlobalHotkey.java

示例12: getReportCommand

import VASSAL.build.module.Chatter; //导入依赖的package包/类
public Command getReportCommand() {
  PieceAccess.GlobalAccess.hideAll();

  Command c = new NullCommand();
  for (MoveSummary ms : movesToReport) {
    Map fromMap = Map.getMapById(ms.getOldMapId());
    Map toMap = Map.getMapById(ms.getNewMapId());
    format.clearProperties();
    if (fromMap == null) {
      format.setFormat(toMap.getCreateFormat());
    }
    else if (fromMap != toMap) {
      format.setFormat(toMap.getMoveToFormat());
    }
    else {
      format.setFormat(toMap.getMoveWithinFormat());
    }
    if (format.getFormat().length() == 0) {
      break;
    }
    format.setProperty(Map.PIECE_NAME, ms.getPieceName());
    format.setProperty(Map.LOCATION, getLocation(toMap, ms.getNewPosition()));
    if (fromMap != null) {
      format.setProperty(Map.OLD_MAP, fromMap.getLocalizedConfigureName());
      format.setProperty(Map.OLD_LOCATION, getLocation(fromMap, ms.getOldPosition()));
    }
    format.setProperty(Map.MAP_NAME, toMap.getLocalizedConfigureName());

    String moveText = format.getLocalizedText();

    if (moveText.length() > 0) {
      c = c.append(new Chatter.DisplayText(GameModule.getGameModule().getChatter(), "* " + moveText));
    }
  }
  PieceAccess.GlobalAccess.revertAll();
  return c;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:38,代码来源:MovementReporter.java

示例13: save

import VASSAL.build.module.Chatter; //导入依赖的package包/类
public Command save() {
  Command comm = null;
  for (SecretNote secretNote : notes) {
    int index = lastSavedNotes.indexOf(secretNote);
    if (index < 0 ||
        lastSavedNotes.get(index).isHidden() != secretNote.isHidden()) {
      Command c = new AddSecretNoteCommand(this, secretNote);
      if (comm == null) {
        comm = c;
      }
      else {
        comm.append(c);
      }
      String msg;
      if (index < 0) {
        msg = "* " + Resources.getString("Notes.has_created", GlobalOptions.getInstance().getPlayerId(), secretNote.getName()) + " *"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      }
      else {
        msg = "* " + Resources.getString("Notes.has_revealed", GlobalOptions.getInstance().getPlayerId(), secretNote.getName()) + " *"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      }
      c = new Chatter.DisplayText(GameModule.getGameModule().getChatter(), msg);
      c.execute();
      comm.append(c);
    }
  }
  return comm;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:28,代码来源:SecretNotesController.java

示例14: setChatter

import VASSAL.build.module.Chatter; //导入依赖的package包/类
/**
 * Set the object that displays chat text. Display any warning
 * messages deferred during earlier initialisation
 */
public void setChatter(Chatter c) {
  chat = c;
  if (deferredChat.size() > 0) {
    for (String msg : deferredChat) {
      warn(msg);
    }
    deferredChat.clear();
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:14,代码来源:GameModule.java

示例15: accept

import VASSAL.build.module.Chatter; //导入依赖的package包/类
protected boolean accept(Command c) {
  return c instanceof Chatter.DisplayText
      || c instanceof PrivMsgCommand
      || c instanceof SoundEncoder.Cmd;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:6,代码来源:MainRoomFilter.java


注:本文中的VASSAL.build.module.Chatter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。