/** * Function used to create the Skins' Buttons and Labels and associate them to a given table, organized. * It also adds Listeners to the Skins' Buttons. * * @param table Table where the Skins' Labels and Buttons will be organized. */ private void createSkins(Table table) { for (int i = 0; i < game.getNumSkins(); ++i) { //Adding Buttons and Labels to the Arrays skinButtons.add(new Button(new TextureRegionDrawable(new TextureRegion(game.getAssetManager().get("big_skins/skin" + (i < 10 ? "0" : "") + i + ".png", Texture.class))))); skinLabels.add(new Label("Current", skin1)); final int j = i; //Needed for Listener initialization skinButtons.get(i).addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { setCurrentLabel(j); } }); table.add(skinButtons.get(i)).size(BUTTON_SIZE, BUTTON_SIZE).pad(IMAGE_EDGE); } table.row(); for (int i = 0; i < game.getNumSkins(); ++i) table.add(skinLabels.get(i)); initializeCurrentSkin(); }
/** * Function used to initialize all the elements of the HUD and add the respective Listeners. */ private void initHUD() { Table hudTable = new Table(); hudTable.setFillParent(true); Button pauseButton = new Button(new TextureRegionDrawable( new TextureRegion(game.getAssetManager().get("pause.png", Texture.class)))); scoreText = new Label("0:00", skin); scoreText.setFontScale(FONT_SCALE, FONT_SCALE); pauseButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { model.togglePause(); } }); hudTable.top(); hudTable.add(scoreText).size(HUD_ELEMENTS_SIZE, HUD_ELEMENTS_SIZE).expandX() .left().fill().padLeft(HORIZONTAL_PAD).padTop(VERTICAL_PAD); hudTable.add(pauseButton).size(HUD_ELEMENTS_SIZE, HUD_ELEMENTS_SIZE).fill() .padRight(HORIZONTAL_PAD).padTop(VERTICAL_PAD); this.addActor(hudTable); }
public StageControl() { // Config config = new ConfigGeneral(); config.load(); // Spritebatch spritebatch = new SpriteBatch(); // Screen touchable wiiScreen = new Button(new Button.ButtonStyle()); wiiScreen.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); wiiImage = new Texture("image/placeholder.png"); addActor(wiiScreen); // Initialize controls for (Control control : controls) control.init(this); // Audio audioThread = new AudioThread(); audioThread.start(); // Video videoThread = new VideoThread(); videoThread.start(); // Command commandThread = new CommandThread(); commandThread.start(); }
public void create() { stage = new Stage(); Gdx.input.setInputProcessor(stage); //font = new BitmapFont(); //skin = new Skin(); //buttonAtlas = new TextureAtlas(Gdx.files.internal()); //skin.addRegions(buttonAtlas); button = new Button(); button.setStyle(new Button.ButtonStyle()); button.addCaptureListener(new EventListener() { @Override public boolean handle(Event event) { Gdx.app.log("LOG", "event " + event); return false; } }); stage.addActor(button); }
private void drawdefenders(){ defenders = new DrawDefenders(); groupBtnDefender = new Group(); Button btn1 = new Button(new ImageButton.ImageButtonStyle()); btn1.setName("btn1"); btn1.setSize(Gdx.graphics.getWidth() * 0.18f, Gdx.graphics.getWidth() * 0.2f); btn1.setPosition(Gdx.graphics.getWidth() * 0.025f, Gdx.graphics.getHeight() / 2.3f - Gdx.graphics.getHeight() * 0.14f); groupBtnDefender.addActor(btn1); Button btn2 = new Button(new ImageButton.ImageButtonStyle()); btn2.setName("btn2"); btn2.setSize(Gdx.graphics.getWidth() * 0.18f, Gdx.graphics.getWidth() * 0.2f); btn2.setPosition(Gdx.graphics.getWidth() * 0.025f, Gdx.graphics.getHeight() / 2.3f); groupBtnDefender.addActor(btn2); Button btn3 = new Button(new ImageButton.ImageButtonStyle()); btn3.setName("btn3"); btn3.setSize(Gdx.graphics.getWidth() * 0.18f, Gdx.graphics.getWidth() * 0.2f); btn3.setPosition(Gdx.graphics.getWidth() * 0.025f, Gdx.graphics.getHeight() / 2.3f + Gdx.graphics.getHeight() * 0.14f); groupBtnDefender.addActor(btn3); }
private void drawAttachers(){ attachers = new DrawAttachers(); Button btn1 = new Button(new ImageButton.ImageButtonStyle()); btn1.setName("btn4"); btn1.setSize(Gdx.graphics.getWidth() * 0.18f, Gdx.graphics.getWidth() * 0.2f); btn1.setPosition(Gdx.graphics.getWidth() - btn1.getWidth() * 1.13f, Gdx.graphics.getHeight() / 2.3f - Gdx.graphics.getHeight() * 0.14f); groupBtnDefender.addActor(btn1); Button btn2 = new Button(new ImageButton.ImageButtonStyle()); btn2.setName("btn5"); btn2.setSize(Gdx.graphics.getWidth() * 0.18f, Gdx.graphics.getWidth() * 0.2f); btn2.setPosition(Gdx.graphics.getWidth() - btn2.getWidth() * 1.13f, Gdx.graphics.getHeight() / 2.3f); groupBtnDefender.addActor(btn2); Button btn3 = new Button(new ImageButton.ImageButtonStyle()); btn3.setName("btn6"); btn3.setSize(Gdx.graphics.getWidth() * 0.18f, Gdx.graphics.getWidth() * 0.2f); btn3.setPosition(Gdx.graphics.getWidth() - btn3.getWidth() * 1.13f, Gdx.graphics.getHeight() / 2.3f + Gdx.graphics.getHeight() * 0.14f); groupBtnDefender.addActor(btn3); }
public QuestRewardDialog(ActorManipulator linkedManipulator, long id, QuestFinishedRewardPacket questReward, ItemPositionSupplier desiredItemPositionSupplier, PacketsSender packetsSender) { super(questReward.getQuestName(), linkedManipulator, id); for (ItemRewardPacket itemReward : questReward.getItemReward()) { ButtonField<QuestRewardIcon> rewardField = createRewardField(desiredItemPositionSupplier, packetsSender, questReward.getQuestName()); QuestRewardIcon questRewardIcon = new QuestRewardIcon(itemReward.getItemIdentifier(), itemReward.getNumberOfItems()); rewardField.put(questRewardIcon); rewardFields.put(itemReward.getItemIdentifier(), rewardField); this.add(rewardField); } this.row(); goldLabel = new StringValueLabel<>("Gold: ", Settings.DEFAULT_SKIN, questReward.getGoldReward()); Button takeGoldButton = ButtonCreator.createTextButton("Take", () -> packetsSender.send(PacketsMaker.makeRetrieveGoldRewardPacket(questReward.getQuestName()))); this.add(goldLabel); this.add(takeGoldButton); this.pack(); }
public ContainerDialog(CharacterItemDataPacket[] itemsToShow, int gold, String title, ActorManipulator linkedContainer, PacketsSender packetsSender, long containerId, ItemPositionSupplier userInventoryTakeItemPositionSupplier) { super(title, linkedContainer, containerId); int numberOfItems = itemsToShow.length; addFieldRow(itemsToShow, packetsSender, numberOfItems, 0, userInventoryTakeItemPositionSupplier); for (int i = ROW_LENGTH; i < numberOfItems; i += ROW_LENGTH) { this.row(); addFieldRow(itemsToShow, packetsSender, numberOfItems, i, userInventoryTakeItemPositionSupplier); } this.row(); goldLabel = new StringValueLabel<>("Gold: ", Settings.DEFAULT_SKIN, gold); this.getButtonTable().add(goldLabel).align(Align.right); Button takeGoldButton = ButtonCreator.createTextButton("Take", () -> packetsSender.send(PacketsMaker.makeTakingGoldFromContainerPacket(containerId))); this.getButtonTable().add(takeGoldButton).align(Align.bottomRight); setWidth(ROW_LENGTH * BUTTON_SIZE + 50); setHeight(120); }
public ShopBuyingDialog(ShopItem item, UserInterface linkedInterface, PacketsSender packetsSender, long shopId) { super(DialogUtils.humanReadableFromItemIdentifier(item.getItem().getIdentifier()), linkedInterface.getDialogs(), item.getItem().getId()); this.item = item; totalPrice = new StringValueLabel<>("Total: ", getSkin(), item.getPrice()); Texture texture = item.getItem().getTexture(); Image image = new Image(texture); Table upperContainer = new Table(); upperContainer.add(image).width(32).height(32).padRight(43); upperContainer.add(numberOfItemsField).width(40).align(Align.right); this.getContentTable().add(upperContainer).align(Align.left); this.getContentTable().row(); this.getContentTable().add(totalPrice); this.getContentTable().row(); Button buyButton = ButtonCreator.createTextButton("Buy", () -> tryToBuyAction(packetsSender, shopId, linkedInterface)); this.getContentTable().add(buyButton); pack(); DialogUtils.centerPosition(this); }
public MenuDialog(UserInterface linkedInterface) { super("Menu", Settings.DEFAULT_SKIN); Button closeButton = new CloseButton(this); getTitleTable().add(closeButton).size(15, 15).padRight(-5).top().right(); TextButton characterChangeButton = ButtonCreator.createTextButton("Change character", () -> linkedInterface.userWantsToChangeCharacter()); TextButton logOutButton = ButtonCreator.createTextButton("Log out", () -> linkedInterface.userWantsToLogOut()); TextButton disconnectButton = ButtonCreator.createTextButton("Disconnect", () -> linkedInterface.userWantsToDisconnect()); TextButton exitButton = ButtonCreator.createTextButton("Exit", () -> Gdx.app.exit()); getContentTable().add(characterChangeButton); getContentTable().row(); getContentTable().add(logOutButton); getContentTable().row(); getContentTable().add(disconnectButton); getContentTable().row(); getContentTable().add(exitButton); getContentTable().row(); DialogUtils.centerPosition(this); pack(); }
public GameButton(float WIDTH, float HEIGHT, String drawable, boolean isCheckable) { audioManager = AudioManager.getInstance(); skin = new Skin(); skin.addRegions(AssetsManager.getTextureAtlas()); Button.ButtonStyle buttonStyle = new Button.ButtonStyle(); buttonStyle.up = skin.getDrawable(drawable); buttonStyle.down = skin.getDrawable(drawable + "_pressed"); if (isCheckable) { buttonStyle.checked = skin.getDrawable(drawable + "_pressed"); } setStyle(buttonStyle); setSize(WIDTH, HEIGHT); rectangle = new Rectangle(getX(),getY(),getWidth(),getHeight()); addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); audioManager.playSound(audioManager.getButtonSound()); } }); }
private void initPlayerButton() { playerButton = new Button(new Button.ButtonStyle()); playerButton.setWidth(460); playerButton.setHeight(360); playerButton.setX(10); playerButton.setY(170); playerButton.setDebug(true); stage.addActor(playerButton); playerButton.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { player.reactOnClick(); game.addPoint(); return super.touchDown(event, x, y, pointer, button); } }); }
private void initResetButton() { resetButton = new Button(new Button.ButtonStyle()); resetButton.setWidth(40); resetButton.setHeight(20); resetButton.setX(160); resetButton.setY(550); resetButton.setDebug(true); stage.addActor(resetButton); resetButton.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { game.resetPoints(); return super.touchDown(event, x, y, pointer, button); } }); }
private void createMobileMoveButton() { float screenWidth = Gdx.graphics.getWidth(); float screenHeight = Gdx.graphics.getHeight(); moveButton = new Button(skin); moveButton.getStyle().down = new TextureRegionDrawable(AssetManager.getInstance().getTextureRegion("default")).tint(MOBILE_BUTTON_DOWN_COLOR); moveButton.getStyle().up = new TextureRegionDrawable(AssetManager.getInstance().getTextureRegion("default")).tint(MOBILE_BUTTON_UP_COLOR); moveButton.setSize(screenWidth * 0.35f, screenHeight * 0.2f); moveButton.setPosition(screenWidth / 32, screenHeight / 32f); moveButton.addListener(new com.badlogic.gdx.scenes.scene2d.InputListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { boolean isTutorial = DAO.getInstance().getBoolean(DAO.IS_NEW_KEY, true); if (Globals.getGameState() == Game.State.WAIT_FOR_INPUT) { Globals.setGameState(Game.State.RUNNING); } if (Globals.getGameState() == Game.State.RUNNING) { movePointer = pointer; } return true; } }); stage.addActor(moveButton); }
protected Button getSettingsButton(boolean useText) { Button button = useText ? new BeepingImageTextButton("Settings", UIManager.skin, "settings") : new BeepingImageButton(UIManager.skin, "settings"); button.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { ScreenManager.addScreen(new SettingsScreen()); } }); return button; }
public void setStyle(EditTextStyle style) { this.style = style; ScrollPane.ScrollPaneStyle sps = new ScrollPane.ScrollPaneStyle(); sps.background = style.background; this.scrollPane.setStyle(sps); Label.LabelStyle ls = new Label.LabelStyle(); ls.font = style.font; ls.fontColor = style.fontColor; this.textLabel.setStyle(ls); Button.ButtonStyle bs = new Button.ButtonStyle(); bs.up = style.editIcon; bs.down = style.editIcon; editButton.setStyle(bs); }
@Override protected void doShow(String signInReasonKey) { Table content = new Table(Config.skin); content.setBackground("ui-store-window-background"); content.defaults().pad(4); LocLabel label = new LocLabel(signInReasonKey); label.setWrap(true); label.setAlignment(Align.center); Button button = new Button(Config.skin); button.defaults().pad(2); button.add(new LocLabel("ui-sign-in")).padTop(1).padLeft(4).expand().right(); button.add(new Tile("ui/button/services-icon")).padTop(4).padBottom(2).padRight(4).expand().left(); button.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { signIn = true; hide(); } }); content.add(label).width(130).row(); content.add(button).width(70).padBottom(8); table.add(content); }
public HexaFrameBottom(Skin hudSkin) { super(); this.hudSkin = hudSkin; hexaFrameImage = new Image(hudSkin.getRegion(HEXA_FRAME_NAME)); setWidth(hexaFrameImage.getWidth()); setHeight(hexaFrameImage.getHeight()); frameHiddenButton = new Button(hudSkin, "frame_bottom_hidden"); frameHiddenButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { hide(false); } }); frameHiddenButton.setPosition(0, 0); frameVisibleGroup.addActor(hexaFrameImage); addActor(frameVisibleGroup); addActor(frameHiddenButton); }
public HEToolbox() { super(true); ButtonGroup<Button> toolButtons = new ButtonGroup<>(); for (final ToolType type : ToolType.values()) { Button button = new VisTextButton(type.toString(), "toggle"); button.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { if (((Button) actor).isChecked()) { HelixEditor.getInstance().getToolbarState().setActiveTool(type); } } }); toolButtons.add(button); add(button).padBottom(-8); row(); } }
public void addButton(LabelStyle style, String label, String secondaryLabel, Runnable action, boolean active) { Button b = new Button(skin.get(ButtonStyle.class)); if (action != null) b.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { action.run(); } }); b.setDisabled(!active); b.add(new Label(label, style)).left(); if (secondaryLabel != null && !secondaryLabel.isEmpty()) b.add(new Label(secondaryLabel, style)).padRight(15f); table.add(b).minHeight(b.getMinHeight()).prefHeight(b.getPrefHeight()).left().padLeft(1f).colspan(nbColumns); table.row(); }
/** * Adds a button to the menu, with an icon on the left and label on the right. */ public Button addButtonSprite(Drawable icon, String label, Runnable action, boolean active) { LabelStyle style = active ? skin.get(LabelStyle.class) : skin.get("inactive", LabelStyle.class); Button b = new Button(skin.get(ButtonStyle.class)); if (action != null) b.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { action.run(); } }); b.setDisabled(!active); b.add(new Image(icon, Scaling.fit)).left(); Label l = new Label(label, style); l.setWrap(true); b.add(l).padLeft(8).right().expandX().fillX(); table.add(b).minHeight(b.getMinHeight()).prefHeight(b.getPrefHeight()).left().padLeft(1f).colspan(nbColumns); table.row(); return b; }
public void buildNotificationMenu() { List<Notification> notifs = notifications.getNotifications(); notifMenu.clear(); if (notifs.isEmpty()) notifMenu.addLabel("No notifications"); else for (Notification n : notifs) { Button b = notifMenu.addButtonSprite(n.type, n.msg, () -> { inputManager.reloadMenus(); if (n.action != null) n.action.run(); }, true); b.addListener(new ClickListener(Buttons.RIGHT) { @Override public void clicked(InputEvent event, float x, float y) { notifications.discard(n); inputManager.reloadMenus(); } }); } notifMenu.addToStage(stage, Gdx.graphics.getWidth() - 400, min(512, notifMenu.getTable().getPrefHeight()), false); }
/** * Konstruktor. * * @param loots * Liste alles Loots, die angezeigt werden sollen. */ public LootPopup(final HashSet<Lootable> loots) { super(); Label label = createLabel("Deine gesammelten Gegenstände"); // label.setWidth(popupWidth - 80); // label.setWrap(true); // label.layout(); addActor(label); LootDisplay button = new LootDisplay(loots, lootPopupHeight, popupWidth - 80); addActor(button); Button ok = createButton("OK"); ok.addListener(new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { LootPopup.this.getOverlay().disposePopup(); event.cancel(); } }); addActor(ok); }
/** * Konstruktor. * * @param cityObject * CityInfos. */ public CityPopup(final CityObject cityObject) { Label label = createLabel(gennerateText(cityObject.getCityInfo())); ScrollPane scollContent = new DefaultScrollPane(label, height / 3, popupWidth * 0.8f); this.addActor(createLabel(cityObject.getCityName())); this.addActor(scollContent); Button btn = new ButtonLarge("Ok"); btn.addListener(new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { getOverlay().disposePopup(); } }); this.addActor(btn); }
/** * Der default Konstruktor. */ public TutorialPopup() { Label label = createLabel(gennerateText()); ScrollPane scollContent = new DefaultScrollPane(label, tutorialPopupHeight, popupWidth * 0.8f); this.addActor(createLabel("Anleitung :)")); this.addActor(scollContent); Button btn = new ButtonLarge("Los"); btn.addListener(new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { getOverlay().disposePopup(); } }); this.addActor(btn); }
public Button createSwitchScreenButton( Sprite text, Sprite up, Sprite down, final AbstractScreen<TaflGame> parent, final AbstractScreen<TaflGame> screen) { ImageButton button = new ImageButton(new DoubleTextureDrawable(new TextureRegion(up), new TextureRegion(text)), new DoubleTextureDrawable(new TextureRegion(down), new TextureRegion(text))); button.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { soundService.playSound(Assets.Sounds.CLICK_SOUND); parent.switchScreen(screen); } }); return button; }
public static void setup(){ registerSerializer(Actor.class, new ActorSerializer()); registerSerializer(Scene.class, new SceneSerializer()); registerSerializer(ImageJson.class, new ImageJson()); registerSerializer(Label.class, new LabelSerializer()); registerSerializer(Button.class, new ButtonSerializer()); registerSerializer(TextButton.class, new TextButtonSerializer()); registerSerializer(Table.class, new TableSerializer()); registerSerializer(CheckBox.class, new CheckBoxSerializer()); registerSerializer(SelectBox.class, new SelectBoxSerializer()); registerSerializer(List.class, new ListSerializer()); registerSerializer(Slider.class, new SliderSerializer()); registerSerializer(TextField.class, new TextFieldSerializer()); registerSerializer(Touchpad.class, new TouchpadSerializer()); registerSerializer(Sprite.class, new SpriteSerializer()); registerSerializer(Dialog.class, new DialogSerializer()); registerSerializer(SplitPane.class, new SplitPaneSerializer()); registerSerializer(ScrollPane.class, new ScrollPaneSerializer()); registerSerializer(Stack.class, new StackSerializer()); registerSerializer(Tree.class, new TreeSerializer()); registerSerializer(Table.class, new TableSerializer()); registerSerializer(ButtonGroup.class, new ButtonGroupSerializer()); registerSerializer(HorizontalGroup.class, new HorizontalGroupSerializer()); registerSerializer(VerticalGroup.class, new VerticalGroupSerializer()); }
@Override public void notify(Events event, Object... data) { switch (event) { case TOGGLE_VISIBILITY_CMD: boolean interf = (Boolean) data[1]; if (!interf) { String key = (String) data[0]; Button b = buttonMap.get(key); b.setProgrammaticChangeEvents(false); if (b != null) { if (data.length == 3) { b.setChecked((Boolean) data[2]); } else { b.setChecked(!b.isChecked()); } } b.setProgrammaticChangeEvents(true); } break; default: break; } }
public PieMenu2(SceneScreen scr) { sceneScreen = scr; font = scr.getUI().getSkin().getFont("desc"); buttons = new Button[NUM_VERBS]; endPositions = new Vector2[NUM_VERBS]; for(int i = 0; i < NUM_VERBS; i++) { buttons[i] = new Button(scr.getUI().getSkin(), "pie_lookat"); endPositions[i] = new Vector2(); addActor(buttons[i]); buttons[i].addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, com.badlogic.gdx.scenes.scene2d.Actor actor) { if (iActor != null) { sceneScreen.runVerb(iActor, "lookat", null); } hide(); } }); } }
public TabPanel(Skin skin) { super(skin); this.skin = skin; buttonGroup = new ButtonGroup<Button>(); header = new HorizontalGroup(); body = new Container<Actor>(); tabs = new ArrayList<Tab>(); buttonGroup.setMaxCheckCount(1); buttonGroup.setMinCheckCount(1); buttonGroup.setUncheckLast(true); header.wrap(true); header.rowAlign(Align.left); add(header).expandX().fillX().left(); row(); add(body).expand().fill(); body.fill(); }
public void addTab(String name, Actor panel) { Button button = new TextButton(name, skin); buttonGroup.add(button); header.addActor(button); tabs.add(new Tab(button, panel)); button.addListener(new ClickListener() { @Override public void clicked (InputEvent event, float x, float y) { setTab((Button)event.getListenerActor()); } }); if(tabs.size() == 1) setTab(0); }
/** * Builds and returns {@link VisTable} containing buttons in platform dependant order. Note that calling this multiple * times will remove buttons from previous tables. */ public VisTable createTable () { VisTable table = new VisTable(true); table.left(); boolean spacingValid = false; for (int i = 0; i < order.length(); i++) { char ch = order.charAt(i); if (ignoreSpacing == false && ch == ' ' && spacingValid) { table.add().width(sizes.buttonBarSpacing); spacingValid = false; } Button button = buttons.get(ch); if (button != null) { table.add(button); spacingValid = true; } } return table; }
public void createPauseMenu() { pauseMenuStage = new Stage(); // pauseMenuStage.setViewport(fit); pauseMenuTable = new Table(); pauseMenuTable.setFillParent(true); pauseMenuStage.addActor(pauseMenuTable); TextButtonStyle style = new TextButtonStyle(); style.up = new TextureRegionDrawable(buttons[0]); // 1080 x 300 style.down = new TextureRegionDrawable(buttons[0]); style.font = new BitmapFont(); resumeButton = new Button(style); pauseMenuTable.add(resumeButton); resumeButton.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { resumeCall(); } }); }
private Cell getCell(int x, int y) { if (mTable != null) { for (Cell c : mTable.getCells()) { if (c.getColumn() == x && c.getRow() == y) { Actor cellActor = (Actor) (c.getWidget()); if (cellActor instanceof Button && (((Button) cellActor).isDisabled() || !((Button) cellActor) .isVisible())) { return null; } else { return c; } } } } return null; }
private Cell getTransCell(int x, int y) { if (mTable != null) { for (Cell c : mTable.getCells()) { if (c.getColumn() == x && c.getRow() == y) { Actor cellActor = (Actor) (c.getWidget()); if (cellActor instanceof Button && (((Button) cellActor).isDisabled() || !((Button) cellActor).isVisible() || !((Button) cellActor) .isTransform())) { return null; } else { return c; } } } } return null; }
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) { if (fromActor instanceof ImageButton && ((ImageButton) fromActor).isDisabled()) { return; } else if (event.getListenerActor() instanceof ImageButton && ((ImageButton) event.getListenerActor()).isDisabled()) { return; } Cell selected = mTable.getCell(event.getListenerActor()); if (selected != null && (mX != selected.getColumn() || mY != selected.getRow())) { Actor cellActor = (Actor) (selected.getWidget()); if (cellActor instanceof Button && (((Button) cellActor).isDisabled() || !((Button) cellActor).isVisible())) { // nothing don't navigate } else { Game.get().playTickSound(); mX = selected.getColumn(); mY = selected.getRow(); } } }
@Override public void modelChanged(ResourceEvent event) { ResourceCategory category = event.getCategory(); if (category == ResourceCategory.SCENE) { Object resource = event.getResource(); if (resource instanceof ModelEntity) { String id = event.getId(); switch (event.getType()) { case ADDED: addSceneBox((ModelEntity) resource, id); break; case REMOVED: Array<Button> buttons = buttonGroup.getButtons(); for (Button button : buttons) { if (((SceneButton) button).scene == resource) { buttonGroup.remove(button); removeActor(button); break; } } break; } } } }
public PauseButton(Pauseable pause, ButtonStyle style) { super(style); this.pauseable = pause; setColor(1f, 1f, 1f, 0.4f); final Button pauseButton = this; addListener(new InputListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { pauseable.setPaused(!pauseable.isPaused()); if (pauseable.isPaused()) { pauseButton.setColor(1f, 1f, 1f, 1f); } else { pauseButton.setColor(1f, 1f, 1f, 0.4f); } return true; } }); }
private void a(Button paramButton, Integer paramInteger) { if (this.e.b != null) { this.e.b.setChecked(false); this.e.b = null; } if (paramInteger != null) this.e.a = Integer.valueOf(paramInteger.intValue()); if (paramButton != null) { this.e.b = paramButton; this.e.b.setChecked(true); this.c.a(this.a, paramInteger.intValue()); } }