예제 #1
0
  @Override
  protected void actionPerformed(GuiButton p_146284_1_) {
    if (p_146284_1_.enabled) {
      if (p_146284_1_.id == 3 && this.bookIsUnsigned) {
        this.editingTitle = true;
        current = getBookTitle();
      } else if (p_146284_1_.id == 4 && this.editingTitle) {
        this.editingTitle = false;
      }

      if (this.bookIsUnsigned && im.reset()) {
        im.getCommited();
        preedit = "";
      }

      super.actionPerformed(p_146284_1_);

      if (((p_146284_1_.id == 1) || (p_146284_1_.id == 2) || (p_146284_1_.id == 4))
          && this.bookIsUnsigned
          && !this.editingTitle) {
        try {
          this.currPage = this.currPageField.getInt(this);
        } catch (Exception e) {
          throw new RuntimeException(e);
        }

        this.current = this.getText();
      }
    }
  }
예제 #2
0
  /** Draws the screen and all the components in it. */
  public void drawScreen(int par1, int par2, float par3) {
    super.drawScreen(par1, par2, par3);

    if (this.bookIsUnsigned) {
      int k = (this.width - this.bookImageWidth) / 2;
      byte b0 = 2;

      String modeText = im.getMode() ? "\ud55c" : "\uc601";
      this.fontRendererObj.drawString(modeText, k + 36, b0 + 16, 0);
    }
  }
예제 #3
0
  /** Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). */
  @Override
  protected void keyTyped(char par1, int par2) {
    if (!this.bookIsUnsigned) {
      super.keyTyped(par1, par2);
      return;
    }

    // from GuiScreen class
    if (par2 == 1) {
      this.mc.displayGuiScreen((GuiScreen) null);
      this.mc.setIngameFocus();
      return;
    }

    if (par1 != 22 && par2 == im.getToggleKey()) {
      im.toggleMode();
    } else if (this.editingTitle) {
      if (keyTypedInTitle(par1, par2)) {
        switch (par2) {
          case Keyboard.KEY_BACK:
            super.keyTyped(par1, par2);
            current = getBookTitle();
            break;
          case Keyboard.KEY_RETURN:
          case Keyboard.KEY_NUMPADENTER:
            super.keyTyped(par1, par2);
            break;
          default:
            this.setBookTitle(current + preedit + " ");
            super.keyTyped(par1, Keyboard.KEY_BACK);
        }
      }
    } else {
      if (keyTypedInBook(par1, par2)) {
        super.keyTyped(par1, par2);
      }
    }
  }
예제 #4
0
  @Override
  public void initGui() {
    super.initGui();

    if (im.reset()) {
      im.getCommited();
      preedit = "";
    }

    if (this.bookIsUnsigned) {
      try {
        this.currPage = this.currPageField.getInt(this);
      } catch (Exception e) {
        throw new RuntimeException(e);
      }

      current = this.getText();
    }
  }