cocos 애니메이션 첫 번째 프레임으로 중지

1541 단어 cocos
    showResultPanel: function () {
        var self = this;
        var resultNode = self.panel_Win;
        if (this._gameResult.isWin) {
            cc.gg.audioMgr.playSFX("niuniu/putong/win");
            resultNode = self.panel_Win;
        } else {
            cc.gg.audioMgr.playSFX("niuniu/putong/lost");
            resultNode = self.Panel_Lose;
        }
        var anim = resultNode.getComponent(cc.Animation);
        anim.once('finished', this.resultAnimationPlayFinished, this);
        var animState = anim.play(null, 0);
        animState.wrapMode = cc.WrapMode.Normal;
        this._resultNode.active = true;
        this._resultNode.opacity = 255;
    },
    /* 
     *  
     */
    showResultAnimationPlayFinished: function (eventType, animationState) {
        this.scheduleOnce(this.hideResultAnimationPlayFinished, 0.5);
        this.playLostPlayerFlyGold();
    },
    /* 
     *  , 
     */
    hideResultAnimationPlayFinished: function (eventType, animationState) {
        // var anim = this._resultNode.getComponent(cc.Animation);
        // anim.once('finished', this.hideResultPanel, this);
        // var animState = anim.play();
        // animState.wrapMode = cc.WrapMode.Reverse;
        this._resultNode.runAction(cc.sequence(cc.fadeOut(0.5), cc.callFunc(function (target) {
            var anim = target.getComponent(cc.Animation);
            anim.play(null, 0);
            anim.sample();
            anim.stop();
        }, this)));
    },

좋은 웹페이지 즐겨찾기