當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。