本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.TextButton.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java TextButton.setColor方法的具体用法?Java TextButton.setColor怎么用?Java TextButton.setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.TextButton
的用法示例。
在下文中一共展示了TextButton.setColor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addButtons
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
private void addButtons() {
buttonTable = new Table();
buttonTable.bottom();
buttonTable.setFillParent(true);
singlePlayer = new TextButton("\n Single Player \n", game.getSkin());
multiPlayer = new TextButton("\n Multi Player \n", game.getSkin());
achievements = new TextButton("\n Achievements \n", game.getSkin());
sign = new TextButton(game.getPlayServices().isSignedIn() ? " Sign Out " : " Sign In ", game.getSkin());
sign.setColor(game.SECONDARY_COLOR);
buttonTable.add(singlePlayer).center().padBottom(40);
buttonTable.row();
buttonTable.add(multiPlayer).center().padBottom(40);
buttonTable.row();
buttonTable.add(achievements).center().padBottom(40);
buttonTable.row();
buttonTable.add(sign).center().padBottom(40);
stage.addActor(buttonTable);
}
示例2: addOptionsButtons
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
private void addOptionsButtons() {
buttonTable = new Table();
buttonTable.bottom();
buttonTable.setFillParent(true);
localGameButton = new TextButton("\n Local \n", game.getSkin());
onlineGameButton = new TextButton("\n Online \n", game.getSkin());
checkGamesButton = new TextButton("\n Check Games \n", game.getSkin());
backButton = new TextButton("Back", game.getSkin());
buttonTable.add(localGameButton).center().padBottom(40);
buttonTable.row();
buttonTable.add(onlineGameButton).center().padBottom(40);
buttonTable.row();
buttonTable.add(checkGamesButton).center().padBottom(40);
buttonTable.row();
buttonTable.add(backButton).center().padBottom(40);
backButton.setColor(Reversi.SECONDARY_COLOR);
stage.addActor(buttonTable);
}
示例3: addChoiceButtons
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
private void addChoiceButtons() {
randomAIButton = new TextButton("\n Easy \n", game.getSkin());
immediateAIButton = new TextButton("\n Medium \n", game.getSkin());
calculatedAIButton = new TextButton("\n Hard \n", game.getSkin());
backButton = new TextButton(" Back ", game.getSkin());
backButton.setTransform(true);
backButton.setColor(Reversi.SECONDARY_COLOR);
buttonTable.add(randomAIButton).center().padBottom(40);
buttonTable.row();
buttonTable.add(immediateAIButton).center().padBottom(40);
buttonTable.row();
buttonTable.add(calculatedAIButton).center().padBottom(40);
buttonTable.row();
buttonTable.add(backButton).center().padBottom(40);
stage.addActor(buttonTable);
}
示例4: checkUI
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
public void checkUI(TextButton ui, String text, int gold){
if(player.gold >= gold)
{
ui.setColor(defaultColor);
ui.setText(text + " ($" + gold + ")");
}
else
{
ui.setColor(Color.RED);
ui.setText(text + " ($" + gold + ") - Not enough $");
}
pack();
}
示例5: initElements
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
protected void initElements() {
blackIcon = new Image(game.getAssetManager().get("black.png", Texture.class));
whiteIcon = new Image(game.getAssetManager().get("white.png", Texture.class));
paddle1 = new Image(game.getAssetManager().get("paddle.png", Texture.class));
paddle2 = new Image(game.getAssetManager().get("paddle.png", Texture.class));
score1 = new Label("02", game.getSkin());
score2 = new Label("02", game.getSkin());
board = new BoardView(presenter);
back = new TextButton("Back", game.getSkin());
back.setColor(Reversi.SECONDARY_COLOR);
restart = new TextButton(" Restart ", game.getSkin());
mainMenu = new TextButton(" Main Menu", game.getSkin());
winner = new Label("", game.getSkin());
}
示例6: ChoosePlayerWindow
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
public ChoosePlayerWindow(String title, Skin skin, ArrayList<Player> opponents) {
super(title, skin);
// create content table for buttons
final Table buttonTable = new Table(skin);
// set width and height
width = opponents.size() * 100 + (opponents.size() + 1) * 10;
height = 1f / 5f * Gdx.graphics.getHeight();
setWidth(width);
setHeight(height);
// create button with listener for each opponent player
for (Player opponent : opponents) {
TextButton playerButton = new TextButton(opponent.getAccount().getUsername(), skin);
switch (opponent.getColor()) {
case BLUE:
playerButton.setColor(Color.BLUE);
break;
case ORANGE:
playerButton.setColor(Color.ORANGE);
break;
case RED:
playerButton.setColor(Color.RED);
break;
case WHITE:
playerButton.setColor(Color.WHITE);
break;
case YELLOW:
playerButton.setColor(Color.YELLOW);
break;
default:
break;
}
playerButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (choosePlayerListener != null) {
choosePlayerListener.onPlayerChoosed(opponent);
remove();
}
}
});
buttonTable.add(playerButton).padLeft(5).padRight(5).padTop(10).padBottom(10).size(90, height - 40);
}
add(buttonTable);
// set position on screen
setPosition(Gdx.graphics.getWidth() / 2 - getWidth() / 2, Gdx.graphics.getHeight() / 2 - getHeight() / 2);
// enable moving the window
setMovable(true);
}
示例7: playerProgressWindow
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
public playerProgressWindow(String title, Skin skin, ArrayList<Player> opponents) {
super(title, skin);
// create content table for buttons
final Table buttonTable = new Table(skin);
// set width and height
width = opponents.size() * 100 + (opponents.size() + 1) * 10;
height = 1f / 5f * Gdx.graphics.getHeight();
setWidth(width);
setHeight(height);
// create button with listener for each opponent player
for (Player opponent : opponents) {
TextButton playerButton = new TextButton(opponent.getAccount().getUsername(), skin);
switch (opponent.getColor()) {
case BLUE:
playerButton.setColor(Color.BLUE);
break;
case ORANGE:
playerButton.setColor(Color.ORANGE);
break;
case RED:
playerButton.setColor(Color.RED);
break;
case WHITE:
playerButton.setColor(Color.WHITE);
break;
case YELLOW:
playerButton.setColor(Color.YELLOW);
break;
default:
break;
}
playerButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (choosePlayerListener != null) {
choosePlayerListener.onPlayerChoosed(opponent);
remove();
}
}
});
buttonTable.add(playerButton).padLeft(5).padRight(5).padTop(10).padBottom(10).size(90, height - 40);
}
add(buttonTable);
// set position on screen
setPosition(Gdx.graphics.getWidth() / 2 - getWidth() / 2, Gdx.graphics.getHeight() / 2 - getHeight() / 2);
// enable moving the window
setMovable(true);
}
示例8: ChooseProgressCardKindWindow
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
public ChooseProgressCardKindWindow(String title, List<ProgressCardKind> kindsToChooseFrom, Skin skin) {
super(title, skin);
// create content table for buttons
final Table buttonTable = new Table(skin);
// set width and height
width = 330;
height = 1f / 5f * Gdx.graphics.getHeight();
setWidth(width);
setHeight(height);
// create button with listener for each kind
for (ProgressCardKind kind : kindsToChooseFrom) {
TextButton kindButton = new TextButton(kind.toString().toLowerCase(), skin);
switch (kind) {
case POLITICS:
kindButton.setColor(Color.BLUE);
break;
case SCIENCE:
kindButton.setColor(Color.GREEN);
break;
case TRADE:
kindButton.setColor(Color.ORANGE);
break;
default:
break;
}
kindButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (chooseKindListener != null) {
chooseKindListener.onKindChosen(kind);
remove();
}
}
});
buttonTable.add(kindButton).padLeft(5).padRight(5).padTop(10).padBottom(10).size(90, height - 40);
}
add(buttonTable);
// set position on screen
setPosition(Gdx.graphics.getWidth() / 2 - getWidth() / 2, Gdx.graphics.getHeight() / 2 - getHeight() / 2);
// enable moving the window
setMovable(true);
}