コード例 #1
0
  @Override
  public boolean handleMouseClicked(int x, int y, int mouseButton) {
    x += parent.getGuiLeft();
    y += parent.getGuiTop();

    for (int i = 0; i < 5; i++) {
      if (scrollAmount + i >= dial.glyphList.size()) break;

      int entryOffset = i * entryHeight;
      boolean
          mouseOverEntry =
              y >= posY + offsetY + entryOffset && y <= posY + offsetY + entryOffset + 20,
          mouseOverMain = mouseOverEntry && x >= posX + offsetX && x < posX + offsetX + sizeMButton,
          mouseOverSmall =
              mouseOverEntry
                  && x >= posX + offsetX + sizeMButton + buttonSpacing
                  && x < posX + offsetX + sizeMButton + buttonSpacing + sizeSButton;

      if (mouseOverMain) {
        ((GuiDialingDevice) parent).onEntrySelected(scrollAmount + i);
        break;
      } else if (mouseOverSmall) {
        if (GuiScreen.isShiftKeyDown()) {
          ((GuiDialingDevice) parent).onEntryDeleted(scrollAmount + i);
          break;
        }

        ((GuiDialingDevice) parent).onEntryEdited(scrollAmount + i);
        break;
      }
    }

    return true;
  }
コード例 #2
0
 public ElementScrollDiallingDevice(GuiDialingDevice gui, TileDialingDevice d, int x, int y) {
   super(gui, x, y, gui.getSizeX() - 14, gui.getSizeY() - 57);
   dial = d;
   texture = gui.getTexture();
 }