本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.Table.addListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Table.addListener方法的具體用法?Java Table.addListener怎麽用?Java Table.addListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.scenes.scene2d.ui.Table
的用法示例。
在下文中一共展示了Table.addListener方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupRedDiceOption
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
private Table setupRedDiceOption(int diceNumber) {
Table redDiceOption = new Table();
redDiceOption.setBackground(redBackground);
redDiceOption.add(new Label("" + diceNumber, CatanGame.skin));
redDiceOption.setTouchable(Touchable.enabled);
redDiceOption.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
if (chosenRedDice == diceNumber) {
System.out.println("discard choice of " + diceNumber);
chosenRedDice = 0;
enableAllTouchablesRed();
} else {
System.out.println("choose " + diceNumber);
chosenRedDice = diceNumber;
disableAllTouchablesRed();
redDiceOption.setTouchable(Touchable.enabled);
redDiceOption.setBackground(redBackground);
}
}
});
return redDiceOption;
}
示例2: setupYellowDiceOption
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
private Table setupYellowDiceOption(int diceNumber) {
Table yellowDiceOption = new Table();
yellowDiceOption.setBackground(yellowBackground);
yellowDiceOption.add(new Label("" + diceNumber, CatanGame.skin));
yellowDiceOption.setTouchable(Touchable.enabled);
yellowDiceOption.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
if (chosenYellowDice == diceNumber) {
System.out.println("discard choice of " + diceNumber);
chosenYellowDice = 0;
enableAllTouchablesYellow();
} else {
System.out.println("choose " + diceNumber);
chosenYellowDice = diceNumber;
disableAllTouchablesYellow();
yellowDiceOption.setTouchable(Touchable.enabled);
yellowDiceOption.setBackground(yellowBackground);
}
}
});
return yellowDiceOption;
}