Java Code Examples for com.badlogic.gdx.scenes.scene2d.ui.TextButton#setDisabled()

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.TextButton#setDisabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SelectCreatureToResurrectWindow.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
private EventListener createListener(final Creature creature, final TextButton button, final WorldObjectView view, final Image selection) {
    return new ClickListener() {
        @Override public void clicked(InputEvent event, float x, float y) {
            view.addActor(selection);
            selection.toBack();
            selected = creature;
            button.setDisabled(false);
        }
    };
}
 
Example 2
Source File: SelectAbilityWindow.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
private ClickListener createListener(final Ability ability, final TextButton button, final Image itemSelection, final Group icon, final LocLabel itemDescriptionLabel) {
    return new ClickListener() {
        @Override public void clicked(InputEvent event, float x, float y) {
            selected = ability;
            icon.addActor(itemSelection);
            itemSelection.toBack();
            button.setDisabled(false);
            itemDescriptionLabel.setParams(Thesaurus.params().with("name", ability.locNameKey()).with("desc", ability.locDescKey()));
        }
    };
}
 
Example 3
Source File: ProfessionAbilityPlayWindow.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override protected void doShow(Params params) {
    callback = params.callback;
    Table content = new Table(Config.skin);
    content.defaults().pad(2);
    content.setBackground("ui-creature-info-background");
    content.setTouchable(Touchable.enabled);
    table.add(content);

    Image image = new Image(Config.skin, "ability/" + params.ability.name + "-icon");
    Image line = new Image(Config.skin, "ui-creature-info-line");
    TextButton use = new LocTextButton("ui-use-ability");

    Thesaurus.Params dp = Thesaurus.params();
    params.ability.fillDescriptionParams(dp, params.creature);
    Label desc = new LocLabel(params.ability.locDescKey(), dp);
    desc.setWrap(true);
    desc.setAlignment(Align.center);

    content.add(image).size(image.getWidth() * 2, image.getHeight() * 2).padBottom(-6).padTop(0).row();
    content.add(new LocLabel(params.ability.locNameKey())).padBottom(3).row();
    content.add(line).width(50).row();
    content.add(desc).width(120).row();
    content.add(use).padBottom(6).padTop(6).width(90).row();

    Thesaurus.LocalizationData reason = new Thesaurus.LocalizationData();
    if (!params.ability.action.canBeApplied(params.creature, reason)) {
        use.setDisabled(true);
        CooldownEffect cooldown = params.creature.get(Attribute.cooldownFor(params.ability.name));
        LocLabel label;
        if (cooldown == null) {
            label = new LocLabel(reason.key, reason.params, StoreWindow.INACTIVE);
        } else {
            Thesaurus.Params p = Thesaurus.params()
                .with("desc", cooldown.locDescKey())
                .with("turn-count", String.valueOf(cooldown.getTurnCount()))
                .with("die", params.creature.description.nameLocKey());
            params.ability.fillDescriptionParams(p, params.creature);
            label = new LocLabel("ui-creature-info-window-effect-description", p, StoreWindow.INACTIVE);
        }
        label.setWrap(true);
        label.setAlignment(Align.center);
        content.add(label).padLeft(4).padRight(4).padBottom(3).width(120).row();
    } else {
        use.addListener(new ChangeListener() {
            @Override public void changed(ChangeEvent event, Actor actor) {
                doUse = true;
                hide();
            }
        });
    }


}