当前位置: 首页>>代码示例>>Java>>正文


Java TextButton.setColor方法代码示例

本文整理汇总了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);
}
 
开发者ID:antonioalmeida,项目名称:retro-reversi,代码行数:22,代码来源:MainMenuView.java

示例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);
}
 
开发者ID:antonioalmeida,项目名称:retro-reversi,代码行数:22,代码来源:MultiplayerMenuView.java

示例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);
}
 
开发者ID:antonioalmeida,项目名称:retro-reversi,代码行数:19,代码来源:DifficultyMenuView.java

示例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();
   }
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:14,代码来源:BaseGUI.java

示例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());
}
 
开发者ID:antonioalmeida,项目名称:retro-reversi,代码行数:15,代码来源:GameStage.java

示例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);
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:57,代码来源:ChoosePlayerWindow.java

示例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);
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:57,代码来源:playerProgressWindow.java

示例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);
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:51,代码来源:ChooseProgressCardKindWindow.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.TextButton.setColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。