Package games.stendhal.client.entity

Examples of games.stendhal.client.entity.IEntity


  @Test
  public final void portal() {
    final RPObject rp = new MockRPObject("portal", null);

    final IEntity en = EntityFactory.createEntity(rp);
    assertNotNull("entity should be created", en);
    assertEquals("we should have created a Portal by now", Portal.class, en
        .getClass());
  }
View Full Code Here


  @Test
  public final void door() {
    final RPObject rp = new MockRPObject("door", null);
    rp.put("dir", 1);
    final IEntity en = EntityFactory.createEntity(rp);
    assertNotNull("entity should be created", en);
    assertEquals("we should have created a Door by now", Door.class, en
        .getClass());
  }
View Full Code Here

  }

  @Test
  public final void fire() {
    final RPObject rp = new MockRPObject("fire", null);
    final IEntity en = EntityFactory.createEntity(rp);
    assertNotNull("entity should be created", en);
    assertEquals("we should have created a Door by now", Fire.class, en
        .getClass());
  }
View Full Code Here

      final Class< ? extends IEntity> entityClass = EntityMap.getClass(type, eclass, subClass);
      if (entityClass == null) {
          return null;
      }

      final IEntity en = entityClass.newInstance();
      en.initialize(object);
      if (en instanceof Entity) {
        EventDispatcher.dispatchEvents(object, (Entity) en);
      }

View Full Code Here

   */
  @Override
  protected void update() {
    super.update();

    IEntity entity  = this.entity;
    if (quantityChanged && (entity != null)) {
      quantitySprite = getQuantitySprite(entity);
      quantityChanged = false;
    }
  }
View Full Code Here

  /**
   * Handle updates.
   */
  protected void update() {
    IEntity entity = this.entity;
    if (entity == null) {
      return;
    }
    if (representationChanged) {
      buildRepresentation(entity);
      representationChanged = false;
    }

    if (positionChanged) {
      x = (int) (IGameScreen.SIZE_UNIT_PIXELS * entity.getX());
      y = (int) (IGameScreen.SIZE_UNIT_PIXELS * entity.getY());
      positionChanged = false;
    }

    if (visibilityChanged) {
      entityComposite = getComposite();
View Full Code Here

   *
   * @param at
   *            The action.
   */
  public void onAction(final ActionType at) {
    IEntity entity = this.entity;
    // return prematurely if view has already been released
    if (isReleased()) {
      Logger.getLogger(Entity2DView.class).debug(
          "View " + this + " already released - action not processed: " + at);
      return;
    }

    final int id = entity.getID().getObjectID();

    switch (at) {
    case LOOK:
    case ADMIN_INSPECT:
    case ADMIN_DESTROY:
      at.send(at.fillTargetInfo(entity.getRPObject()));
      break;

    case ADMIN_ALTER:
      j2DClient.get().setChatLine("/alter #" + id + " ");
      break;
View Full Code Here

   */
  private JButton createCharacterButton(final String name, final RPObject character) {
    // Abusing EntityView code to get the image of the player.
    // Avoid doing sound stuff. That is not available at this stage of
    // running the client.
    IEntity player = new Player() {
      @Override
      protected void onPosition(double x, double y) {
      }
      @Override
      protected void addSounds(String groupName, String categoryName, String... soundNames) {
      }
    };
    // Zero the coordinates, otherwise the EntityView will try to draw
    // itself to some weird place
    character.put("x", 0);
    character.put("y", 0);
    // ignore ghostmode for showing the image
    character.remove("ghostmode");
    // ignore player killer skull
    character.remove("last_player_kill_time");
    player.initialize(character);
   
    EntityView view = EntityViewFactory.create(player);
    // this if-block is there to be compatible with Stendhal 0.84 that is missing information
    Icon icon = null;
    if (view != null) {
View Full Code Here

        final EntityView view = screen.getEntityViewAt(user.getX()
            + direction.getdx(), user.getY() + direction.getdy());

        if (view != null) {
          final IEntity entity = view.getEntity();
          if (!entity.equals(user)) {
            view.onAction();
          }
        }
      }
View Full Code Here

    if (view != null) {
      // ... show context menu (aka command list)
      final String[] actions = view.getActions();

      if (actions.length > 0) {
        final IEntity entity = view.getEntity();

        JPopupMenu menu = new EntityViewCommandList(entity.getType(), actions, view);
        menu.show(canvas, point.x - MENU_OFFSET, point.y - MENU_OFFSET);
        contextMenuFlag = true;
        /*
         * Tricky way to detect recent popup menues. We need the
         * information to prevent walking when hiding the menu.
View Full Code Here

TOP

Related Classes of games.stendhal.client.entity.IEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.