Commit feb3aa3e authored by 李维's avatar 李维

完成拖拽功能

parent a9b979a8
{
"ver": "1.1.2",
"uuid": "1ec6f758-fc48-47d3-bad6-e26a6ebd77bf",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "VideoControlBar",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 8
},
{
"__id__": 10
},
{
"__id__": 21
},
{
"__id__": 24
}
],
"_active": true,
"_components": [
{
"__id__": 27
},
{
"__id__": 28
}
],
"_prefab": {
"__id__": 29
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
640,
100,
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": ""
},
{
"__type__": "cc.Node",
"_name": "progress",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
}
],
"_active": true,
"_components": [
{
"__id__": 6
}
],
"_prefab": {
"__id__": 7
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1053,
"height": 28
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
8,
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": ""
},
{
"__type__": "cc.Node",
"_name": "bar",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": {
"__id__": 5
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 30,
"height": 28
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-528,
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": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "91c20c73-41fc-4aaf-90f6-5f0e30fc0857"
},
"_type": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "406wZYop9D2aRpagd7nuiR",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "b3de4dee-0204-4146-9ae3-fe5790515778"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "480B29nphJA6YED4DUIFgt",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "markNode",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 9
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_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": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "34twh3ifZIPaYKCWna57S6",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "controlButton",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 11
},
{
"__id__": 14
},
{
"__id__": 17
}
],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 20
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 155,
"height": 155
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-650,
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": ""
},
{
"__type__": "cc.Node",
"_name": "play",
"_objFlags": 0,
"_parent": {
"__id__": 10
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 12
}
],
"_prefab": {
"__id__": 13
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 155,
"height": 154
},
"_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": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "45b208cd-8797-4452-b5bc-9c6a3a31fcea"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "c18o1hS1dJaIENF2MvURFk",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "pause",
"_objFlags": 0,
"_parent": {
"__id__": 10
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 15
}
],
"_prefab": {
"__id__": 16
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 155,
"height": 154
},
"_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": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "dbd46980-78b5-4992-8c7d-038b0134885f"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "0doY5vk+RCELITL8R3G2gk",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "replay",
"_objFlags": 0,
"_parent": {
"__id__": 10
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 18
}
],
"_prefab": {
"__id__": 19
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 155,
"height": 155
},
"_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": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "ba88dfb3-89c5-4e4c-9fe6-7c6f6f28a36c"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "caR3d+1m9HkaQbf5Mix4vV",
"sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "e6EaEyxpVO14/aMaOTGN39",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "dragButton",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 22
}
],
"_prefab": {
"__id__": 23
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 52,
"height": 57
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-520,
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": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "7ac0160b-8705-4710-b65d-3bab72310bbc"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "305Bnt78BML5iK0PU65G5T",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "markPoint",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 25
}
],
"_prefab": {
"__id__": 26
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 15,
"height": 15
},
"_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": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 24
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "3fc25a16-8cbc-4cdd-99a2-5251bb1dcf5d"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "359axb3wRFnpR16d4pl6Xc",
"sync": false
},
{
"__type__": "28e11HTXPtGa7wWg93PflND",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 20,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 100,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "ebd1c92e-da1e-4a16-b61b-54a09be17ce4",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
cc.Class({
extends: cc.Component,
start () {
this.init();
this.initVideoBtn();
this.addListener();
this.initdDrag();
},
barBaseW: 0, // 进度条宽度
bgProgress: null, // 进度条背景
bar: null, // 进度条填充
dragBtn: null, // 进度条拖拽按钮
controlBtn: null, // 按钮点击事件挂在这个上面
playBtn: null, // 播放按钮
pauseBtn: null, // 暂停按钮
replayBtn: null, // 重播按钮
init() {
console.log("Init video control component.")
this.bgProgress = cc.find('progress', this.node);
this.bar = cc.find('progress/bar', this.node);
this.dragBtn = cc.find('dragButton', this.node);
this.controlBtn = cc.find('controlButton', this.node);
this.playBtn = cc.find('controlButton/play', this.node);
this.pauseBtn = cc.find('controlButton/pause', this.node);
this.replayBtn = cc.find('controlButton/replay', this.node);
this.playBtn.active = true;
this.pauseBtn.active = false;
this.replayBtn.active = false;
this.videoStatus = 0; // 0:暂停 1:播放中 2:重播
this.barBaseW = this.bgProgress.width;;
this.setProgress(0);
},
initVideoBtn() {
this.controlBtn.addComponent(cc.Button);
this.controlBtn.on('click', () => {
if (this.videoStatus==null || this.videoStatus ==0) {
this.refreshVideoBtnState(1);
this.node.emit('video_btn_click', true)
} else if (this.videoStatus ==1) {
this.refreshVideoBtnState(0);
this.node.emit('video_btn_click', false)
}
});
},
userDragStart: null,
initdDrag() {
const dragStartX = -520;
const maxX = this.bgProgress.width + dragStartX ;
const minX = dragStartX;
this.dragBtn.off(cc.Node.EventType.TOUCH_START);
this.dragBtn.on(cc.Node.EventType.TOUCH_START, (e) => {
this.userDragStart = true;
this.node.emit('on_drag_button', true);
});
this.dragBtn.off(cc.Node.EventType.TOUCH_MOVE);
this.dragBtn.on(cc.Node.EventType.TOUCH_MOVE, (e) => {
const worldPos = e.getLocation();
const localPos = this.dragBtn.parent.convertToNodeSpaceAR(worldPos);
let newX = localPos.x;
newX = Math.min(maxX, Math.max(newX, minX));
this.dragBtn.x = newX;
const percent = Math.abs(newX-dragStartX) / Math.abs(this.bgProgress.width);
this.setProgress(percent);
this.node.emit('on_drag_percent', percent)
});
this.dragBtn.off(cc.Node.EventType.TOUCH_ENDED);
this.dragBtn.on(cc.Node.EventType.TOUCH_ENDED, (e) => {
if(this.userDragStart) {
this.userDragStart = false;
this.node.emit('on_drag_button', false);
}
});
this.dragBtn.on(cc.Node.EventType.MOUSE_UP, (e) => {
if(this.userDragStart) {
this.userDragStart = false;
this.node.emit('on_drag_button', false);
}
});
cc.find('Canvas').on(cc.Node.EventType.TOUCH_ENDED, (e) => {
if(this.userDragStart) {
this.userDragStart = false;
this.node.emit('on_drag_button', false);
}
});
cc.find('Canvas').on(cc.Node.EventType.MOUSE_UP, (e) => {
if(this.userDragStart) {
this.userDragStart = false;
this.node.emit('on_drag_button', false);
}
});
},
// 0:暂停 1:播放中 2:重播
videoStatus: null,
refreshVideoBtnState(status) {
this.videoStatus = status;
switch(status) {
case 0:
this.playBtn.active = true;
this.pauseBtn.active = false;
this.replayBtn.active = false;
break;
case 1:
this.playBtn.active = false;
this.pauseBtn.active = true;
this.replayBtn.active = false;
break;
case 2:
this.playBtn.active = false;
this.pauseBtn.active = false;
this.replayBtn.active = true;
break;
default:
this.playBtn.active = true;
this.pauseBtn.active = false;
this.replayBtn.active = false;
break;
};
},
addListener() {
this.node.on('video_play_end', () => {
this.refreshVideoBtnState();
})
this.node.on('update_video_progress', (value)=>{
if(!this.userDragStart) {
this.setProgress(value);
}
})
this.node.on('update_video_status', (status)=>{
this.refreshVideoBtnState(status);
})
this.node.on("set_mark_points", (data)=>{
const markPoint = cc.find("markPoint", this.node);
const markPointsContainer = cc.find("markNode", this.node);
for(let i=0; i<data.length; i++) {
const newPoint = cc.instantiate(markPoint);
newPoint.x = -520 + this.bgProgress.width * data[i];
newPoint.active = true;
markPointsContainer.addChild(newPoint);
}
})
},
setProgress(progress) {
const dragStartX = -520;
setTimeout(() => {
const w = this.barBaseW * progress;
this.bar.width = w;
if(!this.userDragStart) {
this.dragBtn.x = dragStartX + w;
}
}, 1);
},
});
{
"ver": "1.0.8",
"uuid": "28e111d3-5cfb-466b-bc16-83ddcf7e5343",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "5c56fef8-fa7a-48c9-a282-d5c355deee22",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "2c82c218-fb9f-4368-9761-2ba189614e5c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 157,
"height": 157,
"platformSettings": {},
"subMetas": {
" 重播按钮": {
"ver": "1.0.4",
"uuid": "ba88dfb3-89c5-4e4c-9fe6-7c6f6f28a36c",
"rawTextureUuid": "2c82c218-fb9f-4368-9761-2ba189614e5c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -1,
"trimX": 1,
"trimY": 2,
"width": 155,
"height": 155,
"rawWidth": 157,
"rawHeight": 157,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "986b65e8-dc02-48df-a92a-0743e5e1c828",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 52,
"height": 57,
"platformSettings": {},
"subMetas": {
"可拖动按钮": {
"ver": "1.0.4",
"uuid": "7ac0160b-8705-4710-b65d-3bab72310bbc",
"rawTextureUuid": "986b65e8-dc02-48df-a92a-0743e5e1c828",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 52,
"height": 57,
"rawWidth": 52,
"rawHeight": 57,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "252835f3-3f05-40e2-8b64-6eb98fa01ec6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 157,
"height": 157,
"platformSettings": {},
"subMetas": {
"播放按钮": {
"ver": "1.0.4",
"uuid": "dbd46980-78b5-4992-8c7d-038b0134885f",
"rawTextureUuid": "252835f3-3f05-40e2-8b64-6eb98fa01ec6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -0.5,
"trimX": 1,
"trimY": 2,
"width": 155,
"height": 154,
"rawWidth": 157,
"rawHeight": 157,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "dee7ff5a-af4c-4ee3-998f-bb4659a98a69",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 157,
"height": 157,
"platformSettings": {},
"subMetas": {
"暂停按钮": {
"ver": "1.0.4",
"uuid": "45b208cd-8797-4452-b5bc-9c6a3a31fcea",
"rawTextureUuid": "dee7ff5a-af4c-4ee3-998f-bb4659a98a69",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -0.5,
"trimX": 1,
"trimY": 2,
"width": 155,
"height": 154,
"rawWidth": 157,
"rawHeight": 157,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "860e9678-48af-4e4b-83d2-9e5a5dbc147e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 1069,
"height": 28,
"platformSettings": {},
"subMetas": {
"灰色进度条": {
"ver": "1.0.4",
"uuid": "b3de4dee-0204-4146-9ae3-fe5790515778",
"rawTextureUuid": "860e9678-48af-4e4b-83d2-9e5a5dbc147e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 6,
"offsetY": 0,
"trimX": 14,
"trimY": 0,
"width": 1053,
"height": 28,
"rawWidth": 1069,
"rawHeight": 28,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "253c929f-8f96-46ed-9bde-7b0bf213e793",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 15,
"height": 15,
"platformSettings": {},
"subMetas": {
"跳题标记点": {
"ver": "1.0.4",
"uuid": "3fc25a16-8cbc-4cdd-99a2-5251bb1dcf5d",
"rawTextureUuid": "253c929f-8f96-46ed-9bde-7b0bf213e793",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 15,
"height": 15,
"rawWidth": 15,
"rawHeight": 15,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "733f270e-d4a3-4c16-a4a7-e2cdf0e579f0",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 628,
"height": 25,
"platformSettings": {},
"subMetas": {
"黄色的进度条-中间": {
"ver": "1.0.4",
"uuid": "91c20c73-41fc-4aaf-90f6-5f0e30fc0857",
"rawTextureUuid": "733f270e-d4a3-4c16-a4a7-e2cdf0e579f0",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -1,
"offsetY": 0,
"trimX": 1,
"trimY": 0,
"width": 624,
"height": 25,
"rawWidth": 628,
"rawHeight": 25,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 19,
"borderRight": 19,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c52631a0-a14e-4fdb-af58-3df90427f4ac",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 1069,
"height": 28,
"platformSettings": {},
"subMetas": {
"黄色的进度条-满的": {
"ver": "1.0.4",
"uuid": "69891fc9-0258-4a67-ac2c-9d26cae3cffa",
"rawTextureUuid": "c52631a0-a14e-4fdb-af58-3df90427f4ac",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 6,
"offsetY": 0,
"trimX": 14,
"trimY": 0,
"width": 1053,
"height": 28,
"rawWidth": 1069,
"rawHeight": 28,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 16,
"borderRight": 6,
"subMetas": {}
}
}
}
\ No newline at end of file
...@@ -79,18 +79,21 @@ ...@@ -79,18 +79,21 @@
}, },
{ {
"__id__": 10 "__id__": 10
},
{
"__id__": 39
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 36 "__id__": 65
}, },
{ {
"__id__": 37 "__id__": 66
}, },
{ {
"__id__": 38 "__id__": 67
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -247,43 +250,1023 @@ ...@@ -247,43 +250,1023 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 3 "__id__": 3
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 640,
"_right": 640,
"_top": 470,
"_bottom": 470,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 1280,
"_originalHeight": 720,
"_id": "a3W+F+0tFAFJzUnY+BaTiV"
},
{
"__type__": "cc.Node",
"_name": "hand",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 7
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_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": "a9n85YLmlImaErX3F/ubGc"
},
{
"__type__": "dragonBones.ArmatureDisplay",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_armatureName": "Armature",
"_animationName": "normal",
"_preCacheMode": 0,
"_cacheMode": 0,
"playTimes": -1,
"premultipliedAlpha": false,
"_armatureKey": "ac9a69d6-8ef7-4ae8-b84a-73f1ffbfeb1c#3592528d-2b01-442c-ad9e-c701ab6dd067",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "ac9a69d6-8ef7-4ae8-b84a-73f1ffbfeb1c"
},
"_N$dragonAtlasAsset": {
"__uuid__": "3592528d-2b01-442c-ad9e-c701ab6dd067"
},
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 1,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$debugBones": false,
"_N$enableBatch": false,
"_id": "b5ZWY5+bFE3YNqJ+CrU6nq"
},
{
"__type__": "cc.Node",
"_name": "goodjob",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 9
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 700,
"height": 700
},
"_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": "f23hV9mnBBYZ1OXVQg3VZs"
},
{
"__type__": "dragonBones.ArmatureDisplay",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_armatureName": "armatureName",
"_animationName": "newAnimation",
"_preCacheMode": 0,
"_cacheMode": 0,
"playTimes": -1,
"premultipliedAlpha": false,
"_armatureKey": "9d28773b-d69f-4fc8-b675-16fde99a4712#f615b7c8-a715-4f8d-88f6-c6b0765ede74",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "9d28773b-d69f-4fc8-b675-16fde99a4712"
},
"_N$dragonAtlasAsset": {
"__uuid__": "f615b7c8-a715-4f8d-88f6-c6b0765ede74"
},
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 1,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$debugBones": false,
"_N$enableBatch": false,
"_id": "66t644bDFDb73XispqPIHj"
},
{
"__type__": "cc.Node",
"_name": "VideoControlBar",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 11
},
{
"__id__": 17
},
{
"__id__": 19
},
{
"__id__": 30
},
{
"__id__": 33
}
],
"_active": true,
"_components": [
{
"__id__": 36
},
{
"__id__": 37
}
],
"_prefab": {
"__id__": 38
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
370,
0,
0,
0,
0,
1,
0.7,
0.7,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "e5bF4KDU1F0ZXH6XOAcyPh"
},
{
"__type__": "cc.Node",
"_name": "progress",
"_objFlags": 0,
"_parent": {
"__id__": 10
},
"_children": [
{
"__id__": 12
}
],
"_active": true,
"_components": [
{
"__id__": 15
}
],
"_prefab": {
"__id__": 16
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1053,
"height": 28
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
8,
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": "b8DFmtrzpILI8tvxl45iMF"
},
{
"__type__": "cc.Node",
"_name": "bar",
"_objFlags": 0,
"_parent": {
"__id__": 11
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 13
}
],
"_prefab": {
"__id__": 14
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 30,
"height": 28
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-528,
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": "2foXUCKE5BS7DPMKtOI8r9"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 12
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "91c20c73-41fc-4aaf-90f6-5f0e30fc0857"
},
"_type": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "7evFazcUNOu6fHqFYdjyDH"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 10
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "406wZYop9D2aRpagd7nuiR",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "b3de4dee-0204-4146-9ae3-fe5790515778"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "17JjUkgOVEOqt4lOqtnX86"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 10
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "480B29nphJA6YED4DUIFgt",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "markNode",
"_objFlags": 0,
"_parent": {
"__id__": 10
},
"_children": [],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 18
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_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": "81KVs/SbZPcKwSKLz/nndo"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 10
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "34twh3ifZIPaYKCWna57S6",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "controlButton",
"_objFlags": 0,
"_parent": {
"__id__": 10
},
"_children": [
{
"__id__": 20
},
{
"__id__": 23
},
{
"__id__": 26
}
],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 29
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 155,
"height": 155
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-650,
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": "6dmH2RBYdBjZPm1Nd+E4A+"
},
{
"__type__": "cc.Node",
"_name": "play",
"_objFlags": 0,
"_parent": {
"__id__": 19
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 21
}
],
"_prefab": {
"__id__": 22
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 155,
"height": 154
},
"_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": "4dXD7kKj1CkY4MaCJg8cOw"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 20
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "45b208cd-8797-4452-b5bc-9c6a3a31fcea"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "d0IayV8PRKzp8LiwXDVIrH"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 10
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "c18o1hS1dJaIENF2MvURFk",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "pause",
"_objFlags": 0,
"_parent": {
"__id__": 19
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 24
}
],
"_prefab": {
"__id__": 25
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 155,
"height": 154
},
"_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": "95bI4531NJyrJSZV0fayex"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 23
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "dbd46980-78b5-4992-8c7d-038b0134885f"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "adhS8IX3pBgrN8J1hWpNOl"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 10
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "0doY5vk+RCELITL8R3G2gk",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "replay",
"_objFlags": 0,
"_parent": {
"__id__": 19
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 27
}
],
"_prefab": {
"__id__": 28
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 155,
"height": 155
},
"_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": "eftZh/6TZMKrRBgJqHsEpf"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 26
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "_materials": [
"_target": null, {
"_alignFlags": 45, "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
"_left": 640, }
"_right": 640, ],
"_top": 470, "_srcBlendFactor": 1,
"_bottom": 470, "_dstBlendFactor": 771,
"_verticalCenter": 0, "_spriteFrame": {
"_horizontalCenter": 0, "__uuid__": "ba88dfb3-89c5-4e4c-9fe6-7c6f6f28a36c"
"_isAbsLeft": true, },
"_isAbsRight": true, "_type": 0,
"_isAbsTop": true, "_sizeMode": 1,
"_isAbsBottom": true, "_fillType": 0,
"_isAbsHorizontalCenter": true, "_fillCenter": {
"_isAbsVerticalCenter": true, "__type__": "cc.Vec2",
"_originalWidth": 1280, "x": 0,
"_originalHeight": 720, "y": 0
"_id": "a3W+F+0tFAFJzUnY+BaTiV" },
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "52Std+h5BI96wIxGPGfVE9"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 10
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "caR3d+1m9HkaQbf5Mix4vV",
"sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 10
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "e6EaEyxpVO14/aMaOTGN39",
"sync": false
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "hand", "_name": "dragButton",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 2 "__id__": 10
}, },
"_children": [], "_children": [],
"_active": false, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 7 "__id__": 31
} }
], ],
"_prefab": null, "_prefab": {
"__id__": 32
},
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -294,8 +1277,8 @@ ...@@ -294,8 +1277,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 0, "width": 52,
"height": 0 "height": 57
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -306,7 +1289,7 @@ ...@@ -306,7 +1289,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, -520,
0, 0,
0, 0,
0, 0,
...@@ -329,14 +1312,14 @@ ...@@ -329,14 +1312,14 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "a9n85YLmlImaErX3F/ubGc" "_id": "c2KHpc9t9NjLjaBpsfqpPy"
}, },
{ {
"__type__": "dragonBones.ArmatureDisplay", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 6 "__id__": 30
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -344,48 +1327,53 @@ ...@@ -344,48 +1327,53 @@
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
} }
], ],
"_armatureName": "Armature", "_srcBlendFactor": 1,
"_animationName": "normal", "_dstBlendFactor": 771,
"_preCacheMode": 0, "_spriteFrame": {
"_cacheMode": 0, "__uuid__": "7ac0160b-8705-4710-b65d-3bab72310bbc"
"playTimes": -1,
"premultipliedAlpha": false,
"_armatureKey": "ac9a69d6-8ef7-4ae8-b84a-73f1ffbfeb1c#3592528d-2b01-442c-ad9e-c701ab6dd067",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "ac9a69d6-8ef7-4ae8-b84a-73f1ffbfeb1c"
}, },
"_N$dragonAtlasAsset": { "_type": 0,
"__uuid__": "3592528d-2b01-442c-ad9e-c701ab6dd067" "_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
}, },
"_N$_defaultArmatureIndex": 0, "_fillStart": 0,
"_N$_animationIndex": 1, "_fillRange": 0,
"_N$_defaultCacheMode": 0, "_isTrimmedMode": true,
"_N$timeScale": 1, "_atlas": null,
"_N$debugBones": false, "_id": "4ejxxGDy5PPaBb6LVFKpsc"
"_N$enableBatch": false, },
"_id": "b5ZWY5+bFE3YNqJ+CrU6nq" {
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 10
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "305Bnt78BML5iK0PU65G5T",
"sync": false
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "goodjob", "_name": "markPoint",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 2 "__id__": 10
}, },
"_children": [], "_children": [],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 9 "__id__": 34
} }
], ],
"_prefab": null, "_prefab": {
"__id__": 35
},
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -396,8 +1384,8 @@ ...@@ -396,8 +1384,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 700, "width": 15,
"height": 700 "height": 15
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -431,14 +1419,14 @@ ...@@ -431,14 +1419,14 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "f23hV9mnBBYZ1OXVQg3VZs" "_id": "6ad+N+W5hJPL901Y2uUpbz"
}, },
{ {
"__type__": "dragonBones.ArmatureDisplay", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 8 "__id__": 33
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -446,32 +1434,83 @@ ...@@ -446,32 +1434,83 @@
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
} }
], ],
"_armatureName": "armatureName", "_srcBlendFactor": 1,
"_animationName": "newAnimation", "_dstBlendFactor": 771,
"_preCacheMode": 0, "_spriteFrame": {
"_cacheMode": 0, "__uuid__": "3fc25a16-8cbc-4cdd-99a2-5251bb1dcf5d"
"playTimes": -1,
"premultipliedAlpha": false,
"_armatureKey": "9d28773b-d69f-4fc8-b675-16fde99a4712#f615b7c8-a715-4f8d-88f6-c6b0765ede74",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "9d28773b-d69f-4fc8-b675-16fde99a4712"
}, },
"_N$dragonAtlasAsset": { "_type": 0,
"__uuid__": "f615b7c8-a715-4f8d-88f6-c6b0765ede74" "_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
}, },
"_N$_defaultArmatureIndex": 0, "_fillStart": 0,
"_N$_animationIndex": 1, "_fillRange": 0,
"_N$_defaultCacheMode": 0, "_isTrimmedMode": true,
"_N$timeScale": 1, "_atlas": null,
"_N$debugBones": false, "_id": "3crB2UVtJDL5iR88caaxi5"
"_N$enableBatch": false, },
"_id": "66t644bDFDb73XispqPIHj" {
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 10
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "359axb3wRFnpR16d4pl6Xc",
"sync": false
},
{
"__type__": "28e11HTXPtGa7wWg93PflND",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
},
"_enabled": true,
"_id": "42XWQfk9tE94NY0efe9K5z"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 17,
"_left": 0,
"_right": 0,
"_top": 100,
"_bottom": 100,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "55RxCZdFRM57g/M/UMg8IZ"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 10
},
"asset": {
"__uuid__": "a1cb871b-6ef5-410e-802f-f3a1c2d185e9"
},
"fileId": "",
"sync": false
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
...@@ -482,13 +1521,13 @@ ...@@ -482,13 +1521,13 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 11 "__id__": 40
}, },
{ {
"__id__": 26 "__id__": 55
}, },
{ {
"__id__": 29 "__id__": 58
} }
], ],
"_active": false, "_active": false,
...@@ -546,29 +1585,29 @@ ...@@ -546,29 +1585,29 @@
"_name": "img", "_name": "img",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 10 "__id__": 39
}, },
"_children": [ "_children": [
{ {
"__id__": 12 "__id__": 41
}, },
{ {
"__id__": 14 "__id__": 43
}, },
{ {
"__id__": 16 "__id__": 45
}, },
{ {
"__id__": 18 "__id__": 47
}, },
{ {
"__id__": 20 "__id__": 49
}, },
{ {
"__id__": 22 "__id__": 51
}, },
{ {
"__id__": 24 "__id__": 53
} }
], ],
"_active": true, "_active": true,
...@@ -626,13 +1665,13 @@ ...@@ -626,13 +1665,13 @@
"_name": "go_1", "_name": "go_1",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 11 "__id__": 40
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 13 "__id__": 42
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -688,7 +1727,7 @@ ...@@ -688,7 +1727,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 12 "__id__": 41
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -716,13 +1755,13 @@ ...@@ -716,13 +1755,13 @@
"_name": "black", "_name": "black",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 11 "__id__": 40
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 15 "__id__": 44
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -778,7 +1817,7 @@ ...@@ -778,7 +1817,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 14 "__id__": 43
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -806,13 +1845,13 @@ ...@@ -806,13 +1845,13 @@
"_name": "go_3", "_name": "go_3",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 11 "__id__": 40
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 17 "__id__": 46
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -868,7 +1907,7 @@ ...@@ -868,7 +1907,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 16 "__id__": 45
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -896,13 +1935,13 @@ ...@@ -896,13 +1935,13 @@
"_name": "go_2", "_name": "go_2",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 11 "__id__": 40
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 19 "__id__": 48
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -958,7 +1997,7 @@ ...@@ -958,7 +1997,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 18 "__id__": 47
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -986,13 +2025,13 @@ ...@@ -986,13 +2025,13 @@
"_name": "start_title", "_name": "start_title",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 11 "__id__": 40
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 21 "__id__": 50
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1048,7 +2087,7 @@ ...@@ -1048,7 +2087,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 20 "__id__": 49
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -1076,13 +2115,13 @@ ...@@ -1076,13 +2115,13 @@
"_name": "go_0", "_name": "go_0",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 11 "__id__": 40
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 23 "__id__": 52
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1138,7 +2177,7 @@ ...@@ -1138,7 +2177,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 22 "__id__": 51
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -1166,13 +2205,13 @@ ...@@ -1166,13 +2205,13 @@
"_name": "light", "_name": "light",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 11 "__id__": 40
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 25 "__id__": 54
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1228,7 +2267,7 @@ ...@@ -1228,7 +2267,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 24 "__id__": 53
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -1256,11 +2295,11 @@ ...@@ -1256,11 +2295,11 @@
"_name": "font", "_name": "font",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 10 "__id__": 39
}, },
"_children": [ "_children": [
{ {
"__id__": 27 "__id__": 56
} }
], ],
"_active": true, "_active": true,
...@@ -1318,13 +2357,13 @@ ...@@ -1318,13 +2357,13 @@
"_name": "GOTHICB_1", "_name": "GOTHICB_1",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 26 "__id__": 55
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 28 "__id__": 57
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1380,7 +2419,7 @@ ...@@ -1380,7 +2419,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 27 "__id__": 56
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -1415,17 +2454,17 @@ ...@@ -1415,17 +2454,17 @@
"_name": "audio", "_name": "audio",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 10 "__id__": 39
}, },
"_children": [ "_children": [
{ {
"__id__": 30 "__id__": 59
}, },
{ {
"__id__": 32 "__id__": 61
}, },
{ {
"__id__": 34 "__id__": 63
} }
], ],
"_active": true, "_active": true,
...@@ -1483,13 +2522,13 @@ ...@@ -1483,13 +2522,13 @@
"_name": "goodjob", "_name": "goodjob",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 29 "__id__": 58
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 31 "__id__": 60
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1545,7 +2584,7 @@ ...@@ -1545,7 +2584,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 30 "__id__": 59
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -1564,13 +2603,13 @@ ...@@ -1564,13 +2603,13 @@
"_name": "ready", "_name": "ready",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 29 "__id__": 58
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 33 "__id__": 62
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1626,7 +2665,7 @@ ...@@ -1626,7 +2665,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 32 "__id__": 61
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -1645,13 +2684,13 @@ ...@@ -1645,13 +2684,13 @@
"_name": "go", "_name": "go",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 29 "__id__": 58
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 35 "__id__": 64
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1707,7 +2746,7 @@ ...@@ -1707,7 +2746,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 34 "__id__": 63
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -1775,6 +2814,9 @@ ...@@ -1775,6 +2814,9 @@
"_enabled": true, "_enabled": true,
"baseWidth": 1280, "baseWidth": 1280,
"baseHeight": 940, "baseHeight": 940,
"_id": "bf/vzovXRMI6/uFQ1Gtl23" "videoControlBar": {
"__id__": 10
},
"_id": "7akLvWOt5IlbhsZJIcu0P1"
} }
] ]
\ No newline at end of file
...@@ -6,7 +6,28 @@ ...@@ -6,7 +6,28 @@
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
// import { getSprNode } from "./util"; // import { getSprNode } from "./util";
import { onHomeworkFinish, getSprNode, playAudioByUrl, getScaleRateBy2Node, localPosTolocalPos, randomSortByArr, loadDragonBones, playAudio, showTrebleFirework, delayCall, removeFromArr, showBtnAnima, asyncDelay, jellyShake, showLog, formatTime, getSpriteFrimeByUrl, RandomInt, exchangeNodePos, getSprNodeByUrl } from "../script/util"; import {
onHomeworkFinish,
getSprNode,
playAudioByUrl,
getScaleRateBy2Node,
localPosTolocalPos,
randomSortByArr,
loadDragonBones,
playAudio,
showTrebleFirework,
delayCall,
removeFromArr,
showBtnAnima,
asyncDelay,
jellyShake,
showLog,
formatTime,
getSpriteFrimeByUrl,
RandomInt,
exchangeNodePos,
getSprNodeByUrl,
} from "../script/util";
cc.Class({ cc.Class({
extends: cc.Component, extends: cc.Component,
...@@ -14,11 +35,15 @@ cc.Class({ ...@@ -14,11 +35,15 @@ cc.Class({
properties: { properties: {
baseWidth: { baseWidth: {
default: 1280, default: 1280,
type: cc.Integer type: cc.Integer,
}, },
baseHeight: { baseHeight: {
default: 940, default: 940,
type: cc.Integer type: cc.Integer,
},
videoControlBar: {
default: null,
type: cc.Node
} }
}, },
...@@ -34,8 +59,6 @@ cc.Class({ ...@@ -34,8 +59,6 @@ cc.Class({
this._animaResList = []; this._animaResList = [];
}, },
_designSize: null, _designSize: null,
_frameSize: null, _frameSize: null,
_mapScaleMin: null, _mapScaleMin: null,
...@@ -43,15 +66,16 @@ cc.Class({ ...@@ -43,15 +66,16 @@ cc.Class({
_cocosScale: null, _cocosScale: null,
canvas: null, canvas: null,
initSize() { initSize() {
// 注意cc.winSize只有在适配后(修改fitHeight/fitWidth后)才能获取到正确的值,因此使用cc.getFrameSize()来获取初始的屏幕大小 // 注意cc.winSize只有在适配后(修改fitHeight/fitWidth后)才能获取到正确的值,因此使用cc.getFrameSize()来获取初始的屏幕大小
let screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height let screen_size =
let design_size = cc.Canvas.instance.designResolution.width / cc.Canvas.instance.designResolution.height cc.view.getFrameSize().width / cc.view.getFrameSize().height;
let f = screen_size >= design_size let design_size =
cc.Canvas.instance.designResolution.width /
cc.Canvas.instance.designResolution.height;
let f = screen_size >= design_size;
cc.Canvas.instance.fitHeight = f cc.Canvas.instance.fitHeight = f;
cc.Canvas.instance.fitWidth = !f cc.Canvas.instance.fitWidth = !f;
const frameSize = cc.view.getFrameSize(); const frameSize = cc.view.getFrameSize();
this._frameSize = frameSize; this._frameSize = frameSize;
...@@ -67,8 +91,7 @@ cc.Class({ ...@@ -67,8 +91,7 @@ cc.Class({
this._mapScaleMin = Math.min(sx, sy) * this._cocosScale; this._mapScaleMin = Math.min(sx, sy) * this._cocosScale;
this._mapScaleMax = Math.max(sx, sy) * this._cocosScale; this._mapScaleMax = Math.max(sx, sy) * this._cocosScale;
this.canvas = cc.find('Canvas'); this.canvas = cc.find("Canvas");
// cc.log('cc.Canvas: ', cc.Canvas); // cc.log('cc.Canvas: ', cc.Canvas);
}, },
...@@ -76,8 +99,7 @@ cc.Class({ ...@@ -76,8 +99,7 @@ cc.Class({
isTeacher: null, isTeacher: null,
serverAllUser: null, serverAllUser: null,
start() { start() {
const nextBtn = cc.find("middleLayer/BtnRight");
const nextBtn = cc.find('middleLayer/BtnRight');
if (nextBtn) { if (nextBtn) {
nextBtn.active = false; nextBtn.active = false;
} }
...@@ -87,25 +109,23 @@ cc.Class({ ...@@ -87,25 +109,23 @@ cc.Class({
getData = window.courseware.getData; getData = window.courseware.getData;
} }
getData((data, aspect) => { getData((data, aspect) => {
if (window["air"]?.airClassInfo?.user?.classRole == "tea") {
if (window['air']?.airClassInfo?.user?.classRole == 'tea') {
this.isTeacher = true; this.isTeacher = true;
} }
if (aspect) { if (aspect) {
console.log('aspect : ', aspect); console.log("aspect : ", aspect);
this.serverAllUser = aspect.all_user; this.serverAllUser = aspect.all_user;
this.initPageData(aspect); this.initPageData(aspect);
} }
// this.initPageData({}); // this.initPageData({});
this.data = data || this.getDefaultData(); this.data = data || this.getDefaultData();
console.log('data:', this.data); console.log("data:", this.data);
console.log('dataStr:', JSON.stringify(this.data)); console.log("dataStr:", JSON.stringify(this.data));
this.preloadItem() this.preloadItem();
}) });
}, },
// 用于存储公共数据 当翻页时清空 // 用于存储公共数据 当翻页时清空
...@@ -117,16 +137,12 @@ cc.Class({ ...@@ -117,16 +137,12 @@ cc.Class({
} else { } else {
this.pageData = JSON.parse(pageDataStr); this.pageData = JSON.parse(pageDataStr);
} }
console.log('this.pageData: ', this.pageData); console.log("this.pageData: ", this.pageData);
}, },
setPageData(key, value, isSend = true) { setPageData(key, value, isSend = true) {
if (this.pageData) { if (this.pageData) {
console.log("this.pageData: ", this.pageData);
console.log('this.pageData: ', this.pageData);
this.pageData[key] = value; this.pageData[key] = value;
if (isSend) { if (isSend) {
...@@ -142,13 +158,12 @@ cc.Class({ ...@@ -142,13 +158,12 @@ cc.Class({
}, },
sendPageData() { sendPageData() {
const data = this.pageData; const data = this.pageData;
if (window && window.courseware) { if (window && window.courseware) {
let storePageAspect = window.courseware.storePageAspect; let storePageAspect = window.courseware.storePageAspect;
if (storePageAspect) { if (storePageAspect) {
storePageAspect(data); storePageAspect(data);
console.log('storePageAspect : ', data); console.log("storePageAspect : ", data);
} }
} }
}, },
...@@ -165,13 +180,13 @@ cc.Class({ ...@@ -165,13 +180,13 @@ cc.Class({
getData(func) { getData(func) {
if (window && window.courseware) { if (window && window.courseware) {
window.courseware.getData(func, 'ak_08'); window.courseware.getData(func, "ak_08");
return; return;
} }
const middleLayer = cc.find('middleLayer'); const middleLayer = cc.find("middleLayer");
if (middleLayer) { if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer'); const middleLayerComponent = middleLayer.getComponent("middleLayer");
middleLayerComponent.getData(func); middleLayerComponent.getData(func);
return; return;
} }
...@@ -180,13 +195,74 @@ cc.Class({ ...@@ -180,13 +195,74 @@ cc.Class({
}, },
getDefaultData() { getDefaultData() {
return {
return {"quesArr":[{"itemType":"jump","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/50fe1264135d63c082fa6fb9b7c9dbc2.png","rect":{"x":10.61,"y":0,"width":1201.78,"height":676}},"hotZoneItemArr":[{"id":"1666086880680","index":0,"itemType":"rect","fontScale":0.95546875,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.95546875,"dragDot":{"x":611.5,"y":337.9992270947921},"gIdx":"0","posX":344.2576312800029,"posY":542.6844069496866,"rect":{"x":204.9,"y":261.35,"width":266.77,"height":408.16}}],"ques_start":"0","ques_end":"3"},{"itemType":"jump","ques_start":"3","ques_end":"7","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/50fe1264135d63c082fa6fb9b7c9dbc2.png","rect":{"x":10.61,"y":0,"width":1201.78,"height":676}},"hotZoneItemArr":[{"id":"1666160708755","index":0,"itemType":"rect","fontScale":0.95546875,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.95546875,"dragDot":{"x":611.5,"y":338.0006033081422},"gIdx":"0","posX":821.5,"posY":559,"rect":{"x":653.46,"y":304.59,"width":307.57,"height":353.75}}]}],"video_url":"http://staging-teach.cdn.ireadabc.com/6c03006397a8309aa510210322ae1572.mp4","videoType":"1920_1080"} // jumpTime: '4',
// isDebug: true,
quesArr: [
{
itemType: "jump",
bgItem: {
url: "http://staging-teach.cdn.ireadabc.com/50fe1264135d63c082fa6fb9b7c9dbc2.png",
rect: { x: 10.61, y: 0, width: 1201.78, height: 676 },
},
hotZoneItemArr: [
{
id: "1666086880680",
index: 0,
itemType: "rect",
fontScale: 0.95546875,
imgScale: 1,
imgSizeW: 0,
imgSizeH: 0,
mapScale: 0.95546875,
dragDot: { x: 611.5, y: 337.9992270947921 },
gIdx: "0",
posX: 344.2576312800029,
posY: 542.6844069496866,
rect: { x: 204.9, y: 261.35, width: 266.77, height: 408.16 },
},
],
ques_start: "0",
ques_end: "3",
},
{
itemType: "jump",
ques_start: "3",
ques_end: "7",
bgItem: {
url: "http://staging-teach.cdn.ireadabc.com/50fe1264135d63c082fa6fb9b7c9dbc2.png",
rect: { x: 10.61, y: 0, width: 1201.78, height: 676 },
},
hotZoneItemArr: [
{
id: "1666160708755",
index: 0,
itemType: "rect",
fontScale: 0.95546875,
imgScale: 1,
imgSizeW: 0,
imgSizeH: 0,
mapScale: 0.95546875,
dragDot: { x: 611.5, y: 338.0006033081422 },
gIdx: "0",
posX: 821.5,
posY: 559,
rect: { x: 653.46, y: 304.59, width: 307.57, height: 353.75 },
},
],
},
],
video_url:
"http://staging-teach.cdn.ireadabc.com/6c03006397a8309aa510210322ae1572.mp4",
videoType: "1920_1080",
};
}, },
preload() { preload() {
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList); const preloadArr = this._imageResList
console.log('preloadArr: ', JSON.stringify( preloadArr) ); .concat(this._audioResList)
.concat(this._animaResList);
console.log("preloadArr: ", JSON.stringify(preloadArr));
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => { cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
// console.log(' preload data, ', data); // console.log(' preload data, ', data);
...@@ -200,7 +276,6 @@ cc.Class({ ...@@ -200,7 +276,6 @@ cc.Class({
}, },
addPreloadImage() { addPreloadImage() {
const quesArr = this.data.quesArr; const quesArr = this.data.quesArr;
if (!quesArr || quesArr.length == 0) { if (!quesArr || quesArr.length == 0) {
return; return;
...@@ -213,21 +288,17 @@ cc.Class({ ...@@ -213,21 +288,17 @@ cc.Class({
this._imageResList.push({ url: item.bgItem.url }); this._imageResList.push({ url: item.bgItem.url });
} }
if (!item.hotZoneItemArr) { if (!item.hotZoneItemArr) {
continue; continue;
} }
item.hotZoneItemArr.forEach((value) => { item.hotZoneItemArr.forEach((value) => {
this._imageResList.push({ url: value.pic_url | '' }); this._imageResList.push({ url: value.pic_url | "" });
this._imageResList.push({ url: value.pic2_url | '' }); this._imageResList.push({ url: value.pic2_url | "" });
}) });
} }
}, },
addPreloadAudio(callback) { addPreloadAudio(callback) {
const url1 = this.data.video_url; const url1 = this.data.video_url;
if (!url1) { if (!url1) {
callback(); callback();
...@@ -235,13 +306,12 @@ cc.Class({ ...@@ -235,13 +306,12 @@ cc.Class({
} }
this.getVideoUrl((url) => { this.getVideoUrl((url) => {
console.log("url: ", url);
console.log('url: ', url);
this.data.video_url = url; this.data.video_url = url;
this._audioResList.push({ url: url || '' }); this._audioResList.push({ url: url || "" });
callback(); callback();
}) });
}, },
addPreloadAnima() { addPreloadAnima() {
...@@ -257,11 +327,8 @@ cc.Class({ ...@@ -257,11 +327,8 @@ cc.Class({
// }) // })
}, },
loadEnd(cb) { loadEnd(cb) {
console.log(" in loadEnd ");
console.log(' in loadEnd ')
if (this.isDestroy) { if (this.isDestroy) {
return; return;
} }
...@@ -274,50 +341,38 @@ cc.Class({ ...@@ -274,50 +341,38 @@ cc.Class({
// cb(); // cb();
// return; // return;
this.initData(); this.initData();
this.initMask(); this.initMask();
this.getState(() => { this.getState(() => {
if (window && window["air"]) {
window["air"].hideAirClassLoading(); window["air"].hideAirClassLoading();
}
this.initView(); this.initView();
this.initListener(); this.initListener();
cb(); cb();
}) });
}, },
isFirst: null,
isFirst : null, isLast: null,
isLast : null, playTimes: null,
playTimes : null, jumpData: null,
jumpData : null,
getState(cb) { getState(cb) {
this.isFirst = this.checkIsFirst(); // data.first; //this.checkIsFirst(); this.isFirst = this.checkIsFirst(); // data.first; //this.checkIsFirst();
this.isLast = this.checkIsLast(); // data.last // this.checkIsLast(); this.isLast = this.checkIsLast(); // data.last // this.checkIsLast();
this.playTimes = this.checkPlayTimes(); // data.playTime// this.checkPlayTimes(); this.playTimes = this.checkPlayTimes(); // data.playTime// this.checkPlayTimes();
this.jumpData = this.getJumpData(); //data.saveData // this.getJumpData(); this.jumpData = this.getJumpData(); //data.saveData // this.getJumpData();
cb() cb();
return; return;
console.log(' in getState 1'); console.log(" in getState 1");
callMiddleLayerFunction('PSQS_get_course_info', {}, (data) => { callMiddleLayerFunction("PSQS_get_course_info", {}, (data) => {
console.log(" in getState 2");
console.log(' in getState 2');
this.isFirst = this.checkIsFirst(); // data.first; //this.checkIsFirst(); this.isFirst = this.checkIsFirst(); // data.first; //this.checkIsFirst();
this.isLast = this.checkIsLast(); // data.last // this.checkIsLast(); this.isLast = this.checkIsLast(); // data.last // this.checkIsLast();
...@@ -329,30 +384,28 @@ cc.Class({ ...@@ -329,30 +384,28 @@ cc.Class({
} }
cb && cb(); cb && cb();
}) });
}, },
checkIsFirst() {
checkIsFirst() {
return false; return false;
}, },
checkIsLast() { checkIsLast() {
return false; return false;
}, },
checkPlayTimes() { checkPlayTimes() {
return 1; return 1;
}, },
getJumpData() { getJumpData() {
return //{step: 1}; return; //{step: 1};
}, },
maskSpr: null, maskSpr: null,
initMask() { initMask() {
const mask = getSprNode('black'); const mask = getSprNode("black");
const sx = this.canvas.width / mask.width; const sx = this.canvas.width / mask.width;
const sy = this.canvas.height / mask.height; const sy = this.canvas.height / mask.height;
mask.scaleX = sx; mask.scaleX = sx;
...@@ -360,10 +413,7 @@ initMask() { ...@@ -360,10 +413,7 @@ initMask() {
mask.opacity = 255; mask.opacity = 255;
this.canvas.addChild(mask, 21); this.canvas.addChild(mask, 21);
this.maskSpr = mask; this.maskSpr = mask;
}, },
initMusic() { initMusic() {
cc.assetManager.loadRemote(this.data.bg_audio_url, (err, clip) => { cc.assetManager.loadRemote(this.data.bg_audio_url, (err, clip) => {
...@@ -372,7 +422,6 @@ initMask() { ...@@ -372,7 +422,6 @@ initMask() {
}); });
}, },
isDebug: null, isDebug: null,
treeType: null, treeType: null,
...@@ -396,88 +445,79 @@ initMask() { ...@@ -396,88 +445,79 @@ initMask() {
isLocal: null, isLocal: null,
initData() { initData() {
this.isLocal = true; this.isLocal = true;
this.quesIndex = 0; this.quesIndex = 0;
this.curEndTime = -1; this.curEndTime = -1;
this.dragEndRectArr = []; this.dragEndRectArr = [];
if (this.data.jumpTime) { if (this.data.jumpTime) {
this.jumpTime = Number(this.data.jumpTime); this.jumpTime = Number(this.data.jumpTime);
} }
this.initAudioEffect(); this.initAudioEffect();
}, },
resetQuesIndex() { setProgressBarMarkPoints() {
let points = [];
for(let i=0;i<this.data.quesArr.length;i++) {
const endTime = Number(this.data.quesArr[i].ques_end)
points.push(endTime / this.videoDuration)
}
this.videoControlBar.emit("set_mark_points", points)
},
resetQuesIndex(jumpTime) {
this.quesIndex = -1; this.quesIndex = -1;
for (let i = 0; i < this.data.quesArr.length; i++) {
for (let i=0; i<this.data.quesArr.length; i++) { const startTime = this.data.quesArr[i].ques_start;
const checkTime = this.data.quesArr[i].ques_start; const endTime = this.data.quesArr[i].ques_end;
if (Number(this.jumpTime) >= Number(checkTime)) { if (Number(jumpTime) >= Number(startTime) && Number(jumpTime) < Number(endTime)) {
this.quesIndex = i; this.quesIndex = i;
} else { // console.log("重定位题号:",this.quesIndex)
return;
} }
} }
}, },
audioGoodjob: null, audioGoodjob: null,
audioTryagain: null, audioTryagain: null,
readyClip: null, readyClip: null,
goClip: null, goClip: null,
goodjobClip: null, goodjobClip: null,
initAudioEffect() { initAudioEffect() {
const audioNode = cc.find("Canvas/res/audio");
const audioNode = cc.find('Canvas/res/audio');
const getAudioByResName = (resName) => { const getAudioByResName = (resName) => {
return audioNode.getChildByName(resName).getComponent(cc.AudioSource).clip; return audioNode.getChildByName(resName).getComponent(cc.AudioSource)
} .clip;
};
// this.audioGoodjob = getAudioByResName('goodjob'); // this.audioGoodjob = getAudioByResName('goodjob');
// this.audioTryagain = getAudioByResName('tryagain'); // this.audioTryagain = getAudioByResName('tryagain');
this.readyClip = getAudioByResName('ready'); this.readyClip = getAudioByResName("ready");
this.goClip = getAudioByResName('go'); this.goClip = getAudioByResName("go");
this.goodjobClip = getAudioByResName('goodjob'); this.goodjobClip = getAudioByResName("goodjob");
}, },
sendServerEvent(key, data) { sendServerEvent(key, data) {
const c = window.courseware; const c = window.courseware;
if (c) { if (c) {
c.sendEvent(key, data); c.sendEvent(key, data);
} }
}, },
addServerListener() { addServerListener() {
console.log(" in addServerListener");
console.log(' in addServerListener');
const c = window.courseware; const c = window.courseware;
this.loadEnd();
if (!c) { if (!c) {
return; return;
} }
if (!window.air) { if (!window.air) {
console.log(' window air err !!!!!!!!') console.log(" window air err !!!!!!!!");
return; return;
} }
...@@ -487,60 +527,44 @@ initMask() { ...@@ -487,60 +527,44 @@ initMask() {
this.loadEnd(() => { this.loadEnd(() => {
next(); next();
}); });
} };
}, },
initView() { initView() {
console.log(" in initView");
console.log( ' in initView')
this.hideMask(); this.hideMask();
this.initVideo(); this.initVideo();
this.initHand(); this.initHand();
this.initHotZone(); this.initHotZone();
}, },
initHand() { initHand() {
this.hand = cc.find("Canvas/hand"); this.hand = cc.find("Canvas/hand");
this.hand.active = false; this.hand.active = false;
}, },
initStartView() { initStartView() {
this.showStartLight(); this.showStartLight();
if (this.playTimes > 0) { if (this.playTimes > 0) {
this.showStartTitleGo(); this.showStartTitleGo();
} else { } else {
this.showStartTitleReady(); this.showStartTitleReady();
} }
}, },
lightBg: null,
lightLeft: null,
lightRight: null,
showStartLight() {
const lightBg = getSprNode('black'); lightBg: null,
lightLeft: null,
lightRight: null,
showStartLight() {
const lightBg = getSprNode("black");
lightBg.scaleX = this.canvas.width / lightBg.width; lightBg.scaleX = this.canvas.width / lightBg.width;
lightBg.scaleY = this.canvas.height / lightBg.height; lightBg.scaleY = this.canvas.height / lightBg.height;
lightBg.opacity = 180; lightBg.opacity = 180;
this.canvas.addChild(lightBg, 10); this.canvas.addChild(lightBg, 10);
const lightLeft = getSprNode("light");
const lightLeft = getSprNode('light');
lightLeft.anchorY = 0.9; lightLeft.anchorY = 0.9;
lightLeft.x = -this.canvas.width / 2; lightLeft.x = -this.canvas.width / 2;
lightLeft.y = this.canvas.height / 2; lightLeft.y = this.canvas.height / 2;
...@@ -550,13 +574,11 @@ showStartLight() { ...@@ -550,13 +574,11 @@ showStartLight() {
lightLeft.rotation = 45; lightLeft.rotation = 45;
lightLeft.opacity = 0; lightLeft.opacity = 0;
cc.tween(lightLeft) cc.tween(lightLeft)
.to(1, {rotation: -45}, {easing: "cubicOut"}) .to(1, { rotation: -45 }, { easing: "cubicOut" })
.start();
cc.tween(lightLeft)
.to(0.5, {opacity: 255})
.start(); .start();
cc.tween(lightLeft).to(0.5, { opacity: 255 }).start();
const lightRight = getSprNode('light'); const lightRight = getSprNode("light");
lightRight.anchorY = 0.9; lightRight.anchorY = 0.9;
lightRight.x = this.canvas.width / 2; lightRight.x = this.canvas.width / 2;
lightRight.y = this.canvas.height / 2; lightRight.y = this.canvas.height / 2;
...@@ -566,23 +588,18 @@ showStartLight() { ...@@ -566,23 +588,18 @@ showStartLight() {
lightRight.rotation = -45; lightRight.rotation = -45;
lightRight.opacity = 0; lightRight.opacity = 0;
cc.tween(lightRight) cc.tween(lightRight)
.to(1, {rotation: 45}, {easing: "cubicOut"}) .to(1, { rotation: 45 }, { easing: "cubicOut" })
.start();
cc.tween(lightRight)
.to(0.5, {opacity: 255})
.start(); .start();
cc.tween(lightRight).to(0.5, { opacity: 255 }).start();
this.lightBg = lightBg; this.lightBg = lightBg;
this.lightLeft = lightLeft; this.lightLeft = lightLeft;
this.lightRight = lightRight; this.lightRight = lightRight;
}, },
title: null, title: null,
showStartTitleReady() { showStartTitleReady() {
const title = getSprNode('start_title'); const title = getSprNode("start_title");
title.scale = this._mapScaleMin; title.scale = this._mapScaleMin;
title.y = this.canvas.height / 2 + title.height * title.scaleY; title.y = this.canvas.height / 2 + title.height * title.scaleY;
title.parent = this.canvas; title.parent = this.canvas;
...@@ -591,29 +608,26 @@ showStartLight() { ...@@ -591,29 +608,26 @@ showStartLight() {
cc.tween(title) cc.tween(title)
.delay(0.3) .delay(0.3)
.call(() => { .call(() => {
playAudio(this.readyClip, (() => { playAudio(this.readyClip, () => {
this.startAudioEnd(); this.startAudioEnd();
})); });
}) })
.to(1.5, {y: 0}, {easing: "elasticOut"}) .to(1.5, { y: 0 }, { easing: "elasticOut" })
.start(); .start();
this.title = title this.title = title;
}, },
async showStartTitleGo() { async showStartTitleGo() {
const title = new cc.Node(); const title = new cc.Node();
title.parent = this.canvas; title.parent = this.canvas;
title.zIndex = 11; title.zIndex = 11;
title.scale = this._mapScaleMin; title.scale = this._mapScaleMin;
this.title = title this.title = title;
playAudio(this.goClip, (() => { playAudio(this.goClip, () => {
this.startAudioEnd(); this.startAudioEnd();
})); });
const popNum = (name, time = 1) => { const popNum = (name, time = 1) => {
const sprNode = getSprNode(name); const sprNode = getSprNode(name);
...@@ -622,28 +636,26 @@ showStartLight() { ...@@ -622,28 +636,26 @@ showStartLight() {
sprNode.opacity = 0; sprNode.opacity = 0;
cc.tween(sprNode) cc.tween(sprNode)
.to(time/10, {opacity: 255}) .to(time / 10, { opacity: 255 })
.start(); .start();
cc.tween(sprNode) cc.tween(sprNode)
.to(0.8 * time, {scale: this._mapScaleMin}, {easing: 'elasticOut'}) .to(0.8 * time, { scale: this._mapScaleMin }, { easing: "elasticOut" })
.delay(0 * time) .delay(0 * time)
.to(0.2 * time, {opacity: 0}) .to(0.2 * time, { opacity: 0 })
.start(); .start();
} };
await asyncDelay(2.2); await asyncDelay(2.2);
popNum('go_1', 0.7); popNum("go_1", 0.7);
await asyncDelay(0.7); await asyncDelay(0.7);
popNum('go_2', 0.7); popNum("go_2", 0.7);
await asyncDelay(0.7); await asyncDelay(0.7);
popNum('go_3', 0.7); popNum("go_3", 0.7);
await asyncDelay(0.7); await asyncDelay(0.7);
popNum('go_0'); popNum("go_0");
await asyncDelay(1); await asyncDelay(1);
}, },
isDestroy: null, isDestroy: null,
...@@ -655,56 +667,49 @@ showStartLight() { ...@@ -655,56 +667,49 @@ showStartLight() {
}, },
async hideStartView() { async hideStartView() {
const hideSpr = (sprNode, cb=null) => { const hideSpr = (sprNode, cb = null) => {
cc.tween(sprNode) cc.tween(sprNode)
.to(0.3, {opacity: 0}) .to(0.3, { opacity: 0 })
.call(() => { .call(() => {
sprNode.active = false; sprNode.active = false;
cb && cb(); cb && cb();
}) })
.start(); .start();
} };
hideSpr(this.lightLeft); hideSpr(this.lightLeft);
hideSpr(this.lightRight); hideSpr(this.lightRight);
hideSpr(this.title); hideSpr(this.title);
await asyncDelay(0.2) await asyncDelay(0.2);
hideSpr(this.lightBg, () => { hideSpr(this.lightBg, () => {
if (this.isDestroy) { if (this.isDestroy) {
return; return;
} }
this.startQuesVideo(); this.startQuesVideo();
}); });
}, },
serverStartTest(text) { serverStartTest(text) {
console.log(" in serverStartTest: ", text);
console.log(' in serverStartTest: ', text); const cw = window?.courseware;
const cw = window?.courseware
if (cw) { if (cw) {
if (this.curQues.isKK && this.curQues.KKText) { if (this.curQues.isKK && this.curQues.KKText) {
cw.startTest(text, {"pronounce": this.curQues.KKText}); cw.startTest(text, { pronounce: this.curQues.KKText });
} else { } else {
cw.startTest(text); cw.startTest(text);
} }
} }
this.addMask(); this.addMask();
}, },
hideMask(cb = null) { hideMask(cb = null) {
const mask = this.maskSpr; const mask = this.maskSpr;
mask.opacity = 255; mask.opacity = 255;
cc.tween(mask) cc.tween(mask)
.to(0.2, {opacity: 0}, {easing: "sineOut"}) .to(0.2, { opacity: 0 }, { easing: "sineOut" })
.call(() => { .call(() => {
// mask.active = false; // mask.active = false;
cb && cb(); cb && cb();
...@@ -713,29 +718,22 @@ showStartLight() { ...@@ -713,29 +718,22 @@ showStartLight() {
}, },
serverStopTest(item) { serverStopTest(item) {
const cw = window?.courseware;
const cw = window?.courseware
if (cw) { if (cw) {
cw.stopTest(data => { cw.stopTest((data) => {
console.log('stopTest data: ', data); console.log("stopTest data: ", data);
if (data && typeof (data) == 'string') { if (data && typeof data == "string") {
console.log(JSON.parse(data)); console.log(JSON.parse(data));
data = JSON.parse(data) data = JSON.parse(data);
} }
this.setRecordItemAudio(data, item); this.setRecordItemAudio(data, item);
}); });
} }
}, },
setRecordItemAudio(data, item) { setRecordItemAudio(data, item) {
if (!data) { if (!data) {
return; return;
} }
...@@ -743,23 +741,21 @@ showStartLight() { ...@@ -743,23 +741,21 @@ showStartLight() {
const audioUrl = data.audioUrl; const audioUrl = data.audioUrl;
item.audioUrl = audioUrl; item.audioUrl = audioUrl;
const overall = data.result?.overall; const overall = data.result?.overall;
const integrity = data.result?.integrity; const integrity = data.result?.integrity;
const score = integrity * 0.1 + overall * 0.9; //data.result?.overall; const score = integrity * 0.1 + overall * 0.9; //data.result?.overall;
// item.score = score; // item.score = score;
console.log('overall is : ', overall); console.log("overall is : ", overall);
console.log('integrity is : ', integrity); console.log("integrity is : ", integrity);
console.log('score is : ', score); console.log("score is : ", score);
item.score = score; item.score = score;
console.log(" score: ", score);
console.log(' score: ', score);
this.hideMask(); this.hideMask();
this.video.pause(); this.video.pause();
this.videoControlBar.emit("update_video_status", 0);
this.wrongTimes++; this.wrongTimes++;
...@@ -772,16 +768,9 @@ showStartLight() { ...@@ -772,16 +768,9 @@ showStartLight() {
this.startWrongVideo(); this.startWrongVideo();
} }
} }
}, },
initVideo() { initVideo() {
// this.initQuesList(); // this.initQuesList();
this.initCurQues(); this.initCurQues();
...@@ -789,7 +778,6 @@ showStartLight() { ...@@ -789,7 +778,6 @@ showStartLight() {
this.initVideoRemote(); this.initVideoRemote();
// }) // })
// this.checkStart(); // this.checkStart();
}, },
getVideoUrl(callback) { getVideoUrl(callback) {
...@@ -797,20 +785,18 @@ showStartLight() { ...@@ -797,20 +785,18 @@ showStartLight() {
const url2 = url1.replace(/.mp4$/g, "_m.mp4"); const url2 = url1.replace(/.mp4$/g, "_m.mp4");
this.httpHeadCall(url2, (success) => { this.httpHeadCall(url2, (success) => {
if (success) { if (success) {
console.log('return url2: ', url2); console.log("return url2: ", url2);
callback(url2); callback(url2);
} else { } else {
console.log('return url1: ', url1); console.log("return url1: ", url1);
callback(url1); callback(url1);
} }
}) });
}, },
checkStart() { checkStart() {
console.log(" in checkStart ..", this.curQues);
console.log(' in checkStart ..', this.curQues);
const data = this.curQues; const data = this.curQues;
const videoNode = data?.videoObj?.ques_video; const videoNode = data?.videoObj?.ques_video;
...@@ -819,27 +805,27 @@ showStartLight() { ...@@ -819,27 +805,27 @@ showStartLight() {
} else { } else {
delayCall(0.2, () => { delayCall(0.2, () => {
this.checkStart(); this.checkStart();
}) });
} }
}, },
gameEnd() { gameEnd() {
console.log(' in gameEnd'); console.log(" in gameEnd");
this.showRestart(); this.showRestart();
const data = this.getHomeworkFinishData(); const data = this.getHomeworkFinishData();
console.log("homeworkData: ", JSON.stringify(data)); console.log("homeworkData: ", JSON.stringify(data));
onHomeworkFinish(data) onHomeworkFinish(data);
}, },
getHomeworkFinishData() { getHomeworkFinishData() {
const arr = this.data.quesArr; const arr = this.data.quesArr;
const result = [] const result = [];
for (let i=0; i<arr.length; i++) { for (let i = 0; i < arr.length; i++) {
const oneData = {}; const oneData = {};
oneData.type = arr[i].itemType; oneData.type = arr[i].itemType;
if (oneData.type == 'sound') { if (oneData.type == "sound") {
oneData.word = arr[i].text; oneData.word = arr[i].text;
oneData.audio_url = arr[i].audioUrl; oneData.audio_url = arr[i].audioUrl;
oneData.score = arr[i].score; oneData.score = arr[i].score;
...@@ -850,9 +836,18 @@ showStartLight() { ...@@ -850,9 +836,18 @@ showStartLight() {
result.push(oneData); result.push(oneData);
} }
return {result}; return { result };
}, },
getCurrentQuesIndexByTime(curretnTime) {
let qIndex = -1;
for(let i=0; i<this.data.quesArr.length; i++) {
if(curretnTime>=Number(this.data.quesArr[i].ques_end)) {
qIndex = i;
}
}
return qIndex;
},
checkNextQues() { checkNextQues() {
this.quesIndex++; this.quesIndex++;
...@@ -865,12 +860,11 @@ showStartLight() { ...@@ -865,12 +860,11 @@ showStartLight() {
}, },
startQuesVideo(currentTime = null) { startQuesVideo(currentTime = null) {
console.log(' in startQuesVideo') console.log(" in startQuesVideo");
this.wrongTimes = 0; this.wrongTimes = 0;
const video = this.video; const video = this.video;
video.node.name = 'ques_video'; video.node.name = "ques_video";
console.log("this.curQues: ", this.curQues); console.log("this.curQues: ", this.curQues);
...@@ -880,9 +874,7 @@ showStartLight() { ...@@ -880,9 +874,7 @@ showStartLight() {
video.currentTime = Number(this.curQues.ques_start); video.currentTime = Number(this.curQues.ques_start);
} }
if (this.playTimes > 0) { if (this.playTimes > 0) {
if (this.curQues) { if (this.curQues) {
this.curEndTime = Number(this.curQues.ques_end); this.curEndTime = Number(this.curQues.ques_end);
} }
...@@ -890,13 +882,14 @@ showStartLight() { ...@@ -890,13 +882,14 @@ showStartLight() {
delayCall(0.01, () => { delayCall(0.01, () => {
video.play(); video.play();
}) this.videoControlBar.emit("update_video_status", 1);
});
}, },
isWaitingUserAction: false,
startWaitVideo() { startWaitVideo() {
console.log(' in startWaitVideo ') console.log(" in startWaitVideo ");
this.isWaitingUserAction = true;
this.curQues.hotZoneBg.active = true; this.curQues.hotZoneBg.active = true;
this.hand.active = true; this.hand.active = true;
...@@ -912,40 +905,46 @@ showStartLight() { ...@@ -912,40 +905,46 @@ showStartLight() {
// this.curVideo = video; // this.curVideo = video;
// this.resetVideoPos(videoNode); // this.resetVideoPos(videoNode);
const video = this.video; const video = this.video;
video.node.name = 'wait_video'; video.node.name = "wait_video";
video.currentTime = Number(this.curQues.wait_start); video.currentTime = Number(this.curQues.wait_start);
this.curEndTime = Number(this.curQues.wait_end); this.curEndTime = Number(this.curQues.wait_end);
delayCall(0.01, () => { delayCall(0.01, () => {
video.play(); video.play();
}) this.videoControlBar.emit("update_video_status", 1);
});
if (this.curQues.itemType == 'sound') { if (this.curQues.itemType == "sound") {
this.serverStartTest(this.curQues.text); this.serverStartTest(this.curQues.text);
delayCall(3, () => { delayCall(3, () => {
this.serverStopTest(this.curQues); this.serverStopTest(this.curQues);
}) });
} else { } else {
this.curQues.hotZoneBg.active = true; this.curQues.hotZoneBg.active = true;
} }
}, },
continueWaitVideo() {
console.log(' in continueWaitVideo ')
hideWaitingVideo() {
console.log(" in hiddeWaitVideo ");
this.isWaitingUserAction = false;
this.curQues.hotZoneBg.active = false;
this.hand.active = false;
},
continueWaitVideo() {
console.log(" in continueWaitVideo ");
this.video.currentTime = Number(this.curQues.wait_start); this.video.currentTime = Number(this.curQues.wait_start);
this.curEndTime = Number(this.curQues.wait_end); this.curEndTime = Number(this.curQues.wait_end);
delayCall(0.01, () => { delayCall(0.01, () => {
this.video.play(); this.video.play();
}) this.videoControlBar.emit("update_video_status", 1);
});
}, },
startRightVideo() { startRightVideo() {
console.log(' in startRightVideo ') console.log(" in startRightVideo ");
// const videoNode = this.curQues?.videoObj?.right_video; // const videoNode = this.curQues?.videoObj?.right_video;
// const video = videoNode.getComponent(cc.VideoPlayer); // const video = videoNode.getComponent(cc.VideoPlayer);
...@@ -955,20 +954,19 @@ showStartLight() { ...@@ -955,20 +954,19 @@ showStartLight() {
// this.curVideo = video; // this.curVideo = video;
// this.resetVideoPos(videoNode); // this.resetVideoPos(videoNode);
const video = this.video; const video = this.video;
video.node.name = 'right_video'; video.node.name = "right_video";
video.currentTime = Number(this.curQues.right_start); video.currentTime = Number(this.curQues.right_start);
this.curEndTime = Number(this.curQues.right_end); this.curEndTime = Number(this.curQues.right_end);
delayCall(0.01, () => { delayCall(0.01, () => {
video.play(); video.play();
}) this.videoControlBar.emit("update_video_status", 1);
});
}, },
startWrongVideo() { startWrongVideo() {
console.log(' in startWrongVideo ') console.log(" in startWrongVideo ");
// const videoNode = this.curQues?.videoObj?.wrong_video; // const videoNode = this.curQues?.videoObj?.wrong_video;
// const video = videoNode.getComponent(cc.VideoPlayer); // const video = videoNode.getComponent(cc.VideoPlayer);
...@@ -979,7 +977,7 @@ showStartLight() { ...@@ -979,7 +977,7 @@ showStartLight() {
// this.resetVideoPos(videoNode); // this.resetVideoPos(videoNode);
const video = this.video; const video = this.video;
video.node.name = 'wrong_video'; video.node.name = "wrong_video";
if (this.wrongStartTime && this.wrongEndTime) { if (this.wrongStartTime && this.wrongEndTime) {
video.currentTime = this.wrongStartTime; video.currentTime = this.wrongStartTime;
...@@ -991,11 +989,12 @@ showStartLight() { ...@@ -991,11 +989,12 @@ showStartLight() {
delayCall(0.01, () => { delayCall(0.01, () => {
video.play(); video.play();
}) this.videoControlBar.emit("update_video_status", 1);
});
}, },
startEndVideo() { startEndVideo() {
console.log(' in startEndVideo ') console.log(" in startEndVideo ");
// const videoNode = this.curQues?.videoObj?.end_video; // const videoNode = this.curQues?.videoObj?.end_video;
// const video = videoNode.getComponent(cc.VideoPlayer); // const video = videoNode.getComponent(cc.VideoPlayer);
...@@ -1010,14 +1009,14 @@ showStartLight() { ...@@ -1010,14 +1009,14 @@ showStartLight() {
return; return;
} }
const video = this.video; const video = this.video;
video.node.name = 'end_video'; video.node.name = "end_video";
video.currentTime = Number(this.curQues.end_start); video.currentTime = Number(this.curQues.end_start);
this.curEndTime = Number(this.curQues.end_end); this.curEndTime = Number(this.curQues.end_end);
delayCall(0.01, () => { delayCall(0.01, () => {
video.play(); video.play();
}) this.videoControlBar.emit("update_video_status", 1);
});
}, },
resetVideoPos(videoNode) { resetVideoPos(videoNode) {
...@@ -1033,31 +1032,29 @@ showStartLight() { ...@@ -1033,31 +1032,29 @@ showStartLight() {
}, },
initCurQues() { initCurQues() {
if(this.quesIndex >=0) {
this.curQues = this.data.quesArr[this.quesIndex]; this.curQues = this.data.quesArr[this.quesIndex];
console.log('this.data.quesArr: ', this.data.quesArr); console.log("curQues: ", this.curQues);
} else {
console.log('题目序号不能为负数');
}
}, },
videoDuration: null,
initVideoRemote() { initVideoRemote() {
const url = this.data.video_url; const url = this.data.video_url;
console.log(' in initVideoRemote url: ', url) console.log(" in initVideoRemote url: ", url);
const videoSizeW = 1920; const videoSizeW = 1920;
const videoSizeH = 1080; const videoSizeH = 1080;
const videoRemoteNode = new cc.Node(); const videoRemoteNode = new cc.Node();
videoRemoteNode.width = videoSizeW videoRemoteNode.width = videoSizeW;
videoRemoteNode.height = videoSizeH videoRemoteNode.height = videoSizeH;
videoRemoteNode.parent = this.canvas; videoRemoteNode.parent = this.canvas;
// videoRemoteNode.y = -this.canvas.height * 1.5; // videoRemoteNode.y = -this.canvas.height * 1.5;
videoRemoteNode.scale = this.canvas.height / videoSizeH; videoRemoteNode.scale = this.canvas.height / videoSizeH;
const video = videoRemoteNode.addComponent(cc.VideoPlayer); const video = videoRemoteNode.addComponent(cc.VideoPlayer);
...@@ -1069,60 +1066,51 @@ showStartLight() { ...@@ -1069,60 +1066,51 @@ showStartLight() {
this.video = video; this.video = video;
video.node.on("meta-loaded", (e) => {
video.node.on('meta-loaded', (e) => { console.log("meta-loaded e:", e);
console.log('meta-loaded e:', e); });
}) video.node.on("ready-to-play", async (e) => {
video.node.on('ready-to-play', async (e) => { console.log("e: ", e);
console.log('e: ', e);
if (this.isDestroy) { if (this.isDestroy) {
return; return;
} }
video.play(); video.play();
checkIsPlaying(); checkIsPlaying();
});
})
const checkIsPlaying = () => { const checkIsPlaying = () => {
delayCall(0.05, () => { delayCall(0.05, () => {
if (video.currentTime > 0) { if (video.currentTime > 0) {
video.node.isLoadEnd = true; video.node.isLoadEnd = true;
video.pause(); video.pause();
this.videoLoadEnd(); this.videoLoadEnd();
// this.startQuesVideo(); // this.startQuesVideo();
} else { } else {
checkIsPlaying(); checkIsPlaying();
} }
}) });
};
}
video.node.on('completed', () => { video.node.on("completed", () => {
console.log(' in completed!!!!'); console.log(" in completed!!!!");
if (this.isLast && this.playTimes > 0) { if (this.isLast && this.playTimes > 0) {
this.showGoodjob(); this.showGoodjob();
} else { } else {
this.showMask(() => { this.showMask(() => {
if (!this.isLocal) { if (!this.isLocal) {
callMiddleLayerFunction('PSQS_play_animate_over', null, () => {}) callMiddleLayerFunction("PSQS_play_animate_over", null, () => {});
} }
}) });
} }
// this.curVideoPlayEnd(); // this.curVideoPlayEnd();
}) });
return video.node; return video.node;
}, },
showGoodjob() { showGoodjob() {
...@@ -1132,22 +1120,17 @@ showStartLight() { ...@@ -1132,22 +1120,17 @@ showStartLight() {
goodjob.scale = this._mapScaleMin; goodjob.scale = this._mapScaleMin;
const dragonDisplay = goodjob.getComponent(dragonBones.ArmatureDisplay); const dragonDisplay = goodjob.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.playAnimation('newAnimation', 1); dragonDisplay.playAnimation("newAnimation", 1);
playAudio(this.goodjobClip, async () => { playAudio(this.goodjobClip, async () => {
await asyncDelay(3); await asyncDelay(3);
console.log(' end .....'); console.log(" end .....");
this.showMask(() => { this.showMask(() => {
if (!this.isLocal) { if (!this.isLocal) {
callMiddleLayerFunction('PSQS_play_animate_over', null, () => {}) callMiddleLayerFunction("PSQS_play_animate_over", null, () => {});
} }
})
}); });
});
}, },
getColorRect(w, h) { getColorRect(w, h) {
...@@ -1160,16 +1143,16 @@ showStartLight() { ...@@ -1160,16 +1143,16 @@ showStartLight() {
}, },
videoLoadEnd() { videoLoadEnd() {
this.videoDuration = this.video.getDuration();
// 时长获取到以后 可以计算题目点
this.setProgressBarMarkPoints();
if (this.jumpData) { if (this.jumpData) {
this.setJumpTime(); this.setJumpTime();
} }
if (this.jumpTime) { if (this.jumpTime) {
this.resetQuesIndex(); this.resetQuesIndex(this.jumpTime);
this.initCurQues(); this.initCurQues();
} else if (this.isFirst) { } else if (this.isFirst) {
this.initStartView(); this.initStartView();
return; return;
...@@ -1179,13 +1162,12 @@ showStartLight() { ...@@ -1179,13 +1162,12 @@ showStartLight() {
}, },
setJumpTime() { setJumpTime() {
let isFind = false; let isFind = false;
for (let i=0; i<this.data.quesArr.length; i++) { for (let i = 0; i < this.data.quesArr.length; i++) {
const id = i; const id = i;
if (id == this.jumpData.step) { if (id == this.jumpData.step) {
const quesData = this.data.quesArr[i]; const quesData = this.data.quesArr[i];
this.jumpTime = Number( quesData.ques_start ); this.jumpTime = Number(quesData.ques_start);
isFind = true; isFind = true;
break; break;
...@@ -1196,21 +1178,13 @@ showStartLight() { ...@@ -1196,21 +1178,13 @@ showStartLight() {
const lastQuesData = this.data.quesArr[this.data.quesArr.length - 1]; const lastQuesData = this.data.quesArr[this.data.quesArr.length - 1];
this.jumpTime = lastQuesData.ques_end; this.jumpTime = lastQuesData.ques_end;
} }
}, },
curVideoPlayEnd() { curVideoPlayEnd() {
if (this.playTimes == 0) { if (this.playTimes == 0) {
return; return;
} }
switch (this.video.node.name) { switch (this.video.node.name) {
case "ques_video": case "ques_video":
this.startWaitVideo(); this.startWaitVideo();
...@@ -1223,7 +1197,7 @@ showStartLight() { ...@@ -1223,7 +1197,7 @@ showStartLight() {
// this.checkNextQues(); // this.checkNextQues();
break; break;
case "wrong_video": case "wrong_video":
if (this.curQues.itemType == 'sound') { if (this.curQues.itemType == "sound") {
this.startWaitVideo(); this.startWaitVideo();
} else { } else {
this.checkNextQues(); this.checkNextQues();
...@@ -1233,7 +1207,6 @@ showStartLight() { ...@@ -1233,7 +1207,6 @@ showStartLight() {
this.checkNextQues(); this.checkNextQues();
break; break;
} }
}, },
showMask(cb) { showMask(cb) {
...@@ -1241,23 +1214,17 @@ showStartLight() { ...@@ -1241,23 +1214,17 @@ showStartLight() {
mask.opacity = 0; mask.opacity = 0;
cc.tween(mask) cc.tween(mask)
.to(0.2, {opacity: 255}, {easing: "sineIn"}) .to(0.2, { opacity: 255 }, { easing: "sineIn" })
.call(() => { .call(() => {
cb && cb(); cb && cb();
}) })
.start(); .start();
}, },
showRestart() { showRestart() {
// this.setCurTipAudioUrl(this.data.finish_audio_url); // this.setCurTipAudioUrl(this.data.finish_audio_url);
const circle = getSprNode('bg_circle'); const circle = getSprNode("bg_circle");
// circle.x = this.canvas.width / 4; // circle.x = this.canvas.width / 4;
this.canvas.addChild(circle, 5); this.canvas.addChild(circle, 5);
...@@ -1268,197 +1235,227 @@ showStartLight() { ...@@ -1268,197 +1235,227 @@ showStartLight() {
.repeatForever() .repeatForever()
.start(); .start();
const btn = getSprNode("btn_restart");
const btn = getSprNode('btn_restart');
this.canvas.addChild(btn, 6); this.canvas.addChild(btn, 6);
btn.x = circle.x; btn.x = circle.x;
circle.on('touchstart', () => { circle.on("touchstart", () => {
this.replay(); this.replay();
}) });
}, },
replay() { replay() {
const middleLayer = cc.find("middleLayer");
const middleLayer = cc.find('middleLayer');
if (middleLayer) { if (middleLayer) {
middleLayer.getComponent('middleLayer').reloadBundle(); middleLayer.getComponent("middleLayer").reloadBundle();
} }
}, },
refreshVideoTimeLabel() { refreshVideoTimeLabel() {
const currentTime = this.muteVideoPlayer.currentTime;
const currentTime = this.muteVideoPlayer.currentTime this.curTimeLabel.string = formatTime(
this.curTimeLabel.string = formatTime('mm:ss', new Date(currentTime * 1000)); "mm:ss",
new Date(currentTime * 1000)
);
}, },
refreshItemTimeLabel(item) { refreshItemTimeLabel(item) {
const currentTime = this.videoPlayer.currentTime const currentTime = this.videoPlayer.currentTime;
this.curTimeLabel.string = formatTime('mm:ss', new Date(currentTime * 1000)); this.curTimeLabel.string = formatTime(
"mm:ss",
new Date(currentTime * 1000)
);
}, },
updateCheckStop() { updateCheckStop() {
// console.log("检查停止时间", this.curEndTime);
if (!this.video || this.curEndTime == -1) { if (!this.video || this.curEndTime == -1) {
return; return;
} }
if (this.video.currentTime >= this.curEndTime) { if (this.video.currentTime >= this.curEndTime) {
this.video.pause(); this.video.pause();
this.videoControlBar.emit("update_video_status", 0);
this.video.currentTime = this.curEndTime; this.video.currentTime = this.curEndTime;
this.curEndTime = -1; this.curEndTime = -1;
this.curVideoPlayEnd(); this.curVideoPlayEnd();
// this.videoControlBar.active = false;
} }
}, },
update() { update() {
if (this.isDestroy) { if (this.isDestroy) {
return; return;
} }
this.updateCheckStop(); // 更新当前进度条
if(this.videoDuration== null) {
this.videoControlBar.emit("update_video_progress", 0)
} else {
this.videoControlBar.emit("update_video_progress", this.video.currentTime / this.videoDuration)
}
// 如果没有正在拖动中 检查是否为题目停止
if(!this.isDragProgressBar) {
this.updateCheckStop();
}
}, },
// 重置题目相关数据 - 在用户拖动进度条完成以后
restQuesData(curretnTime) {
let userDragTime = curretnTime;
this.resetQuesIndex(userDragTime);
this.initCurQues();
if(this.quesIndex >= 0) {
this.curEndTime = Number(this.curQues.ques_end);
} else {
// 如果没有找到题目索引 则把当前截止时间设置为无穷大
this.curEndTime = -1;
}
this.video.currentTime = userDragTime;
},
// 是否正在拖动进度条
isDragProgressBar: false,
initListener() { initListener() {
const canvas = cc.find("Canvas");
const canvas = cc.find('Canvas');
let downFlag = false; let downFlag = false;
const touchStart = (e) => { const touchStart = (e) => {
this.canvasTouchStart(e); this.canvasTouchStart(e);
console.log('touch start'); // console.log("touch start");
if (canvas.hasEventListener(cc.Node.EventType.MOUSE_DOWN)) { if (canvas.hasEventListener(cc.Node.EventType.MOUSE_DOWN)) {
canvas.off(cc.Node.EventType.MOUSE_DOWN, mouseDown) canvas.off(cc.Node.EventType.MOUSE_DOWN, mouseDown);
}
} }
};
const mouseDown = (e) => { const mouseDown = (e) => {
if (!downFlag) { if (!downFlag) {
return; return;
} }
this.canvasTouchStart(e); this.canvasTouchStart(e);
console.log('mouse down'); console.log("mouse down");
if (canvas.hasEventListener(cc.Node.EventType.TOUCH_MOVE)) { if (canvas.hasEventListener(cc.Node.EventType.TOUCH_MOVE)) {
canvas.off(cc.Node.EventType.TOUCH_MOVE, touchMove) canvas.off(cc.Node.EventType.TOUCH_MOVE, touchMove);
this.removeHtmlCanvasListener('touchmove'); this.removeHtmlCanvasListener("touchmove");
} }
} };
const touchMove = (e) => { const touchMove = (e) => {
this.canvasTouchMove(e); this.canvasTouchMove(e);
// console.log('touch move'); // console.log('touch move');
if (canvas.hasEventListener(cc.Node.EventType.MOUSE_MOVE)) { if (canvas.hasEventListener(cc.Node.EventType.MOUSE_MOVE)) {
canvas.off(cc.Node.EventType.MOUSE_MOVE, mouseMove) canvas.off(cc.Node.EventType.MOUSE_MOVE, mouseMove);
}
} }
};
const mouseMove = (e) => { const mouseMove = (e) => {
if (!downFlag) { if (!downFlag) {
return; return;
} }
this.canvasTouchMove(e); this.canvasTouchMove(e);
console.log('mouse move'); console.log("mouse move");
if (canvas.hasEventListener(cc.Node.EventType.TOUCH_MOVE)) { if (canvas.hasEventListener(cc.Node.EventType.TOUCH_MOVE)) {
canvas.off(cc.Node.EventType.TOUCH_MOVE, touchMove) canvas.off(cc.Node.EventType.TOUCH_MOVE, touchMove);
this.removeHtmlCanvasListener('touchmove'); this.removeHtmlCanvasListener("touchmove");
}
} }
};
const touchEnd = (e) => { const touchEnd = (e) => {
downFlag = false; downFlag = false;
this.canvasTouchEnd(e); this.canvasTouchEnd(e);
if (canvas.hasEventListener(cc.Node.EventType.MOUSE_UP)) { if (canvas.hasEventListener(cc.Node.EventType.MOUSE_UP)) {
canvas.off(cc.Node.EventType.MOUSE_UP, mouseUp) canvas.off(cc.Node.EventType.MOUSE_UP, mouseUp);
} }
if (canvas.hasEventListener(cc.Node.EventType.MOUSE_LEAVE)) { if (canvas.hasEventListener(cc.Node.EventType.MOUSE_LEAVE)) {
canvas.off(cc.Node.EventType.MOUSE_LEAVE, mouseUp) canvas.off(cc.Node.EventType.MOUSE_LEAVE, mouseUp);
} }
this.removeHtmlTouchEnd(); this.removeHtmlTouchEnd();
} };
const mouseUp = (e) => { const mouseUp = (e) => {
downFlag = false; downFlag = false;
this.canvasTouchEnd(e); this.canvasTouchEnd(e);
if (canvas.hasEventListener(cc.Node.EventType.TOUCH_END)) { if (canvas.hasEventListener(cc.Node.EventType.TOUCH_END)) {
canvas.off(cc.Node.EventType.TOUCH_END, touchEnd) canvas.off(cc.Node.EventType.TOUCH_END, touchEnd);
} }
if (canvas.hasEventListener(cc.Node.EventType.TOUCH_CANCEL)) { if (canvas.hasEventListener(cc.Node.EventType.TOUCH_CANCEL)) {
canvas.off(cc.Node.EventType.TOUCH_CANCEL, touchEnd) canvas.off(cc.Node.EventType.TOUCH_CANCEL, touchEnd);
}
} }
};
canvas.on(cc.Node.EventType.TOUCH_START, touchStart);
canvas.on(cc.Node.EventType.MOUSE_DOWN, mouseDown);
canvas.on(cc.Node.EventType.TOUCH_MOVE, touchMove);
canvas.on(cc.Node.EventType.MOUSE_MOVE, mouseMove);
canvas.on(cc.Node.EventType.TOUCH_START, touchStart) canvas.on(cc.Node.EventType.TOUCH_END, touchEnd);
canvas.on(cc.Node.EventType.MOUSE_DOWN, mouseDown) canvas.on(cc.Node.EventType.TOUCH_CANCEL, touchEnd);
canvas.on(cc.Node.EventType.MOUSE_UP, mouseUp);
canvas.on(cc.Node.EventType.TOUCH_MOVE, touchMove) // 监听组件发来的拖动开始和结束消息
canvas.on(cc.Node.EventType.MOUSE_MOVE, mouseMove) this.videoControlBar.on("on_drag_button", (isDragStart)=>{
if(isDragStart) {
this.hideWaitingVideo();
this.isDragProgressBar = true;
this.video.pause();
this.videoControlBar.emit("update_video_status", 0);
} else {
this.restQuesData(this.video.currentTime);
this.isDragProgressBar = false;
this.video.play();
this.videoControlBar.emit("update_video_status", 1);
}
})
canvas.on(cc.Node.EventType.TOUCH_END, touchEnd) // 监听组件发来的拖动百分比
canvas.on(cc.Node.EventType.TOUCH_CANCEL, touchEnd) this.videoControlBar.on("on_drag_percent", (percent)=>{
canvas.on(cc.Node.EventType.MOUSE_UP, mouseUp) this.video.currentTime = percent * this.videoDuration;
})
// 监听组件发来视频播放、暂停事件
this.videoControlBar.on("video_btn_click", (isPlay)=>{
if(isPlay) {
if(this.isWaitingUserAction) {
this.hideWaitingVideo();
this.restQuesData(this.video.currentTime);
}
this.video.play();
} else {
this.video.pause();
}
})
}, },
canvasTouchStart(e) { canvasTouchStart(e) {
const pos = e.getLocation(); const pos = e.getLocation();
// this.knife.x = pos.x - e.currentTarget.width / 2; // this.knife.x = pos.x - e.currentTarget.width / 2;
// this.knife.y = pos.y - e.currentTarget.height / 2; // this.knife.y = pos.y - e.currentTarget.height / 2;
}, },
canvasTouchMove(e) { canvasTouchMove(e) {
if (!this._curShowItem) { if (!this._curShowItem) {
return; return;
} }
const pos = e.getLocation(); const pos = e.getLocation();
this._curShowItem.x = (pos.x - e.currentTarget.width / 2) / this._curShowItem.parent.scale; this._curShowItem.x =
this._curShowItem.y = (pos.y - e.currentTarget.height / 2) / this._curShowItem.parent.scale;; (pos.x - e.currentTarget.width / 2) / this._curShowItem.parent.scale;
this._curShowItem.y =
(pos.y - e.currentTarget.height / 2) / this._curShowItem.parent.scale;
// console.log('pos: ', pos.x); // console.log('pos: ', pos.x);
}, },
canvasTouchEnd(e) { canvasTouchEnd(e) {
if (!this._curShowItem) { if (!this._curShowItem) {
return; return;
} }
...@@ -1467,37 +1464,36 @@ showStartLight() { ...@@ -1467,37 +1464,36 @@ showStartLight() {
}, },
checkOnDragEndRect() { checkOnDragEndRect() {
console.log("emptyGroupArr: ", this.emptyGroupArr);
console.log('emptyGroupArr: ', this.emptyGroupArr);
for (let i = 0; i < this.dragEndRectArr.length; i++) { for (let i = 0; i < this.dragEndRectArr.length; i++) {
const rect = this.dragEndRectArr[i]; const rect = this.dragEndRectArr[i];
const worldPos = this._curShowItem.parent.convertToWorldSpaceAR(cc.v2(this._curShowItem.x, this._curShowItem.y)); const worldPos = this._curShowItem.parent.convertToWorldSpaceAR(
cc.v2(this._curShowItem.x, this._curShowItem.y)
);
const worldRect = rect.getBoundingBoxToWorld(); const worldRect = rect.getBoundingBoxToWorld();
if (worldRect.contains(worldPos)) { if (worldRect.contains(worldPos)) {
console.log("rect in ");
console.log('rect in ')
this._curShowItem.selectRect = rect; this._curShowItem.selectRect = rect;
// this.checkIsDragEndSuccess(rect); // this.checkIsDragEndSuccess(rect);
return; return;
} }
} }
this.itemBack(); this.itemBack();
}, },
checkIsDragEndSuccess(dragItem) { checkIsDragEndSuccess(dragItem) {
const rect = dragItem.selectRect; const rect = dragItem.selectRect;
const worldPos = dragItem.parent.convertToWorldSpaceAR(cc.v2(dragItem.targetPx, dragItem.targetPy)); const worldPos = dragItem.parent.convertToWorldSpaceAR(
cc.v2(dragItem.targetPx, dragItem.targetPy)
);
const worldRect = rect.getBoundingBoxToWorld(); const worldRect = rect.getBoundingBoxToWorld();
console.log(' worldPos: ', worldPos); console.log(" worldPos: ", worldPos);
console.log(' worldRect: ', worldRect); console.log(" worldRect: ", worldRect);
if (worldRect.contains(worldPos)) { if (worldRect.contains(worldPos)) {
dragItem.x = dragItem.targetPx; dragItem.x = dragItem.targetPx;
...@@ -1507,63 +1503,46 @@ showStartLight() { ...@@ -1507,63 +1503,46 @@ showStartLight() {
// cc.audioEngine.playEffect(this.rightClip, false, 0.8); // cc.audioEngine.playEffect(this.rightClip, false, 0.8);
return true; return true;
} else { } else {
return false; return false;
// this.itemBack(); // this.itemBack();
} }
}, },
itemBack() { itemBack() {
cc.audioEngine.playEffect(this.wrongClip, false, 0.8); cc.audioEngine.playEffect(this.wrongClip, false, 0.8);
cc.tween(this._curShowItem) cc.tween(this._curShowItem)
.to(0.5, {x: this._curShowItem.baseX, y: this._curShowItem.baseY}, {easing: "elasticOut"}) .to(
0.5,
{ x: this._curShowItem.baseX, y: this._curShowItem.baseY },
{ easing: "elasticOut" }
)
.start(); .start();
}, },
removeHtmlCanvasListener(type) { removeHtmlCanvasListener(type) {
// const canvasHtml = document.querySelector('canvas'); // const canvasHtml = document.querySelector('canvas');
// canvasHtml.addEventListener(type, (e) => {}) // canvasHtml.addEventListener(type, (e) => {})
}, },
removeHtmlTouchEnd() { removeHtmlTouchEnd() {
// const canvasHtml = document.querySelector('canvas'); // const canvasHtml = document.querySelector('canvas');
// canvasHtml.removeEventListener('touchend', this.htmlCanvasTouchendFunc, this); // canvasHtml.removeEventListener('touchend', this.htmlCanvasTouchendFunc, this);
}, },
initHotZone() { initHotZone() {
this.initHotZoneBg(); this.initHotZoneBg();
}, },
hotZoneBg: null, hotZoneBg: null,
initHotZoneBg() { initHotZoneBg() {
for (let i = 0; i < this.data.quesArr.length; i++) { for (let i = 0; i < this.data.quesArr.length; i++) {
const data = this.data.quesArr[i]; const data = this.data.quesArr[i];
const hotZoneBg = new cc.Node(); const hotZoneBg = new cc.Node();
hotZoneBg.name = 'hotZoneBg'; hotZoneBg.name = "hotZoneBg";
hotZoneBg.parent = cc.find('Canvas'); hotZoneBg.parent = cc.find("Canvas");
hotZoneBg.data = data; hotZoneBg.data = data;
data.hotZoneBg = hotZoneBg; data.hotZoneBg = hotZoneBg;
...@@ -1574,39 +1553,32 @@ showStartLight() { ...@@ -1574,39 +1553,32 @@ showStartLight() {
} }
cc.loader.load({ url: data.bgItem.url }, (err, img) => { cc.loader.load({ url: data.bgItem.url }, (err, img) => {
hotZoneBg.width = img.width; hotZoneBg.width = img.width;
hotZoneBg.height = img.height; hotZoneBg.height = img.height;
const sprNode = new cc.Node(); const sprNode = new cc.Node();
sprNode.name = 'bgItemSpr' sprNode.name = "bgItemSpr";
var sf = new cc.SpriteFrame(img); var sf = new cc.SpriteFrame(img);
// const spr = hotZoneBg.addComponent(cc.Sprite); // const spr = hotZoneBg.addComponent(cc.Sprite);
const spr = sprNode.addComponent(cc.Sprite); const spr = sprNode.addComponent(cc.Sprite);
spr.spriteFrame = sf spr.spriteFrame = sf;
sprNode.width = hotZoneBg.width; sprNode.width = hotZoneBg.width;
sprNode.height = hotZoneBg.height; sprNode.height = hotZoneBg.height;
sprNode.parent = hotZoneBg; sprNode.parent = hotZoneBg;
sprNode.opacity = 0; sprNode.opacity = 0;
// const sx = this.canvas.width / hotZoneBg.width; // const sx = this.canvas.width / hotZoneBg.width;
const sy = this.canvas.height / hotZoneBg.height; const sy = this.canvas.height / hotZoneBg.height;
// const s = Math.min(sx, sy); // const s = Math.min(sx, sy);
hotZoneBg.scale = sy; hotZoneBg.scale = sy;
if (data.itemType != "sound") {
if (data.itemType != 'sound') {
this.initHotZoneItem(hotZoneBg); this.initHotZoneItem(hotZoneBg);
} }
}); });
} }
// this.hotZoneBg = new cc.Node(); // this.hotZoneBg = new cc.Node();
// this.hotZoneBg.name = 'hotZoneBg'; // this.hotZoneBg.name = 'hotZoneBg';
// this.hotZoneBg.parent = cc.find('Canvas'); // this.hotZoneBg.parent = cc.find('Canvas');
...@@ -1625,8 +1597,6 @@ showStartLight() { ...@@ -1625,8 +1597,6 @@ showStartLight() {
// this.hotZoneBg.width = img.width; // this.hotZoneBg.width = img.width;
// this.hotZoneBg.height = img.height; // this.hotZoneBg.height = img.height;
// const sprNode = new cc.Node(); // const sprNode = new cc.Node();
// sprNode.name = 'bgItemSpr' // sprNode.name = 'bgItemSpr'
// var sf = new cc.SpriteFrame(img); // var sf = new cc.SpriteFrame(img);
...@@ -1638,7 +1608,6 @@ showStartLight() { ...@@ -1638,7 +1608,6 @@ showStartLight() {
// sprNode.parent = this.hotZoneBg; // sprNode.parent = this.hotZoneBg;
// window['bg'] = sprNode // window['bg'] = sprNode
// const sx = this.canvas.width / this.hotZoneBg.width; // const sx = this.canvas.width / this.hotZoneBg.width;
// const sy = (this.canvas.height - titleH) / this.hotZoneBg.height; // const sy = (this.canvas.height - titleH) / this.hotZoneBg.height;
// const s = Math.min(sx, sy); // const s = Math.min(sx, sy);
...@@ -1648,16 +1617,10 @@ showStartLight() { ...@@ -1648,16 +1617,10 @@ showStartLight() {
// this.hotZoneBg.y = 0 - titleH / 2; // this.hotZoneBg.y = 0 - titleH / 2;
// // console.log('this.hotZoneBg.y', this.hotZoneBg.y); // // console.log('this.hotZoneBg.y', this.hotZoneBg.y);
// // this.data.bgItem.isShowDebugLine = true; // // this.data.bgItem.isShowDebugLine = true;
// this.initHotZoneItem(); // this.initHotZoneItem();
// }); // });
}, },
initHotZoneItem(bg) { initHotZoneItem(bg) {
...@@ -1669,7 +1632,7 @@ showStartLight() { ...@@ -1669,7 +1632,7 @@ showStartLight() {
this.setOneHand(item, bg); this.setOneHand(item, bg);
break; break;
case "1" : case "1":
this.setOneAnimaSmall(item, bg); this.setOneAnimaSmall(item, bg);
break; break;
...@@ -1680,25 +1643,19 @@ showStartLight() { ...@@ -1680,25 +1643,19 @@ showStartLight() {
default: default:
break; break;
} }
}); });
}, },
setOneDragEndRect(data, bg) { setOneDragEndRect(data, bg) {
console.log(" in setOneDragEndRect"); console.log(" in setOneDragEndRect");
const quesData = bg.data; const quesData = bg.data;
const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width; const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width;
const rectNode = new cc.Node(); const rectNode = new cc.Node();
rectNode.name = 'rect' + data.index; rectNode.name = "rect" + data.index;
bg.addChild(rectNode); bg.addChild(rectNode);
const ctx = rectNode.addComponent(cc.Graphics); const ctx = rectNode.addComponent(cc.Graphics);
// 红色矩形 // 红色矩形
ctx.lineWidth = 4; ctx.lineWidth = 4;
...@@ -1709,7 +1666,6 @@ showStartLight() { ...@@ -1709,7 +1666,6 @@ showStartLight() {
// console.log('scale: ', scale); // console.log('scale: ', scale);
// console.log('scale2: ', scale / data.mapScale); // console.log('scale2: ', scale / data.mapScale);
rectNode.width = data.rect.width * scale; rectNode.width = data.rect.width * scale;
rectNode.height = data.rect.height * scale; rectNode.height = data.rect.height * scale;
rectNode.x = -bg.width / 2 + data.rect.x * scale; rectNode.x = -bg.width / 2 + data.rect.x * scale;
...@@ -1718,7 +1674,6 @@ showStartLight() { ...@@ -1718,7 +1674,6 @@ showStartLight() {
rectNode.anchorX = rectNode.anchorY = 0; rectNode.anchorX = rectNode.anchorY = 0;
if (quesData.bgItem.isShowDebugLine) { if (quesData.bgItem.isShowDebugLine) {
ctx.rect(0, 0, rectNode.width, rectNode.height); ctx.rect(0, 0, rectNode.width, rectNode.height);
} }
...@@ -1734,71 +1689,64 @@ showStartLight() { ...@@ -1734,71 +1689,64 @@ showStartLight() {
rectNode.audioClip = audioClip; rectNode.audioClip = audioClip;
}); });
} }
}, },
setOneDragPic(data, bg) { setOneDragPic(data, bg) {
const quesData = bg.data; const quesData = bg.data;
const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width; const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width;
const picNode = new cc.Node(); const picNode = new cc.Node();
picNode.name= 'pic' + data.index; picNode.name = "pic" + data.index;
picNode.data = data; picNode.data = data;
bg.addChild(picNode); bg.addChild(picNode);
cc.loader.load({url: data.pic_url}, (err, img) => { cc.loader.load({ url: data.pic_url }, (err, img) => {
const spr = picNode.addComponent(cc.Sprite); const spr = picNode.addComponent(cc.Sprite);
spr.spriteFrame = new cc.SpriteFrame(img) spr.spriteFrame = new cc.SpriteFrame(img);
const scale = rate / bg.scaleY; const scale = rate / bg.scaleY;
console.log('picNode.width: ', picNode.width); console.log("picNode.width: ", picNode.width);
console.log('data.rect.width: ', data.rect.width); console.log("data.rect.width: ", data.rect.width);
console.log('scale: ', scale); console.log("scale: ", scale);
// picNode.width = data.rect.width * scale; // picNode.width = data.rect.width * scale;
// picNode.height = data.rect.height * scale; // picNode.height = data.rect.height * scale;
const picScale = data.rect.width * scale / picNode.width; const picScale = (data.rect.width * scale) / picNode.width;
picNode.scale = picScale; picNode.scale = picScale;
picNode.x = -bg.width / 2 + data.rect.x * scale; picNode.x = -bg.width / 2 + data.rect.x * scale;
picNode.y = bg.height / 2 - data.rect.height * scale - data.rect.y * scale; picNode.y =
bg.height / 2 - data.rect.height * scale - data.rect.y * scale;
picNode.x += picNode.width / 2 * picNode.scaleX; picNode.x += (picNode.width / 2) * picNode.scaleX;
picNode.y += picNode.height / 2 * picNode.scaleX; picNode.y += (picNode.height / 2) * picNode.scaleX;
// picNode.anchorX = picNode.anchorY = 0; // picNode.anchorX = picNode.anchorY = 0;
// if (data.audio_url) { // if (data.audio_url) {
// this.addPicAudio(picNode); // this.addPicAudio(picNode);
// } // }
this.addDragPoint(picNode, data, bg) this.addDragPoint(picNode, data, bg);
if (!quesData.dragPicArr) { if (!quesData.dragPicArr) {
quesData.dragPicArr = []; quesData.dragPicArr = [];
} }
quesData.dragPicArr.push(picNode); quesData.dragPicArr.push(picNode);
}); });
}, },
addDragPoint(picNode, data, bg) { addDragPoint(picNode, data, bg) {
const quesData = bg.data; const quesData = bg.data;
picNode.baseX = picNode.x; picNode.baseX = picNode.x;
picNode.baseY = picNode.y; picNode.baseY = picNode.y;
const realRate = bg.width / quesData.bgItem.rect.width; const realRate = bg.width / quesData.bgItem.rect.width;
picNode.targetPx = -bg.width / 2 + ( data.dragDot.x - quesData.bgItem.rect.x ) * realRate; picNode.targetPx =
picNode.targetPy = bg.height / 2 - (data.dragDot.y - quesData.bgItem.rect.y) * realRate; -bg.width / 2 + (data.dragDot.x - quesData.bgItem.rect.x) * realRate;
picNode.targetPy =
bg.height / 2 - (data.dragDot.y - quesData.bgItem.rect.y) * realRate;
// if (data.audio_url) { // if (data.audio_url) {
// cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => { // cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
...@@ -1806,7 +1754,6 @@ showStartLight() { ...@@ -1806,7 +1754,6 @@ showStartLight() {
// }); // });
// } // }
picNode.on(cc.Node.EventType.TOUCH_START, () => { picNode.on(cc.Node.EventType.TOUCH_START, () => {
// if (picNode.isDragEnd) { // if (picNode.isDragEnd) {
// if (picNode.audioClip) { // if (picNode.audioClip) {
...@@ -1816,20 +1763,15 @@ showStartLight() { ...@@ -1816,20 +1763,15 @@ showStartLight() {
// return; // return;
// } // }
this._curShowItem = picNode; this._curShowItem = picNode;
});
})
}, },
setOneAction(data) { setOneAction(data) {
const rate =
(this.hotZoneBg.scale * this.hotZoneBg.width) /
this.data.bgItem.rect.width;
const rate = (this.hotZoneBg.scale * this.hotZoneBg.width) / this.data.bgItem.rect.width;
const rectNode = new cc.Node(); const rectNode = new cc.Node();
rectNode.name = 'rect' + data.index; rectNode.name = "rect" + data.index;
this.hotZoneBg.addChild(rectNode); this.hotZoneBg.addChild(rectNode);
const ctx = rectNode.addComponent(cc.Graphics); const ctx = rectNode.addComponent(cc.Graphics);
...@@ -1843,7 +1785,10 @@ showStartLight() { ...@@ -1843,7 +1785,10 @@ showStartLight() {
rectNode.width = data.rect.width * scale; rectNode.width = data.rect.width * scale;
rectNode.height = data.rect.height * scale; rectNode.height = data.rect.height * scale;
rectNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale; rectNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale;
rectNode.y = this.hotZoneBg.height / 2 - data.rect.height * scale - data.rect.y * scale; rectNode.y =
this.hotZoneBg.height / 2 -
data.rect.height * scale -
data.rect.y * scale;
const { x, y, width, height } = rectNode; const { x, y, width, height } = rectNode;
rectNode.anchorX = rectNode.anchorY = 0; rectNode.anchorX = rectNode.anchorY = 0;
...@@ -1853,42 +1798,33 @@ showStartLight() { ...@@ -1853,42 +1798,33 @@ showStartLight() {
ctx.stroke(); ctx.stroke();
ctx.fill(); ctx.fill();
console.log("setOneAction ~~ data: ", data);
const actionData = data["actionData_" + data.gIdx];
console.log('setOneAction ~~ data: ', data)
const actionData = data['actionData_' + data.gIdx];
if (!actionData) { if (!actionData) {
return; return;
} }
if (actionData.type == 'text') { if (actionData.type == "text") {
const label = this.setOneActionText(rectNode, actionData); const label = this.setOneActionText(rectNode, actionData);
label.node.scale = scale * data.fontScale; label.node.scale = scale * data.fontScale;
// label.overflow = cc.Label.Overflow.NONE; // label.overflow = cc.Label.Overflow.NONE;
// label.node.setContentSize(new cc.Size(0, lineHeight)); // label.node.setContentSize(new cc.Size(0, lineHeight));
label["_forceUpdateRenderData"](true); label["_forceUpdateRenderData"](true);
} else if (actionData.type == "pic") {
} else if (actionData.type == 'pic') {
const pic = this.setOneActionPic(rectNode, actionData); const pic = this.setOneActionPic(rectNode, actionData);
} else if (actionData.type == "anima") {
} else if (actionData.type == 'anima') {
const anima = this.setOneActionAnima(rectNode, actionData); const anima = this.setOneActionAnima(rectNode, actionData);
} }
}, },
setOneActionText(rectNode, actionData) { setOneActionText(rectNode, actionData) {
// const labelNode = new cc.Node(); // const labelNode = new cc.Node();
// labelNode.parent = rectNode; // labelNode.parent = rectNode;
const label = this.getLabel(); // labelNode.addComponent(cc.Label); const label = this.getLabel(); // labelNode.addComponent(cc.Label);
const labelNode = label.node; const labelNode = label.node;
labelNode.parent = rectNode; labelNode.parent = rectNode;
label.font = cc.find('Canvas/res/font/aharoni').getComponent(cc.Label).font; label.font = cc.find("Canvas/res/font/aharoni").getComponent(cc.Label).font;
label.string = actionData.text; label.string = actionData.text;
// label.string = `<size=${size}><color=#751e00>${this.curGroup.title }</color></size>` // label.string = `<size=${size}><color=#751e00>${this.curGroup.title }</color></size>`
// label.lineHeight = size; // label.lineHeight = size;
...@@ -1897,52 +1833,50 @@ showStartLight() { ...@@ -1897,52 +1833,50 @@ showStartLight() {
// labelNode.anchorY = 1 // labelNode.anchorY = 1
labelNode.color = cc.Color.BLACK; labelNode.color = cc.Color.BLACK;
const opArr = actionData.changeOption;
const opArr = actionData.changeOption
// console.log('opArr', opArr); // console.log('opArr', opArr);
const tweenArr = []; const tweenArr = [];
for (let i = 0; i < opArr.length; i++) { for (let i = 0; i < opArr.length; i++) {
const opData = opArr[i]; const opData = opArr[i];
console.log('opArr[0]', opArr[i]) console.log("opArr[0]", opArr[i]);
if (opData[0] == 'fontColor') { if (opData[0] == "fontColor") {
const color = new cc.Color(); const color = new cc.Color();
cc.Color.fromHEX(color, opData[1]); cc.Color.fromHEX(color, opData[1]);
labelNode.color = color; labelNode.color = color;
} else if (opData[0] == "opacity") {
} else if (opData[0] == 'opacity') {
// console.log('opData: ', opData) // console.log('opData: ', opData)
labelNode.opacity = Number(opData[1] / 100 * 255) + 0.1; labelNode.opacity = Number((opData[1] / 100) * 255) + 0.1;
// console.log(labelNode.opacity); // console.log(labelNode.opacity);
tweenArr.push({ item: labelNode, option: `{"${opData[0]}" : ${opData[2] / 100 * 255}}`, optionName: opData[0] },) tweenArr.push({
item: labelNode,
option: `{"${opData[0]}" : ${(opData[2] / 100) * 255}}`,
optionName: opData[0],
});
} else { } else {
label[opData[0]] = opData[1]; label[opData[0]] = opData[1];
tweenArr.push({ item: label, option: `{"${opData[0]}" : ${opData[2]}}`, optionName: opData[0] }) tweenArr.push({
item: label,
option: `{"${opData[0]}" : ${opData[2]}}`,
optionName: opData[0],
});
} }
} }
if (actionData.audio_url) { if (actionData.audio_url) {
cc.assetManager.loadRemote(actionData.audio_url, (err, audioClip) => { cc.assetManager.loadRemote(actionData.audio_url, (err, audioClip) => {
labelNode.audioClip = audioClip; labelNode.audioClip = audioClip;
}); });
} }
label.lineHeight = label.fontSize; label.lineHeight = label.fontSize;
labelNode.y += rectNode.height / 2; labelNode.y += rectNode.height / 2;
labelNode.x += rectNode.width / 2; labelNode.x += rectNode.width / 2;
rectNode.addComponent(cc.Button); rectNode.addComponent(cc.Button);
rectNode.on('click', () => { rectNode.on("click", () => {
if (labelNode.audioClip) { if (labelNode.audioClip) {
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
cc.audioEngine.playEffect(labelNode.audioClip, false, 0.8); cc.audioEngine.playEffect(labelNode.audioClip, false, 0.8);
...@@ -1963,22 +1897,19 @@ showStartLight() { ...@@ -1963,22 +1897,19 @@ showStartLight() {
// console.log( JSON.parse(tweenData.option) ); // console.log( JSON.parse(tweenData.option) );
if (tweenData.optionName == 'opacity') { if (tweenData.optionName == "opacity") {
console.log('~~~ ', tweenData.item[tweenData.optionName]); console.log("~~~ ", tweenData.item[tweenData.optionName]);
// tweenData.item[tweenData.optionName] = tweenData.item[tweenData.optionName] + 1 // tweenData.item[tweenData.optionName] = tweenData.item[tweenData.optionName] + 1
cc.tween(tweenData.item) cc.tween(tweenData.item)
.to(actionData.changeTime, JSON.parse(tweenData.option)) .to(actionData.changeTime, JSON.parse(tweenData.option))
.start(); .start();
} }
} }
// cc.tween({}) // cc.tween({})
// .to(5, { scale: (Math.random() - 0.5) + 1}) // .to(5, { scale: (Math.random() - 0.5) + 1})
// .start(); // .start();
}); });
// labelNode.opacity = 255; // labelNode.opacity = 255;
...@@ -1987,15 +1918,13 @@ showStartLight() { ...@@ -1987,15 +1918,13 @@ showStartLight() {
}, },
setOneActionPic(rectNode, actionData) { setOneActionPic(rectNode, actionData) {
console.log("setOneActionPic actionData: ", actionData);
console.log('setOneActionPic actionData: ', actionData)
const picNode = new cc.Node(); const picNode = new cc.Node();
rectNode.addChild(picNode); rectNode.addChild(picNode);
cc.loader.load({ url: actionData.pic_url }, (err, img) => { cc.loader.load({ url: actionData.pic_url }, (err, img) => {
const spr = picNode.addComponent(cc.Sprite); const spr = picNode.addComponent(cc.Sprite);
spr.spriteFrame = new cc.SpriteFrame(img) spr.spriteFrame = new cc.SpriteFrame(img);
picNode.y += rectNode.height / 2; picNode.y += rectNode.height / 2;
picNode.x += rectNode.width / 2; picNode.x += rectNode.width / 2;
...@@ -2003,35 +1932,34 @@ showStartLight() { ...@@ -2003,35 +1932,34 @@ showStartLight() {
picNode.scaleX = rectNode.width / picNode.width; picNode.scaleX = rectNode.width / picNode.width;
picNode.scaleY = rectNode.height / picNode.height; picNode.scaleY = rectNode.height / picNode.height;
const opArr = actionData.changeOption const opArr = actionData.changeOption;
const tweenArr = []; const tweenArr = [];
for (let i = 0; i < opArr.length; i++) { for (let i = 0; i < opArr.length; i++) {
const opData = opArr[i]; const opData = opArr[i];
console.log('opData: ~~~ ', opData); console.log("opData: ~~~ ", opData);
if (opData[0] == 'opacity') { if (opData[0] == "opacity") {
picNode.opacity = Number(opData[1] / 100 * 255) + 0.1; picNode.opacity = Number((opData[1] / 100) * 255) + 0.1;
console.log(picNode.opacity); console.log(picNode.opacity);
tweenArr.push({ item: picNode, option: `{"${opData[0]}" : ${opData[2] / 100 * 255}}`, optionName: opData[0] },) tweenArr.push({
item: picNode,
option: `{"${opData[0]}" : ${(opData[2] / 100) * 255}}`,
optionName: opData[0],
});
} else { } else {
// picNode[opData[0]] = Number(opData[1]); // picNode[opData[0]] = Number(opData[1]);
// tweenArr.push({item: picNode, option: `{"${opData[0]}" : ${opData[2]}}`, optionName: opData[0]}) // tweenArr.push({item: picNode, option: `{"${opData[0]}" : ${opData[2]}}`, optionName: opData[0]})
} }
if (actionData.audio_url) { if (actionData.audio_url) {
cc.assetManager.loadRemote(actionData.audio_url, (err, audioClip) => { cc.assetManager.loadRemote(actionData.audio_url, (err, audioClip) => {
rectNode.audioClip = audioClip; rectNode.audioClip = audioClip;
}); });
} }
rectNode.addComponent(cc.Button); rectNode.addComponent(cc.Button);
rectNode.on('click', () => { rectNode.on("click", () => {
if (rectNode.audioClip) { if (rectNode.audioClip) {
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
cc.audioEngine.playEffect(rectNode.audioClip, false, 0.8); cc.audioEngine.playEffect(rectNode.audioClip, false, 0.8);
...@@ -2045,22 +1973,18 @@ showStartLight() { ...@@ -2045,22 +1973,18 @@ showStartLight() {
for (let i = 0; i < tweenArr.length; i++) { for (let i = 0; i < tweenArr.length; i++) {
const tweenData = tweenArr[i]; const tweenData = tweenArr[i];
if (tweenData.optionName == 'opacity') { if (tweenData.optionName == "opacity") {
cc.tween(tweenData.item) cc.tween(tweenData.item)
.to(actionData.changeTime, JSON.parse(tweenData.option)) .to(actionData.changeTime, JSON.parse(tweenData.option))
.start(); .start();
} }
} }
}); });
} }
}); });
}, },
setOneActionAnima(rectNode, actionData) { setOneActionAnima(rectNode, actionData) {
const animaNode = new cc.Node(); const animaNode = new cc.Node();
rectNode.addChild(animaNode); rectNode.addChild(animaNode);
...@@ -2074,20 +1998,15 @@ showStartLight() { ...@@ -2074,20 +1998,15 @@ showStartLight() {
const dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay); const dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
if (!data.texPngData) { if (!data.texPngData) {
return return;
} }
const image = data.texPngData.url; //"http://staging-teach.cdn.ireadabc.com/5a0c5af3e952acd0ac83a6e5c6f03ff1.png";
const ske = data.skeJsonData.url; //"http://staging-teach.cdn.ireadabc.com/bd825dcceea298d1146be8067ae3d17f.json";
const image = data.texPngData.url//"http://staging-teach.cdn.ireadabc.com/5a0c5af3e952acd0ac83a6e5c6f03ff1.png"; const atlas = data.texJsonData.url; //"http://staging-teach.cdn.ireadabc.com/246f8991b729fa3e5a7f4802de828efa.json";
const ske = data.skeJsonData.url//"http://staging-teach.cdn.ireadabc.com/bd825dcceea298d1146be8067ae3d17f.json";
const atlas = data.texJsonData.url//"http://staging-teach.cdn.ireadabc.com/246f8991b729fa3e5a7f4802de828efa.json";
cc.loader.load(image, (error, texture) => { cc.loader.load(image, (error, texture) => {
cc.loader.load({ url: atlas, type: "txt" }, (error, atlasJson) => {
cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => { cc.loader.load({ url: ske, type: "txt" }, (error, dragonBonesJson) => {
cc.loader.load({ url: ske, type: 'txt' }, (error, dragonBonesJson) => {
const atlas = new dragonBones.DragonBonesAtlasAsset(); const atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = atlasJson; atlas.atlasJson = atlasJson;
atlas.texture = texture; atlas.texture = texture;
...@@ -2098,7 +2017,6 @@ showStartLight() { ...@@ -2098,7 +2017,6 @@ showStartLight() {
dragonDisplay.dragonAtlasAsset = atlas; dragonDisplay.dragonAtlasAsset = atlas;
dragonDisplay.dragonAsset = asset; dragonDisplay.dragonAsset = asset;
let json = JSON.parse(asset.dragonBonesJson); let json = JSON.parse(asset.dragonBonesJson);
let armatures = json["armature"]; let armatures = json["armature"];
let armatureNames = []; let armatureNames = [];
...@@ -2139,7 +2057,6 @@ showStartLight() { ...@@ -2139,7 +2057,6 @@ showStartLight() {
// }); // });
} }
// animaNode.x = rectNode.x + rectNode.width / 2; // animaNode.x = rectNode.x + rectNode.width / 2;
// animaNode.y = rectNode.y + rectNode.height / 2; // animaNode.y = rectNode.y + rectNode.height / 2;
...@@ -2148,46 +2065,43 @@ showStartLight() { ...@@ -2148,46 +2065,43 @@ showStartLight() {
// const scale = Math.min(sx, sy); // const scale = Math.min(sx, sy);
// animaNode.scale = scale; // animaNode.scale = scale;
animaNode.y += rectNode.height / 2; animaNode.y += rectNode.height / 2;
animaNode.x += rectNode.width / 2; animaNode.x += rectNode.width / 2;
animaNode.scaleX = rectNode.width / animaNode.width; animaNode.scaleX = rectNode.width / animaNode.width;
animaNode.scaleY = rectNode.height / animaNode.height; animaNode.scaleY = rectNode.height / animaNode.height;
const opArr = actionData.changeOption const opArr = actionData.changeOption;
const tweenArr = []; const tweenArr = [];
for (let i = 0; i < opArr.length; i++) { for (let i = 0; i < opArr.length; i++) {
const opData = opArr[i]; const opData = opArr[i];
console.log('opData: ~~~ ', opData); console.log("opData: ~~~ ", opData);
if (opData[0] == 'opacity') { if (opData[0] == "opacity") {
animaNode.opacity = Number(opData[1] / 100 * 255) + 0.1; animaNode.opacity = Number((opData[1] / 100) * 255) + 0.1;
console.log(animaNode.opacity); console.log(animaNode.opacity);
tweenArr.push({ item: animaNode, option: `{"${opData[0]}" : ${opData[2] / 100 * 255}}`, optionName: opData[2] == null ? '' : opData[0] },) tweenArr.push({
item: animaNode,
option: `{"${opData[0]}" : ${(opData[2] / 100) * 255}}`,
optionName: opData[2] == null ? "" : opData[0],
});
} else { } else {
// animaNode[opData[0]] = Number(opData[1]); // animaNode[opData[0]] = Number(opData[1]);
// tweenArr.push({item: animaNode, option: `{"${opData[0]}" : ${opData[2]}}`, optionName: opData[2] == null ? '' : opData[0]}) // tweenArr.push({item: animaNode, option: `{"${opData[0]}" : ${opData[2]}}`, optionName: opData[2] == null ? '' : opData[0]})
} }
if (actionData.audio_url) { if (actionData.audio_url) {
cc.assetManager.loadRemote(actionData.audio_url, (err, audioClip) => { cc.assetManager.loadRemote(
actionData.audio_url,
(err, audioClip) => {
rectNode.audioClip = audioClip; rectNode.audioClip = audioClip;
});
} }
);
}
rectNode.addComponent(cc.Button); rectNode.addComponent(cc.Button);
rectNode.on('click', () => { rectNode.on("click", () => {
if (rectNode.audioClip) { if (rectNode.audioClip) {
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
cc.audioEngine.playEffect(rectNode.audioClip, false, 0.8); cc.audioEngine.playEffect(rectNode.audioClip, false, 0.8);
...@@ -2201,45 +2115,34 @@ showStartLight() { ...@@ -2201,45 +2115,34 @@ showStartLight() {
for (let j = 0; j < tweenArr.length; j++) { for (let j = 0; j < tweenArr.length; j++) {
const tweenData = tweenArr[j]; const tweenData = tweenArr[j];
console.log('tweenData: ', tweenData); console.log("tweenData: ", tweenData);
if (tweenData.optionName) { if (tweenData.optionName) {
cc.tween(tweenData.item) cc.tween(tweenData.item)
.to(actionData.changeTime, JSON.parse(tweenData.option)) .to(actionData.changeTime, JSON.parse(tweenData.option))
.start(); .start();
} }
} }
if (animationNames.length > 0) { if (animationNames.length > 0) {
dragonDisplay.playAnimation(animationNames[0], 1); dragonDisplay.playAnimation(animationNames[0], 1);
} }
}); });
} }
}); });
}); });
}); });
}, },
setOneAnimaSmall(data) { setOneAnimaSmall(data) {
const rate =
(this.hotZoneBg.scale * this.hotZoneBg.width) /
const rate = (this.hotZoneBg.scale * this.hotZoneBg.width) / this.data.bgItem.rect.width; this.data.bgItem.rect.width;
const rectNode = new cc.Node(); const rectNode = new cc.Node();
rectNode.name = 'rect' + data.index; rectNode.name = "rect" + data.index;
this.hotZoneBg.addChild(rectNode); this.hotZoneBg.addChild(rectNode);
const ctx = rectNode.addComponent(cc.Graphics); const ctx = rectNode.addComponent(cc.Graphics);
// 红色矩形 // 红色矩形
ctx.lineWidth = 4; ctx.lineWidth = 4;
...@@ -2251,47 +2154,40 @@ showStartLight() { ...@@ -2251,47 +2154,40 @@ showStartLight() {
rectNode.width = data.rect.width * scale; rectNode.width = data.rect.width * scale;
rectNode.height = data.rect.height * scale; rectNode.height = data.rect.height * scale;
rectNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale; rectNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale;
rectNode.y = this.hotZoneBg.height / 2 - data.rect.height * scale - data.rect.y * scale; rectNode.y =
this.hotZoneBg.height / 2 -
data.rect.height * scale -
data.rect.y * scale;
rectNode.anchorX = rectNode.anchorY = 0; rectNode.anchorX = rectNode.anchorY = 0;
if (this.data.bgItem.isShowDebugLine) { if (this.data.bgItem.isShowDebugLine) {
ctx.rect(0, 0, rectNode.width, rectNode.height); ctx.rect(0, 0, rectNode.width, rectNode.height);
} }
ctx.stroke(); ctx.stroke();
ctx.fill(); ctx.fill();
const animaNode = new cc.Node(); const animaNode = new cc.Node();
animaNode.name = 'anima_' + data.index; animaNode.name = "anima_" + data.index;
this.hotZoneBg.addChild(animaNode); this.hotZoneBg.addChild(animaNode);
if (data.audio_url) { if (data.audio_url) {
cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => { cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
animaNode.audioClip = audioClip; animaNode.audioClip = audioClip;
}); });
} }
const dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay); const dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
if (!data.texPngData) { if (!data.texPngData) {
return return;
} }
const image = data.texPngData.url//"http://staging-teach.cdn.ireadabc.com/5a0c5af3e952acd0ac83a6e5c6f03ff1.png"; const image = data.texPngData.url; //"http://staging-teach.cdn.ireadabc.com/5a0c5af3e952acd0ac83a6e5c6f03ff1.png";
const ske = data.skeJsonData.url//"http://staging-teach.cdn.ireadabc.com/bd825dcceea298d1146be8067ae3d17f.json"; const ske = data.skeJsonData.url; //"http://staging-teach.cdn.ireadabc.com/bd825dcceea298d1146be8067ae3d17f.json";
const atlas = data.texJsonData.url//"http://staging-teach.cdn.ireadabc.com/246f8991b729fa3e5a7f4802de828efa.json"; const atlas = data.texJsonData.url; //"http://staging-teach.cdn.ireadabc.com/246f8991b729fa3e5a7f4802de828efa.json";
cc.loader.load(image, (error, texture) => { cc.loader.load(image, (error, texture) => {
cc.loader.load({ url: atlas, type: "txt" }, (error, atlasJson) => {
cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => { cc.loader.load({ url: ske, type: "txt" }, (error, dragonBonesJson) => {
cc.loader.load({ url: ske, type: 'txt' }, (error, dragonBonesJson) => {
const atlas = new dragonBones.DragonBonesAtlasAsset(); const atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = atlasJson; atlas.atlasJson = atlasJson;
atlas.texture = texture; atlas.texture = texture;
...@@ -2302,8 +2198,6 @@ showStartLight() { ...@@ -2302,8 +2198,6 @@ showStartLight() {
dragonDisplay.dragonAtlasAsset = atlas; dragonDisplay.dragonAtlasAsset = atlas;
dragonDisplay.dragonAsset = asset; dragonDisplay.dragonAsset = asset;
let json = JSON.parse(asset.dragonBonesJson); let json = JSON.parse(asset.dragonBonesJson);
let armatures = json["armature"]; let armatures = json["armature"];
// console.log('armatures: ', armatures); // console.log('armatures: ', armatures);
...@@ -2324,16 +2218,16 @@ showStartLight() { ...@@ -2324,16 +2218,16 @@ showStartLight() {
} }
rectNode.addComponent(cc.Button); rectNode.addComponent(cc.Button);
rectNode.on('click', () => { rectNode.on("click", () => {
if (rectNode.isClicked) { if (rectNode.isClicked) {
// return; // return;
} }
rectNode.isClicked = true; rectNode.isClicked = true;
console.log('clicked'); console.log("clicked");
if (animaNode.audioClip) { if (animaNode.audioClip) {
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
cc.director.emit('STOP_ALL_AUDIO') cc.director.emit("STOP_ALL_AUDIO");
cc.audioEngine.playEffect(animaNode.audioClip, false, 0.8); cc.audioEngine.playEffect(animaNode.audioClip, false, 0.8);
} }
...@@ -2343,7 +2237,6 @@ showStartLight() { ...@@ -2343,7 +2237,6 @@ showStartLight() {
}); });
} }
animaNode.x = rectNode.x + rectNode.width / 2; animaNode.x = rectNode.x + rectNode.width / 2;
animaNode.y = rectNode.y + rectNode.height / 2; animaNode.y = rectNode.y + rectNode.height / 2;
...@@ -2351,11 +2244,9 @@ showStartLight() { ...@@ -2351,11 +2244,9 @@ showStartLight() {
const sy = rectNode.height / animaNode.height; const sy = rectNode.height / animaNode.height;
const scale = Math.min(sx, sy); const scale = Math.min(sx, sy);
animaNode.scale = scale; animaNode.scale = scale;
}); });
}); });
}); });
}, },
setSubmitRect(data, bg) { setSubmitRect(data, bg) {
...@@ -2363,10 +2254,9 @@ showStartLight() { ...@@ -2363,10 +2254,9 @@ showStartLight() {
const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width; const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width;
const rectNode = new cc.Node(); const rectNode = new cc.Node();
rectNode.name = 'rect' + data.index; rectNode.name = "rect" + data.index;
bg.addChild(rectNode); bg.addChild(rectNode);
const ctx = rectNode.addComponent(cc.Graphics); const ctx = rectNode.addComponent(cc.Graphics);
// 红色矩形 // 红色矩形
ctx.lineWidth = 4; ctx.lineWidth = 4;
...@@ -2375,8 +2265,6 @@ showStartLight() { ...@@ -2375,8 +2265,6 @@ showStartLight() {
const scale = rate / bg.scaleY; const scale = rate / bg.scaleY;
rectNode.width = data.rect.width * scale; rectNode.width = data.rect.width * scale;
rectNode.height = data.rect.height * scale; rectNode.height = data.rect.height * scale;
rectNode.x = -bg.width / 2 + data.rect.x * scale; rectNode.x = -bg.width / 2 + data.rect.x * scale;
...@@ -2385,14 +2273,13 @@ showStartLight() { ...@@ -2385,14 +2273,13 @@ showStartLight() {
rectNode.anchorX = rectNode.anchorY = 0; rectNode.anchorX = rectNode.anchorY = 0;
if (quesData.bgItem.isShowDebugLine) { if (quesData.bgItem.isShowDebugLine) {
ctx.rect(0, 0, rectNode.width, rectNode.height); ctx.rect(0, 0, rectNode.width, rectNode.height);
} }
ctx.stroke(); ctx.stroke();
ctx.fill(); ctx.fill();
console.log('```data: ', data) console.log("```data: ", data);
// if (data.audio_url) { // if (data.audio_url) {
// cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => { // cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
...@@ -2401,14 +2288,14 @@ showStartLight() { ...@@ -2401,14 +2288,14 @@ showStartLight() {
// } // }
rectNode.addComponent(cc.Button); rectNode.addComponent(cc.Button);
rectNode.on('click', () => { rectNode.on("click", () => {
if (rectNode.isClicked) { if (rectNode.isClicked) {
// return; // return;
} }
rectNode.isClicked = true; rectNode.isClicked = true;
if (this.curQues.itemType == "submit") { if (this.curQues.itemType == "submit") {
this.checkSubmitSelectQues(); this.checkSubmitSelectQues();
} else if (this.curQues.itemType == "drag"){ } else if (this.curQues.itemType == "drag") {
this.checkSubmitDragQues(); this.checkSubmitDragQues();
} }
// console.log('clicked'); // console.log('clicked');
...@@ -2427,15 +2314,13 @@ showStartLight() { ...@@ -2427,15 +2314,13 @@ showStartLight() {
}); });
}, },
setOptPic(data, bg) { setOptPic(data, bg) {
const quesData = bg.data; const quesData = bg.data;
const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width; const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width;
const picNode = new cc.Node(); const picNode = new cc.Node();
picNode.name = 'pic' + data.index; picNode.name = "pic" + data.index;
picNode.data = data; picNode.data = data;
bg.addChild(picNode); bg.addChild(picNode);
picNode.data = data; picNode.data = data;
...@@ -2445,7 +2330,6 @@ showStartLight() { ...@@ -2445,7 +2330,6 @@ showStartLight() {
} }
quesData.optPicArr.push(picNode); quesData.optPicArr.push(picNode);
const scale = rate / bg.scaleY; const scale = rate / bg.scaleY;
picNode.width = data.rect.width * scale; picNode.width = data.rect.width * scale;
picNode.height = data.rect.height * scale; picNode.height = data.rect.height * scale;
...@@ -2454,9 +2338,7 @@ showStartLight() { ...@@ -2454,9 +2338,7 @@ showStartLight() {
picNode.anchorX = picNode.anchorY = 0; picNode.anchorX = picNode.anchorY = 0;
getSprNodeByUrl(data.pic_url, (spr) => { getSprNodeByUrl(data.pic_url, (spr) => {
const sprNode = spr.node; const sprNode = spr.node;
sprNode.scaleX = picNode.width / sprNode.width; sprNode.scaleX = picNode.width / sprNode.width;
...@@ -2465,10 +2347,9 @@ showStartLight() { ...@@ -2465,10 +2347,9 @@ showStartLight() {
sprNode.parent = picNode; sprNode.parent = picNode;
picNode.spr1 = sprNode; picNode.spr1 = sprNode;
}) });
getSprNodeByUrl(data.pic2_url, (spr) => { getSprNodeByUrl(data.pic2_url, (spr) => {
const sprNode = spr.node; const sprNode = spr.node;
sprNode.scaleX = picNode.width / sprNode.width; sprNode.scaleX = picNode.width / sprNode.width;
...@@ -2478,12 +2359,10 @@ showStartLight() { ...@@ -2478,12 +2359,10 @@ showStartLight() {
sprNode.opacity = 0; sprNode.opacity = 0;
picNode.spr2 = sprNode; picNode.spr2 = sprNode;
}) });
picNode.isSelect = false; picNode.isSelect = false;
picNode.on("touchstart", () => { picNode.on("touchstart", () => {
this.hideAllOptSelect(); this.hideAllOptSelect();
picNode.isSelect = true; picNode.isSelect = true;
...@@ -2495,14 +2374,12 @@ showStartLight() { ...@@ -2495,14 +2374,12 @@ showStartLight() {
picNode.spr1.opacity = 255; picNode.spr1.opacity = 255;
picNode.spr2.opacity = 0; picNode.spr2.opacity = 0;
} }
});
})
if (data.audio_url) { if (data.audio_url) {
this.addPicAudio(picNode); this.addPicAudio(picNode);
} }
// cc.loader.load({ url: data.pic_url }, (err, img) => { // cc.loader.load({ url: data.pic_url }, (err, img) => {
// const spr = picNode.addComponent(cc.Sprite); // const spr = picNode.addComponent(cc.Sprite);
...@@ -2522,46 +2399,47 @@ showStartLight() { ...@@ -2522,46 +2399,47 @@ showStartLight() {
// // } // // }
// }); // });
}, },
hideAllOptSelect() { hideAllOptSelect() {
const optPicArr = this.curQues.optPicArr; const optPicArr = this.curQues.optPicArr;
optPicArr.forEach(it => { optPicArr.forEach((it) => {
it.isSelect = false; it.isSelect = false;
it.spr1.opacity = 255; it.spr1.opacity = 255;
it.spr2.opacity = 0; it.spr2.opacity = 0;
}) });
}, },
setOnePic(data) { setOnePic(data) {
const rate = (this.hotZoneBg.scale * this.hotZoneBg.width) / this.data.bgItem.rect.width; const rate =
(this.hotZoneBg.scale * this.hotZoneBg.width) /
this.data.bgItem.rect.width;
const picNode = new cc.Node(); const picNode = new cc.Node();
picNode.name = 'pic' + data.index; picNode.name = "pic" + data.index;
picNode.data = data; picNode.data = data;
this.hotZoneBg.addChild(picNode); this.hotZoneBg.addChild(picNode);
cc.loader.load({ url: data.pic_url }, (err, img) => { cc.loader.load({ url: data.pic_url }, (err, img) => {
const spr = picNode.addComponent(cc.Sprite); const spr = picNode.addComponent(cc.Sprite);
spr.spriteFrame = new cc.SpriteFrame(img) spr.spriteFrame = new cc.SpriteFrame(img);
const scale = rate / this.hotZoneBg.scaleY; const scale = rate / this.hotZoneBg.scaleY;
picNode.width = data.rect.width * scale; picNode.width = data.rect.width * scale;
picNode.height = data.rect.height * scale; picNode.height = data.rect.height * scale;
picNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale; picNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale;
picNode.y = this.hotZoneBg.height / 2 - data.rect.height * scale - data.rect.y * scale; picNode.y =
this.hotZoneBg.height / 2 -
data.rect.height * scale -
data.rect.y * scale;
picNode.anchorX = picNode.anchorY = 0; picNode.anchorX = picNode.anchorY = 0;
if (data.audio_url) { if (data.audio_url) {
this.addPicAudio(picNode); this.addPicAudio(picNode);
} }
}); });
}, },
setOneAudioRect(data, bg) { setOneAudioRect(data, bg) {
...@@ -2569,10 +2447,9 @@ showStartLight() { ...@@ -2569,10 +2447,9 @@ showStartLight() {
const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width; const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width;
const rectNode = new cc.Node(); const rectNode = new cc.Node();
rectNode.name = 'rect' + data.index; rectNode.name = "rect" + data.index;
bg.addChild(rectNode); bg.addChild(rectNode);
const ctx = rectNode.addComponent(cc.Graphics); const ctx = rectNode.addComponent(cc.Graphics);
// 红色矩形 // 红色矩形
ctx.lineWidth = 4; ctx.lineWidth = 4;
...@@ -2589,14 +2466,13 @@ showStartLight() { ...@@ -2589,14 +2466,13 @@ showStartLight() {
rectNode.anchorX = rectNode.anchorY = 0; rectNode.anchorX = rectNode.anchorY = 0;
if (quesData.bgItem.isShowDebugLine) { if (quesData.bgItem.isShowDebugLine) {
ctx.rect(0, 0, rectNode.width, rectNode.height); ctx.rect(0, 0, rectNode.width, rectNode.height);
} }
ctx.stroke(); ctx.stroke();
ctx.fill(); ctx.fill();
console.log('```data: ', data) console.log("```data: ", data);
if (data.audio_url) { if (data.audio_url) {
cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => { cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
...@@ -2605,12 +2481,12 @@ showStartLight() { ...@@ -2605,12 +2481,12 @@ showStartLight() {
} }
rectNode.addComponent(cc.Button); rectNode.addComponent(cc.Button);
rectNode.on('click', () => { rectNode.on("click", () => {
if (rectNode.isClicked) { if (rectNode.isClicked) {
// return; // return;
} }
rectNode.isClicked = true; rectNode.isClicked = true;
console.log('clicked'); console.log("clicked");
if (rectNode.audioClip) { if (rectNode.audioClip) {
// cc.audioEngine.stopAllEffects(); // cc.audioEngine.stopAllEffects();
cc.audioEngine.playEffect(rectNode.audioClip, false, 0.8); cc.audioEngine.playEffect(rectNode.audioClip, false, 0.8);
...@@ -2619,11 +2495,11 @@ showStartLight() { ...@@ -2619,11 +2495,11 @@ showStartLight() {
}, },
setOneHand(data, bg) { setOneHand(data, bg) {
const rectNode = this.setOneRect(data, bg); const rectNode = this.setOneRect(data, bg);
const worldPos = rectNode.parent.convertToWorldSpaceAR(cc.v2(rectNode.x + rectNode.width / 2, rectNode.y + rectNode.height / 2)) const worldPos = rectNode.parent.convertToWorldSpaceAR(
cc.v2(rectNode.x + rectNode.width / 2, rectNode.y + rectNode.height / 2)
);
const pos = this.hand.parent.convertToNodeSpaceAR(worldPos); const pos = this.hand.parent.convertToNodeSpaceAR(worldPos);
bg.handX = pos.x; bg.handX = pos.x;
...@@ -2635,10 +2511,9 @@ showStartLight() { ...@@ -2635,10 +2511,9 @@ showStartLight() {
const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width; const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width;
const rectNode = new cc.Node(); const rectNode = new cc.Node();
rectNode.name = 'rect' + data.index; rectNode.name = "rect" + data.index;
bg.addChild(rectNode); bg.addChild(rectNode);
const ctx = rectNode.addComponent(cc.Graphics); const ctx = rectNode.addComponent(cc.Graphics);
// 红色矩形 // 红色矩形
ctx.lineWidth = 4; ctx.lineWidth = 4;
...@@ -2649,7 +2524,6 @@ showStartLight() { ...@@ -2649,7 +2524,6 @@ showStartLight() {
// console.log('scale: ', scale); // console.log('scale: ', scale);
// console.log('scale2: ', scale / data.mapScale); // console.log('scale2: ', scale / data.mapScale);
rectNode.width = data.rect.width * scale; rectNode.width = data.rect.width * scale;
rectNode.height = data.rect.height * scale; rectNode.height = data.rect.height * scale;
rectNode.x = -bg.width / 2 + data.rect.x * scale; rectNode.x = -bg.width / 2 + data.rect.x * scale;
...@@ -2658,14 +2532,13 @@ showStartLight() { ...@@ -2658,14 +2532,13 @@ showStartLight() {
rectNode.anchorX = rectNode.anchorY = 0; rectNode.anchorX = rectNode.anchorY = 0;
if (quesData.bgItem.isShowDebugLine || this.data.isDebug) { if (quesData.bgItem.isShowDebugLine || this.data.isDebug) {
ctx.rect(0, 0, rectNode.width, rectNode.height); ctx.rect(0, 0, rectNode.width, rectNode.height);
} }
ctx.stroke(); ctx.stroke();
ctx.fill(); ctx.fill();
console.log('```data: ', data) console.log("```data: ", data);
// if (data.audio_url) { // if (data.audio_url) {
// cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => { // cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
...@@ -2674,7 +2547,7 @@ showStartLight() { ...@@ -2674,7 +2547,7 @@ showStartLight() {
// } // }
rectNode.addComponent(cc.Button); rectNode.addComponent(cc.Button);
rectNode.on('click', () => { rectNode.on("click", () => {
// if (rectNode.isClicked) { // if (rectNode.isClicked) {
// return; // return;
// } // }
...@@ -2682,7 +2555,6 @@ showStartLight() { ...@@ -2682,7 +2555,6 @@ showStartLight() {
// console.log('clicked'); // console.log('clicked');
// this.video.pause(); // this.video.pause();
// if (data.selectType == 'right') { // if (data.selectType == 'right') {
// this.curQues.isRight = true; // this.curQues.isRight = true;
// this.startRightVideo(); // this.startRightVideo();
...@@ -2702,18 +2574,15 @@ showStartLight() { ...@@ -2702,18 +2574,15 @@ showStartLight() {
const id = data.index; const id = data.index;
bg.active = false; bg.active = false;
this.hand.active = false; this.hand.active = false;
console.log("跳转", data.index)
this.showMask(() => { this.showMask(() => {
if (!this.isLocal) { if (!this.isLocal) {
callMiddleLayerFunction('PSQS_jump_to_question', {step: id}, null) callMiddleLayerFunction("PSQS_jump_to_question", { step: id }, null);
} }
}) });
}); });
return rectNode; return rectNode;
}, },
addPicAudio(picNode) { addPicAudio(picNode) {
...@@ -2724,7 +2593,7 @@ showStartLight() { ...@@ -2724,7 +2593,7 @@ showStartLight() {
}); });
picNode.addComponent(cc.Button); picNode.addComponent(cc.Button);
picNode.on('click', () => { picNode.on("click", () => {
if (picNode.audioClip) { if (picNode.audioClip) {
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
cc.audioEngine.playEffect(picNode.audioClip, false, 0.8); cc.audioEngine.playEffect(picNode.audioClip, false, 0.8);
...@@ -2733,15 +2602,15 @@ showStartLight() { ...@@ -2733,15 +2602,15 @@ showStartLight() {
}, },
getLabel() { getLabel() {
const resLabel = cc.find("Canvas/res/label") const resLabel = cc.find("Canvas/res/label");
const labelNode = cc.instantiate(resLabel) const labelNode = cc.instantiate(resLabel);
const label = labelNode.getComponent(cc.Label); const label = labelNode.getComponent(cc.Label);
return label; return label;
}, },
getRichText() { getRichText() {
const resLabel = cc.find("Canvas/res/label") const resLabel = cc.find("Canvas/res/label");
const label = resLabel.getComponent(cc.Label); const label = resLabel.getComponent(cc.Label);
const fontFamily = label.fontFamily; const fontFamily = label.fontFamily;
...@@ -2749,37 +2618,33 @@ showStartLight() { ...@@ -2749,37 +2618,33 @@ showStartLight() {
const richText = node.addComponent(cc.RichText); const richText = node.addComponent(cc.RichText);
richText.fontFamily = fontFamily; richText.fontFamily = fontFamily;
return richText; return richText;
}, },
getAnim(resName) { getAnim(resName) {
const anim = cc.find("Canvas/res/anim/" + resName); const anim = cc.find("Canvas/res/anim/" + resName);
const newAnim = cc.instantiate(anim) const newAnim = cc.instantiate(anim);
return newAnim; return newAnim;
}, },
checkSubmitDragQues() { checkSubmitDragQues() {
console.log("in checkSubmitDragQues");
console.log('in checkSubmitDragQues');
let isRight = true; let isRight = true;
const dragPicArr = this.curQues.dragPicArr; const dragPicArr = this.curQues.dragPicArr;
for (let i = 0; i < dragPicArr.length; i++) { for (let i = 0; i < dragPicArr.length; i++) {
const isDragRight = this.checkIsDragEndSuccess(dragPicArr[i]); const isDragRight = this.checkIsDragEndSuccess(dragPicArr[i]);
if (!isDragRight) { if (!isDragRight) {
console.log("dragItem: ", dragPicArr[i]); console.log("dragItem: ", dragPicArr[i]);
console.log("drag fail "); console.log("drag fail ");
isRight = false; isRight = false;
break; break;
} }
} }
this.video.pause(); this.video.pause();
this.videoControlBar.emit("update_video_status", 0);
this.curQues.isRight = isRight; this.curQues.isRight = isRight;
if (isRight) { if (isRight) {
this.startRightVideo(); this.startRightVideo();
...@@ -2788,10 +2653,7 @@ showStartLight() { ...@@ -2788,10 +2653,7 @@ showStartLight() {
} }
}, },
checkSubmitSelectQues() { checkSubmitSelectQues() {
let isRight = true; let isRight = true;
const optPicArr = this.curQues.optPicArr; const optPicArr = this.curQues.optPicArr;
for (let i = 0; i < optPicArr.length; i++) { for (let i = 0; i < optPicArr.length; i++) {
...@@ -2801,51 +2663,47 @@ showStartLight() { ...@@ -2801,51 +2663,47 @@ showStartLight() {
// console.log('data.selectType: ', data.selectType); // console.log('data.selectType: ', data.selectType);
if (optPicArr[i].isSelect) { if (optPicArr[i].isSelect) {
if (data.selectType != 'right') { if (data.selectType != "right") {
isRight = false; isRight = false;
break; break;
} }
} else { } else {
if (data.selectType == 'right') { if (data.selectType == "right") {
isRight = false; isRight = false;
break; break;
} }
} }
} }
console.log("clicked");
console.log('clicked');
this.video.pause(); this.video.pause();
this.videoControlBar.emit("update_video_status", 0);
this.curQues.isRight = isRight; this.curQues.isRight = isRight;
if (isRight) { if (isRight) {
this.startRightVideo(); this.startRightVideo();
} else { } else {
this.startWrongVideo(); this.startWrongVideo();
} }
}, },
httpHeadCall(requsetUrl, callback) { httpHeadCall(requsetUrl, callback) {
let xhr = new XMLHttpRequest(); let xhr = new XMLHttpRequest();
console.log("Status: Send Post Request to " + requsetUrl); console.log("Status: Send Post Request to " + requsetUrl);
try { try {
xhr.onreadystatechange = () => { xhr.onreadystatechange = () => {
try { try {
console.log("xhr.readyState: ", xhr.readyState);
console.log('xhr.readyState: ', xhr.readyState);
if (xhr.readyState == 4) { if (xhr.readyState == 4) {
if ((xhr.status >= 200 && xhr.status < 400)) { if (xhr.status >= 200 && xhr.status < 400) {
callback(true); callback(true);
} else { } else {
callback(false); callback(false);
} }
} }
} catch (e) { } catch (e) {
console.log(e) console.log(e);
} }
}; };
...@@ -2856,7 +2714,6 @@ showStartLight() { ...@@ -2856,7 +2714,6 @@ showStartLight() {
// xhr.send(JSON.stringify(requestData)); // xhr.send(JSON.stringify(requestData));
xhr.send(); xhr.send();
xhr.timeout = 15000; xhr.timeout = 15000;
xhr.onerror = (e) => { xhr.onerror = (e) => {
console.log("汪汪汪 posterror", e); console.log("汪汪汪 posterror", e);
...@@ -2867,23 +2724,17 @@ showStartLight() { ...@@ -2867,23 +2724,17 @@ showStartLight() {
console.log("汪汪汪 ontimeout", e); console.log("汪汪汪 ontimeout", e);
callback(false); callback(false);
}; };
} catch (e) { } catch (e) {
console.log("Send Get Request error: ", e) console.log("Send Get Request error: ", e);
} }
}, },
isDestroy: null, isDestroy: null,
onDestroy() { onDestroy() {
this.isDestroy = true; this.isDestroy = true;
cc.Tween.stopAll(); cc.Tween.stopAll();
cc.game.canvas.style.backgroundColor = '#000000'; cc.game.canvas.style.backgroundColor = "#000000";
// this.pauseVideo(); // this.pauseVideo();
},
}
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment