Browse Source

Merge branch 'master' of http://zhi-edu.com:3000/lan/zedu_client

Administrator 3 years ago
parent
commit
2ee4f69801

+ 1 - 1
assets/scene/Editor.fire

@@ -174,7 +174,7 @@
       "array": [
         0,
         0,
-        513.5424503348706,
+        525.2308757483279,
         0,
         0,
         0,

+ 21 - 17
assets/script/rule/GuideRule.ts

@@ -405,7 +405,7 @@ export default class GuideRule extends cc.Component {
         }
         return audios
     }
-    playAni() {
+    playAni(noDelay: boolean = false) {
         if (this.playState == PLAY_STATE.start) {
             this.playState = PLAY_STATE.playing
             let aniEnd = this.dataJson.ani == ''
@@ -434,7 +434,7 @@ export default class GuideRule extends cc.Component {
                 let allActionTweenIndex = 0
                 for (let customAction of action.actions) {
                     let actionTween = t()
-                        .delay(customAction.startDelay)
+                        .delay(noDelay ? 0 : customAction.startDelay)
                         .call(() => {
                             for (let audio of customAction.audios) {
                                 if (audio.audioName) {
@@ -543,23 +543,24 @@ export default class GuideRule extends cc.Component {
                             }
                         })
                     } else if (customAction.actionType == ACT_TYPE.shake) {
+                        let shakeTime = 0.05
                         actionTween.then(
                             t().repeat(
-                                Math.ceil(customAction.runTime / 0.5),
+                                Math.ceil((customAction.runTime / shakeTime) * 10),
                                 t()
-                                    .by(0.05, {x: 5, y: 7})
-                                    .by(0.05, {x: -6, y: -7})
-                                    .by(0.05, {x: 6, y: 3})
-                                    .by(0.05, {x: 3, y: -5})
-                                    .by(0.05, {x: -5, y: 5})
-                                    .by(0.05, {x: 2, y: -3})
-                                    .by(0.05, {x: -8, y: -10})
-                                    .by(0.05, {x: 3, y: 10})
-                                    .by(0.05, {x: 0, y: 0}),
+                                    .by(shakeTime, {x: 5, y: 7})
+                                    .by(shakeTime, {x: -6, y: -7})
+                                    .by(shakeTime, {x: 6, y: 3})
+                                    .by(shakeTime, {x: 3, y: -5})
+                                    .by(shakeTime, {x: -5, y: 5})
+                                    .by(shakeTime, {x: 2, y: -3})
+                                    .by(shakeTime, {x: -8, y: -10})
+                                    .by(shakeTime, {x: 3, y: 10})
+                                    .by(shakeTime, {x: 0, y: 0}),
                             ),
                         )
                     }
-                    actionTween.delay(customAction.endDelay)
+                    actionTween.delay(noDelay ? 0 : customAction.endDelay)
                     if (lastSequence != customAction.isSequence) {
                         lastSequence = customAction.isSequence
                         allActionTweenIndex += 1
@@ -583,13 +584,13 @@ export default class GuideRule extends cc.Component {
                         manyActionTween.parallel(manyActionTweenArr.tween[0], ...manyActionTweenArr.tween.splice(1))
                     }
                 }
-                let unionTween = t().delay(action.startDelay)
+                let unionTween = t().delay(noDelay ? 0 : action.startDelay)
                 if (action.repeat > 0) {
                     unionTween.repeat(action.repeat, manyActionTween)
                 } else {
                     unionTween.then(manyActionTween)
                 }
-                unionTween.delay(action.endDelay)
+                unionTween.delay(noDelay ? 0 : action.endDelay)
                 if (lastUnionSequence != action.isSequence) {
                     lastUnionSequence = action.isSequence
                     allUnionActionIndex += 1
@@ -599,7 +600,7 @@ export default class GuideRule extends cc.Component {
                 }
                 allUnionActionArr[allUnionActionIndex].tween.push(unionTween)
             }
-            let allUnionAction = t().delay(this.dataJson.actionTagDelayTime)
+            let allUnionAction = t().delay(noDelay ? 0 : this.dataJson.actionTagDelayTime)
             for (let manyUnionAction of allUnionActionArr) {
                 if (manyUnionAction.lastUnionSequence || manyUnionAction.tween.length <= 1) {
                     for (let tempAction of manyUnionAction.tween) {
@@ -659,7 +660,10 @@ export default class GuideRule extends cc.Component {
     editorPlayAudio(url) {
         if (!CC_EDITOR) return
         ccUtils.editorLoadSync(PathUtils.addSGP(url + '.mp3', GAME_SEME_TYPE[this.guideUI.gameType], 1)).then(clip => {
-            cc.audioEngine.playEffect(clip, false)
+            let id = cc.audioEngine.playEffect(clip, false)
+            cc.audioEngine.setFinishCallback(id, () => {
+                cc.audioEngine.uncache(clip)
+            })
         })
     }
 }

+ 6 - 0
assets/script/ui/Editor.ts

@@ -473,6 +473,12 @@ export default class Editor extends cc.Component {
         let guideUI = this.getGameNode().getComponent(GuideUI)
         guideUI.playGuide()
     }
+    playNodeGuide(nodeIndex: number) {
+        cc['engine']._animatingInEditMode = 1
+        cc['engine'].animatingInEditMode = 1
+        let guideUI = this.getGameNode().getComponent(GuideUI)
+        guideUI.playNodeGuide()
+    }
     pauseGuide() {
         let guideUI = this.getGameNode().getComponent(GuideUI)
         guideUI.pauseGuide()

+ 8 - 0
assets/script/ui/public/GuideUI.ts

@@ -200,6 +200,14 @@ export class GuideUI extends BaseUI {
         }
         this.initPlayBtn(true)
     }
+    playNodeGuide() {
+        if (!this.canPlay) return
+        if (!CC_EDITOR) return
+        let node = cc['engine'].getInstanceById(Editor.Selection.curSelection('node'))
+        for (let guideRule of this.curPageRules) {
+            if (guideRule.node == node) guideRule.playAni(true)
+        }
+    }
     pauseGuide() {
         for (let guideRule of this.curPageRules) {
             guideRule.pauseAni()

+ 6 - 0
packages/CCSceneMenu/panel/editGame.js

@@ -166,6 +166,7 @@ Editor.Panel.extend({
         <ui-button id="play" @confirm="onPlayGuide" class="red">播放引导</ui-button>
         <ui-button id="pause" @confirm="onPauseGuide" class="blue">暂停引导</ui-button>
         <ui-button id="reset" @confirm="onResetGuide" class="green">重置引导</ui-button>
+        <ui-button id="nodePlay" @confirm="onPlayNodeGuide" class="red">单独播放</ui-button>
       </div>
     </div>
   `,
@@ -277,6 +278,11 @@ Editor.Panel.extend({
                             if (err) Editor.error(err);
                         }, 20000);
                     },
+                    onPlayNodeGuide(e) {
+                        Editor.Scene.callSceneScript('cc-ext-scene-menu', 'playNodeGuide', _config, (err) => {
+                            if (err) Editor.error(err);
+                        }, 20000);
+                    },
                 }
             });
         };

+ 6 - 0
packages/CCSceneMenu/scene-accessor.ts

@@ -361,6 +361,12 @@ module.exports = {
         let editor = canvas.getComponent('Editor')
         editor.playGuide()
     },
+    'playNodeGuide': function (event, config) {
+        let {canvas, param} = isEditor(event, config)
+        if (!canvas) return
+        let editor = canvas.getComponent('Editor')
+        editor.playNodeGuide()
+    },
     'pauseGuide': function (event, config) {
         let {canvas, param} = isEditor(event, config)
         if (!canvas) return