예제 #1
0
파일: ScrollBar.java 프로젝트: ccazuc/RPG
 private void mouseDragEvent() {
   if (Mideas.mouseX() >= this.x + 4 && Mideas.mouseX() <= this.x + 24) {
     if (Mideas.mouseY() >= this.y + this.y_ascensor
         && Mideas.mouseY() <= this.y + this.y_ascensor + 16) {
       if (Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1) {
         if (Mouse.getEventButtonState()) {
           this.down = true;
           this.y_ascensor_onclick = Mideas.mouseY();
         }
       }
     }
   }
   if (Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1) {
     if (!Mouse.getEventButtonState()) {
       this.down = false;
       this.y_ascensor_lastclick = this.y_ascensor;
     }
   }
   if (this.down) {
     if (Mideas.mouseY() >= this.y + this.Y_ASCENSOR_UP_SHIFT + 11
         && Mideas.mouseY()
             <= this.y
                 + this.y_size
                 + 7
                 + this.Y_ASCENSOR_DOWN_SHIFT * Mideas.getDisplayXFactor()) {
       this.y_ascensor = Mideas.mouseY() - this.y_ascensor_onclick + this.y_ascensor_lastclick;
     } else if (Mideas.mouseY() <= this.y + this.Y_ASCENSOR_UP_SHIFT + 11) {
       this.y_ascensor = this.Y_ASCENSOR_UP_SHIFT;
     } else if (Mideas.mouseY()
         >= this.y + this.y_size + this.Y_ASCENSOR_DOWN_SHIFT * Mideas.getDisplayXFactor()) {
       this.y_ascensor = this.y_size + this.Y_ASCENSOR_DOWN_SHIFT * Mideas.getDisplayXFactor();
     }
   }
 }
예제 #2
0
파일: ScrollBar.java 프로젝트: ccazuc/RPG
 private void drawDownArrow() {
   if (this.y_ascensor == this.y_size + this.Y_ASCENSOR_DOWN_SHIFT * Mideas.getDisplayXFactor()) {
     Draw.drawQuad(Sprites.scrollbar_grey_down_arrow, this.x + 5, this.y + this.y_size);
   } else {
     Draw.drawQuad(Sprites.scrollbar_down_arrow, this.x + 5, this.y + this.y_size);
   }
 }
예제 #3
0
파일: ScrollBar.java 프로젝트: ccazuc/RPG
 public float getScrollPercentage() {
   if (this.y_ascensor == this.Y_ASCENSOR_UP_SHIFT) {
     return 0;
   }
   if (this.y_ascensor == this.y_size + this.Y_ASCENSOR_DOWN_SHIFT * Mideas.getDisplayXFactor()) {
     return 1;
   }
   return (this.y_ascensor) / (this.y_size - Sprites.ascensor.getImageHeight());
 }
예제 #4
0
파일: ScrollBar.java 프로젝트: ccazuc/RPG
 public void draw() {
   Draw.drawQuad(
       Sprites.scrollbar,
       this.x - 2,
       this.y + Sprites.top_button.getImageHeight() * Mideas.getDisplayXFactor(),
       Sprites.scrollbar.getImageWidth() * Mideas.getDisplayXFactor(),
       this.y_size
           + 17
           - Sprites.top_button.getImageHeight() * Mideas.getDisplayXFactor()
           - Sprites.bot_button.getImageHeight() * Mideas.getDisplayXFactor());
   Draw.drawQuad(Sprites.top_button, this.x - 2, this.y);
   Draw.drawQuad(
       Sprites.bot_button,
       this.x - 2,
       this.y
           + 19
           + this.y_size
           - Sprites.top_button.getImageHeight() * Mideas.getDisplayXFactor());
   drawUpArrow();
   drawDownArrow();
   Draw.drawQuad(Sprites.ascensor, this.x + 5, this.y + this.y_ascensor);
 }
예제 #5
0
파일: ScrollBar.java 프로젝트: ccazuc/RPG
 private void mouseScroll() {
   if (Mideas.mouseX() >= this.x - this.x_frame_size + 25
       && Mideas.mouseX() <= this.x + 25
       && Mideas.mouseY() >= this.y - 25
       && Mideas.mouseY() <= this.y + this.y_frame_size + 25) {
     if (this.mouseWheel != 0) {
       System.out.println(this.mouseWheel);
       if (this.mouseWheel > 0 && this.y_ascensor - this.scroll_tick_size > 23) {
         this.y_ascensor -= this.scroll_tick_size;
       } else if (this.mouseWheel > 0 && this.y_ascensor - this.scroll_tick_size <= 23) {
         this.y_ascensor = this.Y_ASCENSOR_UP_SHIFT;
       } else if (this.mouseWheel < 0
           && this.y_ascensor + this.scroll_tick_size + 18 < this.y_size - 5) {
         this.y_ascensor += this.scroll_tick_size;
       } else if (this.mouseWheel < 0
           && this.y_ascensor + this.scroll_tick_size + 18 >= this.y_size - 5) {
         this.y_ascensor = this.y_size + this.Y_ASCENSOR_DOWN_SHIFT * Mideas.getDisplayXFactor();
       }
       this.y_ascensor_lastclick = this.y_ascensor;
       this.mouseWheel = 0;
     }
   }
 }
예제 #6
0
파일: SocialFrame.java 프로젝트: ccazuc/RPG
public class SocialFrame {

  static SocialFrameMenu selectedMenu = SocialFrameMenu.GUILD_FRAME;
  static Friend selectedFriend;
  private static int Y_SOCIAL_FRAME_DEFAULT = 115;
  static float Y_SOCIAL_FRAME = Y_SOCIAL_FRAME_DEFAULT * Mideas.getDisplayYFactor();
  private static int X_SOCIAL_FRAME_DEFAULT = 5;
  static float X_SOCIAL_FRAME = X_SOCIAL_FRAME_DEFAULT * Mideas.getDisplayXFactor();
  private static final float BUTTON_MENU_Y = 461;
  private static final float BUTTON_MENU_Y_SIZE = 33;
  private static ButtonMenu friendButtonMenu =
      new ButtonMenu(
          X_SOCIAL_FRAME + 20 * Mideas.getDisplayXFactor(),
          Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
          54 * Mideas.getDisplayXFactor(),
          BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor(),
          "Friends",
          10,
          1,
          true) {

        @Override
        public void eventButtonClick() {
          unselectAllButton();
          this.setIsSelected(true);
          selectedMenu = SocialFrameMenu.FRIEND_FRAME;
        }
      };
  private static ButtonMenu whoButtonMenu =
      new ButtonMenu(
          X_SOCIAL_FRAME + 80 * Mideas.getDisplayXFactor(),
          Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
          44 * Mideas.getDisplayXFactor(),
          BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor(),
          "Who",
          10,
          1,
          false) {

        @Override
        public void eventButtonClick() {
          unselectAllButton();
          this.setIsSelected(true);
          // selectedMenu = SocialFrameMenu.WHO_FRAME;
        }
      };
  private static ButtonMenu guildButtonMenu =
      new ButtonMenu(
          X_SOCIAL_FRAME + 130 * Mideas.getDisplayXFactor(),
          Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
          60 * Mideas.getDisplayXFactor(),
          BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor(),
          "Guild",
          10,
          1,
          false) {

        @Override
        public void eventButtonClick() {
          unselectAllButton();
          this.setIsSelected(true);
          selectedMenu = SocialFrameMenu.GUILD_FRAME;
        }

        @Override
        public boolean activateCondition() {
          return Mideas.joueur1().getGuild() != null;
        }
      };
  private static ButtonMenu discussionButtonMenu =
      new ButtonMenu(
          X_SOCIAL_FRAME + 194 * Mideas.getDisplayXFactor(),
          Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
          85 * Mideas.getDisplayXFactor(),
          BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor(),
          "Discussion",
          10,
          1,
          false) {

        @Override
        public void eventButtonClick() {
          unselectAllButton();
          this.setIsSelected(true);
          // selectedMenu = SocialFrameMenu.DISCUSSION_FRAME;
        }
      };
  private static ButtonMenu raidButtonMenu =
      new ButtonMenu(
          X_SOCIAL_FRAME + 285 * Mideas.getDisplayXFactor(),
          Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
          49 * Mideas.getDisplayXFactor(),
          BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor(),
          "Raid",
          10,
          1,
          false) {

        @Override
        public void eventButtonClick() {
          unselectAllButton();
          this.setIsSelected(true);
          // selectedMenu = SocialFrameMenu.RAID_FRAME;
        }
      };
  private static CrossButton closeFrame =
      new CrossButton(
          X_SOCIAL_FRAME + 370 * Mideas.getDisplayXFactor(),
          Y_SOCIAL_FRAME + 14 * Mideas.getDisplayYFactor()) {

        @Override
        public void eventButtonClick() {
          Interface.setSocialFrameStatus(false);
          this.reset();
        }
      };
  private static boolean draw = true;

  public static void draw() {
    if (selectedMenu == SocialFrameMenu.FRIEND_FRAME) {
      FriendsFrame.draw();
    } else if (selectedMenu == SocialFrameMenu.WHO_FRAME) {
      drawWhoFrame();
    } else if (selectedMenu == SocialFrameMenu.GUILD_FRAME) {
      GuildFrame.draw();
    } else if (selectedMenu == SocialFrameMenu.DISCUSSION_FRAME) {
      drawDiscussionFrame();
    } else if (selectedMenu == SocialFrameMenu.RAID_FRAME) {
      drawRaidFrame();
    }
    if (draw) {
      friendButtonMenu.draw();
      whoButtonMenu.draw();
      guildButtonMenu.draw();
      discussionButtonMenu.draw();
      raidButtonMenu.draw();
      closeFrame.draw();
    }
  }

  public static boolean mouseEvent() {
    if (friendButtonMenu.event()) return true;
    if (whoButtonMenu.event()) return true;
    if (guildButtonMenu.event()) return true;
    if (discussionButtonMenu.event()) return true;
    if (raidButtonMenu.event()) return true;
    if (closeFrame.event()) return true;
    if (selectedMenu == SocialFrameMenu.FRIEND_FRAME) {
      return FriendsFrame.mouseEvent();
    } else if (selectedMenu == SocialFrameMenu.WHO_FRAME) {
      return mouseEventWhoFrame();
    } else if (selectedMenu == SocialFrameMenu.GUILD_FRAME) {
      return GuildFrame.mouseEvent();
    } else if (selectedMenu == SocialFrameMenu.DISCUSSION_FRAME) {
      return mouseEventDiscussionFrame();
    } else if (selectedMenu == SocialFrameMenu.RAID_FRAME) {
      return mouseEventRaidFrame();
    }
    return false;
  }

  private static void drawWhoFrame() {}

  private static void drawDiscussionFrame() {}

  private static void drawRaidFrame() {}

  private static boolean mouseEventWhoFrame() {

    return false;
  }

  private static boolean mouseEventDiscussionFrame() {

    return false;
  }

  private static boolean mouseEventRaidFrame() {

    return false;
  }

  static void unselectAllButton() {
    friendButtonMenu.setIsSelected(false);
    whoButtonMenu.setIsSelected(false);
    guildButtonMenu.setIsSelected(false);
    discussionButtonMenu.setIsSelected(false);
    raidButtonMenu.setIsSelected(false);
  }

  public static void updateSize() {
    Y_SOCIAL_FRAME = Y_SOCIAL_FRAME_DEFAULT * Mideas.getDisplayYFactor();
    X_SOCIAL_FRAME = X_SOCIAL_FRAME_DEFAULT * Mideas.getDisplayXFactor();
    friendButtonMenu.update(
        X_SOCIAL_FRAME + 20 * Mideas.getDisplayXFactor(),
        Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
        54 * Mideas.getDisplayXFactor(),
        BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor());
    whoButtonMenu.update(
        X_SOCIAL_FRAME + 80 * Mideas.getDisplayXFactor(),
        Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
        44 * Mideas.getDisplayXFactor(),
        BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor());
    guildButtonMenu.update(
        X_SOCIAL_FRAME + 130 * Mideas.getDisplayXFactor(),
        Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
        60 * Mideas.getDisplayXFactor(),
        BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor());
    discussionButtonMenu.update(
        X_SOCIAL_FRAME + 194 * Mideas.getDisplayXFactor(),
        Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
        85 * Mideas.getDisplayXFactor(),
        BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor());
    raidButtonMenu.update(
        X_SOCIAL_FRAME + 285 * Mideas.getDisplayXFactor(),
        Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
        49 * Mideas.getDisplayXFactor(),
        BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor());
    closeFrame.update(
        X_SOCIAL_FRAME + 370 * Mideas.getDisplayXFactor(),
        Y_SOCIAL_FRAME + 14 * Mideas.getDisplayYFactor());
  }

  public static void test() {
    friendButtonMenu.setIsSelected(!friendButtonMenu.isSelected());
    whoButtonMenu.setIsSelected(!whoButtonMenu.isSelected());
    guildButtonMenu.setIsSelected(!guildButtonMenu.isSelected());
    draw = !draw;
  }
}
예제 #7
0
파일: SocialFrame.java 프로젝트: ccazuc/RPG
 public static void updateSize() {
   Y_SOCIAL_FRAME = Y_SOCIAL_FRAME_DEFAULT * Mideas.getDisplayYFactor();
   X_SOCIAL_FRAME = X_SOCIAL_FRAME_DEFAULT * Mideas.getDisplayXFactor();
   friendButtonMenu.update(
       X_SOCIAL_FRAME + 20 * Mideas.getDisplayXFactor(),
       Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
       54 * Mideas.getDisplayXFactor(),
       BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor());
   whoButtonMenu.update(
       X_SOCIAL_FRAME + 80 * Mideas.getDisplayXFactor(),
       Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
       44 * Mideas.getDisplayXFactor(),
       BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor());
   guildButtonMenu.update(
       X_SOCIAL_FRAME + 130 * Mideas.getDisplayXFactor(),
       Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
       60 * Mideas.getDisplayXFactor(),
       BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor());
   discussionButtonMenu.update(
       X_SOCIAL_FRAME + 194 * Mideas.getDisplayXFactor(),
       Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
       85 * Mideas.getDisplayXFactor(),
       BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor());
   raidButtonMenu.update(
       X_SOCIAL_FRAME + 285 * Mideas.getDisplayXFactor(),
       Y_SOCIAL_FRAME + BUTTON_MENU_Y * Mideas.getDisplayYFactor(),
       49 * Mideas.getDisplayXFactor(),
       BUTTON_MENU_Y_SIZE * Mideas.getDisplayYFactor());
   closeFrame.update(
       X_SOCIAL_FRAME + 370 * Mideas.getDisplayXFactor(),
       Y_SOCIAL_FRAME + 14 * Mideas.getDisplayYFactor());
 }