public WndChooseWay(final TomeOfMastery tome, final HeroSubClass way1, final HeroSubClass way2) { super(); final String TXT_MASTERY = "Which way will you follow?"; final String TXT_CANCEL = "I'll decide later"; float bottom = createCommonStuff(tome, way1.desc() + "\n\n" + way2.desc() + "\n\n" + TXT_MASTERY); RedButton btnWay1 = new RedButton(Utils.capitalize(way1.title())) { @Override protected void onClick() { hide(); tome.choose(way1); } }; btnWay1.setRect(0, bottom + GAP, (WIDTH - GAP) / 2, BTN_HEIGHT); add(btnWay1); RedButton btnWay2 = new RedButton(Utils.capitalize(way2.title())) { @Override protected void onClick() { hide(); tome.choose(way2); } }; btnWay2.setRect(btnWay1.right() + GAP, btnWay1.top(), btnWay1.width(), BTN_HEIGHT); add(btnWay2); RedButton btnCancel = new RedButton(TXT_CANCEL) { @Override protected void onClick() { hide(); } }; btnCancel.setRect(0, btnWay2.bottom() + GAP, WIDTH, BTN_HEIGHT); add(btnCancel); resize(WIDTH, (int) btnCancel.bottom()); }
public WndChooseWay(final TomeOfMastery tome, final HeroSubClass way) { super(); final String TXT_REMASTERY = "Do you want to respec into %s?"; final String TXT_OK = "Yes, I want to respec"; final String TXT_CANCEL = "Maybe later"; float bottom = createCommonStuff( tome, way.desc() + "\n\n" + Utils.format(TXT_REMASTERY, Utils.indefinite(way.title()))); RedButton btnWay = new RedButton(TXT_OK) { @Override protected void onClick() { hide(); tome.choose(way); } }; btnWay.setRect(0, bottom + GAP, WIDTH, BTN_HEIGHT); add(btnWay); RedButton btnCancel = new RedButton(TXT_CANCEL) { @Override protected void onClick() { hide(); } }; btnCancel.setRect(0, btnWay.bottom() + GAP, WIDTH, BTN_HEIGHT); add(btnCancel); resize(WIDTH, (int) btnCancel.bottom()); }