Commit 674546a4 authored by 杨一航's avatar 杨一航

add v0.1 版本

parent d4cfc91f
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
CCEffect %{
techniques:
- passes:
- vert: vs
frag: fs
blendState:
targets:
- blend: true
rasterizerState:
cullMode: none
properties:
texture: { value: white }
alphaThreshold: { value: 0.5 }
}%
CCProgram vs %{
precision highp float;
#include <cc-global>
#include <cc-local>
in vec3 a_position;
in vec4 a_color;
out vec4 v_color;
#if USE_TEXTURE
in vec2 a_uv0;
out vec2 v_uv0;
#endif
void main () {
vec4 pos = vec4(a_position, 1);
#if CC_USE_MODEL
pos = cc_matViewProj * cc_matWorld * pos;
#else
pos = cc_matViewProj * pos;
#endif
#if USE_TEXTURE
v_uv0 = a_uv0;
#endif
v_color = a_color;
gl_Position = pos;
}
}%
CCProgram fs %{
precision highp float;
#include <alpha-test>
#include <texture>
in vec4 v_color;
#if USE_TEXTURE
in vec2 v_uv0;
uniform sampler2D texture;
#endif
void main () {
vec4 o = vec4(1, 1, 1, 1);
vec4 t = vec4(1, 1, 1, 1);
#if USE_TEXTURE
CCTexture(texture, v_uv0, o);
#endif
o *= v_color;
if(distance(o.rgb, t.rgb)<0.3)
o.a =0.0;
ALPHA_TEST(o);
gl_FragColor = o;
}
}%
{
"ver": "1.0.25",
"uuid": "ef2f70bc-84a5-48b7-aa8a-bf495c7a1402",
"compiledShaders": [
{
"glsl1": {
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n vec4 t = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n vec4 texture_tmp = texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n o.a *= texture_tmp.a;\n #else\n o *= texture_tmp;\n #endif\n #endif\n o *= v_color;\n if(distance(o.rgb, t.rgb)<0.3)\n o.a =0.0;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
},
"glsl3": {
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n vec4 t = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n vec4 texture_tmp = texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n o.a *= texture_tmp.a;\n #else\n o *= texture_tmp;\n #endif\n #endif\n o *= v_color;\n if(distance(o.rgb, t.rgb)<0.3)\n o.a =0.0;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
}
}
],
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.Material",
"_name": "New Material",
"_objFlags": 0,
"_native": "",
"_effectAsset": {
"__uuid__": "ef2f70bc-84a5-48b7-aa8a-bf495c7a1402"
},
"_techniqueIndex": 0,
"_techniqueData": {
"0": {
"defines": {
"USE_TEXTURE": true
}
}
}
}
\ No newline at end of file
{
"ver": "1.0.3",
"uuid": "c4fd8197-4506-45a8-84a5-887e2c4e71ed",
"dataAsSubAsset": null,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "8b37ac82-bfc9-4134-aac8-c7b5b5a53809",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "9bb4c51a-ce48-4018-8ad2-33436094705c",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
[ [
{ {
"__type__": "cc.SceneAsset", "__type__": "cc.Prefab",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"_native": "", "_native": "",
"scene": { "data": {
"__id__": 1 "__id__": 1
} },
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
}, },
{ {
"__type__": "cc.Scene", "__type__": "cc.Node",
"_name": "LoadingLayer",
"_objFlags": 0, "_objFlags": 0,
"_parent": null, "_parent": null,
"_children": [ "_children": [
{ {
"__id__": 2 "__id__": 2
},
{
"__id__": 7
},
{
"__id__": 11
},
{
"__id__": 14
},
{
"__id__": 17
},
{
"__id__": 21
},
{
"__id__": 25
},
{
"__id__": 34
},
{
"__id__": 54
} }
], ],
"_active": false, "_active": true,
"_components": [], "_components": [
"_prefab": null, {
"__id__": 59
},
{
"__id__": 60
}
],
"_prefab": {
"__id__": 61
},
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -30,8 +67,8 @@ ...@@ -30,8 +67,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 0, "width": 2560,
"height": 0 "height": 1920
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -54,46 +91,42 @@ ...@@ -54,46 +91,42 @@
1 1
] ]
}, },
"_is3DNode": true, "_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"autoReleaseAssets": true, "_id": ""
"_id": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "Canvas", "_name": "bg",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 1 "__id__": 1
}, },
"_children": [ "_children": [],
{
"__id__": 3
},
{
"__id__": 5
},
{
"__id__": 7
},
{
"__id__": 14
}
],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 24 "__id__": 3
}, },
{ {
"__id__": 25 "__id__": 4
}, },
{ {
"__id__": 26 "__id__": 5
} }
], ],
"_prefab": null, "_prefab": {
"__id__": 6
},
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -104,8 +137,8 @@ ...@@ -104,8 +137,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1280, "width": 2560,
"height": 720 "height": 1920
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -116,8 +149,8 @@ ...@@ -116,8 +149,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
640, 1280,
360, 960,
0, 0,
0, 0,
0, 0,
...@@ -139,23 +172,166 @@ ...@@ -139,23 +172,166 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "a5esZu+45LA5mBpvttspPD" "_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "f29707ed-4120-4cee-8b97-e7a7ed611557"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 2,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 2176,
"_originalHeight": 1600,
"_id": ""
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
},
"fileId": "a1GjpGzJdD65Biy/y88Sq8",
"sync": false
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "Main Camera", "_name": "layout",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 2 "__id__": 1
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 4 "__id__": 8
},
{
"__id__": 9
} }
], ],
"_prefab": null, "_prefab": {
"__id__": 10
},
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -166,8 +342,8 @@ ...@@ -166,8 +342,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1280, "width": 300,
"height": 720 "height": 200
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -178,10 +354,10 @@ ...@@ -178,10 +354,10 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
1280,
1210,
0, 0,
0, 0,
362.85545494732423,
0,
0, 0,
0, 0,
1, 1,
...@@ -201,59 +377,95 @@ ...@@ -201,59 +377,95 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "e1WoFrQ79G7r4ZuQE3HlNb" "_id": ""
}, },
{ {
"__type__": "cc.Camera", "__type__": "cc.Layout",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 3 "__id__": 7
}, },
"_enabled": true, "_enabled": true,
"_cullingMask": 4294967295, "_layoutSize": {
"_clearFlags": 7, "__type__": "cc.Size",
"_backgroundColor": { "width": 300,
"__type__": "cc.Color", "height": 200
"r": 0,
"g": 0,
"b": 0,
"a": 255
}, },
"_depth": -1, "_resize": 1,
"_zoomRatio": 1, "_N$layoutType": 1,
"_targetTexture": null, "_N$cellSize": {
"_fov": 60, "__type__": "cc.Size",
"_orthoSize": 10, "width": 40,
"_nearClip": 1, "height": 40
"_farClip": 4096, },
"_ortho": true, "_N$startAxis": 0,
"_rect": { "_N$paddingLeft": 0,
"__type__": "cc.Rect", "_N$paddingRight": 0,
"x": 0, "_N$paddingTop": 0,
"y": 0, "_N$paddingBottom": 0,
"width": 1, "_N$spacingX": 500,
"height": 1 "_N$spacingY": 0,
"_N$verticalDirection": 1,
"_N$horizontalDirection": 0,
"_N$affectedByScale": false,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 18,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 250,
"_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
}, },
"_renderStages": 1, "asset": {
"_alignWithScreen": true, "__uuid__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
"_id": "81GN3uXINKVLeW4+iKSlim" },
"fileId": "afaLDsGNdF8rTS2GfZ3h3s",
"sync": false
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "bg", "_name": "left",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 2 "__id__": 1
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 6 "__id__": 12
} }
], ],
"_prefab": null, "_prefab": {
"__id__": 13
},
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -264,8 +476,8 @@ ...@@ -264,8 +476,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 2456, "width": 0,
"height": 1850 "height": 0
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -276,8 +488,8 @@ ...@@ -276,8 +488,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 880,
0, 1210,
0, 0,
0, 0,
0, 0,
...@@ -299,58 +511,313 @@ ...@@ -299,58 +511,313 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "32MJMZ2HRGF4BOf533Avyi" "_id": ""
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Widget",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 5 "__id__": 11
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "alignMode": 2,
{ "_target": null,
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" "_alignFlags": 18,
} "_left": 0,
], "_right": 0,
"_srcBlendFactor": 770, "_top": 0,
"_dstBlendFactor": 771, "_bottom": 0,
"_spriteFrame": { "_verticalCenter": 250,
"__uuid__": "f523a200-d1c3-4939-b9a2-2cfe285e5c03" "_horizontalCenter": -400,
}, "_isAbsLeft": true,
"_type": 0, "_isAbsRight": true,
"_sizeMode": 1, "_isAbsTop": true,
"_fillType": 0, "_isAbsBottom": true,
"_fillCenter": { "_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
},
"fileId": "24ejo0WoZJxpoRK40tkCN+",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "right",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_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": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
1680,
1210,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0 "y": 0,
"z": 0
}, },
"_fillStart": 0, "_skewX": 0,
"_fillRange": 0, "_skewY": 0,
"_isTrimmedMode": true, "_is3DNode": false,
"_atlas": null, "_groupIndex": 0,
"_id": "97/S6HDq9MeqgmV1Zwnhbb" "groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
},
"_enabled": true,
"alignMode": 2,
"_target": null,
"_alignFlags": 18,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 250,
"_horizontalCenter": 400,
"_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__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
},
"fileId": "42DCsVISJGIKgyDyhKrDpv",
"sync": false
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "bottomPart", "_name": "vs",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 2 "__id__": 1
}, },
"_children": [ "_children": [],
"_active": true,
"_components": [
{ {
"__id__": 8 "__id__": 18
}, },
{ {
"__id__": 11 "__id__": 19
}
],
"_prefab": {
"__id__": 20
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 593,
"height": 594
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
1280,
1210,
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.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 18,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 250,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "dragonBones.ArmatureDisplay",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
} }
], ],
"_armatureName": "Armature",
"_animationName": "",
"_preCacheMode": 0,
"_cacheMode": 0,
"playTimes": 1,
"premultipliedAlpha": false,
"_armatureKey": "b667ff81-473f-4c7a-aa8c-81d83296e459#04b2b9d0-6e85-475c-b5a6-6b7362e8f102",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "b667ff81-473f-4c7a-aa8c-81d83296e459"
},
"_N$dragonAtlasAsset": {
"__uuid__": "04b2b9d0-6e85-475c-b5a6-6b7362e8f102"
},
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 0,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$debugBones": false,
"_N$enableBatch": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
},
"fileId": "4cZmgdmo1Az6QuveaZ6W/3",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true, "_active": true,
"_components": [], "_components": [
"_prefab": null, {
"__id__": 22
},
{
"__id__": 23
}
],
"_prefab": {
"__id__": 24
},
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -362,7 +829,154 @@ ...@@ -362,7 +829,154 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 0, "width": 0,
"height": 0 "height": 63
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
1280,
633.901,
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.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "",
"_N$string": "",
"_fontSize": 50,
"_lineHeight": 50,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "34b18543-1119-458b-928b-969e7e48d0fd"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
},
"_enabled": true,
"alignMode": 2,
"_target": null,
"_alignFlags": 16,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_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__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
},
"fileId": "8bJSQRyJRA0Jkcc+8GY5Do",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "progressBar",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 26
}
],
"_active": true,
"_components": [
{
"__id__": 30
},
{
"__id__": 31
},
{
"__id__": 32
}
],
"_prefab": {
"__id__": 33
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1578,
"height": 42
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -373,8 +987,8 @@ ...@@ -373,8 +987,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
635.132, 1280,
-356.326, 555,
0, 0,
0, 0,
0, 0,
...@@ -396,26 +1010,28 @@ ...@@ -396,26 +1010,28 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "8c7k8ep/ZFNpO263+1QHz9" "_id": ""
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "btn_left", "_name": "bar",
"_objFlags": 0, "_objFlags": 512,
"_parent": { "_parent": {
"__id__": 7 "__id__": 25
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 9 "__id__": 27
}, },
{ {
"__id__": 10 "__id__": 28
} }
], ],
"_prefab": null, "_prefab": {
"__id__": 29
},
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -426,20 +1042,20 @@ ...@@ -426,20 +1042,20 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 61, "width": 0,
"height": 67 "height": 32
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 0,
"y": 0.5 "y": 0.5
}, },
"_trs": { "_trs": {
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-148.464, -784,
34, 0,
0, 0,
0, 0,
0, 0,
...@@ -461,14 +1077,14 @@ ...@@ -461,14 +1077,14 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "5ad2wLQLxIN5Eg7OHecSH6" "_id": ""
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 8 "__id__": 26
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -479,10 +1095,10 @@ ...@@ -479,10 +1095,10 @@
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5" "__uuid__": "b435887d-bae1-49a8-bd0c-aeeeda4c6c73"
}, },
"_type": 0, "_type": 2,
"_sizeMode": 1, "_sizeMode": 0,
"_fillType": 0, "_fillType": 0,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -493,94 +1109,226 @@ ...@@ -493,94 +1109,226 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_atlas": null, "_atlas": null,
"_id": "84mqOgJ3JNqZrYVTEU8CjE" "_id": ""
}, },
{ {
"__type__": "cc.Button", "__type__": "cc.Widget",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 8 "__id__": 26
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "alignMode": 1,
"_grayMaterial": null, "_target": null,
"duration": 0.1, "_alignFlags": 8,
"zoomScale": 1.2, "_left": 5,
"clickEvents": [], "_right": 0,
"_N$interactable": true, "_top": 0,
"_N$enableAutoGrayEffect": false, "_bottom": 0,
"_N$transition": 0, "_verticalCenter": 0,
"transition": 0, "_horizontalCenter": 0,
"_N$normalColor": { "_isAbsLeft": true,
"__type__": "cc.Color", "_isAbsRight": true,
"r": 255, "_isAbsTop": true,
"g": 255, "_isAbsBottom": true,
"b": 255, "_isAbsHorizontalCenter": true,
"a": 255 "_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
}, },
"_N$pressedColor": { "asset": {
"__type__": "cc.Color", "__uuid__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
"r": 211,
"g": 211,
"b": 211,
"a": 255
}, },
"pressedColor": { "fileId": "1coIwLNVZGEZEzF3dItpuK",
"__type__": "cc.Color", "sync": false
"r": 211, },
"g": 211, {
"b": 211, "__type__": "cc.Sprite",
"a": 255 "_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
}, },
"_N$hoverColor": { "_enabled": true,
"__type__": "cc.Color", "_materials": [
"r": 255, {
"g": 255, "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
"b": 255, }
"a": 255 ],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "afa1a774-a1cf-4476-b01f-bdc83069f46c"
}, },
"hoverColor": { "_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.ProgressBar",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
},
"_enabled": true,
"_N$totalLength": 1568,
"_N$barSprite": {
"__id__": 27
},
"_N$mode": 0,
"_N$progress": 0,
"_N$reverse": false,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
},
"_enabled": true,
"alignMode": 2,
"_target": null,
"_alignFlags": 16,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_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__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
},
"fileId": "55nJZ9Uk5CArtjDKXyL9xa",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "head",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 35
},
{
"__id__": 38
},
{
"__id__": 44
},
{
"__id__": 47
},
{
"__id__": 50
}
],
"_active": false,
"_components": [],
"_prefab": {
"__id__": 53
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
"r": 255, "r": 255,
"g": 255, "g": 255,
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_N$disabledColor": { "_contentSize": {
"__type__": "cc.Color", "__type__": "cc.Size",
"r": 124, "width": 340,
"g": 124, "height": 340
"b": 124,
"a": 255
}, },
"_N$normalSprite": null, "_anchorPoint": {
"_N$pressedSprite": null, "__type__": "cc.Vec2",
"pressedSprite": null, "x": 0.5,
"_N$hoverSprite": null, "y": 0.5
"hoverSprite": null, },
"_N$disabledSprite": null, "_trs": {
"_N$target": null, "__type__": "TypedArray",
"_id": "bcYN/4EKBJhbIAfovo9Ah1" "ctor": "Float64Array",
"array": [
-1233.11,
-606.716,
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", "__type__": "cc.Node",
"_name": "btn_right", "_name": "bg",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 7 "__id__": 34
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 12 "__id__": 36
},
{
"__id__": 13
} }
], ],
"_prefab": null, "_prefab": {
"__id__": 37
},
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -591,8 +1339,8 @@ ...@@ -591,8 +1339,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 60, "width": 258,
"height": 66 "height": 258
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -603,8 +1351,8 @@ ...@@ -603,8 +1351,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-47.164, 0,
34, 0,
0, 0,
0, 0,
0, 0,
...@@ -626,14 +1374,14 @@ ...@@ -626,14 +1374,14 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "46i3stdzpHX6zQHTGnRsNE" "_id": ""
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 11 "__id__": 35
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -644,7 +1392,7 @@ ...@@ -644,7 +1392,7 @@
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59" "__uuid__": "59b5cf19-b997-4572-b537-8b94f22b26bf"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 1,
...@@ -656,99 +1404,42 @@ ...@@ -656,99 +1404,42 @@
}, },
"_fillStart": 0, "_fillStart": 0,
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_atlas": null, "_atlas": null,
"_id": "42Sh8QS/BHn4WiGyPQPKPt" "_id": ""
}, },
{ {
"__type__": "cc.Button", "__type__": "cc.PrefabInfo",
"_name": "", "root": {
"_objFlags": 0, "__id__": 1
"node": {
"__id__": 11
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
}, },
"_N$disabledColor": { "asset": {
"__type__": "cc.Color", "__uuid__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
"r": 124,
"g": 124,
"b": 124,
"a": 255
}, },
"_N$normalSprite": null, "fileId": "eauguU1wtOrbhO0xPWGhAt",
"_N$pressedSprite": null, "sync": false
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "1aj32fYY1IxLesa77E70Qu"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "res", "_name": "mask",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 2 "__id__": 34
}, },
"_children": [ "_children": [
{ {
"__id__": 15 "__id__": 39
}, }
{ ],
"__id__": 18 "_active": true,
}, "_components": [
{ {
"__id__": 21 "__id__": 42
} }
], ],
"_active": false, "_prefab": {
"_components": [], "__id__": 43
"_prefab": null, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -759,8 +1450,8 @@ ...@@ -759,8 +1450,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 0, "width": 258,
"height": 0 "height": 258
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -794,23 +1485,25 @@ ...@@ -794,23 +1485,25 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "0aAzbH6R1E+6AmGRrkKa5O" "_id": ""
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "font", "_name": "headImg",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 14 "__id__": 38
}, },
"_children": [ "_children": [],
"_active": true,
"_components": [
{ {
"__id__": 16 "__id__": 40
} }
], ],
"_active": true, "_prefab": {
"_components": [], "__id__": 41
"_prefab": null, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -821,8 +1514,8 @@ ...@@ -821,8 +1514,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 0, "width": 40,
"height": 0 "height": 36
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -856,23 +1549,101 @@ ...@@ -856,23 +1549,101 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "9bLfcYeeNKrr524vzWchiM" "_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 39
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "8cdb44ac-a3f6-449f-b354-7cd48cf84061"
},
"_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__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
},
"fileId": "60BI1U1b9OoZRIDunWHW0a",
"sync": false
},
{
"__type__": "cc.Mask",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 38
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_spriteFrame": {
"__uuid__": "59b5cf19-b997-4572-b537-8b94f22b26bf"
},
"_type": 2,
"_segments": 64,
"_N$alphaThreshold": 0.6,
"_N$inverted": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
},
"fileId": "5cd2Jos1dOS46NiARvN6qg",
"sync": false
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "BRLNSDB", "_name": "frame",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 15 "__id__": 34
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 17 "__id__": 45
} }
], ],
"_prefab": null, "_prefab": {
"__id__": 46
},
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -883,8 +1654,8 @@ ...@@ -883,8 +1654,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 0, "width": 280,
"height": 0 "height": 280
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -918,54 +1689,68 @@ ...@@ -918,54 +1689,68 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "cfMLGsq0BMhJARv+ySMAxS" "_id": ""
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 16 "__id__": 44
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [
"_srcBlendFactor": 770, {
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_string": "", "_spriteFrame": {
"_N$string": "", "__uuid__": "61f66300-e031-447d-9107-251b09648d7a"
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "c551970e-b095-45f3-9f1d-25cde8b8deb1"
}, },
"_isSystemFontUsed": false, "_type": 0,
"_spacingX": 0, "_sizeMode": 1,
"_batchAsBitmap": false, "_fillType": 0,
"_styleFlags": 0, "_fillCenter": {
"_underlineHeight": 0, "__type__": "cc.Vec2",
"_N$horizontalAlign": 0, "x": 0,
"_N$verticalAlign": 0, "y": 0
"_N$fontFamily": "Arial", },
"_N$overflow": 0, "_fillStart": 0,
"_N$cacheMode": 0, "_fillRange": 0,
"_id": "9bNHNPu5lC7rQYyr8ai/sY" "_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
},
"fileId": "8aSOlD3bNAYbWZEGUBpU7X",
"sync": false
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "img", "_name": "frame_self",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 14 "__id__": 34
}, },
"_children": [ "_children": [],
"_active": true,
"_components": [
{ {
"__id__": 19 "__id__": 48
} }
], ],
"_active": true, "_prefab": {
"_components": [], "__id__": 49
"_prefab": null, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -976,8 +1761,8 @@ ...@@ -976,8 +1761,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 0, "width": 388,
"height": 0 "height": 388
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -1011,23 +1796,68 @@ ...@@ -1011,23 +1796,68 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "53LUHHG2pEr79fyrvazXJs" "_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 47
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "922c0839-c8d1-4f42-936b-1be1d3bb6af5"
},
"_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__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
},
"fileId": "ddBCn3FshPQ4V9KDNSlBfr",
"sync": false
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "icon", "_name": "name",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 18 "__id__": 34
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 20 "__id__": 51
} }
], ],
"_prefab": null, "_prefab": {
"__id__": 52
},
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -1038,8 +1868,8 @@ ...@@ -1038,8 +1868,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 138, "width": 122.34,
"height": 141 "height": 63
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -1051,7 +1881,7 @@ ...@@ -1051,7 +1881,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
0, -203.314,
0, 0,
0, 0,
0, 0,
...@@ -1073,51 +1903,82 @@ ...@@ -1073,51 +1903,82 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "1blU2OArJIfoC9XfupGxJG" "_id": ""
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Label",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 19 "__id__": 50
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_string": "Label",
"__uuid__": "6fbc30a8-3c49-44ae-8ba4-7f56f385b78a" "_N$string": "Label",
"_fontSize": 50,
"_lineHeight": 50,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "343540a1-2609-4367-b74f-cfa6d2e2cb6b"
}, },
"_type": 0, "_isSystemFontUsed": false,
"_sizeMode": 1, "_spacingX": 0,
"_fillType": 0, "_batchAsBitmap": false,
"_fillCenter": { "_styleFlags": 0,
"__type__": "cc.Vec2", "_underlineHeight": 0,
"x": 0, "_N$horizontalAlign": 1,
"y": 0 "_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
}, },
"_fillStart": 0, "asset": {
"_fillRange": 0, "__uuid__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
"_isTrimmedMode": true, },
"_atlas": null, "fileId": "6anh4wjaRPMqyS2LhXSx4j",
"_id": "03GEWUEZJGyKormWgIWCtM" "sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
},
"fileId": "f9qrJyDh5P1oErn3FfsNL7",
"sync": false
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "audio", "_name": "res",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 14 "__id__": 1
}, },
"_children": [ "_children": [
{ {
"__id__": 22 "__id__": 55
} }
], ],
"_active": true, "_active": true,
"_components": [], "_components": [],
"_prefab": null, "_prefab": {
"__id__": 58
},
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -1163,23 +2024,25 @@ ...@@ -1163,23 +2024,25 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "d9f+b0lmZGSJJae6zrADhp" "_id": ""
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "btn", "_name": "match",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 21 "__id__": 54
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 23 "__id__": 56
} }
], ],
"_prefab": null, "_prefab": {
"__id__": 57
},
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
...@@ -1225,18 +2088,18 @@ ...@@ -1225,18 +2088,18 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "e87DSaFCVJfb2PAUkf4/o7" "_id": ""
}, },
{ {
"__type__": "cc.AudioSource", "__type__": "cc.AudioSource",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 22 "__id__": 55
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
"__uuid__": "f0680ae0-c079-45ef-abd7-9e63d90b982b" "__uuid__": "cea5587b-af50-40ca-b249-8adf586ed31c"
}, },
"_volume": 1, "_volume": 1,
"_mute": false, "_mute": false,
...@@ -1244,34 +2107,39 @@ ...@@ -1244,34 +2107,39 @@
"_firstlyEnabled": true, "_firstlyEnabled": true,
"playOnLoad": false, "playOnLoad": false,
"preload": false, "preload": false,
"_id": "dey05oKrBIspvsDa6pOIQz" "_id": ""
}, },
{ {
"__type__": "cc.Canvas", "__type__": "cc.PrefabInfo",
"_name": "", "root": {
"_objFlags": 0, "__id__": 1
"node": {
"__id__": 2
}, },
"_enabled": true, "asset": {
"_designResolution": { "__uuid__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
"__type__": "cc.Size", },
"width": 1280, "fileId": "24pM39t0xAcpeV3Rbf7iK5",
"height": 720 "sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
}, },
"_fitWidth": true, "fileId": "28B+az6rRACpZT/KUohVaz",
"_fitHeight": true, "sync": false
"_id": "59Cd0ovbdF4byw5sbjJDx7"
}, },
{ {
"__type__": "cc.Widget", "__type__": "cc.Widget",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 2 "__id__": 1
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 2,
"_target": null, "_target": null,
"_alignFlags": 45, "_alignFlags": 45,
"_left": 0, "_left": 0,
...@@ -1288,16 +2156,27 @@ ...@@ -1288,16 +2156,27 @@
"_isAbsVerticalCenter": true, "_isAbsVerticalCenter": true,
"_originalWidth": 0, "_originalWidth": 0,
"_originalHeight": 0, "_originalHeight": 0,
"_id": "29zXboiXFBKoIV4PQ2liTe" "_id": ""
}, },
{ {
"__type__": "408a6f4ZfpM8Yzyg+IOGg/V", "__type__": "4d354gk3w1AIKtlOv2FygBk",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 2 "__id__": 1
}, },
"_enabled": true, "_enabled": true,
"_id": "eaTVUpqahPfZeO9+sUI7RP" "_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d"
},
"fileId": "",
"sync": false
} }
] ]
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "eeb30776-64d3-4ec2-962b-a1f4bee3b27d",
"optimizationPolicy": "SINGLE_INSTANCE",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "ef09732c-6b0e-4dbd-a3cd-b4a117cba25e",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "343540a1-2609-4367-b74f-cfa6d2e2cb6b",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "0a933136-2f52-4fa8-ae58-f0de6b381f41",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2176,
"height": 1600,
"platformSettings": {},
"subMetas": {
"bg": {
"ver": "1.0.4",
"uuid": "f29707ed-4120-4cee-8b97-e7a7ed611557",
"rawTextureUuid": "0a933136-2f52-4fa8-ae58-f0de6b381f41",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 2176,
"height": 1600,
"rawWidth": 2176,
"rawHeight": 1600,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "34b18543-1119-458b-928b-969e7e48d0fd",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "a2433807-efd6-466a-a0a3-3ab3f0a5dbf6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "point",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1568,
"height": 32,
"platformSettings": {},
"subMetas": {
"progress_bar": {
"ver": "1.0.4",
"uuid": "b435887d-bae1-49a8-bd0c-aeeeda4c6c73",
"rawTextureUuid": "a2433807-efd6-466a-a0a3-3ab3f0a5dbf6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1568,
"height": 32,
"rawWidth": 1568,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "cd5a4b74-7b02-4477-988a-744a7be97b61",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "point",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1578,
"height": 42,
"platformSettings": {},
"subMetas": {
"progress_bg": {
"ver": "1.0.4",
"uuid": "afa1a774-a1cf-4476-b01f-bdc83069f46c",
"rawTextureUuid": "cd5a4b74-7b02-4477-988a-744a7be97b61",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1578,
"height": 42,
"rawWidth": 1578,
"rawHeight": 42,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "37c4e6f0-5f20-4a83-8e31-321837bf1c40",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 280,
"height": 280,
"platformSettings": {},
"subMetas": {
"tx_01": {
"ver": "1.0.4",
"uuid": "61f66300-e031-447d-9107-251b09648d7a",
"rawTextureUuid": "37c4e6f0-5f20-4a83-8e31-321837bf1c40",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 280,
"height": 280,
"rawWidth": 280,
"rawHeight": 280,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "ef6d8c0a-f5c5-42fa-b25d-dcd50f04a3e3",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 258,
"height": 258,
"platformSettings": {},
"subMetas": {
"tx_01zw": {
"ver": "1.0.4",
"uuid": "59b5cf19-b997-4572-b537-8b94f22b26bf",
"rawTextureUuid": "ef6d8c0a-f5c5-42fa-b25d-dcd50f04a3e3",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 258,
"height": 258,
"rawWidth": 258,
"rawHeight": 258,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "96aa5a20-e629-42ba-8e51-405e6ab04003",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 388,
"height": 388,
"platformSettings": {},
"subMetas": {
"tx_xuanzhong": {
"ver": "1.0.4",
"uuid": "922c0839-c8d1-4f42-936b-1be1d3bb6af5",
"rawTextureUuid": "96aa5a20-e629-42ba-8e51-405e6ab04003",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 388,
"height": 388,
"rawWidth": 388,
"rawHeight": 388,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.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
const { ccclass, property } = cc._decorator;
@ccclass
export default class BoardCardItem extends cc.Component {
_cardId: number;
_rjumpId: number;
_wjumpId: number;
_cardUrl: string;
_word: string;
letter: string = '';
set cardData(data: { id: number, rjumpId: number, wJumpId?: number, url: string, word: "string" }) {
this._cardId = data.id;
this._rjumpId = data.rjumpId;
this._wjumpId = data.wJumpId;
this._cardUrl = data.url;
this._word = data.word;
}
get Id() {
return this._cardId;
}
get rjumpId() {
return this._rjumpId;
}
get wjumpId() {
return this._rjumpId;
}
}
{
"ver": "1.0.8",
"uuid": "d0c4be55-8094-4115-abdf-7fb6dec9f838",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
import LoadingLayer from "../script/BoardGame_LoadingLayer";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
import { NetworkHelper } from "../script/NetworkHelper";
import { GameServer } from "../script/Server";
import { RandomInt, asyncPlayDragonBoneAnimation, asyncTweenTo, asyncDelay, onHomeworkFinish } from "../script/util";
import BoardCardItem from "./boardCardItem";
const { ccclass, property } = cc._decorator;
@ccclass
export default class SceneComponent extends MyCocosSceneComponent {
@property(cc.Prefab)
loadingLayerPrefab = null;
@property(cc.Node)
boardBtn = null
@property(cc.Node)
cover = null
_cardList: Array<cc.Node> = [];
private _isRolling: any;
_randomList = ["1", "2", "3"]
excellent: any;
_nowData: any;
private _nextIdx: any;
private _nowIndex: number;
private _nowIdx: number;
private _myData: any;
private _myLastPos: cc.Vec2;
private _otherLastPos: cc.Vec2;
private _loadingDone: boolean = false;
addPreloadImage() {
// TODO 根据自己的配置预加载图片资源
// this._imageResList.push({ url: this.data.pic_url });
}
addPreloadAudio() {
// TODO 根据自己的配置预加载音频资源
this._audioResList.push({ url: this.data.gameStartAudio });
this._audioResList.push({ url: this.data.gameLoadingAudio });
this._audioResList.push({ url: this.data.waitingWheel });
this._audioResList.push({ url: this.data.waitingPiece });
this._audioResList.push({ url: this.data.waitingTurn });
}
addPreloadAnima() { }
onLoadEnd() {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.log("onLoadEnd");
this.initData();
this.initView();
this.initListener();
}
_status = {
state: -1,// -1:未开始 0 准备阶段 1 roll 2 判定
Red: -1,
Blue: -1,
step: 0,
current: "Blue",
jump: null
};
playerId;
isRoomOwner;
server: GameServer;
networkHelper: NetworkHelper;
async initData() {
this.initCards();
this.networkHelper = new NetworkHelper();
this.initNetworkListener();
do {
this.playerId = await this.networkHelper.init("op_16_2", 2);
if (this.playerId === null) {
console.log("onDestroy");
this.networkHelper.onDestroy();
}
console.log("this.playerId = " + this.playerId);
} while (this.playerId === null);
const room = this.networkHelper.room;
if (this.playerId == room.roomInfo.owner) {
console.log("房主");
this.isRoomOwner = true;
this.server = new GameServer(2, this.networkHelper);
this.server.jumpList = this.getJumpList();
this.server.randomList = this._randomList;
this.server.TotalStep = this._cardList.length;
await this.networkHelper.startFrameSync();
this.server.addPlayer({
uuid: this.playerId,
isAI: false,
});
this.server.startMatch();
}
await this.initHeadImgAndName();
}
async initHeadImgAndName() {
const playerInfo: any = {
playerHeadUrl: "http://staging-teach.cdn.ireadabc.com/0751c28419a0e8ffb1f0e84435b081ce.png",
playerName: "test",
};
const middleLayer = cc.find("middleLayer");
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent("middleLayer");
if (middleLayerComponent.getUserInfo && middleLayerComponent.getHeadUrl) {
const kidInfo = await middleLayerComponent.getUserInfo();
const playerHeadUrl = middleLayerComponent.getHeadUrl(kidInfo.avatar_url || kidInfo.id);
playerInfo.playerHeadUrl = playerHeadUrl;
playerInfo.playerName = kidInfo.nick_name || '拼读达人';
}
}
this.networkHelper.sendFrame({
type: "playerInfo",
playerId: this.playerId,
playerName: playerInfo.playerName,
playerHeadUrl: playerInfo.playerHeadUrl,
});
}
initCards() {
let cardDatas = [
{
id: 1, rJumpId: 2, wJumpId: null, word: "bat", url: "",
},
{
id: 2, rJumpId: 3, wJumpId: null, word: "man", url: "",
},
{
id: 3, rJumpId: 4, wJumpId: null, word: "pad", url: "",
},
{
id: 4, rJumpId: 5, wJumpId: null, word: "dam", url: "",
},
{
id: 5, rJumpId: 6, wJumpId: null, word: "map", url: "",
},
{
id: 6, rJumpId: 7, wJumpId: null, word: "ant", url: "",
},
{
id: 7, rJumpId: 8, wJumpId: null, word: "can", url: "",
},
{
id: 8, rJumpId: 9, wJumpId: null, word: "cam", url: "",
},
{
id: 9, rJumpId: 10, wJumpId: null, word: "mat", url: "",
},
{
id: 10, rJumpId: 11, wJumpId: null, word: "cat", url: "",
},
{
id: 11, rJumpId: 12, wJumpId: null, word: "fan", url: "",
},
{
id: 12, rJumpId: 13, wJumpId: null, word: "tap", url: "",
},
{
id: 13, rJumpId: 14, wJumpId: null, word: "cap", url: "",
},
{
id: 14, rJumpId: 15, wJumpId: null, word: "bag", url: "",
},
{
id: 15, rJumpId: 16, wJumpId: null, word: "yam", url: "",
},
{
id: 16, rJumpId: 17, wJumpId: null, word: "yak", url: "",
},
{
id: 17, rJumpId: 18, wJumpId: null, word: "rat", url: "",
},
{
id: 18, rJumpId: 19, wJumpId: null, word: "rag", url: "",
},
{
id: 19, rJumpId: 20, wJumpId: null, word: "pan", url: "",
},
{
id: 20, rJumpId: 21, wJumpId: null, word: "dad", url: "",
},
{
id: 21, rJumpId: 22, wJumpId: null, word: "jam", url: "",
},
{
id: 22, rJumpId: 23, wJumpId: null, word: "ax", url: "",
},
{
id: 23, rJumpId: 24, wJumpId: null, word: "hat", url: "",
},
{
id: 24, rJumpId: null, wJumpId: null, word: "map", url: "",
},
]
this._cardList = cc.find("Canvas/road/root/wordCards").children;
let list = this.data.cardDatas || cardDatas;
for (let i = 0; i < this._cardList.length; ++i) {
let data = list[i];
let com = this._cardList[i].addComponent(BoardCardItem);
com.cardData = data;
}
}
initView() {
this.initBg();
this.initLoadingLayer();
this.initPiece();
}
getJumpList() {
const jumpList = [];
this._cardList.forEach(node => {
const itemData = node.getComponent(BoardCardItem);
if (itemData.rjumpId) {
const from = itemData.Id;
const to = itemData.rjumpId;
jumpList.push({ from, to });
}
});
return jumpList;
}
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
}
loadingLayer;
initLoadingLayer() {
const loadingLayerNode = cc.instantiate(this.loadingLayerPrefab);
loadingLayerNode.parent = this.node;
loadingLayerNode.zIndex = 100;
this.loadingLayer = loadingLayerNode.getComponent(LoadingLayer);
this.loadingLayer.setMaxPlayerNumber(2);
this.loadingLayer.onLoadFinished(() => {
this.playAudioByUrl(this.data.gameStartAudio);
this._loadingDone = true;
this.updateStatus();
});
this.playAudioByUrl(this.data.gameLoadingAudio);
}
blinkTheDice() {
cc.find("Canvas/road/board").children.forEach((node) => {
cc.tween(node)
.set({ scale: 1 })
.to(0.2, { scale: 1.1 })
.to(0.2, { scale: 1.0 })
.union()
.repeatForever()
.start();
});
}
normaltheDice() {
cc.find("Canvas/road/board").children.forEach((node) => {
node.stopAllActions();
node.color = cc.color(250, 250, 250);
});
}
greyDice() {
cc.find("Canvas/road/board").children.forEach((node) => {
node.color = cc.color(150, 150, 150);
});
}
initPiece() {
}
initListener() {
this.boardBtn.on("click", () => {
if (!this.isMySide || this._status.state != 0) {
return;
}
this.networkHelper.sendFrame({
type: "roll",
uuid: this.myData.uuid,
});
});
}
stopRollPiece() {
let node = this.getCurrentPiece()
node.stopAllActions();
}
rollPiece() {
let node = this.getCurrentPiece()
node.stopAllActions();
cc.tween(node)
.set({ scale: 1, angle: 0 })
.to(0.1, { angle: -10 })
.to(0.2, { angle: 10 })
.to(0.1, { angle: 0 })
.delay(1)
.union()
.repeatForever()
.start();
this._cardList.forEach((child: cc.Node, idx, list) => {
cc.tween(child)
.set({ scale: 1 })
.delay(idx * 0.1)
.to(0.1, { scale: 1.1 })
.to(0.1, { scale: 1 })
.delay(list.length * 0.11 - idx * 0.11)
.start();
});
}
jumpBlock(idx) {
const targetNode = this._cardList[idx];
return targetNode;
}
getNextRightIdx() {
const startIdx = this._status[this._status.current];
}
showStars(node) {
cc.tween(node)
.delay(0.07)
.call(() => {
const light = cc.instantiate(cc.find("nodes/light"));
light.parent = node.parent;
cc.tween(light)
.set({
x: node.x + RandomInt(200) - 100,
y: node.y + 50,
scale: 0,
})
.by(
1,
{
y: 200 + RandomInt(200) - 100,
scale: 0.7 + 0.3 * Math.random(),
},
{ easing: "cubicOut" }
)
.removeSelf()
.start();
})
.union()
.repeatForever()
.start();
}
async peaceJumpAndSpeak() {
let node = cc.find(`Canvas/road/root/piece${this._status.current}`);
let nowIdx = this._status[this._status.current];
let nextIdx = nowIdx + this._status.step;
let word = await this.pieceJump(node, nowIdx, nextIdx);
if (this.isMySide) {
let card = this._cardList[nextIdx];
await this.openCoursView(card);
await this._startCourseware(word);
}
}
openCoursView(node) {
this.cover.active = true;
let probar = this.cover.getChildByName("probar");
this.cover.getChildByName("bar").removeAllChildren();
let icon = cc.instantiate(node);
icon.parent = this.cover.getChildByName("bar");
icon.x = 0;
icon.y = 0;
icon.scale = 1;
probar.getComponent(cc.ProgressBar).unscheduleAllCallbacks();
let total = 1;
probar.getComponent(cc.ProgressBar).schedule(() => {
probar.getComponent(cc.ProgressBar).progress = total;
total -= 1 / 30;
if (total < 0) {
probar.getComponent(cc.ProgressBar).unscheduleAllCallbacks();
this._coursewareStoped();
}
}, 0.1, 31, 0.1)
}
async _startCourseware(word) {
if (!cc.sys.isBrowser && window["courseware"]?.startTest) {
console.log("模拟录音开始 单词:" + word);
window["courseware"]?.startTest(word);
} else {
console.log("web 模拟录音开始");
}
await asyncDelay(3);
this._coursewareStoped();
}
async _coursewareStoped() {
if (!this.cover.active) {
return;
}
this.cover.active = false;
cc.tween(this.cover).to(0.5, { opacity: 255 }).start();
await asyncDelay(0.5);
if (!cc.sys.isBrowser && window["courseware"]?.stopTest) {
window["courseware"]?.stopTest((res, b) => {
if (typeof res == "string") {
res = JSON.parse(res);
}
console.log("++++++++++++ _coursewareEnd +++++++++++++++");
this._coursewareEnd(res.result?.pronunciation || 0,)
console.log("pronunciation=== " + res.result?.pronunciation);
console.log("333=== " + res.result?.pronunciation);
});
} else {
await asyncDelay(3);
console.log("web 模拟录音评测 结果");
this._coursewareEnd(Math.random() > 0.5 ? 100 : 70)
}
}
async _coursewareEnd(score: number) {
if (score >= 80) {
console.log("====评测通过=====");
this.networkHelper.sendFrame({
type: "right",
uuid: this.myData.uuid,
});
} else {
console.log("====评测不通过=====");
this.networkHelper.sendFrame({
type: "wrong",
uuid: this.myData.uuid,
});
}
}
roundEndCheck() {
this.networkHelper.sendFrame({
type: "stateUpdate",
uuid: this.myData.uuid,
});
}
async updateStatus(status = null) {
if (!this._loadingDone) return;
let state = this._status.state;
switch (state) {
case -1:
break;
case 0:
if (this.isMySide) {
this.normaltheDice();
await this.showYourTurn();
this.blinkTheDice();
} else {
this.greyDice();
}
this.rollPiece();
break;
case 1:
if (this.isMySide) {
} else {
this.greyDice();
}
this.stopRollPiece();
break;
case 2:
if (this.isMySide) {
} else {
this.greyDice();
}
break;
}
const blueFrame = cc.find("Canvas/road/blueHead/icon");
const redFrame = cc.find("Canvas/road/redHead/icon");
let blinkFrame: cc.Node, stopBlinkFrame: cc.Node;
if (this._status.current == "Red") {
blinkFrame = redFrame;
stopBlinkFrame = blueFrame;
} else {
blinkFrame = blueFrame;
stopBlinkFrame = redFrame;
}
blinkFrame.stopAllActions();
cc.tween(blinkFrame)
.set({ opacity: 100 })
.to(1.5, { opacity: 255 }, { easing: "cubicOut" })
.to(1.5, { opacity: 100 }, { easing: "cubicIn" })
.union()
.repeatForever()
.start();
stopBlinkFrame.stopAllActions();
// stopBlinkFrame.opacity = 0;
}
getCurrentPiece() {
if (this._status.current == "Red") {
return cc.find("Canvas/road/root/pieceRed");
} else {
return cc.find("Canvas/road/root/pieceBlue");
}
}
changeSide() {
// if (this._status.current == "Red") {
// this._status.current = "Blue";
// console.log("changeSide Blue");
// } else {
// this._status.current = "Red";
// console.log("changeSide Red");
// }
}
showYourTurn() {
console.log("=====showYourTurn===========");
return new Promise((resolve, reject) => {
const yourTurn = cc.find("Canvas/yourturn");
yourTurn.active = true;
cc.tween(yourTurn)
.set({ opacity: 0, scale: 5 })
.to(1, { opacity: 255, scale: 2 })
.delay(0.5)
.to(0.5, { opacity: 0 })
.call(() => {
resolve(null);
})
.start();
});
}
async pieceJump(node, from, to) {
return new Promise((resolve) => {
if (from < to) {
let card = this._cardList[from + 1];
cc.tween(node).to(0.2, { position: card.position }).call(() => {
resolve(this.pieceJump(node, from + 1, to));
}).start()
} else {
let word = this._cardList[from + 1].getComponent(BoardCardItem)._word
resolve(word);
}
})
}
async fixStep() {
if (this._status.jump) {
let node = cc.find(`Canvas/road/root/piece${this._status.current}`);
let pos = this._cardList[this._status.jump].position;
await asyncTweenTo(
node,
0.7,
{ x: pos.x, y: pos.y },
{ easing: "cubicOut" }
);
node.stopAllActions();
}
}
async pieceGoBack() {
this.playLocalAudio("wrong");
let node = cc.find(`Canvas/road/root/piece${this._status.current}`);
let pos;
if (this._status.jump) {
pos = this._cardList[this._status.jump].position;
} else {
let Idx = this._status[this._status.current];
pos = this._cardList[Idx].position;
console.log("now idx == " + Idx);
}
await asyncTweenTo(
node,
0.7,
{ x: pos.x, y: pos.y },
{ easing: "cubicOut" }
);
node.stopAllActions();
}
get isMySide() {
const playerMe = this.allPlayerList.find(
(player) => player.uuid == this.playerId
);
return playerMe.color == this._status.current
}
get myData() {
if (!this._myData) {
const playerMe = this.allPlayerList.find(
(player) => player.uuid == this.playerId
);
this._myData = playerMe;
}
return this._myData;
}
allPlayerList;
initNetworkListener() {
this.networkHelper.on("playerJoin", (event) => {
if (this.server) {
this.server.onPlayerJoin({ data: { joinPlayerId: event.playerId } });
}
cc.log("playerJoin" + JSON.stringify(event));
});
this.networkHelper.on("playerLeave", (event) => {
cc.log("playerLeave" + JSON.stringify(event));
cc.find("Canvas/bg/PlayerOffLineLayer").active = true;
this.networkHelper.leaveRoom();
});
this.networkHelper.on("playerOffLine", (event) => {
cc.find("Canvas/bg/PlayerOffLineLayer").active = true;
this.networkHelper.leaveRoom();
this.log("playerOffLine" + JSON.stringify(event));
});
this.networkHelper.on("gameStart", (event) => { });
this.networkHelper.on("frameEvent", (event) => {
event.data.frame.items.forEach(async (item) => {
if (this.server) {
this.server.onFrameEvent(item.data);
}
console.log("event type " + item.data.type);
console.log("event data" + JSON.stringify(item.data.status));
if (item.data.type == "SERVER_allPlayerInfo") {
console.log(
"SERVER_allPlayerInfo: " + JSON.stringify(item.data.playerData)
);
item.data.playerData.forEach((player) => {
if (!this.allPlayerList) {
this.allPlayerList = [];
}
if (
!this.allPlayerList.find(
(listPlayer) => listPlayer.uuid == player.uuid
)
) {
this.allPlayerList.push({
uuid: player.uuid,
name: player.name,
color: player.color,
headUrl: player.headUrl,
});
}
this.loadPlayerHeadImage();
this.loadingLayer.addPlayer(
player.name,
player.uuid == this.playerId,
player.headUrl,
player.uuid
);
});
} else if (item.data.type == "SERVER_updateStatus") {
this._status = JSON.parse(JSON.stringify(item.data.status));
this.updateStatus();
} else if (item.data.type == "SERVER_playerRoll") {
this._status = JSON.parse(JSON.stringify(item.data.status));
if (this.isMySide) {
this.normaltheDice();
} else {
this.greyDice();
}
await this.rollTheDice(this._status.step);
console.log("rollTheDice done");
await this.peaceJumpAndSpeak();
console.log("peaceJumpAndSpeak done");
this.roundEndCheck();
}
else if (item.data.type == "SERVER_playerRight") {
this.playLocalAudio("right");
this._status = JSON.parse(JSON.stringify(item.data.status));
await this.fixStep();
this.roundEndCheck();
} else if (item.data.type == "SERVER_playerWrong") {
await this.pieceGoBack();
this.roundEndCheck();
} else if (item.data.type == "SERVER_playerWin") {
this._status = JSON.parse(JSON.stringify(item.data.status));
const node = cc.find(
`Canvas/road/root/piece${this._status.current}`
);
const idx = this._cardList.length;
const rightBlock = this._cardList[idx - 1];
// await this.pieceFindRightBlock(rightBlock, idx);
if (this.isMySide) {
this.showWin();
onHomeworkFinish({ isWin: true });
} else {
this.showLoss();
onHomeworkFinish({ isWin: false });
}
}
});
});
}
showWin() {
cc.find("Canvas/endBg").active = true;
const bg = cc.find("Canvas/endBg/bg");
cc.tween(bg).to(1, { opacity: 100 }).start();
const loss = cc.find("Canvas/endBg/labelBg/labelLoss");
loss.active = false;
this.playLocalAudio("胜利");
}
showLoss() {
cc.find("Canvas/endBg").active = true;
const bg = cc.find("Canvas/endBg/bg");
cc.tween(bg).to(1, { opacity: 100 }).start();
const win = cc.find("Canvas/endBg/labelBg/labelWin");
win.active = false;
this.playLocalAudio("失败");
}
loadPlayerHeadImage() {
const red = cc.find("Canvas/road/redHead/icon");
const blue = cc.find("Canvas/road/blueHead/icon");
this.allPlayerList.forEach((player) => {
this.getSpriteFrimeByUrl(player.headUrl, (sf) => {
if (player.color == "Red") {
red.getComponent(cc.Sprite).spriteFrame = sf;
} else {
blue.getComponent(cc.Sprite).spriteFrame = sf;
}
});
});
}
finish() {
// onHomeworkFinish();
}
rollTheDice(num) {
if (this._isRolling) {
return;
}
const dice = cc.find("Canvas/road/board/runBoard");
return new Promise((resolve, reject) => {
const targetAngle = Math.ceil(dice.angle / 360 + 1) * 360;
const time = (targetAngle - 360 - dice.angle) / 360;
this._isRolling = true;
cc.tween(dice)
.by(3, { angle: 360 }, { easing: "cubicIn" })
.to(time, { angle: targetAngle })
.by(1, { angle: 360 })
.by(1, { angle: 360 })
.by(1, { angle: 360 })
.by(1, { angle: 360 })
.by((1 / 6) * num, { angle: 60 * num })
.by(3, { angle: 360 }, { easing: "cubicOut" })
.call(() => {
this._isRolling = false;
resolve(null);
})
.start();
});
}
playLocalAudio(audioName) {
this.node.getChildByName("audio").getChildByName(audioName).getComponent(cc.AudioSource).play();
}
// 生命周期
onDestroy() {
this.networkHelper.onDestroy();
}
}
import BoardCardItem from "../scene/boardCardItem";
import { NetworkHelper } from "./NetworkHelper";
import { asyncDelay } from "./util";
export class AI {
networkHelper: NetworkHelper;
playerData: any;
_status = {
state: -1,// -1:未开始 0 准备阶段 1 roll 2 判定
Red: 0,
Blue: 0,
step: 0,
current: "Blue",
jump: null,
};
constructor(networkHelper: NetworkHelper, playerData: any) {
this.networkHelper = networkHelper;
this.playerData = playerData;
}
async onFrameEvent(data) {
console.log("AI get event: " + JSON.stringify(data));
if (data.type == "SERVER_updateStatus") {
this._status = JSON.parse(JSON.stringify(data.status));
if (this.playerData.color != this._status.current) return
if (!this._status.step) {
await asyncDelay(Math.random() * 3 + 2);
this.networkHelper.sendFrame({
type: "roll",
uuid: this.playerData.uuid,
});
} else {
await asyncDelay(Math.random() * 3 + 2);
if (Math.random() < 0.7) {
this.networkHelper.sendFrame({
type: "right",
uuid: this.playerData.uuid,
});
} else {
this.networkHelper.sendFrame({
type: "wrong",
uuid: this.playerData.uuid,
});
}
}
}
}
}
{
"ver": "1.0.8",
"uuid": "b34ee12d-9170-469d-8bfc-e972bcfdec10",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { asyncPlayDragonBoneAnimation } from "./util";
const { ccclass, property } = cc._decorator;
@ccclass
export default class LoadingLayer extends cc.Component {
ctor() {
}
// 生命周期 onLoad
onLoad() {
// this.initSize();
}
_designSize; // 设计分辨率
_frameSize; // 屏幕分辨率
_mapScaleMin; // 场景中常用缩放(取大值)
_mapScaleMax; // 场景中常用缩放(取小值)
_cocosScale; // cocos 自缩放 (较少用到)
initSize() {
// 注意cc.winSize只有在适配后(修改fitHeight/fitWidth后)才能获取到正确的值,因此使用cc.getFrameSize()来获取初始的屏幕大小
let screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height
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.fitWidth = !f
const frameSize = cc.view.getFrameSize();
this._frameSize = frameSize;
this._designSize = cc.view.getDesignResolutionSize();
let sx = cc.winSize.width / frameSize.width;
let sy = cc.winSize.height / frameSize.height;
this._cocosScale = Math.min(sx, sy);
sx = frameSize.width / this._designSize.width;
sy = frameSize.height / this._designSize.height;
this._mapScaleMin = Math.min(sx, sy) * this._cocosScale;
this._mapScaleMax = Math.max(sx, sy) * this._cocosScale;
}
// 生命周期 start
async start() {
this.updateLabel('创建房间中');
this.progressTo(0.1, 1);
await this.asyncDelay(1);
this.updateLabel('匹配小伙伴中');
}
async initView() {
this.setMaxPlayerNumber(5);
}
_maxPlayerNum;
setMaxPlayerNumber(number) {
this._maxPlayerNum = number;
}
_playerList;
addPlayer(name, isSelf, headUrl, uuid) {
if (!this._playerList) {
this._playerList = [];
}
if (this._playerList.find(player => player.uuid == uuid)) {
return;
}
this._playerList.push({ name, isSelf, headUrl, uuid });
console.log('name = ' + name);
const layout = cc.find('layout', this.node);
const headNode = cc.instantiate(cc.find('head', this.node));
headNode.x = 0;
headNode.y = 0;
headNode.active = true;
const frameSelf = cc.find('frame_self', headNode);
if (!isSelf) {
frameSelf.opacity = 0;
}
const nameLabel = cc.find('name', headNode);
nameLabel.getComponent(cc.Label).string = name;
const headImg = cc.find('mask/headImg', headNode);
this.loadSpriteByUrl(headImg, headUrl, () => {
const scale = Math.max(
headImg.parent.width / headImg.width,
headImg.parent.height / headImg.height
);
headImg.scale = scale;
});
if (this._playerList.length == 1) {
cc.find('left', this.node).addChild(headNode);
} else {
cc.find('right', this.node).addChild(headNode);
const vs = cc.find('vs', this.node);
asyncPlayDragonBoneAnimation(vs, 'normal', 1);
this.playLocalAudio('match');
}
const rate = Math.min(1, this._playerList.length / this._maxPlayerNum);
if (rate == 1) {
this.updateLabel('同步中');
}
this.progressTo(rate, 3);
}
_onLoadFinishFunc;
onLoadFinished(func) {
this._onLoadFinishFunc = func;
}
async asyncDelay(time) {
return new Promise((resolve, reject) => {
try {
this._timeoutIds.push(setTimeout(() => {
resolve(null);
}, time * 1000));
} catch (e) {
reject(e);
}
});
}
updateLabel(str) {
const label = cc.find('label', this.node).getComponent(cc.Label);
if (label['tweenAction']) {
label['tweenAction'].stop();
}
label['tweenAction'] = cc.tween(label)
.set({ string: `${str}` })
.delay(0.4)
.set({ string: `${str}.` })
.delay(0.4)
.set({ string: `${str}..` })
.delay(0.4)
.set({ string: `${str}...` })
.delay(0.4)
.union()
.repeatForever()
.start();
}
_maxRate = 0;
progressTo(rate, time) {
this._maxRate = Math.max(this._maxRate, rate);
const duration = Math.max(time + this.RandomInt(-1, 1), 1);
const progress = cc.find('progressBar', this.node).getComponent(cc.ProgressBar);
if (progress['tweenAction']) {
progress['tweenAction'].stop();
}
const easingList = [
'linear',
'quadInOut',
'cubicInOut',
];
progress['tweenAction'] = cc.tween(progress)
.to(duration, { progress: this._maxRate }, { easing: easingList[this.RandomInt(easingList.length)] })
.call(() => {
if (rate == 1) {
if (this._onLoadFinishFunc) {
this._onLoadFinishFunc();
}
this.node.active = false;
}
})
.start();
}
RandomInt(a, b = 0) {
let max = Math.max(a, b);
let min = Math.min(a, b);
return Math.floor(Math.random() * (max - min) + min);
}
// ------------------------------------------------
loadSpriteByUrl(node, url, cb) {
cc.loader.load({ url }, (err, img) => {
if (!node) {
cb && cb();
}
const spriteFrame = new cc.SpriteFrame(img)
const spr = node.getComponent(cc.Sprite);
spr.spriteFrame = spriteFrame;
cb && cb();
});
}
currentPlayedAudioId;
stopCurrentPlayedAudio() {
if (this.currentPlayedAudioId !== null) {
cc.audioEngine.stop(this.currentPlayedAudioId);
this.currentPlayedAudioId = null;
}
}
playEffect(name, cb) {
this.stopCurrentPlayedAudio();
const audioNode = cc.find(`audios/${name}`);
const audioClip = audioNode.getComponent(cc.AudioSource).clip;
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
this.currentPlayedAudioId = audioId;
if (cb) {
cc.audioEngine.setFinishCallback(audioId, cb);
}
}
playAudioByUrl(audio_url, cb = null) {
if (!audio_url) {
if (cb) {
cb();
}
return;
}
this.stopCurrentPlayedAudio();
cc.assetManager.loadRemote(audio_url.toLowerCase(), (err, audioClip) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
this.currentPlayedAudioId = audioId;
if (cb) {
cc.audioEngine.setFinishCallback(audioId, cb);
}
});
}
playLocalAudio(name) {
return new Promise((resolve, reject) => {
this.stopCurrentPlayedAudio();
const audioNode = cc.find(`res/${name}`, this.node);
if (!audioNode) {
resolve(null);
return;
}
const audioClip = audioNode.getComponent(cc.AudioSource).clip;
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
this.currentPlayedAudioId = audioId;
cc.audioEngine.setFinishCallback(audioId, () => {
resolve(null);
});
});
}
_timeoutIds = [];
_intervalIds = [];
// 生命周期
onDestroy() {
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
this._intervalIds.forEach(id => {
clearInterval(id);
});
}
}
{
"ver": "1.0.8",
"uuid": "4d354824-df0d-4020-ab65-3afd85ca0064",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { RandomInt } from "./util";
export class NetworkHelper {
_eventListeners: any = {};
ctor() { }
on(eventName, func) {
this._eventListeners[eventName] = func;
}
async init(roomType: string, maxPlayers: number) {
await this.initRoom();
return await this.joinRoom(roomType, maxPlayers);
}
async startGame() {
await this.startFrameSync();
await this.closeRoom();
}
async stopGame() {
await this.stopFrameSync();
await this.closeRoom();
await this.leaveRoom();
}
listenerInited = false;
room: any;
client: any;
async initRoom() {
const client = new globalThis.Play.Client({
appId: "JCKc6bU8FywdjIPupjNH8Jwx-gzGzoHsz",
appKey: "WUrRDpb46z2qFLsUNbhknYcP",
userId: `${new Date().getTime()}_${RandomInt(100000000)}`,
playServer: 'https://lyn5nahs.lc-cn-n1-shared.com'
});
console.log('client = ', client);
await client.connect();
this.client = client;
console.log('连接成功');
}
player: any;
joinRoom(roomType: string, maxPlayers: number) {
return new Promise((resolve, reject) => {
const roomProp = { roomType, maxPlayers };
this.client.joinRandomRoom({
matchProperties: roomProp,
}).then((room) => {
resolve(this.onJoinRoomSuccess(room));
}).catch((error) => {
console.log('加入房间失败');
if (error.code == 4301) {
const options = {
visible: true,
playerTtl: 0,
emptyRoomTtl: 0,
maxPlayerCount: maxPlayers,
customRoomProperties: roomProp,
customRoomPropertyKeysForLobby: ['roomType', 'maxPlayers'],
flag: globalThis.Play.CreateRoomFlag.MasterUpdateRoomProperties
};
this.client.createRoom({
roomOptions: options,
}).then((room) => {
resolve(this.onJoinRoomSuccess(room));
}).catch((error) => {
console.error(error.code, error.detail);
});
}
});
});
}
onJoinRoomSuccess(room: globalThis.Play.Room) {
console.log('加入房间成功 room = ', room);
const playerMe = room.playerList.find(player => player.isLocal);
const masterPlayer = room.playerList.find(player => player.isMaster);
const masterId = masterPlayer.userId;
const playerId = playerMe.userId;
this.room = new FakeRoom(masterId);
this.room.players.push(this.room.player);
this.player = this.room.player;
this.client.on(globalThis.Play.Event.PLAYER_ROOM_LEFT, (event) => {
this.onLeaveRoom({ data: { leavePlayerId: event.leftPlayer.userId } });
});
this.client.on(globalThis.Play.Event.PLAYER_ROOM_JOINED, (event) => {
this.onJoinRoom({ playerId: event.newPlayer.userId });
});
this.client.on(globalThis.Play.Event.CUSTOM_EVENT, (event) => {
this.onRecvFrame({ data: event.eventData });
});
// this.room.onDisconnect(this.onDisconnect.bind(this));
// this.room.onDismiss(this.onDisconnect.bind(this));
return playerId;
}
async leaveRoom() {
await this.client.close();
console.log("退房成功");
}
async dismissRoom() {
if (this.room.ownerId == this.player.id) {
console.log("房间已解散");
}
}
async closeRoom() {
// 设置房间不可见
await this.client.setRoomVisible(false);
console.log(this.client.room.visible);
}
async startFrameSync() {
console.log("开始帧同步成功");
}
async stopFrameSync() {
console.log("停止帧同步成功");
}
sendFrame(data: any) {
this.client.sendEvent(0, { frame: { items: [{ data: data }] } }, {
receiverGroup: globalThis.Play.ReceiverGroup.All,
});
}
onJoinRoom(event) {
console.log("新玩家加入", event);
if (this._eventListeners["playerJoin"]) {
this._eventListeners["playerJoin"](event);
}
this.room.players.forEach(player => {
console.log('player.playerId = ', player.playerId);
});
}
onLeaveRoom(event) {
console.log("onLeaveRoom");
if (this._eventListeners["playerLeave"]) {
this._eventListeners["playerLeave"](event);
}
console.log("玩家退出", event.data.leavePlayerId);
}
onRecvFromClient() { }
onDisconnect(event) {
this.log("玩家掉线了: " + JSON.stringify(event));
if (this._eventListeners["playerOffLine"]) {
this._eventListeners["playerOffLine"](event);
}
}
onRecvFrame(event) {
if (this._eventListeners["frameEvent"]) {
this._eventListeners["frameEvent"](event);
}
}
onStartFrameSync(event) {
console.log('onStartFrameSync');
if (this._eventListeners["gameStart"]) {
this._eventListeners["gameStart"](event);
}
}
onStopFrameSync(event) { }
onRecvFromGameSvr() { }
async onDestroy() {
try {
console.log("onDestroy1");
// MGOBE.Listener.clear();
this.stopFrameSync();
this.closeRoom();
this.dismissRoom();
this.leaveRoom();
console.log("onDestroy2");
} catch (e) {
console.log(JSON.stringify(e));
}
}
log(str) {
const node = cc.find("middleLayer");
if (node) {
node.getComponent("middleLayer").log(str);
} else {
cc.log(str);
}
}
callNetworkApiGet(baseUrl, uri, data, callBack) {
let queryStr = "?";
const params = [];
for (const key in data) {
if (Object.hasOwnProperty.call(data, key)) {
params.push(`${key}=${data[key]}`);
}
}
queryStr += params.join("&");
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = () => {
if (xhr.readyState == 4 && xhr.status >= 200 && xhr.status < 400) {
callBack(xhr.responseText);
}
};
const url = `${baseUrl}${uri}${queryStr}`;
console.log("url = " + url);
xhr.open("GET", url, true);
xhr.send();
}
}
export function asyncDelay(time) {
return new Promise((resolve, reject) => {
cc.tween(cc.find("Canvas"))
.delay(time)
.call(() => {
resolve(null);
})
.start();
});
}
class FakeRoom {
ownerId;
players = [];
player: any;
roomInfo;
constructor(playerId) {
this.player = { playerId: playerId };
this.ownerId = playerId;
this.roomInfo = { owner: playerId }
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "276b8459-3748-4390-aa2d-79564d19382e",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import BoardCardItem from "../scene/boardCardItem";
import { asyncDelay, RandomInt } from "../script/util";
import { AI } from "./AI";
import { NetworkHelper } from "./NetworkHelper";
export class GameServer {
playerList = [];
playerMaxNumber = 0;
networkHelper: NetworkHelper = null;
nameList = [
"Chris",
"Benny",
"Leslie",
"Devin",
"Sam",
"Kerry",
"Joey",
"Hailey",
"Fred",
"Arrow",
"Tony",
"Michael",
];
headUrls = [
"http://staging-teach.cdn.ireadabc.com/0751c28419a0e8ffb1f0e84435b081ce.png",
"http://staging-teach.cdn.ireadabc.com/f596e586a31ac2813b1702557941c022.png",
"http://staging-teach.cdn.ireadabc.com/f0f396c52c42239913fd94523db979fa.png",
"http://staging-teach.cdn.ireadabc.com/9f2d2ef622fa33d4e2abcbdc4b40ab6a.png",
"http://staging-teach.cdn.ireadabc.com/f40ce4a8630039c4cf48a63fc1399c52.png",
];
jumpList = [
// { from: 2, to: 11 },
// { from: 3, to: 7 },
// { from: 8, to: 18 },
// { from: 9, to: 2 },
// { from: 12, to: 15 },
// { from: 13, to: 1 },
// { from: 21, to: 5 },
// { from: 24, to: 16 },
];
private _totalStep: any;
randomList = [];
private _useAI: boolean;
constructor(playerMaxNumber, networkHelper) {
this.playerMaxNumber = playerMaxNumber;
this.networkHelper = networkHelper;
this._timeoutIds = [];
this._intervalIds = [];
this.headUrls = this.headUrls.sort((a, b) => RandomInt(2) - 1);
this.nameList = this.nameList.sort((a, b) => RandomInt(2) - 1);
this.networkHelper.startFrameSync();
}
async addPlayer(player) {
console.log("addPlayer");
this.playerList.push({
name: this.nameList.splice(0, 1)[0],
uuid: player.uuid,
color:
player.uuid == this.networkHelper.room.roomInfo.owner ? "Blue" : "Red",
isAI: player.isAI,
headUrl: this.headUrls.splice(0, 1)[0],
});
if (player.isAI) {
this._useAI = true;
await asyncDelay(1);
this.networkHelper.sendFrame({
type: "SERVER_allPlayerInfo",
playerData: this.playerList,
});
if (this.playerList.length == this.playerMaxNumber) {
this.networkHelper.closeRoom();
await asyncDelay(0.5);
this.startGame();
this.startAI();
}
}
}
gameStatus = {
state: 0,// -1:未开始 0 准备阶段 1 roll 2 判定
Red: 0,
Blue: 0,
step: 0,
current: "Blue",
jump: 0,
};
startGame() {
this.networkHelper.sendFrame({
type: "SERVER_updateStatus",
status: this.gameStatus,
});
}
onPlayerJoin(event) {
this.addPlayer({
uuid: event.data.joinPlayerId,
isAI: false,
});
}
_aiPlayerList = [];
startMatch() {
for (let i = 0; i < this.playerMaxNumber; i++) {
this._timeoutIds.push(
setTimeout(() => {
const count = this.playerMaxNumber - this.playerList.length;
if (count > 0) {
const playerInfo = {
uuid: "ai_" + i,
isAI: true,
color: "Red",
};
this._aiPlayerList.push(new AI(this.networkHelper, playerInfo));
this.addPlayer(playerInfo);
}
}, RandomInt(10000, 15000))
);
}
}
async onFrameEvent(data) {
if (this.gameStatus['gameOver']) {
return;
}
let sender = this.playerList.find(p => p.uuid == data.uuid);
if (data.type == "playerInfo") {
this.networkHelper.sendFrame({
type: "SERVER_allPlayerInfo",
playerData: this.playerList,
status: this.gameStatus,
});
if (this.playerList.length == this.playerMaxNumber) {
this.networkHelper.closeRoom();
await asyncDelay(0.5);
this.startGame();
this.startAI();
}
}
else if (data.type == "roll") {
if (!data.uuid) {
console.warn("data no uuid");
return;
}
if (sender.color == this.gameStatus.current) {
let nowStep = this.gameStatus[this.gameStatus.current];
let index = Math.floor(Math.random() * this.randomList.length)
let step = this.randomList[index];
step = Math.min(step, this._totalStep - nowStep);
console.log("random step ===" + step);
this.gameStatus.step = step;
this.gameStatus.state = 1;
this.networkHelper.sendFrame({
type: "SERVER_playerRoll",
status: this.gameStatus,
});
} else {
console.warn("data uuid not match");
}
}
else if (data.type == "right") {
let nowStep = this.gameStatus[this.gameStatus.current];
const jump = this.jumpList.find(jump => parseInt(jump.from) == parseInt(data.idx));
this.gameStatus[this.gameStatus.current] = jump ? parseInt(jump.to) : nowStep + this.gameStatus.step;
if (this.gameStatus[this.gameStatus.current] < this._totalStep) {
this.gameStatus.step = null;
this.gameStatus.state = 2;
this.networkHelper.sendFrame({
type: "SERVER_playerRight",
status: this.gameStatus,
});
this.changeSide();
} else {
this.gameStatus.state = 2;
this.networkHelper.sendFrame({
type: "SERVER_playerWin",
status: this.gameStatus,
});
this.gameStatus['gameOver'] = true;
}
} else if (data.type == "wrong") {
console.log("data = " + JSON.stringify(data));
this.gameStatus.step = null;
this.gameStatus.state = 2;
this.networkHelper.sendFrame({
type: "SERVER_playerWrong",
status: this.gameStatus,
});
this.changeSide();
} else if (data.type == "stateUpdate") {
if (this._useAI || sender.color == this.gameStatus.current) {
if (this.gameStatus.state == 2) {
this.gameStatus.state = 0;
}
this.networkHelper.sendFrame({
type: "SERVER_updateStatus",
status: this.gameStatus,
});
this.gameStatus.jump = null;
}
}
else {
this._aiPlayerList.forEach((ai: AI) => {
ai.onFrameEvent(data);
});
}
}
set TotalStep(step) {
this._totalStep = step;
}
changeSide() {
console.log("=====changeSide=======");
console.log("=====old =======" + this.gameStatus.current);
if (this.gameStatus.current == "Red") {
this.gameStatus.current = "Blue";
} else {
this.gameStatus.current = "Red";
}
console.log("=====now =======" + this.gameStatus.current);
}
startAI() {
this.playerList
.filter((player) => player.isAI == true)
.forEach((player) => { });
}
_timeoutIds = null;
_intervalIds = null;
// 生命周期
onDestroy() {
this._timeoutIds.forEach((id) => {
clearTimeout(id);
});
this._intervalIds.forEach((id) => {
clearInterval(id);
});
}
}
{
"ver": "1.0.8",
"uuid": "214b9747-6232-4e0d-a165-c1db9725b3c6",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
export const defaultData = {
gameStartAudio:
"http://staging-teach.cdn.ireadabc.com/7c18e0838dcf0707f885842ed09e1579.mp3",
gameLoadingAudio:
"http://staging-teach.cdn.ireadabc.com/6b3846cee6afa2ae450234aeec835beb.mp3",
waitingWheel:
"http://staging-teach.cdn.ireadabc.com/23376490a9ba0f4a3fe0618fc1c935e1.mp3",
waitingPiece:
"http://staging-teach.cdn.ireadabc.com/b44fa51172b19b555fda30717c773027.mp3",
waitingTurn:
"http://staging-teach.cdn.ireadabc.com/a6a5c388c636bc6d063946e91b4bd21a.mp3",
cardDatas: [
{
id: 1, rJumpId: null, wJumpId: null, word: "bat", url: "",
},
{
id: 2, rJumpId: 6, wJumpId: null, word: "man", url: "",
},
{
id: 3, rJumpId: null, wJumpId: null, word: "pad", url: "",
},
{
id: 4, rJumpId: null, wJumpId: null, word: "dam", url: "",
},
{
id: 5, rJumpId: null, wJumpId: null, word: "map", url: "",
},
{
id: 6, rJumpId: null, wJumpId: null, word: "ant", url: "",
},
{
id: 7, rJumpId: null, wJumpId: null, word: "can", url: "",
},
{
id: 8, rJumpId: 13, wJumpId: null, word: "cam", url: "",
},
{
id: 9, rJumpId: null, wJumpId: null, word: "mat", url: "",
},
{
id: 10, rJumpId: null, wJumpId: null, word: "cat", url: "",
},
{
id: 11, rJumpId: null, wJumpId: null, word: "fan", url: "",
},
{
id: 12, rJumpId: 21, wJumpId: null, word: "tap", url: "",
},
{
id: 13, rJumpId: null, wJumpId: null, word: "cap", url: "",
},
{
id: 14, rJumpId: null, wJumpId: null, word: "bag", url: "",
},
{
id: 15, rJumpId: 19, wJumpId: null, word: "yam", url: "",
},
{
id: 16, rJumpId: null, wJumpId: null, word: "yak", url: "",
},
{
id: 17, rJumpId: null, wJumpId: null, word: "rat", url: "",
},
{
id: 18, rJumpId: null, wJumpId: null, word: "rag", url: "",
},
{
id: 19, rJumpId: null, wJumpId: null, word: "pan", url: "",
},
{
id: 20, rJumpId: 24, wJumpId: null, word: "dad", url: "",
},
{
id: 21, rJumpId: null, wJumpId: null, word: "jam", url: "",
},
{
id: 22, rJumpId: null, wJumpId: null, word: "ax", url: "",
},
{
id: 23, rJumpId: null, wJumpId: null, word: "hat", url: "",
},
{
id: 24, rJumpId: null, wJumpId: null, word: "map", url: "",
},
]
};
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "54089ef5-2877-48e9-a350-f026565c00cc",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
export as namespace Play;
declare class EventEmitter<T> {
on<K extends keyof T>(event: K, listener: (payload: T[K]) => any): this;
on(evt: string, listener: Function): this;
once<K extends keyof T>(event: K, listener: (payload: T[K]) => any): this;
once(evt: string, listener: Function): this;
off<K extends keyof T>(evt: K | string, listener?: Function): this;
emit<K extends keyof T>(evt: K | string, ...args: any[]): boolean;
}
export enum Event {
/** 断开连接 */
DISCONNECTED = 'disconnected',
/** 加入到大厅 */
LOBBY_JOINED = 'lobbyJoined',
/** 大厅房间列表变化 */
LOBBY_ROOM_LIST_UPDATED = 'lobbyRoomListUpdate',
/** 有新玩家加入房间 */
PLAYER_ROOM_JOINED = 'newPlayerJoinedRoom',
/** 有玩家离开房间 */
PLAYER_ROOM_LEFT = 'playerLeftRoom',
/** 玩家活跃属性变化 */
PLAYER_ACTIVITY_CHANGED = 'playerActivityChanged',
/** 主机变更 */
MASTER_SWITCHED = 'masterSwitched',
/** 离开房间 */
ROOM_LEFT = 'roomLeft',
/** 被踢出房间 */
ROOM_KICKED = 'roomKicked',
/** 房间系统属性变化 */
ROOM_SYSTEM_PROPERTIES_CHANGED = 'roomSystemPropertiesChanged',
/** 房间自定义属性变化 */
ROOM_CUSTOM_PROPERTIES_CHANGED = 'roomCustomPropertiesChanged',
/** 玩家自定义属性变化 */
PLAYER_CUSTOM_PROPERTIES_CHANGED = 'playerCustomPropertiesChanged',
/** 自定义事件 */
CUSTOM_EVENT = 'customEvent',
/** 错误事件 */
ERROR = 'error',
}
export enum ReceiverGroup {
/** 其他人(除了自己之外的所有人) */
Others,
/** 所有人(包括自己) */
All,
/** 主机客户端 */
MasterClient,
}
interface CustomProperties {
[key: string]: any;
}
interface CustomEventData {
[key: string]: any;
}
interface ErrorEvent {
code: number;
detail: string;
}
declare interface PlayEvent {
connected: void;
connectFailed: ErrorEvent;
disconnected: void;
lobbyJoined: void;
lobbyLeft: void;
lobbyRoomListUpdate: void;
roomCreated: void;
roomCreateFailed: ErrorEvent;
roomJoined: void;
roomJoinFailed: ErrorEvent;
newPlayerJoinedRoom: {
newPlayer: Player;
};
playerLeftRoom: {
leftPlayer: Player;
};
playerActivityChanged: {
player: Player;
};
masterSwitched: {
newMaster: Player;
};
roomLeft: void;
roomKicked: {
code: number;
msg: string;
};
roomCustomPropertiesChanged: {
changedProps: CustomProperties;
};
roomSystemPropertiesChanged: {
changedProps: CustomProperties;
};
playerCustomPropertiesChanged: {
player: Player;
changedProps: CustomProperties;
};
customEvent: {
eventId: number;
eventData: CustomEventData;
senderId: number;
};
error: ErrorEvent;
}
export class LobbyRoom {
readonly roomName: string;
readonly maxPlayerCount: number;
readonly expectedUserIds: string[];
readonly emptyRoomTtl: number;
readonly playerTtl: number;
readonly playerCount: number;
readonly customRoomPropertiesForLobby: CustomProperties;
}
export class Player {
readonly userId: string;
readonly actorId: number;
readonly isLocal: boolean;
readonly isMaster: boolean;
readonly isActive: boolean;
setCustomProperties(
properties: CustomProperties,
opts?: {
expectedValues?: CustomProperties;
}
): Promise<void>;
readonly customProperties: CustomProperties;
}
export class Room {
readonly name: string;
readonly open: boolean;
readonly visible: boolean;
readonly maxPlayerCount: number;
readonly master: Player;
readonly masterId: number;
readonly expectedUserIds: string[];
readonly playerList: Player[];
getPlayer(actorId: number): Player;
setCustomProperties(
properties: CustomProperties,
opts?: {
expectedValues?: CustomProperties;
}
): Promise<void>;
readonly customProperties: CustomProperties;
setOpen(open: boolean): Promise<void>;
setVisible(visible: boolean): Promise<void>;
setRoomMaxPlayerCount(count: number): Promise<void>;
setRoomExpectedUserIds(expectedUserIds: string[]): Promise<void>;
clearRoomExpectedUserIds(): Promise<void>;
addRoomExpectedUserIds(expectedUserIds: string[]): Promise<void>;
removeRoomExpectedUserIds(expectedUserIds: string[]): Promise<void>;
setMaster(newMasterId: number): Promise<void>;
sendEvent(
eventId: number,
eventData?: CustomEventData,
options?: {
receiverGroup?: ReceiverGroup;
targetActorIds?: number[];
}
): Promise<void>;
kickPlayer(
actorId: number,
opts?: {
code?: number;
msg?: string;
}
): Promise<void>;
leave(): Promise<void>;
}
export class Client extends EventEmitter<PlayEvent> {
readonly room: Room;
readonly player: Player;
readonly lobbyRoomList: LobbyRoom[];
userId: string;
constructor(opts: {
appId: string;
appKey: string;
userId: string;
ssl?: boolean;
feature?: string;
gameVersion?: string;
playServer?: string;
});
connect(): Promise<Client>;
reconnect(): Promise<Client>;
reconnectAndRejoin(): Promise<Room>;
close(): Promise<void>;
joinLobby(): Promise<void>;
leaveLobby(): Promise<void>;
createRoom(opts?: {
roomName?: string;
roomOptions?: Object;
expectedUserIds?: string[];
}): Promise<Room>;
joinRoom(
roomName: string,
opts?: {
expectedUserIds?: string[];
}
): Promise<Room>;
rejoinRoom(roomName: string): Promise<Room>;
joinOrCreateRoom(
roomName: string,
opts?: {
roomOptions?: Object;
expectedUserIds: string[];
}
): Promise<Room>;
joinRandomRoom(opts?: {
matchProperties?: Object;
expectedUserIds?: string[];
}): Promise<Room>;
matchRandom(
piggybackPeerId: string,
opts?: { matchProperties?: Object; expectedUserIds?: string[] }
): Promise<LobbyRoom>;
setRoomOpen(open: boolean): Promise<void>;
setRoomVisible(visible: boolean): Promise<void>;
setRoomMaxPlayerCount(count: number): Promise<void>;
setRoomExpectedUserIds(expectedUserIds: string[]): Promise<void>;
clearRoomExpectedUserIds(): Promise<void>;
addRoomExpectedUserIds(expectedUserIds: string[]): Promise<void>;
removeRoomExpectedUserIds(expectedUserIds: string[]): Promise<void>;
setMaster(newMasterId: number): Promise<void>;
sendEvent(
eventId: number,
eventData?: CustomEventData,
options?: {
receiverGroup?: ReceiverGroup;
targetActorIds?: number[];
}
): Promise<void>;
leaveRoom(): Promise<void>;
kickPlayer(
actorId: number,
opts?: {
code?: number;
msg?: string;
}
): Promise<void>;
pauseMessageQueue(): void;
resumeMessageQueue(): void;
}
export enum CreateRoomFlag {
FixedMaster = 1,
MasterUpdateRoomProperties = 2,
}
export function setAdapters(newAdapters: { WebSocket: Function }): void;
export enum LogLevel {
Debug = 'Debug',
Warn = 'Warn',
Error = 'Error',
}
export function setLogger(logger: {
Debug: (...args: any[]) => any;
Warn: (...args: any[]) => any;
Error: (...args: any[]) => any;
}): void;
export enum PlayErrorCode {
OPEN_WEBSOCKET_ERROR = 10001,
SEND_MESSAGE_STATE_ERROR = 10002,
}
export function registerType<T>(
type: T,
typeId: number,
serializeMethod: (obj: T) => Uint8Array,
deserializeMethod: (bytes: Uint8Array) => T
): void;
export function serializeObject(obj: Object): Uint8Array;
export function deserializeObject(bytes: Uint8Array): Object;
{
"ver": "2.0.0",
"uuid": "f31ed67d-4205-485f-9d56-0b38ee4013d8",
"subMetas": {}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"ver": "1.0.8",
"uuid": "32aec51c-c22c-4930-8091-1f63e8beb5e8",
"isPlugin": true,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": true,
"subMetas": {}
}
\ No newline at end of file
...@@ -71,64 +71,64 @@ export function setSprNodeMaxLen(sprNode, maxW, maxH) { ...@@ -71,64 +71,64 @@ export function setSprNodeMaxLen(sprNode, maxW, maxH) {
} }
export function localPosTolocalPos(baseNode, targetNode) { export function localPosTolocalPos(baseNode, targetNode) {
const worldPos = targetNode.parent.convertToWorldSpaceAR(cc.v2(targetNode.x, targetNode.y)); const worldPos = targetNode.parent.convertToWorldSpaceAR(cc.v2(targetNode.x, targetNode.y));
const localPos = baseNode.parent.convertToNodeSpaceAR(cc.v2(worldPos.x, worldPos.y)); const localPos = baseNode.parent.convertToNodeSpaceAR(cc.v2(worldPos.x, worldPos.y));
return localPos; return localPos;
} }
export function worldPosToLocalPos(worldPos, baseNode) { export function worldPosToLocalPos(worldPos, baseNode) {
const localPos = baseNode.parent.convertToNodeSpaceAR(cc.v2(worldPos.x, worldPos.y)); const localPos = baseNode.parent.convertToNodeSpaceAR(cc.v2(worldPos.x, worldPos.y));
return localPos; return localPos;
} }
export function getScaleRateBy2Node(baseNode, targetNode, maxFlag = true) { export function getScaleRateBy2Node(baseNode, targetNode, maxFlag = true) {
const worldRect1 = targetNode.getBoundingBoxToWorld(); const worldRect1 = targetNode.getBoundingBoxToWorld();
const worldRect2 = baseNode.getBoundingBoxToWorld(); const worldRect2 = baseNode.getBoundingBoxToWorld();
const sx = worldRect1.width / worldRect2.width; const sx = worldRect1.width / worldRect2.width;
const sy = worldRect1.height / worldRect2.height; const sy = worldRect1.height / worldRect2.height;
if (maxFlag) { if (maxFlag) {
return Math.max(sx, sy); return Math.max(sx, sy);
} else { } else {
return Math.min(sx, sy); return Math.min(sx, sy);
} }
} }
export function getDistance (start, end){ export function getDistance(start, end) {
var pos = cc.v2(start.x - end.x, start.y - end.y); var pos = cc.v2(start.x - end.x, start.y - end.y);
var dis = Math.sqrt(pos.x*pos.x + pos.y*pos.y); var dis = Math.sqrt(pos.x * pos.x + pos.y * pos.y);
return dis; return dis;
} }
export function playAudioByUrl(audio_url, cb=null) { export function playAudioByUrl(audio_url, cb = null) {
if (audio_url) { if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => { cc.assetManager.loadRemote(audio_url, (err, audioClip: any) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8); const audioId = cc.audioEngine.play(audioClip, false, 0.8);
if (cb) { if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => { cc.audioEngine.setFinishCallback(audioId, () => {
cb(); cb();
}); });
} }
}); });
} }
} }
export function btnClickAnima(btn, time=0.15, rate=1.05) { export function btnClickAnima(btn, time = 0.15, rate = 1.05) {
btn.tmpScale = btn.scale; btn.tmpScale = btn.scale;
btn.on(cc.Node.EventType.TOUCH_START, () => { btn.on(cc.Node.EventType.TOUCH_START, () => {
cc.tween(btn) cc.tween(btn)
.to(time / 2, {scale: btn.scale * rate}) .to(time / 2, { scale: btn.scale * rate })
.start() .start()
}) })
btn.on(cc.Node.EventType.TOUCH_CANCEL, () => { btn.on(cc.Node.EventType.TOUCH_CANCEL, () => {
cc.tween(btn) cc.tween(btn)
.to(time / 2, {scale: btn.tmpScale}) .to(time / 2, { scale: btn.tmpScale })
.start() .start()
}) })
btn.on(cc.Node.EventType.TOUCH_END, () => { btn.on(cc.Node.EventType.TOUCH_END, () => {
cc.tween(btn) cc.tween(btn)
.to(time / 2, {scale: btn.tmpScale}) .to(time / 2, { scale: btn.tmpScale })
.start() .start()
}) })
} }
...@@ -177,83 +177,17 @@ export function playAudio(audioClip, cb = null) { ...@@ -177,83 +177,17 @@ export function playAudio(audioClip, cb = null) {
export async function asyncDelay(time) { export async function asyncDelay(time) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
cc.tween(cc.find('Canvas')) const canvas = cc.find('Canvas');
cc.tween(canvas)
.delay(time) .delay(time)
.call(()=>{ .call(() => {
resolve(null); resolve(null);
}) })
.start(); .start();
} catch (e) { } catch (e) {
reject(e); reject(e);
} }
}) });
}
export async function asyncLoadDragonBoneAnime(node, { skeJsonData: { url: skeJsonDataUrl }, texJsonData: { url: texJsonDataUrl }, texPngData: { url: texPngDataUrl } }) {
if (!texPngDataUrl || !texJsonDataUrl || !texPngDataUrl
|| texPngDataUrl == '' || texJsonDataUrl == '' || texPngDataUrl == '') {
return;
}
return new Promise((resolve, reject) => {
if (node.animaNode) {
node.animaNode.removeFromParent();
}
const animaNode = new cc.Node();
animaNode.name = 'animaNode';
animaNode.parent = node;
animaNode.active = true;
node.animaNode = animaNode;
const dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
const loadTexture = new Promise((resolve, reject) => {
cc.assetManager.loadRemote(texPngDataUrl, (error, texture) => {
if (error) {
reject(error);
}
resolve(texture);
});
});
const loadTexJsonData = new Promise((resolve, reject) => {
cc.assetManager.loadAny({ url: texJsonDataUrl }, (error, atlasJson) => {
if (error) {
reject(error);
}
resolve(atlasJson);
});
});
const loadSkeJsonData = new Promise((resolve, reject) => {
cc.assetManager.loadAny({ url: skeJsonDataUrl }, (error, dragonBonesJson) => {
if (error) {
reject(error);
}
resolve(dragonBonesJson);
});
});
Promise.all([loadTexture, loadTexJsonData, loadSkeJsonData]).then(([texture, atlasJson, dragonBonesJson]) => {
const atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = JSON.stringify(atlasJson);
atlas.texture = texture;
const asset = new dragonBones.DragonBonesAsset();
asset.dragonBonesJson = JSON.stringify(dragonBonesJson);
dragonDisplay.dragonAtlasAsset = atlas;
dragonDisplay.dragonAsset = asset;
let armatureNames = dragonBonesJson.armature.map(data => data.name);
if (armatureNames.length > 0) {
dragonDisplay.armatureName = armatureNames[0];
}
resolve(animaNode);
});
});
} }
export class FireworkSettings { export class FireworkSettings {
...@@ -411,56 +345,33 @@ export function showTrebleFirework(baseNode, rabbonList) { ...@@ -411,56 +345,33 @@ export function showTrebleFirework(baseNode, rabbonList) {
showFireworks(right); showFireworks(right);
} }
export function httpHeadCall(requsetUrl: string, callback) { export function onHomeworkFinish(data: any = null) {
let xhr = new XMLHttpRequest();
console.log("Status: Send Post Request to " + requsetUrl);
try {
xhr.onreadystatechange = () => {
try {
console.log('xhr.readyState: ', xhr.readyState);
if (xhr.readyState == 4) {
if ((xhr.status >= 200 && xhr.status < 400)) {
callback(true);
} else {
callback(false);
}
}
} catch (e) {
console.log(e)
}
};
xhr.open("HEAD", requsetUrl, true);
xhr.send();
xhr.timeout = 15000;
xhr.onerror = (e) => {
callback(false);
};
xhr.ontimeout = (e) => {
callback(false);
};
} catch (e) {
console.log("Send Get Request error: ", e);
}
}
export function onHomeworkFinish(data = "", callback = ()=>{}) {
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.onHomeworkFinish(callback, data); if (middleLayerComponent.role == 'student') {
middleLayerComponent.onHomeworkFinish(() => { }, data);
}
} else { } else {
console.log('onHomeworkFinish', JSON.stringify(data)); console.log('onHomeworkFinish');
} }
} }
export function callMiddleLayerFunction(apiName: string, data: any, callback: Function) { export async function asyncPlayDragonBoneAnimation(node, animationName, time = 1, onFrameEvent = null) {
const middleLayer = cc.find('middleLayer'); return new Promise((resolve, reject) => {
if (middleLayer) { node.getComponent(dragonBones.ArmatureDisplay)
const middleLayerComponent = middleLayer.getComponent('middleLayer'); .once(dragonBones.EventObject.COMPLETE, () => {
middleLayerComponent.callMiddleLayerFunction(apiName, data, callback); resolve(null);
} else { });
console.log('callMiddleLayerFunction: ' + apiName);
}
}
node.getComponent(dragonBones.ArmatureDisplay)
.on(dragonBones.EventObject.FRAME_EVENT, ({ name }) => {
if (onFrameEvent && typeof (onFrameEvent) == 'function') {
onFrameEvent(name);
}
});
node.getComponent(dragonBones.ArmatureDisplay)
.playAnimation(animationName, time);
});
}
{
"ver": "2.3.5",
"uuid": "bb0b803e-b982-44bf-8d80-27db6c7d119c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 98,
"height": 151,
"platformSettings": {},
"subMetas": {
"pieceBlue": {
"ver": "1.0.4",
"uuid": "052e85f7-6675-4b13-8f74-d15b46aec377",
"rawTextureUuid": "bb0b803e-b982-44bf-8d80-27db6c7d119c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 98,
"height": 151,
"rawWidth": 98,
"rawHeight": 151,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d183f697-be20-4b64-90f9-7124190e6593",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 98,
"height": 151,
"platformSettings": {},
"subMetas": {
"pieceRed": {
"ver": "1.0.4",
"uuid": "c44efbe3-f9f7-43ea-b8ee-b6b767538db0",
"rawTextureUuid": "d183f697-be20-4b64-90f9-7124190e6593",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 98,
"height": 151,
"rawWidth": 98,
"rawHeight": 151,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "595a9e03-c5a6-47d5-b3a3-d52305598669",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 584,
"height": 235,
"platformSettings": {},
"subMetas": {
"yourturn": {
"ver": "1.0.4",
"uuid": "579a0a5e-e571-43b3-97d8-777bd23fa900",
"rawTextureUuid": "595a9e03-c5a6-47d5-b3a3-d52305598669",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 584,
"height": 235,
"rawWidth": 584,
"rawHeight": 235,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "97dde347-de5a-43ff-a35c-e60177b838d2",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1819,
"height": 1398,
"platformSettings": {},
"subMetas": {
"说明图片(先看这个)": {
"ver": "1.0.4",
"uuid": "4bb75d89-2f9b-46f7-944a-cd0629c9a8f6",
"rawTextureUuid": "97dde347-de5a-43ff-a35c-e60177b838d2",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1819,
"height": 1398,
"rawWidth": 1819,
"rawHeight": 1398,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "a8ab6c6c-065b-4752-83ad-d37ed4adcb80",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 450,
"height": 452,
"platformSettings": {},
"subMetas": {
"转盘转动层": {
"ver": "1.0.4",
"uuid": "45e7f8cc-6dc1-4393-92b3-d3b4b2d2e13a",
"rawTextureUuid": "a8ab6c6c-065b-4752-83ad-d37ed4adcb80",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 450,
"height": 452,
"rawWidth": 450,
"rawHeight": 452,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
"height": 31, "height": 31,
"rawWidth": 813, "rawWidth": 813,
"rawHeight": 51, "rawHeight": 51,
"borderTop": 0, "borderTop": 15,
"borderBottom": 0, "borderBottom": 3,
"borderLeft": 0, "borderLeft": 24,
"borderRight": 0, "borderRight": 24,
"subMetas": {} "subMetas": {}
} }
} }
......
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
"height": 51, "height": 51,
"rawWidth": 813, "rawWidth": 813,
"rawHeight": 51, "rawHeight": 51,
"borderTop": 0, "borderTop": 18,
"borderBottom": 0, "borderBottom": 25,
"borderLeft": 0, "borderLeft": 31,
"borderRight": 0, "borderRight": 25,
"subMetas": {} "subMetas": {}
} }
} }
......
{
"ver": "2.3.5",
"uuid": "c382f238-9049-409c-9ca0-f302714bad01",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 530,
"height": 267,
"platformSettings": {},
"subMetas": {
"鲸鱼": {
"ver": "1.0.4",
"uuid": "d67186f0-2908-4c9c-acdf-1689033e52f0",
"rawTextureUuid": "c382f238-9049-409c-9ca0-f302714bad01",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 530,
"height": 267,
"rawWidth": 530,
"rawHeight": 267,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
import { asyncDelay, onHomeworkFinish } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
const { ccclass, property } = cc._decorator;
@ccclass
export default class SceneComponent extends MyCocosSceneComponent {
addPreloadImage() {
// TODO 根据自己的配置预加载图片资源
this._imageResList.push({ url: this.data.pic_url });
this._imageResList.push({ url: this.data.pic_url_2 });
}
addPreloadAudio() {
// TODO 根据自己的配置预加载音频资源
this._audioResList.push({ url: this.data.audio_url });
}
addPreloadAnima() {
}
onLoadEnd() {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData();
this.initView();
this.initListener();
}
_cantouch = null;
initData() {
// 所有全局变量 默认都是null
this._cantouch = true;
}
initView() {
this.initBg();
this.initPic();
this.initBtn();
this.initIcon();
}
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
}
pic1 = null;
pic2 = null;
initPic() {
const canvas = cc.find('Canvas');
const maxW = canvas.width * 0.7;
this.getSprNodeByUrl(this.data.pic_url, (sprNode) => {
const picNode1 = sprNode;
picNode1.scale = maxW / picNode1.width;
picNode1.baseX = picNode1.x;
canvas.addChild(picNode1);
this.pic1 = picNode1;
const labelNode = new cc.Node();
labelNode.color = cc.Color.YELLOW;
const label = labelNode.addComponent(cc.Label);
label.string = this.data.text;
label.fontSize = 60;
label.lineHeight = 60;
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent('cc.Label').font;
picNode1.addChild(labelNode);
});
this.getSprNodeByUrl(this.data.pic_url_2, (sprNode) => {
const picNode2 = sprNode;
picNode2.scale = maxW / picNode2.width;
canvas.addChild(picNode2);
picNode2.x = canvas.width;
picNode2.baseX = picNode2.x;
this.pic2 = picNode2;
const labelNode = new cc.Node();
const label = labelNode.addComponent(cc.RichText);
const size = 60
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent(cc.Label).font;
label.string = `<outline color=#751e00 width=4><size=${size}><color=#ffffff>${this.data.text}</color></size></outline>`
label.lineHeight = size;
picNode2.addChild(labelNode);
});
}
initIcon() {
const iconNode = this.getSprNode('icon');
iconNode.zIndex = 5;
iconNode.anchorX = 1;
iconNode.anchorY = 1;
iconNode.parent = cc.find('Canvas');
iconNode.x = iconNode.parent.width / 2 - 10;
iconNode.y = iconNode.parent.height / 2 - 10;
iconNode.on(cc.Node.EventType.TOUCH_START, () => {
this.playAudioByUrl(this.data.audio_url);
})
}
curPage = null;
initBtn() {
this.curPage = 0;
const bottomPart = cc.find('Canvas/bottomPart');
bottomPart.zIndex = 5; // 提高层级
bottomPart.x = bottomPart.parent.width / 2;
bottomPart.y = -bottomPart.parent.height / 2;
const leftBtnNode = bottomPart.getChildByName('btn_left');
//节点中添加了button组件 则可以添加click事件监听
leftBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 0) {
return;
}
this.curPage = 0
this.leftMove();
this.playLocalAudio('btn');
})
const rightBtnNode = bottomPart.getChildByName('btn_right');
//节点中添加了button组件 则可以添加click事件监听
rightBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 1) {
return;
}
this.curPage = 1
this.rightMove();
// 游戏结束时需要调用这个方法通知系统作业完成
onHomeworkFinish();
this.playLocalAudio('btn');
})
}
leftMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
}
rightMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX - len }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX - len }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
}
// update (dt) {},
initListener() {
}
playLocalAudio(audioName) {
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
return new Promise((resolve, reject) => {
const id = cc.audioEngine.playEffect(audio.clip, false);
cc.audioEngine.setFinishCallback(id, () => {
resolve(id);
});
})
}
}
export const defaultData = {
"pic_url": "http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png",
"pic_url_2": "http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png",
"text": "This is a test label.",
"audio_url": "http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"
}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "0bb51832-4774-4f99-a94a-16e248980193",
"subMetas": {}
}
\ No newline at end of file
...@@ -2,5 +2,39 @@ ...@@ -2,5 +2,39 @@
"last-module-event-record-time": 1600677246969, "last-module-event-record-time": 1600677246969,
"migrate-history": [ "migrate-history": [
"cloud-function" "cloud-function"
] ],
"group-list": [
"default"
],
"collision-matrix": [
[
true
]
],
"excluded-modules": [
"3D Physics/Builtin"
],
"preview-port": 7456,
"design-resolution-width": 960,
"design-resolution-height": 640,
"fit-width": false,
"fit-height": true,
"use-project-simulator-setting": false,
"simulator-orientation": false,
"use-customize-simulator": true,
"simulator-resolution": {
"width": 960,
"height": 640
},
"clear-simulator-cache": true,
"facebook": {
"enable": false,
"appID": "",
"live": {
"enable": false
},
"audience": {
"enable": false
}
}
} }
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