List of usage examples for com.badlogic.gdx.scenes.scene2d Touchable disabled
Touchable disabled
To view the source code for com.badlogic.gdx.scenes.scene2d Touchable disabled.
Click Source Link
From source file:actors.Footman.java
public Footman(float hlth, float dmg, float x, float y, int lvl, int pth) { this.setName("footman"); damage = dmg;// w ww . j av a 2s. com health = hlth; level = lvl; path = pth; notmoving = false; if (damage < 400) texture = new Texture("footman0.png"); if (damage < 450 && damage >= 400) texture = new Texture("footman1.png"); if (damage < 600 && damage >= 450) texture = new Texture("footman2.png"); if (damage < 1000 && damage >= 600) texture = new Texture("champion.png"); if (damage >= 1000) texture = new Texture("footman3.png"); sprite = new Sprite(texture); sprite.setScale(0.65f); setBounds(sprite.getX(), sprite.getY(), sprite.getWidth(), sprite.getHeight()); emptyHealthBar = new Sprite(new Texture("emptyBar.png")); fullHealthBar = new Sprite(new Texture("fullBar.png")); setTouchable(Touchable.disabled); velocity = 80; inCombat = false; assignMovement(x, y); /* init = new MoveToAction(); init.setPosition(x, y); ms = new MoveToAction(); ms.setPosition(100f,375f); ma1 = new MoveToAction(); ma1.setPosition(315f,375f); ma1.setDuration(((315-100 )/velocity)); ma2 = new MoveToAction(); ma2.setPosition(315f, 180f); ma2.setDuration((375-180)/velocity); ma3 = new MoveToAction(); ma3.setPosition(510f, 180f); ma3.setDuration((510-315)/velocity); ma4 = new MoveToAction(); ma4.setPosition(510f, 570f); ma4.setDuration((570-180)/velocity); ma5 = new MoveToAction(); ma5.setPosition(680f, 570f); ma5.setDuration((680-510)/velocity); ma6 = new MoveToAction(); ma6.setPosition(680f, 375f); ma6.setDuration((570-375)/velocity); ma7 = new MoveToAction(); ma7.setPosition(1000f, 375f); ma7.setDuration((1000-680)/velocity); SequenceAction sa1 = new SequenceAction(ms, ma1, ma2, ma3, ma4); SequenceAction sa2 = new SequenceAction(ma5, ma6, ma7); SequenceAction sa3 = new SequenceAction(ma1, ma2, ma3, ma4); SequenceAction sa4 = new SequenceAction(ma2, ma3, ma4); SequenceAction sa5 = new SequenceAction(ma3, ma4, ma5, ma6, ma7); SequenceAction sa6 = new SequenceAction(init, ma4, ma5, ma6, ma7); SequenceAction sa7 = new SequenceAction(init, ma5, ma6, ma7); SequenceAction sa8 = new SequenceAction(init, ma6, ma7); SequenceAction csa1 = new SequenceAction(sa1, sa2); SequenceAction csa2 = new SequenceAction(init, sa3, sa2); SequenceAction csa3 = new SequenceAction(init, sa4, sa2); SequenceAction csa4 = new SequenceAction(init, sa5); if((x==100)&&(y==375)) this.addAction(csa1); else if((y==375)&&(x<315)) { ma1.setDuration((315-x)/velocity); sa3 = new SequenceAction(ma1, ma2, ma3, ma4); csa2 = new SequenceAction(init, sa3, sa2); this.addAction(csa2); } else if((x==315)&&(y!=180)) { ma2.setDuration((y-180)/velocity); sa4 = new SequenceAction(ma2, ma3, ma4); csa3 = new SequenceAction(init, sa4, sa2); this.addAction(csa3); } else if((y==180)&&(x!=510)) { ma3.setDuration((510-x)/velocity); sa5 = new SequenceAction(ma3, ma4, ma5, ma6, ma7); csa4 = new SequenceAction(init, sa5); this.addAction(csa4); } else if((x==510)&&(y!=570)) { ma4.setDuration((570-y)/velocity); sa6 = new SequenceAction(init, ma4, ma5, ma6, ma7); this.addAction(sa6); } else if((y==570)&&(x!=680)) { ma5.setDuration((680-x)/velocity); sa7 = new SequenceAction(init, ma5, ma6, ma7); this.addAction(sa7); } else if((x==680)&&(y!=375)) { ma6.setDuration((y-375)/velocity); sa8 = new SequenceAction(init, ma6, ma7); this.addAction(sa8); } else if((y==375)&&(x>315)) { ma7.setDuration((1000-x)/velocity); SequenceAction sa9 = new SequenceAction(init, ma7); this.addAction(sa9); } */ }
From source file:ateamproject.kezuino.com.github.render.screens.GameScreen.java
public void showPlayersView() { this.playerMenu.clear(); TextButton btExit = new TextButton("Oke", skin); btExit.addListener(new ClickListener() { @Override// w ww. ja va 2 s . com public void clicked(InputEvent event, float x, float y) { getSession().setPlayerMenuShowing(false); playerMenu.hide(); } }); this.playerMenu.add(btExit); Table scrollTable = new Table(skin); ArrayList<String> people = new ArrayList<>(); PacketGetKickInformation packetGetKickInfo = new PacketGetKickInformation(); Client.getInstance().send(packetGetKickInfo); people.addAll(packetGetKickInfo.getResult()); for (String person : people) { String[] peopleResult = person.split(" "); TextButton bKick = new TextButton("Kick", skin); bKick.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { PacketSetKickInformation packetKick = new PacketSetKickInformation( UUID.fromString(peopleResult[4]), null); Client.getInstance().send(packetKick); PacketGetKickInformation packetKickInfo = new PacketGetKickInformation(); Client.getInstance().send(packetKickInfo); people.clear(); people.addAll(packetKickInfo.getResult()); } }); scrollTable.add(peopleResult[0]); scrollTable.columnDefaults(0); scrollTable.add(bKick); scrollTable.columnDefaults(1); scrollTable.add(peopleResult[1] + "/" + peopleResult[2]); scrollTable.columnDefaults(2); scrollTable.row(); if (peopleResult[3].equals("true")) { bKick.setDisabled(true); bKick.setTouchable(Touchable.disabled); bKick.setColor(255, 0, 0, 100); } } playerMenu.add(scrollTable); this.playerMenu.show(stage); getSession().showPlayerMenu(); }
From source file:ateamproject.kezuino.com.github.render.screens.LoginScreen.java
public LoginScreen(Game game) { super(game);/* w w w . j a v a 2 s. co m*/ TextField txtUsername = new TextField("pactales1@gmail.com", skin); TextField txtPassword = new TextField("pactales!", skin); txtPassword.setPasswordCharacter('*'); txtPassword.setPasswordMode(true); TextButton btnLogin = new TextButton("Inloggen", skin); btnLogin.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { btnLogin.setTouchable(Touchable.disabled); btnLogin.setText("Laden"); Thread loginThread = new Thread(() -> { PacketLoginAuthenticate packet = new PacketLoginAuthenticate(txtUsername.getText(), txtPassword.getText(), null); Client.getInstance().send(packet); Gdx.app.postRunnable(() -> { // Login was successful.. if (Client.getInstance().getId() != null) { PacketLoginUserExists packetUserExists = new PacketLoginUserExists( txtUsername.getText(), null); Client.getInstance().send(packetUserExists); // Handle user doesn't exist. if (!packetUserExists.getResult()) { Dialog d = new Dialog("Geen gebruiker gevonden", skin); d.add("Gebruikersnaam:"); TextField f = new TextField("", skin); d.add(f); bExit = new TextButton("Oke", skin); bExit.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (!f.getText().isEmpty()) { PacketLoginCreateNewUser packet1; packet1 = new PacketLoginCreateNewUser(f.getText(), txtUsername.getText()); Client.getInstance().send(packet1); if (!packet1.getResult()) { new Dialog("Error", skin) { { text("De naam bestaat al."); button("Oke"); } }.show(stage); } else { d.hide(); Client.getInstance().setUsername(f.getText()); game.setScreen(new MainScreen(game)); } } } }); d.add(bExit); d.show(stage); } else { game.setScreen(new MainScreen(game)); } } else { new Dialog("Error", skin) { { text(packet.getResult().getMessage()); button("Oke"); } }.show(stage); } btnLogin.setText("Inloggen"); btnLogin.setTouchable(Touchable.enabled);//enable button touch }); }); loginThread.start(); } }); txtUsername.setSize(300, 40); txtPassword.setSize(300, 40); txtPassword.setPasswordMode(true); btnLogin.setSize(300, 40); btnLogin.setPosition(stage.getWidth() / 2 - btnLogin.getWidth() / 2, 150); txtUsername.setPosition(stage.getWidth() / 2 - txtUsername.getWidth() / 2, 300); txtPassword.setPosition(stage.getWidth() / 2 - txtPassword.getWidth() / 2, 250); stage.addActor(btnLogin); stage.addActor(txtUsername); stage.addActor(txtPassword); backgroundMusic = Assets.getMusicStream("menu.mp3"); }
From source file:awakening.view.menu.Controls.java
License:Apache License
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1);/*from w w w . j a va 2 s .co m*/ Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); Gdx.graphics.setDisplayMode(game.getSize().width, game.getSize().height, game.isFullscreen()); if (btnUp.isChecked()) { btnUp.setColor(Color.RED); btnUp.setTouchable(Touchable.disabled); btnDown.setTouchable(Touchable.disabled); btnLeft.setTouchable(Touchable.disabled); btnRight.setTouchable(Touchable.disabled); btnZoomIn.setTouchable(Touchable.disabled); btnZoomOut.setTouchable(Touchable.disabled); btnBack.setTouchable(Touchable.disabled); setControls(btnUp); } else if (btnDown.isChecked()) { btnDown.setColor(Color.RED); btnUp.setTouchable(Touchable.disabled); btnDown.setTouchable(Touchable.disabled); btnLeft.setTouchable(Touchable.disabled); btnRight.setTouchable(Touchable.disabled); btnZoomIn.setTouchable(Touchable.disabled); btnZoomOut.setTouchable(Touchable.disabled); btnBack.setTouchable(Touchable.disabled); setControls(btnDown); } else if (btnLeft.isChecked()) { btnLeft.setColor(Color.RED); btnUp.setTouchable(Touchable.disabled); btnDown.setTouchable(Touchable.disabled); btnLeft.setTouchable(Touchable.disabled); btnRight.setTouchable(Touchable.disabled); btnZoomIn.setTouchable(Touchable.disabled); btnZoomOut.setTouchable(Touchable.disabled); btnBack.setTouchable(Touchable.disabled); setControls(btnLeft); } else if (btnRight.isChecked()) { btnRight.setColor(Color.RED); btnUp.setTouchable(Touchable.disabled); btnDown.setTouchable(Touchable.disabled); btnLeft.setTouchable(Touchable.disabled); btnRight.setTouchable(Touchable.disabled); btnZoomIn.setTouchable(Touchable.disabled); btnZoomOut.setTouchable(Touchable.disabled); btnBack.setTouchable(Touchable.disabled); setControls(btnRight); } else if (btnZoomIn.isChecked()) { btnZoomIn.setColor(Color.RED); btnUp.setTouchable(Touchable.disabled); btnDown.setTouchable(Touchable.disabled); btnLeft.setTouchable(Touchable.disabled); btnRight.setTouchable(Touchable.disabled); btnZoomIn.setTouchable(Touchable.disabled); btnZoomOut.setTouchable(Touchable.disabled); btnBack.setTouchable(Touchable.disabled); setControls(btnZoomIn); } else if (btnZoomOut.isChecked()) { btnZoomOut.setColor(Color.RED); btnUp.setTouchable(Touchable.disabled); btnDown.setTouchable(Touchable.disabled); btnLeft.setTouchable(Touchable.disabled); btnRight.setTouchable(Touchable.disabled); btnZoomIn.setTouchable(Touchable.disabled); btnZoomOut.setTouchable(Touchable.disabled); btnBack.setTouchable(Touchable.disabled); setControls(btnZoomOut); } ///Settings sound.setVolume(game.getMusicVolume()); ///Cursor Pixmap pm = new Pixmap(Gdx.files.internal("img/cursor.png")); Gdx.input.setCursorImage(pm, 0, 0); pm.dispose(); ///Draw Background batch.setProjectionMatrix(camera.combined); batch.begin(); batch.draw(background, 0, 0, Gdx.app.getGraphics().getWidth(), Gdx.app.getGraphics().getHeight()); batch.end(); ///Draw Stage stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f)); stage.draw(); }
From source file:awakening.view.menu.MapSelection.java
License:Apache License
@Override public void show() { Gdx.input.setInputProcessor(stage);// w w w. jav a 2 s . c om ///Title title.setPosition(Gdx.app.getGraphics().getWidth() / 2 - title.getWidth() / 2, Gdx.app.getGraphics().getHeight() - 30); stage.addActor(title); ///Widgets Background widgetsBackground.setPosition(Gdx.app.getGraphics().getWidth() / 2 - widgetsBackground.getWidth() / 2, Gdx.app.getGraphics().getHeight() / 2 - widgetsBackground.getHeight() / 2); stage.addActor(widgetsBackground); ///Back Button btnBack.setWidth(100); btnBack.setPosition(Gdx.app.getGraphics().getWidth() / 2 - btnBack.getWidth() / 2, Gdx.app.getGraphics().getHeight() - widgetsBackground.getHeight() + 10); btnBack.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { effect.play(game.getSoundVolume()); game.setScreen(new MainMenu(game, sound, effect)); return false; } }); stage.addActor(btnBack); btnJeu.setWidth(200); btnJeu.setPosition(Gdx.app.getGraphics().getWidth() / 2 - btnJeu.getWidth() / 2, Gdx.app.getGraphics().getHeight() - widgetsBackground.getHeight() + 40); btnJeu.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { effect.play(game.getSoundVolume()); game.setScreen(new Solo(game, mapListes.get(indexMap))); return true; } }); stage.addActor(btnJeu); ///Next Button btnNext.setWidth(75); btnNext.setHeight(75); btnNext.setPosition( Gdx.app.getGraphics().getWidth() - Gdx.app.getGraphics().getWidth() / 8 - btnNext.getWidth(), Gdx.app.getGraphics().getHeight() / 2); btnNext.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { effect.play(game.getSoundVolume()); disableMap(); indexMap++; indexMap %= mapListes.size(); changeMap(); return false; } } ); stage.addActor(btnNext); ///Previous Button btnPrevious.setWidth(75); btnPrevious.setHeight(75); btnPrevious.setPosition(Gdx.app.getGraphics().getWidth() / 8, Gdx.app.getGraphics().getHeight() / 2); btnPrevious.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { effect.play(game.getSoundVolume()); disableMap(); indexMap--; if (indexMap < 0) indexMap = mapListes.size() - 1; changeMap(); return false; } } ); stage.addActor(btnPrevious); for (Field f : mapListes) { BoutonShop mapButton = new BoutonShop(f.getTexture(), Gdx.app.getGraphics().getWidth() / 4, Gdx.app.getGraphics().getWidth() / 4); mapButton.setPosition(Gdx.app.getGraphics().getWidth() / 2 - mapButton.getWidth() / 2, Gdx.app.getGraphics().getHeight() / 2 - mapButton.getHeight() / 2); mapButton.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { effect.play(game.getSoundVolume()); return false; } }); mapButton.setVisible(false); mapButton.setTouchable(Touchable.disabled); ; stage.addActor(mapButton); maps.add(mapButton); } changeMap(); }
From source file:awakening.view.menu.MapSelection.java
License:Apache License
public void disableMap() { maps.get(indexMap).setVisible(false); maps.get(indexMap).setTouchable(Touchable.disabled); }
From source file:awakening.view.menu.WaitingRoomClient.java
License:Apache License
/** * Constructor//from w w w . j a va 2 s .co m * * @param game Tower Awakening's Game * @param sound Main menu's music * @param effect Button's effect */ public WaitingRoomClient(TAGame game, Music sound, Sound effect) { this.game = game; this.sound = sound; this.effect = effect; try { socket = new Socket(InetAddress.getByName(null), 1134); input = new BufferedReader(new InputStreamReader(socket.getInputStream())); output = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())), true); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } th1 = new Thread(new Runnable() { @Override public void run() { try { while (true) { String messagePlayer = input.readLine(); if (messagePlayer != null) { TextArea t = new TextArea(messagePlayer, skin); t.setTouchable(Touchable.disabled); chatBox.row(); chatBox.add(t).height(75).width(500); } } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); th1.start(); stage = new Stage(); try { if (game.getLanguage().equals("ENGLISH")) { language = ResourceBundle.getBundle("awakening.view.menu.res_en_EN", locales[0]); } else if (game.getLanguage().equals("FRENCH")) { language = ResourceBundle.getBundle("awakening.view.menu.res_fr_FR", locales[1]); } else if (game.getLanguage().equals("ITALIAN")) { language = ResourceBundle.getBundle("awakening.view.menu.res_it_IT", locales[2]); } else { language = ResourceBundle.getBundle("awakening.view.menu.res", locales[0]); } } catch (java.util.MissingResourceException e) { System.out.println("yolo"); } ///Viewport camera = new OrthographicCamera(); view = new StretchViewport(Gdx.app.getGraphics().getWidth(), Gdx.app.getGraphics().getWidth(), camera); ///Background background = new Texture(Gdx.files.internal("img/menu/Background-2.png")); batch = new SpriteBatch(); ///Skin skin = new Skin(Gdx.files.internal("uiskin.json")); ///Title title = new Label(language.getString("label_waiting_room"), skin); ///Widgets Background widgetsBackground = new Image(new Texture(Gdx.files.internal("img/widget/window_selection.png"))); widgetsBackground.setSize(Gdx.app.getGraphics().getWidth() - Gdx.app.getGraphics().getWidth() / 8, Gdx.app.getGraphics().getHeight() - Gdx.app.getGraphics().getHeight() / 8); ///Back Button btnBack = new TextButton(language.getString("button_back"), skin); ///ChatBox chatBox = new Table(); scroll = new ScrollPane(chatBox); scroll.setForceScroll(false, true); scroll.setFlickScroll(true); scroll.setOverscroll(false, false); ///Message message = new TextField("", skin); btnSend = new TextButton(language.getString("button_send"), skin); }
From source file:awakening.view.menu.WaitingRoomClient.java
License:Apache License
@Override public void show() { Gdx.input.setInputProcessor(stage);/*from ww w. j av a 2 s . c o m*/ ///Title title.setPosition(Gdx.app.getGraphics().getWidth() / 2 - title.getWidth() / 2, Gdx.app.getGraphics().getHeight() - 30); stage.addActor(title); ///Widgets Background widgetsBackground.setPosition(Gdx.app.getGraphics().getWidth() / 2 - widgetsBackground.getWidth() / 2, Gdx.app.getGraphics().getHeight() / 2 - widgetsBackground.getHeight() / 2); stage.addActor(widgetsBackground); ///Back Button btnBack.setWidth(100); btnBack.setPosition(Gdx.app.getGraphics().getWidth() / 2 - btnBack.getWidth() / 2, Gdx.app.getGraphics().getHeight() - widgetsBackground.getHeight() + 10); btnBack.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { effect.play(game.getSoundVolume()); th1.interrupt(); game.setScreen(new MainMenu(game, sound, effect)); return false; } }); stage.addActor(btnBack); stage.addActor(btnSend); stage.addActor(message); scroll.setSize(widgetsBackground.getWidth() - ((1 / 8) * widgetsBackground.getWidth()), widgetsBackground.getHeight() - widgetsBackground.getHeight() / 2); scroll.setPosition(Gdx.app.getGraphics().getWidth() / 2 - scroll.getWidth() / 2, Gdx.app.getGraphics().getHeight() / 2 - scroll.getHeight() / 2); stage.addActor(scroll); btnSend.setPosition(500, 30); message.setPosition(btnBack.getX() - message.getWidth() / 2, btnBack.getY() + btnBack.getHeight() + 5); btnSend.setWidth(100); btnSend.setPosition(message.getX() + message.getWidth(), message.getY()); btnSend.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { if (!message.getText().equals("")) { TextArea t = new TextArea("Client : " + message.getText(), skin); t.setTouchable(Touchable.disabled); chatBox.row(); chatBox.add(t).height(75).width(500); if (output != null) { output.println(t.getText()); } message.setText(""); } return false; } }); }
From source file:awakening.view.menu.WaitingRoomServer.java
License:Apache License
@Override public void show() { Gdx.input.setInputProcessor(stage);//from w ww . j ava 2 s . com ///Title title.setPosition(Gdx.app.getGraphics().getWidth() / 2 - title.getWidth() / 2, Gdx.app.getGraphics().getHeight() - 30); stage.addActor(title); ///Widgets Background widgetsBackground.setPosition(Gdx.app.getGraphics().getWidth() / 2 - widgetsBackground.getWidth() / 2, Gdx.app.getGraphics().getHeight() / 2 - widgetsBackground.getHeight() / 2); stage.addActor(widgetsBackground); ///Back Button btnBack.setWidth(100); btnBack.setPosition(Gdx.app.getGraphics().getWidth() / 2 - btnBack.getWidth() / 2, Gdx.app.getGraphics().getHeight() - widgetsBackground.getHeight() + 10); btnBack.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { effect.play(game.getSoundVolume()); th1.interrupt(); game.setScreen(new MainMenu(game, sound, effect)); return false; } }); stage.addActor(btnBack); scroll.setSize(widgetsBackground.getWidth() - ((1 / 8) * widgetsBackground.getWidth()), widgetsBackground.getHeight() - widgetsBackground.getHeight() / 2); scroll.setPosition(Gdx.app.getGraphics().getWidth() / 2 - scroll.getWidth() / 2, Gdx.app.getGraphics().getHeight() / 2 - scroll.getHeight() / 2); stage.addActor(scroll); btnSend.setWidth(100); btnSend.setPosition(btnBack.getX(), btnBack.getY() + btnBack.getHeight() + 5); btnSend.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { if (!message.getText().equals("")) { TextArea t = new TextArea("Server : " + message.getText(), skin); t.setTouchable(Touchable.disabled); chatBox.row(); chatBox.add(t).height(75).width(500); if (output != null) { output.println(t.getText()); } message.setText(""); } return false; } }); stage.addActor(btnSend); message.setPosition(btnSend.getX() - message.getWidth(), btnSend.getY()); stage.addActor(message); btnStart.setWidth(100); btnStart.setPosition(btnSend.getX() + btnSend.getWidth(), btnSend.getY()); btnStart.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { effect.play(game.getSoundVolume()); /// TODO return false; } }); stage.addActor(btnStart); th1 = new Thread(new Runnable() { @Override public void run() { try { System.out.println("Attente Serveur "); connection = serverSocket.accept(); System.out.println("Connect fdp " + connection.getPort()); input = new BufferedReader(new InputStreamReader(connection.getInputStream())); output = new PrintWriter( new BufferedWriter(new OutputStreamWriter(connection.getOutputStream())), true); while (true) { String messagePlayer = input.readLine(); if (messagePlayer != null) { TextArea t = new TextArea(messagePlayer, skin); t.setTouchable(Touchable.disabled); chatBox.row(); chatBox.add(t).height(75).width(500); } } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); th1.start(); }
From source file:com.bagon.matchteam.mtx.game.AbstractGame.java
License:Apache License
/** * BETA method (Works fine, but need lots of test) <br> * Screen to screen transition, only works for Scene2D Stage based game, * actionCurrent is applied to current stage when it is completed * (Sequence), actionNext is applied to new screens stage as intro for next * screen// w w w .j a v a2s .c om * <p> * * WARNING! Do not use dispose anywhere else for stage/screen, if dispose * true here * * @param currentScreen * the screen currently set * @param actionCurrent * Scene2D action to be applied to current screen stage * @param nextScreen * the next screen to be set * @param actionNext * Scene2D action to be applied to next screen stage * @param disposeScreen * dispose current screen after transition completed * */ public void setScreenWithTransition(final AbstractScreen currentScreen, final Action actionCurrent, final AbstractScreen nextScreen, final Action actionNext, final boolean disposeScreen) { // currentScreen.getStage().getRoot().setTouchable(Touchable.disabled); nextScreen.getStage().getRoot().setTouchable(Touchable.disabled); // previousScreenToDispose = currentScreen; if (actionCurrent != null && currentScreen != null) { currentScreen.getStage().addAction(Actions.sequence(actionCurrent, new Action() { @Override public boolean act(float delta) { if (actionNext != null) { setScreen(nextScreen); nextScreen.getStage().addAction(actionNext); nextScreen.getStage().getRoot().setTouchable(Touchable.enabled); isDisposeScreen = disposeScreen; } else { setScreen(nextScreen); nextScreen.getStage().getRoot().setTouchable(Touchable.enabled); isDisposeScreen = disposeScreen; } return true; } })); } else { if (actionNext != null) { setScreen(nextScreen); nextScreen.getStage().getRoot().setTouchable(Touchable.enabled); nextScreen.getStage().addAction(actionNext); isDisposeScreen = disposeScreen; } else { setScreen(nextScreen); nextScreen.getStage().getRoot().setTouchable(Touchable.enabled); isDisposeScreen = disposeScreen; } } }