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


Java ActionType类代码示例

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

示例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();
    }
}
 
开发者ID:AlmasB,项目名称:FXGLGames,代码行数:11,代码来源:PongApp.java

示例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();
    }
}
 
开发者ID:AlmasB,项目名称:FXGLGames,代码行数:11,代码来源:PongApp.java

示例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();
    }
}
 
开发者ID:AlmasB,项目名称:FXGLGames,代码行数:11,代码来源:PongApp.java

示例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();
    }
}
 
开发者ID:AlmasB,项目名称:FXGLGames,代码行数:11,代码来源:PongApp.java

示例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);
}
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:14,代码来源:InGameWindowSample.java

示例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);
}
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:8,代码来源:AudioPlayerTest.java

示例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);
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:13,代码来源:MainScene.java

示例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());
}
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:6,代码来源:NotificationSample.java

示例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()));
}
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:5,代码来源:FXShooterApp.java

示例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");
}
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:5,代码来源:InputSample2.java

示例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");
}
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:5,代码来源:InputSample2.java

示例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");
}
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:5,代码来源:InputSample2.java

示例14: moveLeft

import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Move Left", type = ActionType.ON_ACTION)
public void moveLeft() {
    playerPosition.translate(-5, 0);
}
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:5,代码来源:ViewportTest.java

示例15: moveRight

import com.almasb.fxgl.input.ActionType; //导入依赖的package包/类
@OnUserAction(name = "Move Right", type = ActionType.ON_ACTION)
public void moveRight() {
    playerPosition.translate(5, 0);
}
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:5,代码来源:ViewportTest.java


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