Browse Source

【更新】:
1.添加场景背景图,遮挡加载时的黑屏;
2.去掉弹窗,token验证失败,返回课程详情页;
3.添加倒计时用到的音效;
4.添加挑战开始页面的按钮音效;
5.添加挑战完成页面星星音效;
6.添加小手提示用到的音效;
7.优化视频页,处理加载过程的黑屏;
8.优化音频回调脚本;
9.修改加载资源函数(加载resources内音频使用);
10.优化开屏loading显示,保留图片与浏览器显示比例,强制横屏显示;
11.添加音效资源;

youhaitao 2 years ago
parent
commit
f594a9fac6
58 changed files with 488 additions and 143 deletions
  1. 116 19
      assets/main/SceneMain.fire
  2. 25 20
      assets/main/SceneMain.ts
  3. 3 2
      assets/res/downCount/src/DownCount.ts
  4. 5 5
      assets/res/luojigouFinish/res/prefab/luojigouFinish.prefab
  5. 5 5
      assets/res/luojigouFinish/src/LuojigouFinish.ts
  6. 1 1
      assets/res/luojigouStart/res/prefab/luojigouStart.prefab
  7. 8 5
      assets/res/luojigouStart/src/LuojigouStart.ts
  8. 4 0
      assets/res/tipHand/src/TipHand.ts
  9. 0 12
      assets/res/tipHand/描述文本.md
  10. 0 6
      assets/res/tipHand/描述文本.md.meta
  11. 46 30
      assets/res/videoPlayer/src/VideoPlayer.ts
  12. 13 0
      assets/resources/audio.meta
  13. BIN
      assets/resources/audio/button_touch.mp3
  14. 8 0
      assets/resources/audio/button_touch.mp3.meta
  15. BIN
      assets/resources/audio/clock.mp3
  16. 8 0
      assets/resources/audio/clock.mp3.meta
  17. BIN
      assets/resources/audio/error_good_0.mp3
  18. 8 0
      assets/resources/audio/error_good_0.mp3.meta
  19. BIN
      assets/resources/audio/error_good_1.mp3
  20. 8 0
      assets/resources/audio/error_good_1.mp3.meta
  21. BIN
      assets/resources/audio/error_touch.mp3
  22. 8 0
      assets/resources/audio/error_touch.mp3.meta
  23. BIN
      assets/resources/audio/good_move.mp3
  24. 8 0
      assets/resources/audio/good_move.mp3.meta
  25. BIN
      assets/resources/audio/good_touch.mp3
  26. 8 0
      assets/resources/audio/good_touch.mp3.meta
  27. BIN
      assets/resources/audio/handTip.mp3
  28. 8 0
      assets/resources/audio/handTip.mp3.meta
  29. BIN
      assets/resources/audio/particle_0.mp3
  30. 8 0
      assets/resources/audio/particle_0.mp3.meta
  31. BIN
      assets/resources/audio/particle_1.mp3
  32. 8 0
      assets/resources/audio/particle_1.mp3.meta
  33. BIN
      assets/resources/audio/right_0.mp3
  34. 8 0
      assets/resources/audio/right_0.mp3.meta
  35. BIN
      assets/resources/audio/right_1.mp3
  36. 8 0
      assets/resources/audio/right_1.mp3.meta
  37. BIN
      assets/resources/audio/right_2.mp3
  38. 8 0
      assets/resources/audio/right_2.mp3.meta
  39. BIN
      assets/resources/audio/right_3.mp3
  40. 8 0
      assets/resources/audio/right_3.mp3.meta
  41. BIN
      assets/resources/audio/star_1.mp3
  42. 8 0
      assets/resources/audio/star_1.mp3.meta
  43. BIN
      assets/resources/audio/star_2.mp3
  44. 8 0
      assets/resources/audio/star_2.mp3.meta
  45. BIN
      assets/resources/audio/star_3.mp3
  46. 8 0
      assets/resources/audio/star_3.mp3.meta
  47. BIN
      assets/resources/audio/star_hide.mp3
  48. 8 0
      assets/resources/audio/star_hide.mp3.meta
  49. 20 0
      assets/resources/configAudio.json
  50. 6 0
      assets/resources/configAudio.json.meta
  51. 15 21
      assets/src/audioUitls/AudioCB.ts
  52. 42 0
      assets/src/audioUitls/AudioManager.ts
  53. 10 0
      assets/src/audioUitls/AudioManager.ts.meta
  54. 4 5
      assets/src/common/Tools.ts
  55. 3 1
      assets/src/common/common.ts
  56. 3 2
      assets/src/config/Loader.ts
  57. 14 8
      build-templates/web-mobile/index.html
  58. 1 1
      settings/project.json

+ 116 - 19
assets/main/SceneMain.fire

@@ -73,18 +73,21 @@
       },
       {
         "__id__": 5
+      },
+      {
+        "__id__": 7
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 12
+        "__id__": 14
       },
       {
-        "__id__": 13
+        "__id__": 15
       },
       {
-        "__id__": 14
+        "__id__": 16
       }
     ],
     "_prefab": null,
@@ -137,7 +140,7 @@
   },
   {
     "__type__": "cc.Node",
-    "_name": "Main Camera",
+    "_name": "bg",
     "_objFlags": 0,
     "_parent": {
       "__id__": 2
@@ -160,8 +163,102 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 0,
-      "height": 0
+      "width": 2480,
+      "height": 1440
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "6fzT7uVktEdYAS59qVBov/"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 3
+    },
+    "_enabled": true,
+    "_materials": [
+      {
+        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
+      }
+    ],
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_spriteFrame": {
+      "__uuid__": "7d07c1e2-73b5-410d-998f-dbe6f1cc8026"
+    },
+    "_type": 0,
+    "_sizeMode": 1,
+    "_fillType": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_atlas": null,
+    "_id": "c3HBEHJz9MNqvFbgEm4Cp+"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Main Camera",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 6
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 1920,
+      "height": 1080
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -202,7 +299,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 3
+      "__id__": 5
     },
     "_enabled": true,
     "_cullingMask": 4294967295,
@@ -242,19 +339,19 @@
     },
     "_children": [
       {
-        "__id__": 6
+        "__id__": 8
       }
     ],
     "_active": false,
     "_components": [
       {
-        "__id__": 8
+        "__id__": 10
       },
       {
-        "__id__": 9
+        "__id__": 11
       },
       {
-        "__id__": 10
+        "__id__": 12
       }
     ],
     "_prefab": null,
@@ -310,13 +407,13 @@
     "_name": "label",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 5
+      "__id__": 7
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 7
+        "__id__": 9
       }
     ],
     "_prefab": null,
@@ -372,7 +469,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 6
+      "__id__": 8
     },
     "_enabled": true,
     "_materials": [
@@ -405,7 +502,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 5
+      "__id__": 7
     },
     "_enabled": true,
     "_materials": [
@@ -437,7 +534,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 5
+      "__id__": 7
     },
     "_enabled": true,
     "alignMode": 1,
@@ -464,7 +561,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 5
+      "__id__": 7
     },
     "_enabled": true,
     "_normalMaterial": null,
@@ -473,7 +570,7 @@
     "zoomScale": 1.2,
     "clickEvents": [
       {
-        "__id__": 11
+        "__id__": 13
       }
     ],
     "_N$interactable": true,
@@ -582,7 +679,7 @@
       "__uuid__": "cd07e761-75fb-4f91-be77-c08f86d00457"
     },
     "btnNext": {
-      "__id__": 5
+      "__id__": 7
     },
     "_id": "80oQpM9U1KTIx7FH0iSB/b"
   },

+ 25 - 20
assets/main/SceneMain.ts

@@ -9,7 +9,7 @@ import GameFinish, { PropsFinish } from "../res/luojigouFinish/src/LuojigouFinis
 import AudioCB from "../src/audioUitls/AudioCB";
 import Tools from "../src/common/Tools";
 import PopupManager, { PopupCacheMode } from "../src/popUp/PopupManager";
-import { HttpStateMap } from "../res/http/HttpStateMap";
+import AudioManager from "../src/audioUitls/AudioManager";
 
 const { ccclass, property } = cc._decorator;
 @ccclass
@@ -65,15 +65,16 @@ export default class Scene extends cc.Component {
             this.enterGame();
         }
         else {
-            const options = {
-                title: '',
-                content: '请下载应用!'
-            };
-            const params = {
-                mode: PopupCacheMode.Once,
-            };
-            let prefab = await PopupManager.load('prefab/popUp');
-            PopupManager.show(cc.instantiate(prefab), options, params);
+            // const options = {
+            //     title: '',
+            //     content: '请下载应用!'
+            // };
+            // const params = {
+            //     mode: PopupCacheMode.Once,
+            // };
+            // let prefab = await PopupManager.load('prefab/popUp');
+            // PopupManager.show(cc.instantiate(prefab), options, params);
+            window.location.href = common.urlClass;
         }
         return;
     }
@@ -109,7 +110,8 @@ export default class Scene extends cc.Component {
         common.setItemId(json.itemId);
         let isHas = await this.initData(unitNum);
         if (isHas) {
-            await AudioCB.instance.init();
+            await AudioCB.getInstance().init();
+            await AudioManager.getInstance().loadAudios();
             this.initUI();
 
             common.log("场景加载完成,等待进入游戏层");
@@ -121,15 +123,16 @@ export default class Scene extends cc.Component {
             }
         }
         else {
-            const options = {
-                title: '',
-                content: '当前动画游戏不存在!',
-            };
-            const params = {
-                mode: PopupCacheMode.Once,
-            };
-            let prefab = await PopupManager.load('prefab/popUp');
-            PopupManager.show(cc.instantiate(prefab), options, params);
+            // const options = {
+            //     title: '',
+            //     content: '当前动画游戏不存在!',
+            // };
+            // const params = {
+            //     mode: PopupCacheMode.Once,
+            // };
+            // let prefab = await PopupManager.load('prefab/popUp');
+            // PopupManager.show(cc.instantiate(prefab), options, params);
+            window.location.href = common.urlClass;
         }
     };
 
@@ -211,6 +214,7 @@ export default class Scene extends cc.Component {
             script.initBundle(bundle, config);
         }
         this.node.addChild(this.nodeShow, CConst.ZORDER_GAME);
+        this.node.getChildByName('bg').active = true;
         this.resetBtnNext(true);
     }
 
@@ -223,6 +227,7 @@ export default class Scene extends cc.Component {
             script.initBundle(bundle, config);
         }
         this.nodeVideo.active = true;
+        this.node.getChildByName('bg').active = false;
         this.resetBtnNext(true);
     }
 

+ 3 - 2
assets/res/downCount/src/DownCount.ts

@@ -1,3 +1,4 @@
+import AudioManager from "../../../src/audioUitls/AudioManager";
 import Tools from "../../../src/common/Tools";
 
 const { ccclass, property } = cc._decorator;
@@ -54,6 +55,7 @@ export default class DownCount extends cc.Component {
 
     /** 倒计时-启动 */
     downCountLunch(): void {
+        AudioManager.getInstance().playEffect('audio/clock');
         const progressBar = this.nodeProgress.getComponent(cc.ProgressBar);
         this.schedule(() => {
             this.timeCount += this.timeDelay;
@@ -66,6 +68,7 @@ export default class DownCount extends cc.Component {
                     if (icon.active) {
                         icon.active = false;
                         item.getChildByName('gray').active = true;
+                        AudioManager.getInstance().playEffect('audio/star_hide');
                     }
                 }
             });
@@ -81,10 +84,8 @@ export default class DownCount extends cc.Component {
     }
 
     errorAdd(){
-        this.downCountStop();
         this.errorCount++;
         this.timeCount += 20;
-        this.downCountLunch();
     }
 
     /** 获取题卡获得的星星 用在过关后的弹窗 */

+ 5 - 5
assets/res/luojigouFinish/res/prefab/luojigouFinish.prefab

@@ -854,11 +854,11 @@
       }
     ],
     "paused": false,
-    "defaultSkin": "",
-    "defaultAnimation": "",
+    "defaultSkin": "2-star",
+    "defaultAnimation": "success1",
     "_preCacheMode": 0,
     "_cacheMode": 0,
-    "loop": false,
+    "loop": true,
     "premultipliedAlpha": true,
     "timeScale": 1,
     "_accTime": 0,
@@ -866,10 +866,10 @@
     "_frameCache": null,
     "_curFrame": null,
     "_skeletonCache": null,
-    "_animationName": "success2",
+    "_animationName": "success1",
     "_animationQueue": [],
     "_headAniInfo": null,
-    "_playTimes": 1,
+    "_playTimes": 0,
     "_isAniComplete": true,
     "_N$skeletonData": {
       "__uuid__": "8066bf5b-32e6-41e2-8446-0f2916cb191b"

+ 5 - 5
assets/res/luojigouFinish/src/LuojigouFinish.ts

@@ -2,6 +2,7 @@ import Tools from "../../../src/common/Tools";
 import CConst from "../../../src/common/CConst";
 import NotifierCenter from "../../../src/webtcp/NotifierCenter";
 import common from "../../../src/common/common";
+import AudioManager from "../../../src/audioUitls/AudioManager";
 
 const EStarSkineMap = new Map([
     [1, '1-Star'],
@@ -26,11 +27,6 @@ export default class LuojigouFinish extends cc.Component {
     @property({ tooltip: '弹窗中的spine', type: sp.Skeleton })
     SuccessSpine: sp.Skeleton = null;
 
-    protected onDisable(): void {
-        this.unscheduleAllCallbacks();
-        Tools.stopEffects();
-    }
-
     /**
      * @description 设置成功弹窗的动画
      * @description 星星数
@@ -40,8 +36,10 @@ export default class LuojigouFinish extends cc.Component {
         this.node.active = true;
         const spine = this.SuccessSpine;
         spine.setSkin(EStarSkineMap.get(props.star));
+        spine.timeScale = 0.8;
         spine.setAnimation(0, ESuccessAni.success1, false);
         spine.addAnimation(0, ESuccessAni.success2, true);
+        AudioManager.getInstance().playEffect('audio/star_' + props.star);
 
         if (props.audios && props.audios.length > 0) {
             Tools.playEffectArr(props.audios, this.closeLJGCard.bind(this));
@@ -55,7 +53,9 @@ export default class LuojigouFinish extends cc.Component {
        * @description 关闭逻辑狗弹窗
        */
     closeLJGCard() {
+        Tools.stopEffects();
         this.node.active = false;
+        this.unscheduleAllCallbacks();
         NotifierCenter.trigger(CConst.EVENT_ENTER_GAME);
     }
 }

+ 1 - 1
assets/res/luojigouStart/res/prefab/luojigouStart.prefab

@@ -1528,7 +1528,7 @@
     },
     "component": "",
     "_componentId": "dceb764dL1JiYCW/zhyLoDq",
-    "handler": "closeLJGCard",
+    "handler": "eventClose",
     "customEventData": ""
   },
   {

+ 8 - 5
assets/res/luojigouStart/src/LuojigouStart.ts

@@ -1,6 +1,7 @@
 import Tools from "../../../src/common/Tools";
 import CConst from "../../../src/common/CConst";
 import NotifierCenter from "../../../src/webtcp/NotifierCenter";
+import AudioManager from "../../../src/audioUitls/AudioManager";
 
 /**
  * @description 逻辑狗card的脚本
@@ -35,11 +36,6 @@ export default class LuojigouStart extends cc.Component {
     @property({ tooltip: '星星list', type: cc.Node })
     StarList: cc.Node[] = []
 
-    protected onDisable(): void {
-        this.unscheduleAllCallbacks();
-        Tools.stopEffects();
-    }
-
     /**
      * @description 设置逻辑狗卡片
      */
@@ -59,11 +55,18 @@ export default class LuojigouStart extends cc.Component {
         }
     }
 
+    eventClose(){
+        this.closeLJGCard();
+        AudioManager.getInstance().playEffect('audio/button_touch');
+    }
+
     /**
      * @description 关闭逻辑狗弹窗
      */
     closeLJGCard() {
+        Tools.stopEffects();
         this.node.active = false;
+        this.unscheduleAllCallbacks();
         NotifierCenter.trigger(CConst.EVENT_GAME_START);
     }
 }

+ 4 - 0
assets/res/tipHand/src/TipHand.ts

@@ -1,3 +1,4 @@
+import AudioManager from "../../../src/audioUitls/AudioManager";
 import Tools from "../../../src/common/Tools";
 
 /** 提示参数 */
@@ -115,6 +116,7 @@ export default class TipHand extends cc.Component {
 
     /* 按下 */
     private Press(callback: Function) {
+        AudioManager.getInstance().playEffect('audio/handTip');
         this.skAperture.node.active = false;
         Tools.playAnimation(this.skHand, this.event_danji, false, () => {
             this.skAperture.node.active = true;
@@ -136,6 +138,7 @@ export default class TipHand extends cc.Component {
         this.nodeTip.active = true;
         this.nodeTip.position = pStart;
         this.skAperture.node.active = true;
+        AudioManager.getInstance().playEffect('audio/handTip');
         Tools.playAnimation(this.skAperture, this.ani_dianji, false);
         Tools.playAnimation(this.skHand, this.event_danji, false, () => {
             Tools.playAnimation(this.skHand, this.event_taishou, false, () => {
@@ -406,6 +409,7 @@ export default class TipHand extends cc.Component {
         this.nodeTip.setPosition(starPos);
         this.arrow.active = false;
         let len = cc.v2(endPos.x, endPos.y).sub(cc.v2(starPos.x, starPos.y)).mag();
+        AudioManager.getInstance().playEffect('audio/handTip');
         Tools.playAnimation(this.skHand, this.event_danji, false, () => {
             this.skAperture.node.active = true;
             Tools.playAnimation(this.skAperture, this.ani_dianji, true);

+ 0 - 12
assets/res/tipHand/描述文本.md

@@ -1,12 +0,0 @@
-# 引导手文档描述
-
-## 使用规则
-## 点击
- Click()
-
-## 循环点击
-ClickCycle()
-
-## 循环拖拽
-TouchCycle()
-## 

+ 0 - 6
assets/res/tipHand/描述文本.md.meta

@@ -1,6 +0,0 @@
-{
-  "ver": "2.0.2",
-  "uuid": "46c0a9e3-8bd9-40e7-9654-d1a0019dba60",
-  "importer": "markdown",
-  "subMetas": {}
-}

+ 46 - 30
assets/res/videoPlayer/src/VideoPlayer.ts

@@ -21,7 +21,9 @@ export default class VideoPlayer extends GameBase {
     @property({ tooltip: '视频资源', type: cc.VideoPlayer })
     video: cc.VideoPlayer = null;
 
+    currentTime = 0;
     protected onEnable(): void {
+        this.currentTime = 0;
         this.nodeStart.active = true;
         this.loadVideo();
     }
@@ -30,7 +32,17 @@ export default class VideoPlayer extends GameBase {
         this.stopVideo();
     }
 
-    async loadVideo(){
+    protected update(dt: number): void {
+        if (!this.nodeStart.active) {
+            return;
+        }
+        if (this.currentTime > 0 && this.video.isPlaying()) {
+            this.nodeStart.active = false;
+            common.log('视频 播放');
+        }
+    }
+
+    async loadVideo() {
         let unitCur = common.getUnitNum();
         let pageNum = common.getPageNum();
         let attribute: AttributeUnit = common.attributeMap[unitCur];
@@ -39,54 +51,58 @@ export default class VideoPlayer extends GameBase {
     };
 
     /** 事件-点击屏幕 */
-    eventTouch(){
+    eventTouch() {
         this.playVideo();
     }
 
     /** 事件-视频相关 */
     eventVideo(videoplayer: cc.VideoPlayer, event: cc.VideoPlayer.EventType, customEventData): void {
-        common.log('视频:', this.getStatus(event), '; url: ', videoplayer.remoteURL);
-        if (this.video.isPlaying()) {
-            this.nodeStart.active = false;
-            common.log('视频播放');
+        common.log('视频 event: ', this.getStatus(event), ', isPlaying: ', this.video.isPlaying());
+        if (event === cc.VideoPlayer.EventType.READY_TO_PLAY) {
+            this.currentTime = 0.01;
+            this.playVideo();
         }
-        else if(event === cc.VideoPlayer.EventType.READY_TO_PLAY){
+        else if (event === cc.VideoPlayer.EventType.META_LOADED) {
+            this.currentTime = this.video.currentTime + 0.01;
             this.playVideo();
         }
         else if (event === cc.VideoPlayer.EventType.COMPLETED) {
             common.setGameToLocal();
             NotifierCenter.trigger(CConst.EVENT_ENTER_GAME, {});
         }
+        else if (event === cc.VideoPlayer.EventType.CLICKED) {
+            this.playVideo();
+        }
     }
-    
-    playVideo(){
+
+    playVideo() {
         if (!this.video.isPlaying()) {
             this.video.play();
         }
     }
 
-    stopVideo(){
+    stopVideo() {
         this.video.stop();
     }
 
-    getStatus (event) { 
-        switch (event) { 
-            case cc.VideoPlayer.EventType.PLAYING: 
-                return 'PLAYING'; 
-            case cc.VideoPlayer.EventType.PAUSED: 
-                return 'PAUSED'; 
-            case cc.VideoPlayer.EventType.STOPPED: 
-                 return 'STOPPED'; 
-             case cc.VideoPlayer.EventType.COMPLETED: 
-                 return 'COMPLETED'; 
-             case cc.VideoPlayer.EventType.META_LOADED: 
-                 return 'META_LOADED'; 
-             case cc.VideoPlayer.EventType.CLICKED: 
-                 return 'CLICKED'; 
-             case cc.VideoPlayer.EventType.READY_TO_PLAY: 
-                 return 'READY_TO_PLAY'; 
-             default: 
-                 return 'NONE'; 
-         } 
-     }; 
+    getStatus(event) {
+        switch (event) {
+            case cc.VideoPlayer.EventType.PLAYING:
+                return 'PLAYING';
+            case cc.VideoPlayer.EventType.PAUSED:
+                return 'PAUSED';
+            case cc.VideoPlayer.EventType.STOPPED:
+                return 'STOPPED';
+            case cc.VideoPlayer.EventType.COMPLETED:
+                return 'COMPLETED';
+            case cc.VideoPlayer.EventType.META_LOADED:
+                return 'META_LOADED';
+            case cc.VideoPlayer.EventType.CLICKED:
+                return 'CLICKED';
+            case cc.VideoPlayer.EventType.READY_TO_PLAY:
+                return 'READY_TO_PLAY';
+            default:
+                return 'NONE';
+        }
+    };
 }

+ 13 - 0
assets/resources/audio.meta

@@ -0,0 +1,13 @@
+{
+  "ver": "1.1.3",
+  "uuid": "58c7106f-9b81-4257-b2cb-11762ba075cf",
+  "importer": "folder",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

BIN
assets/resources/audio/button_touch.mp3


+ 8 - 0
assets/resources/audio/button_touch.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "9a475e9b-d39f-445d-aa6d-9e699e96974e",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 0.862041,
+  "subMetas": {}
+}

BIN
assets/resources/audio/clock.mp3


+ 8 - 0
assets/resources/audio/clock.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "9f61a1c0-3549-451d-bda6-750ca800c78f",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 1.128688,
+  "subMetas": {}
+}

BIN
assets/resources/audio/error_good_0.mp3


+ 8 - 0
assets/resources/audio/error_good_0.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "a5a535df-3fad-4d28-890f-0345d609b9fe",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 0.835918,
+  "subMetas": {}
+}

BIN
assets/resources/audio/error_good_1.mp3


+ 8 - 0
assets/resources/audio/error_good_1.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "5d2eaf62-d455-4f37-a902-c70af8438795",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 0.629333,
+  "subMetas": {}
+}

BIN
assets/resources/audio/error_touch.mp3


+ 8 - 0
assets/resources/audio/error_touch.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "5ba04178-1681-43ee-993f-1aa71c951e98",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 0.317333,
+  "subMetas": {}
+}

BIN
assets/resources/audio/good_move.mp3


+ 8 - 0
assets/resources/audio/good_move.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "7cd7f98f-6bf0-4b17-8408-f86b3ee96fe2",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 0.940408,
+  "subMetas": {}
+}

BIN
assets/resources/audio/good_touch.mp3


+ 8 - 0
assets/resources/audio/good_touch.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "aa9b3ead-f687-46a3-b6f5-0e80614377cf",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 0.1045,
+  "subMetas": {}
+}

BIN
assets/resources/audio/handTip.mp3


+ 8 - 0
assets/resources/audio/handTip.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "1bc76fdc-a0ed-4f6a-a91d-b98ea71d9745",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 1.880816,
+  "subMetas": {}
+}

BIN
assets/resources/audio/particle_0.mp3


+ 8 - 0
assets/resources/audio/particle_0.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "ef3934cf-5190-45df-a34b-c098498b7942",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 1.071,
+  "subMetas": {}
+}

BIN
assets/resources/audio/particle_1.mp3


+ 8 - 0
assets/resources/audio/particle_1.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "25624eca-be7f-46a6-9ce3-b5e9585fe70d",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 1.724,
+  "subMetas": {}
+}

BIN
assets/resources/audio/right_0.mp3


+ 8 - 0
assets/resources/audio/right_0.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "2a050f79-251e-40c5-aef6-314d9e1aefab",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 1.259,
+  "subMetas": {}
+}

BIN
assets/resources/audio/right_1.mp3


+ 8 - 0
assets/resources/audio/right_1.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "f1b79829-d44e-4569-b678-f1e6a340fbe6",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 1.415375,
+  "subMetas": {}
+}

BIN
assets/resources/audio/right_2.mp3


+ 8 - 0
assets/resources/audio/right_2.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "5b319b7d-2c04-4244-b002-25db7dd57cf7",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 0.711688,
+  "subMetas": {}
+}

BIN
assets/resources/audio/right_3.mp3


+ 8 - 0
assets/resources/audio/right_3.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "7ae2e899-b918-4daf-b157-2d22b6677b6b",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 2.3249,
+  "subMetas": {}
+}

BIN
assets/resources/audio/star_1.mp3


+ 8 - 0
assets/resources/audio/star_1.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "f6417321-5dcd-4b00-b4e7-79a8a1045fe4",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 4.959875,
+  "subMetas": {}
+}

BIN
assets/resources/audio/star_2.mp3


+ 8 - 0
assets/resources/audio/star_2.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "d6b4ecc4-c424-41cd-9c92-dbdd451ecc8c",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 4.959875,
+  "subMetas": {}
+}

BIN
assets/resources/audio/star_3.mp3


+ 8 - 0
assets/resources/audio/star_3.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "b02a2dfd-2acf-48cf-ad98-16e20269fc68",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 4.959875,
+  "subMetas": {}
+}

BIN
assets/resources/audio/star_hide.mp3


+ 8 - 0
assets/resources/audio/star_hide.mp3.meta

@@ -0,0 +1,8 @@
+{
+  "ver": "2.0.3",
+  "uuid": "e347f541-8380-4150-af0e-6d9c02c2aed7",
+  "importer": "audio-clip",
+  "downloadMode": 0,
+  "duration": 0.677333,
+  "subMetas": {}
+}

+ 20 - 0
assets/resources/configAudio.json

@@ -0,0 +1,20 @@
+[
+    "audio/button_touch",
+    "audio/clock",
+    "audio/error_good_0",
+    "audio/error_good_1",
+    "audio/error_touch",
+    "audio/good_move",
+    "audio/good_touch",
+    "audio/handTip",
+    "audio/particle_0",
+    "audio/particle_1",
+    "audio/right_0",
+    "audio/right_1",
+    "audio/right_2",
+    "audio/right_3",
+    "audio/stat_1",
+    "audio/stat_2",
+    "audio/stat_3",
+    "audio/star_hide"
+]

+ 6 - 0
assets/resources/configAudio.json.meta

@@ -0,0 +1,6 @@
+{
+  "ver": "1.0.2",
+  "uuid": "5a8eb15b-62b0-4c2f-94ca-e31074ffecb0",
+  "importer": "json",
+  "subMetas": {}
+}

+ 15 - 21
assets/src/audioUitls/AudioCB.ts

@@ -19,7 +19,7 @@ export default class AudioCB {
     private _handlers: any = {};
     private _currTimer: number = 0;
 
-    public static get instance(): AudioCB {
+    public static getInstance(): AudioCB {
         if (AudioCB._instance == null) {
             AudioCB._instance = new AudioCB();
         }
@@ -38,33 +38,27 @@ export default class AudioCB {
     public onEnterFrame(): void {
         if (this._pool.length > 0) {
             let first: AudioHandler = this._pool.shift();
-            this.removeQueue();
             if (first.order == AudioOrder.Add) {
-                common.log('音频回调-添加: ', first.name);
                 this._handlers[first.name] = first;
+                common.log('音频回调-添加 队列:', Object.keys(this._handlers));
+            }
+            else if(first.order == AudioOrder.Del){
+                this.removeQueue();
+                common.log('音频回调-清除 队列:', Object.keys(this._handlers));
             }
         }
 
         this._currTimer = Date.now();
-        if (this._currTimer >= this._handlers.exeTime) {
-            let method: Function = this._handlers.method;
-            let args: any[] = this._handlers.args;
-            method.apply(this._handlers.thisObj, args);
-            this._handlers.clear();
-            this._handlers = null;
-        }
-
         for (const key in this._handlers) {
-            if (Object.prototype.hasOwnProperty.call(this._handlers, key)) {
-                const handler: AudioHandler = this._handlers[key];
-                if (this._currTimer >= handler.exeTime) {
-                    let method: Function = handler.method;
-                    let args: any[] = handler.args;
-                    method.apply(handler.thisObj, args);
-                    common.log('音频回调-执行: ', handler.name);
-                    handler.clear();
-                    delete this._handlers[key];
-                }
+            if (key === "undefined") continue;
+            const handler: AudioHandler = this._handlers[key];
+            if (this._currTimer >= handler.exeTime) {
+                let method: Function = handler.method;
+                let args: any[] = handler.args;
+                method.apply(handler.thisObj, args);
+                common.log('音频回调-执行: ', handler.name);
+                handler.clear();
+                delete this._handlers[key];
             }
         }
     }

+ 42 - 0
assets/src/audioUitls/AudioManager.ts

@@ -0,0 +1,42 @@
+import Loader from "../config/Loader";
+
+export default class AudioManager {
+    private static _instance: AudioManager;
+    public static getInstance(): AudioManager {
+        if (!this._instance) {
+            this._instance = new AudioManager();
+        }
+        return this._instance;
+    };
+
+    /** 音效缓存池 */
+    private static _soundPool: Map<string, cc.AudioClip> = new Map<string, cc.AudioClip>();
+
+    /** 根据配置文件加载音频 */ 
+    async loadAudios(){
+        let config: cc.JsonAsset = await Loader.loadResLoacl('configAudio');
+        if (!config) {
+            return;
+        }
+        let data: string[] = config.json;
+        data.forEach(async(path) => {
+            let audio: cc.AudioClip = await Loader.loadResLoacl(path);
+            AudioManager._soundPool.set(path, audio);
+        });
+    };
+
+    /** 播放音频 */
+    async playEffect(path: string, loop?: boolean){
+        let audio = AudioManager._soundPool.get(path);
+        if (!audio) {
+            audio = await Loader.loadResLoacl(path);
+            AudioManager._soundPool.set(path, audio);
+        }
+        cc.audioEngine.playEffect(audio, loop ? true : false);
+    };
+
+    /** 停止音频 */
+    stopEffect(){
+        cc.audioEngine.stopAllEffects();
+    };
+};

+ 10 - 0
assets/src/audioUitls/AudioManager.ts.meta

@@ -0,0 +1,10 @@
+{
+  "ver": "1.1.0",
+  "uuid": "e3afea5a-e35b-46e0-b636-f53436abac69",
+  "importer": "typescript",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 4 - 5
assets/src/common/Tools.ts

@@ -35,9 +35,8 @@ class Tools {
      */
     playEffect(audio: cc.AudioClip, loop: boolean = false, cb: Function = null): Promise<void> {
         return new Promise((resolve) => {
-            this.stopEffects();
             cc.audioEngine.playEffect(audio, loop);
-            AudioCB.instance.addQueue(AudioOrder.Add, audio.name, audio.duration * 1000, () => {
+            AudioCB.getInstance().addQueue(AudioOrder.Add, audio.name, audio.duration * 1000, () => {
                 if (cb) {
                     cb();
                 }
@@ -52,8 +51,8 @@ class Tools {
      */
     playEffectArr(audios: cc.AudioClip[], cb: Function = null): Promise<void> {
         return new Promise(async resolve => {
-            for (const iterator of audios) {
-                await this.playEffect(iterator);
+            for (const audio of audios) {
+                await this.playEffect(audio);
             }
             if (cb) {
                 cb();
@@ -64,7 +63,7 @@ class Tools {
 
     stopEffects() {
         cc.audioEngine.stopAllEffects();
-        AudioCB.instance.addQueue(AudioOrder.Del);
+        AudioCB.getInstance().addQueue(AudioOrder.Del);
     }
 
     /** 从节点上获取数组 */

+ 3 - 1
assets/src/common/common.ts

@@ -40,12 +40,14 @@ class common {
     isDebug: boolean = false;
     project: string = "luojigou_yinliu";
     itemId: string = '';
-    unitCur: number = 2;// 第几集,从1开始
+    unitCur: number = 1;// 第几集,从1开始
     pageCur: number = 1;// 第几个游戏,从1开始
     isCanPlayVideo = false;
     attributeMap: any = {};// 内部形式为 { "0" : AttributeUtil } 
     urlToken: string = 'https://open.api.luojigou.vip/mall/mobile/common/verify/token';// 验证token的地址;
     urlOver: string = 'https://open.api.luojigou.vip/app/app/gameCourse/record/12321312';// 当前集游戏完结,上报地址;
+    urlClass: string = 'https://luojigou.vip/ac/#/courseDetail?id=1568062284888866817&mode=luojigou';// 课程页
+    objRes: any = {};//通用音频
 
     getItemId(){
         return this.itemId;

+ 3 - 2
assets/src/config/Loader.ts

@@ -29,11 +29,12 @@ class Loader {
         });
     }
 
-    loadResLoacl(path){
+    loadResLoacl(path): Promise<any>{
         return new Promise((resolve) => {
-            cc.resources.load(path, cc.Asset, function (err, asset) {
+            cc.resources.load(path, function (err, asset: any) {
                 if (err) {
                     common.log("加载失败:", path);
+                    resolve(null);
                 }
                 else {
                     common.log("加载资源:", path);

+ 14 - 8
build-templates/web-mobile/index.html

@@ -94,17 +94,23 @@
             let height = document.documentElement.clientHeight;
             splash = $('#splash');
             if (width < height) {
-                splash.width(height);
-                splash.height(width);
-                splash.css('top', (height - width) / 2);
-                splash.css('left', 0 - (height - width) / 2);
+                let radio = height/1920;
+                let curW = radio*2480;
+                let curH = radio*1440;
+                splash.width(curW);
+                splash.height(curH);
+                splash.css('top', (height - curH) / 2);
+                splash.css('left', 0 - (curW - width) / 2);
                 splash.css('transform', 'rotate(90deg)');
                 splash.css('transform-origin', '50% 50%');
             } else {
-                splash.width(width);
-                splash.height(height);
-                splash.css('top', 0);
-                splash.css('left', 0);
+                let radio = width/1920;
+                let curW = radio*2480;
+                let curH = radio*1440;
+                splash.width(curW);
+                splash.height(curH);
+                splash.css('top', (height - curH) / 2);
+                splash.css('left', (width - curW) / 2);
                 splash.css('transform', 'none');
                 splash.css('transform-origin', '50% 50%');
             }

+ 1 - 1
settings/project.json

@@ -2,7 +2,7 @@
   "migrate-history": [
     "cloud-function"
   ],
-  "last-module-event-record-time": 1662688588861,
+  "last-module-event-record-time": 1663293593607,
   "group-list": [
     "default"
   ],