JoustToken.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:metastone 作者:
public JoustToken(GameBoardView boardView, Card card, boolean up, boolean won) {
    Window parent = boardView.getScene().getWindow();
    this.cardToken = new CardTooltip();

    popup = new Popup();
    popup.getContent().setAll(cardToken);
    popup.setX(parent.getX() + 600);
    popup.show(parent);
    int offsetY = up ? -200 : 100;
    popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5 + offsetY);

    cardToken.setCard(card);

    NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
    FadeTransition animation = new FadeTransition(Duration.seconds(1.0), cardToken);
    animation.setDelay(Duration.seconds(1f));
    animation.setOnFinished(this::onComplete);
    animation.setFromValue(1);
    animation.setToValue(0);
    animation.play();

    if (won) {
        ScaleTransition scaleAnimation = new ScaleTransition(Duration.seconds(0.5f), cardToken);
        scaleAnimation.setByX(0.1);
        scaleAnimation.setByY(0.1);
        scaleAnimation.setCycleCount(2);
        scaleAnimation.setAutoReverse(true);
        scaleAnimation.play();  
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号