Package tyrelion

Examples of tyrelion.InteractionManager


  /* (non-Javadoc)
   * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
   */
  public void update(Observable o, Object arg) {
    InteractionManager im = InteractionManager.getInstance();
   
    if("keyReleased".equals(arg)) {
      int key = im.getKeyReleased_key();
      switch (key) {
      case Input.KEY_W: 
        setAnimation(ANIM_STANDING_UP);
        break;
     
View Full Code Here


  /* (non-Javadoc)
   * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
   */
  public void update(Observable interactionManager, Object listenerType) {
    if (!TyrelionContainer.getInstance().getContainer().isPaused()){
      InteractionManager im = (InteractionManager) interactionManager;
     
      if("mouseClicked".equals(listenerType)) {
        int button = im.getMouseClicked_button();
        int x = im.getMouseClicked_x();
        int y = im.getMouseClicked_y();
       
        if (isOver(x, y)) {
          if (button == Input.MOUSE_RIGHT_BUTTON && Player.getInstance().inRange(this)) {
            rightClickAction();
          }
        }
      }
     
      if ("mouseMoved".equals(listenerType)) {
        int newX = im.getMouseMoved_newx();
        int newY = im.getMouseMoved_newy();
        int oldX = im.getMouseMoved_oldx();
        int oldY = im.getMouseMoved_oldy();
 
        GameContainer container = TyrelionContainer.getInstance().getContainer();
       
        if (isOver(newX, newY)) {
          if (Player.getInstance().inRange(this)) {
View Full Code Here

   */
  public void update(Observable arg0, Object arg1) {
    shape.setCenterX(tileX*48);
    shape.setCenterY(tileY*48);
    if (!TyrelionContainer.getInstance().getContainer().isPaused()){
      InteractionManager im = (InteractionManager) arg0;
     
      if("mouseClicked".equals(arg1)) {
        int button = im.getMouseClicked_button();
        int x = im.getMouseClicked_x();
        int y = im.getMouseClicked_y();
        if (isOver(x, y)) {
          if (button == Input.MOUSE_RIGHT_BUTTON && Player.getInstance().inRange(this)) {
            rightClickAction();
          }
        }
      }
     
      if ("mouseMoved".equals(arg1)) {
        int newX = im.getMouseMoved_newx();
        int newY = im.getMouseMoved_newy();
        int oldX = im.getMouseMoved_oldx();
        int oldY = im.getMouseMoved_oldy();
 
        GameContainer container = TyrelionContainer.getInstance().getContainer();
       
        if (isOver(newX, newY)) {
          if (Player.getInstance().inRange(this)) {
View Full Code Here

  /* (non-Javadoc)
   * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
   */
  public void update(Observable observable, Object input) {
    InteractionManager im = (InteractionManager) observable;
    if ("keyReleased".equals(input)){
      if (im.getKeyReleased_key() == Input.KEY_ESCAPE) {
        CursorManager.getInstance().setCursor(CursorManager.ARROW, TyrelionContainer.getInstance().getContainer());
        if (isShowMenu){
          isShowMenu = false;
          TyrelionContainer.getInstance().getContainer().resume();
        } else {
View Full Code Here

 
  /* (non-Javadoc)
   * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
   */
  public void update(Observable observable, Object input) {
    InteractionManager im = (InteractionManager) observable;
   
    if ("keyReleased".equals(input)){
      if (im.getKeyReleased_key() == Input.KEY_C || im.getKeyReleased_key() == Input.KEY_I) {
        CursorManager.getInstance().setCursor(CursorManager.SWORD, TyrelionContainer.getInstance().getContainer());
        showCharinfo = !showCharinfo;
        if (showCharinfo){
          TyrelionContainer.getInstance().getContainer().pause();
        } else { TyrelionContainer.getInstance().getContainer().resume(); }
      }
     
      if (im.getKeyReleased_key() == Input.KEY_ESCAPE) {
        CursorManager.getInstance().setCursor(CursorManager.SWORD, TyrelionContainer.getInstance().getContainer());
        if (showCharinfo){
          showCharinfo = false;
          TyrelionContainer.getInstance().getContainer().resume();
        }
      }
     
      if (im.getKeyReleased_key() == Input.KEY_LSHIFT || im.getKeyReleased_key() == Input.KEY_RSHIFT) {
        split = false;
      }
    }
   
    if ("keyPressed".equals(input)){
      if (im.getKeyPressed_key() == Input.KEY_LSHIFT || im.getKeyPressed_key() == Input.KEY_RSHIFT) {
        split = true;
      }
    }
   
    if ("mousePressed".equals(input)){
     
      int x = im.getMousePressed_x(); int y = im.getMousePressed_y();
     
      if (isMouseOverInventory(x, y)){
       
        item = inventory.isOverItem(x-posX-577, y-posY-236);
       
        mousePressed = true;
        if (item != null) {
          if(split && item.getCount()>1){
            item.toggleShow(split);
            itemAtCursor = inventory.new InventoryField(item.getItem());
          } else{
            item.toggleShow(false);
            itemAtCursor = item;
          }
        }
      }
     
      if (isMouseOverCharacterIcon(x, y)) {
        CursorManager.getInstance().setCursor(CursorManager.SWORD, TyrelionContainer.getInstance().getContainer());
        showCharinfo = !showCharinfo;
        if (showCharinfo){
          TyrelionContainer.getInstance().getContainer().pause();
        } else { TyrelionContainer.getInstance().getContainer().resume(); }
      }
    }
   
    if ("mouseMoved".equals(input)){
      //get current mouse position
      mouseX = im.getMouseMoved_newx();
      mouseY = im.getMouseMoved_newy();
    }
   
    if ("mouseReleased".equals(input)){
      int x = im.getMouseReleased_x(); int y = im.getMouseReleased_y();
      mousePressed = false;
        if (item != null) {
         
          if (isMouseOverInventory(x, y)){
            int fieldX = (x-posX-577) / 56;
View Full Code Here

TOP

Related Classes of tyrelion.InteractionManager

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.