本文整理汇总了Java中com.almasb.fxgl.input.ActionType类的典型用法代码示例。如果您正苦于以下问题:Java ActionType类的具体用法?Java ActionType怎么用?Java ActionType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActionType类属于com.almasb.fxgl.input包,在下文中一共展示了ActionType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: second
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Test", type = ActionType.ON_ACTION_BEGIN)
public void second() {
//getAudioPlayer().stopAllMusic();
getAudioPlayer().pauseMusic(music);
getMasterTimer().runOnceAfter(() -> {
getAudioPlayer().resumeMusic(music);
}, Duration.seconds(2));
// getAudioPlayer().pauseAllMusic();
//
// getMasterTimer().runOnceAfter(() -> {
// getAudioPlayer().resumeAllMusic();
// }, Duration.seconds(3));
// getMasterTimer().runOnceAfter(() -> {
// getAudioPlayer().stopAllMusic();
// }, Duration.seconds(3));
}
示例2: up
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Up", type = ActionType.ON_ACTION)
public void up() {
if (mode == GameMode.MP_CLIENT) {
getNet().getConnection().ifPresent(conn -> {
conn.send(new ClientMessage(true, false, false));
});
} else {
playerBat.up();
}
}
示例3: down
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Down", type = ActionType.ON_ACTION)
public void down() {
if (mode == GameMode.MP_CLIENT) {
getNet().getConnection().ifPresent(conn -> {
conn.send(new ClientMessage(false, true, false));
});
} else {
playerBat.down();
}
}
示例4: stopBat
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Up", type = ActionType.ON_ACTION_END)
public void stopBat() {
if (mode == GameMode.MP_CLIENT) {
getNet().getConnection().ifPresent(conn -> {
conn.send(new ClientMessage(false, false, true));
});
} else {
playerBat.stop();
}
}
示例5: stopBat2
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Down", type = ActionType.ON_ACTION_END)
public void stopBat2() {
if (mode == GameMode.MP_CLIENT) {
getNet().getConnection().ifPresent(conn -> {
conn.send(new ClientMessage(false, false, true));
});
} else {
playerBat.stop();
}
}
示例6: openWindow
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Open", type = ActionType.ON_ACTION_BEGIN)
public void openWindow() {
// 1. create in-game window
InGameWindow window = new InGameWindow("Window Title");
// 2. set properties
window.setPrefSize(300, 200);
window.setPosition(400, 300);
window.setBackgroundColor(Color.BLACK);
// 3. attach to game scene as UI node
getGameScene().addUINode(window);
}
示例7: first
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Open", type = ActionType.ON_ACTION_BEGIN)
public void first() {
music = getAssetLoader().loadMusic("intro.mp3");
music.setCycleCount(2);
getAudioPlayer().playMusic(music);
}
示例8: openWindow
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Open", type = ActionType.ON_ACTION_BEGIN)
public void openWindow() {
// 1. create in-game window
InGameWindow window = new InGameWindow("FXGL Window");
// 2. set properties
window.setPrefSize(300, 200);
window.setPosition(400, 300);
window.setBackgroundColor(Color.BLACK);
gameScene.addUINode(window);
}
示例9: showNotification
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Show Notification", type = ActionType.ON_ACTION_BEGIN)
public void showNotification() {
// 1. get notification service and push a message
getNotificationService().pushNotification("Some Message! Tick: " + getTick());
}
示例10: shoot
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Shoot", type = ActionType.ON_ACTION_BEGIN)
public void shoot() {
playerControl.shoot(getInput().getVectorToMouse(player.getPositionComponent().getValue()));
}
示例11: printLineBegin
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Print Line", type = ActionType.ON_ACTION_BEGIN)
public void printLineBegin() {
System.out.println("Action Begin");
}
示例12: printLine
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Print Line", type = ActionType.ON_ACTION)
public void printLine() {
System.out.println("On Action");
}
示例13: printLineEnd
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Print Line", type = ActionType.ON_ACTION_END)
public void printLineEnd() {
System.out.println("Action End");
}
示例14: moveLeft
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Move Left", type = ActionType.ON_ACTION)
public void moveLeft() {
playerPosition.translate(-5, 0);
}
示例15: moveRight
import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Move Right", type = ActionType.ON_ACTION)
public void moveRight() {
playerPosition.translate(5, 0);
}