Search in sources :

Example 71 with ClickListener

use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project Eidolons by IDemiurge.

the class FacingPanel method getGearListener.

private EventListener getGearListener(boolean clockwise) {
    return new ClickListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            // GuiEventManager
            WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_INPUT, new ActionInput(dataSource.getTurnAction(clockwise), new Context(dataSource.getEntity().getRef())));
            GearCluster gear = clockwise ? gearsClockwise : gearsAntiClockwise;
            gear.activeWork(0.25f, 0.5f);
            return super.touchDown(event, x, y, pointer, button);
        }
    };
}
Also used : Context(main.game.logic.action.context.Context) ActionInput(eidolons.game.core.ActionInput) GearCluster(eidolons.libgdx.gui.generic.GearCluster) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 72 with ClickListener

use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project Eidolons by IDemiurge.

the class QuickWeaponPanel method getListener.

private EventListener getListener() {
    return new ClickListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            if (button == 1) {
                GuiEventManager.trigger(GuiEventType.RADIAL_MENU_CLOSE);
                GuiEventManager.trigger(GuiEventType.CREATE_RADIAL_MENU, dataSource.getWeapon());
            } else {
                WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_INPUT, new ActionInput(getDataSource().getOwnerObj().getAttackAction(offhand), new Context(getDataSource().getOwnerObj(), null)));
            }
            return false;
        }

        @Override
        public boolean mouseMoved(InputEvent event, float x, float y) {
            return super.mouseMoved(event, x, y);
        }

        @Override
        public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
            super.enter(event, x, y, pointer, fromActor);
            weapon.setZIndex(getChildren().size - 2);
        }

        @Override
        public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
            super.exit(event, x, y, pointer, toActor);
            weapon.setZIndex(1);
        }
    };
}
Also used : Context(main.game.logic.action.context.Context) ActionInput(eidolons.game.core.ActionInput) Actor(com.badlogic.gdx.scenes.scene2d.Actor) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 73 with ClickListener

use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project Eidolons by IDemiurge.

the class ItemListPanel method getOrCreateElement.

protected TextButton getOrCreateElement(SelectableItemData sub) {
    TextButton button = getCache().get(sub);
    if (button == null || sub == null) {
        button = new TextButton((sub.name), StyleHolder.getTextButtonStyle(getButtonStyle(), getFontStyle(), getFontColor(), getFontSize())) {

            @Override
            public boolean isChecked() {
                return super.isChecked();
            }
        };
        getCache().put(sub, button);
        TextButton finalButton = button;
        button.addListener(new ClickListener() {

            @Override
            public void clicked(InputEvent event, float x, float y) {
                ItemListPanel.this.clicked(finalButton, sub);
            }
        });
    }
    return button;
}
Also used : TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 74 with ClickListener

use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project Eidolons by IDemiurge.

the class EditorControlPanel method init.

public void init() {
    // 
    setSize(GdxMaster.getWidth() / 3 * 2, 64);
    TextButtonStyle style = StyleHolder.getTextButtonStyle(FONT.AVQ, GdxColorMaster.GOLDEN_WHITE, 18);
    for (MAP_EDITOR_FUNCTION sub : MAP_EDITOR_FUNCTION.values()) {
        TextButton button = new TextButton(sub.name(), style);
        button.setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
        button.addListener(new ClickListener() {

            @Override
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
                try {
                    handleFunction(sub);
                } catch (Exception e) {
                    main.system.ExceptionMaster.printStackTrace(e);
                }
                return super.touchDown(event, x, y, pointer, button);
            }
        });
        addActor(button);
    }
}
Also used : TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) TextButtonStyle(com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener) NinePatchDrawable(com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)

Example 75 with ClickListener

use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project Eidolons by IDemiurge.

the class EditorPalette method init.

public void init() {
    clearChildren();
    clearListeners();
    addListener(new ClickListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            // updateRequired=true;
            return super.touchDown(event, x, y, pointer, button);
        }
    });
    setSize(GdxMaster.getWidth() / 3 * 2, 256);
    int columns = (int) (getWidth() / 64);
    for (EDITOR_PALETTE sub : EDITOR_PALETTE.values()) {
        OBJ_TYPE TYPE = ContentManager.getOBJ_TYPE(sub.name());
        if (TYPE == null) {
            addCustomTab(sub);
            continue;
        }
        TabbedPanel tabbedPanel = new TabbedPanel();
        TablePanel<Actor> table;
        if (TYPE == null)
            continue;
        List<String> list = DataManager.getTabsGroup(TYPE);
        if (list.isEmpty())
            list.add("");
        for (String group : list) {
            table = new TablePanel<>();
            table.defaults().width(64).height(64);
            table.top().left().padLeft(64).padTop(64);
            table.setFillParent(true);
            ArrayList<ObjType> types = new ArrayList<>(DataManager.getTypesGroup(TYPE, group));
            int i = 0;
            int rows = 0;
            for (ObjType type : types) {
                TextureRegion texture = TextureCache.getOrCreateR(type.getImagePath());
                ValueContainer item = new ValueContainer(texture);
                item.setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
                item.overrideImageSize(64, 64);
                item.addListener(new ValueTooltip(type.getName()).getController());
                item.addListener(getItemListener(item));
                table.add(item).left();
                item.setUserObject(type);
                i++;
                if (i >= columns) {
                    i = 0;
                    table.row();
                    rows++;
                }
            }
            table.pack();
            if (rows > 3) {
                ScrollPanel scrollPanel = new ScrollPanel();
                scrollPanel.addElement(table);
                tabbedPanel.addTab(scrollPanel, group);
            } else {
                tabbedPanel.addTab(table, group);
            }
        }
        addTab(tabbedPanel, sub.name());
    }
// scrollable?
}
Also used : ValueTooltip(eidolons.libgdx.gui.tooltips.ValueTooltip) OBJ_TYPE(main.content.OBJ_TYPE) ArrayList(java.util.ArrayList) TabbedPanel(eidolons.libgdx.gui.panels.TabbedPanel) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ObjType(main.entity.type.ObjType) Actor(com.badlogic.gdx.scenes.scene2d.Actor) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) ScrollPanel(eidolons.libgdx.gui.panels.ScrollPanel) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener) NinePatchDrawable(com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)

Aggregations

ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)82 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)74 Stage (com.badlogic.gdx.scenes.scene2d.Stage)39 Texture (com.badlogic.gdx.graphics.Texture)27 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)27 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)24 TextureRegionDrawable (com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable)24 ImageButton (com.badlogic.gdx.scenes.scene2d.ui.ImageButton)23 Skin (com.badlogic.gdx.scenes.scene2d.ui.Skin)23 Sprite (com.badlogic.gdx.graphics.g2d.Sprite)22 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)21 Actor (com.badlogic.gdx.scenes.scene2d.Actor)18 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)18 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)17 ScrollPane (com.badlogic.gdx.scenes.scene2d.ui.ScrollPane)7 InputListener (com.badlogic.gdx.scenes.scene2d.InputListener)6 Button (com.badlogic.gdx.scenes.scene2d.ui.Button)6 Touchpad (com.badlogic.gdx.scenes.scene2d.ui.Touchpad)6 Texto (mx.itesm.another_monkey_paradox.Utils.Texto)6 BitmapFont (com.badlogic.gdx.graphics.g2d.BitmapFont)5