Commit 6d988c90 authored by 杨一航's avatar 杨一航

fix

parent 2b543834
{
"ver": "1.1.2",
"uuid": "6bfb05ca-1a0f-4641-a854-718f949fdf19",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"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 EndView extends cc.Component {
@property(cc.Node)
winRoot: cc.Node = null;
@property(cc.Node)
loseRoot: cc.Node = null;
@property(cc.Node)
redIcon: cc.Node = null;
@property(cc.Node)
blueIcon: cc.Node = null;
@property(cc.Label)
lb_red: cc.Label = null;
@property(cc.Label)
lb_blue: cc.Label = null;
@property(cc.Node)
replayNode: cc.Node = null;
onLoad() {
this.replayNode.on("click", this.replay, this)
}
showView(win: boolean, redScore, blueScore, redUrl, blueUrl) {
this.winRoot.active = win;
this.loseRoot.active = !win;
this.lb_blue.string = blueScore;
this.lb_red.string = redScore;
cc.loader.load({ url: redUrl }, (err, img) => {
this.redIcon.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(img)
})
cc.loader.load({ url: blueUrl }, (err, img) => {
this.blueIcon.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(img)
})
}
replay() {
cc.game.restart();
}
}
{
"ver": "1.0.8",
"uuid": "b7a11c07-c2ff-4470-a00b-6654f03aedb4",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "endView",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 7
},
{
"__id__": 10
},
{
"__id__": 21
},
{
"__id__": 32
},
{
"__id__": 41
},
{
"__id__": 50
},
{
"__id__": 57
},
{
"__id__": 60
},
{
"__id__": 63
},
{
"__id__": 66
}
],
"_active": true,
"_components": [
{
"__id__": 69
},
{
"__id__": 70
}
],
"_prefab": {
"__id__": 71
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 2560,
"height": 1920
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
1280,
960,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "cover",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
},
{
"__id__": 4
},
{
"__id__": 5
}
],
"_prefab": {
"__id__": 6
},
"_opacity": 162,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 2560,
"height": 1920
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_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": 1,
"_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": 100,
"_originalHeight": 100,
"_id": ""
},
{
"__type__": "cc.BlockInputEvents",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "327XAkAkRCfJeMIKzLNfA1",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "bg",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 8
}
],
"_prefab": {
"__id__": 9
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1180,
"height": 832
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-4.13,
-103.24,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "62d04316-ec71-4372-8bb5-34e18060b23f"
},
"_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__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "e8kFWBNHVF743x/xQsX2Te",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "winRoot",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 11
},
{
"__id__": 14
},
{
"__id__": 17
}
],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 20
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "top",
"_objFlags": 0,
"_parent": {
"__id__": 10
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 12
}
],
"_prefab": {
"__id__": 13
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1589,
"height": 590
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
2.65,
233.201,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "4af41b0b-f45d-4508-b32c-6d7863e4687b"
},
"_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__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "58vQKe4uFEDpeO0kXszVEG",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "reward",
"_objFlags": 0,
"_parent": {
"__id__": 10
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 15
}
],
"_prefab": {
"__id__": 16
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 416,
"height": 376
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
8.259,
28.907,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "1f2b6e51-3f77-427c-b96e-f3263966de16"
},
"_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__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "10yeAUWtVMFJgWwYntYf57",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "WIN_",
"_objFlags": 0,
"_parent": {
"__id__": 10
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 18
}
],
"_prefab": {
"__id__": 19
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1000,
"height": 262
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
8.259,
379.923,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "9b6fd39a-dc70-4101-9f7c-1233c26aa401"
},
"_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__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "b7qmEbewFIpocGOarJZgMb",
"sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "7f9VXSbUhJfLWvNkzWSmaV",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "loseRoot",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 22
},
{
"__id__": 25
},
{
"__id__": 28
}
],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 31
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "top",
"_objFlags": 0,
"_parent": {
"__id__": 21
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 23
}
],
"_prefab": {
"__id__": 24
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1589,
"height": 590
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
2.65,
233.201,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "59864bd8-c9b4-42dd-b063-39335a541f3d"
},
"_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__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "beTZROgupL+LM6dnKJUk7D",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "reward",
"_objFlags": 0,
"_parent": {
"__id__": 21
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 26
}
],
"_prefab": {
"__id__": 27
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 447,
"height": 396
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
8.259,
28.907,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "ecaf3b5f-9fa9-4a22-91c8-fc039bddd94d"
},
"_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__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "77Le9D5KlIgb1eTfry4MjH",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "LOSE",
"_objFlags": 0,
"_parent": {
"__id__": 21
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 29
}
],
"_prefab": {
"__id__": 30
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1268,
"height": 388
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
8.259,
379.923,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 28
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "6ee8f9f0-7277-45a2-aff7-78b74087400d"
},
"_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__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "dceVi2xXRElq+D60X/mhXx",
"sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "feEMaWOARJ8I3mE8hCiO0v",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "redHead",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 33
}
],
"_active": true,
"_components": [
{
"__id__": 39
}
],
"_prefab": {
"__id__": 40
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 247,
"height": 247
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-350,
-80,
0,
0,
0,
0,
1,
1.4,
1.4,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "mask",
"_objFlags": 0,
"_parent": {
"__id__": 32
},
"_children": [
{
"__id__": 34
}
],
"_active": true,
"_components": [
{
"__id__": 37
}
],
"_prefab": {
"__id__": 38
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 170,
"height": 170
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-14.444,
13.186,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "redIcon",
"_objFlags": 0,
"_parent": {
"__id__": 33
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 35
}
],
"_prefab": {
"__id__": 36
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 200,
"height": 200
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 34
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": null,
"_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.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "c3QqnPGt1HdIrqsKi3wRXL",
"sync": false
},
{
"__type__": "cc.Mask",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_spriteFrame": null,
"_type": 1,
"_segments": 200,
"_N$alphaThreshold": 0,
"_N$inverted": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "fdbOIRw9hICoKbqMf7dfB6",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 32
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "5c5c155b-3efb-47e1-a3c6-e08bf61f0108"
},
"_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__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "fbVF6OxpZCm4XFn3eCD/p7",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "blueHead",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 42
}
],
"_active": true,
"_components": [
{
"__id__": 48
}
],
"_prefab": {
"__id__": 49
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 247,
"height": 247
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
350,
-80,
0,
0,
0,
0,
1,
1.4,
1.4,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "mask",
"_objFlags": 0,
"_parent": {
"__id__": 41
},
"_children": [
{
"__id__": 43
}
],
"_active": true,
"_components": [
{
"__id__": 46
}
],
"_prefab": {
"__id__": 47
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 170,
"height": 170
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-14.673,
15.006,
0,
0,
0,
0,
1,
1,
1,
0.71429
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "blueIcon",
"_objFlags": 0,
"_parent": {
"__id__": 42
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 44
}
],
"_prefab": {
"__id__": 45
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 200,
"height": 200
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 43
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": null,
"_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.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "4dJgGV6QxKzr8pTU8BRj1T",
"sync": false
},
{
"__type__": "cc.Mask",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 42
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_spriteFrame": null,
"_type": 1,
"_segments": 200,
"_N$alphaThreshold": 0,
"_N$inverted": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "96eptC68xCe79uXxKQdwEP",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 41
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "3270c0e5-00d4-4ad6-9a86-de56ea92c6ff"
},
"_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__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "ddjpdndaxEBp/lOmELr5Rq",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "replayBtn",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 51
}
],
"_active": true,
"_components": [
{
"__id__": 54
},
{
"__id__": 55
}
],
"_prefab": {
"__id__": 56
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 326,
"height": 138
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
12.389,
-379.923,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "lb",
"_objFlags": 0,
"_parent": {
"__id__": 50
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 52
}
],
"_prefab": {
"__id__": 53
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 242,
"g": 184,
"b": 32,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 240,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-2,
4,
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__": 51
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "再玩一次",
"_N$string": "再玩一次",
"_fontSize": 60,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_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.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "bdTHMTCPZMR57j8NdNwdol",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 50
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "94fa32b7-c935-488b-9d27-9df4e480d70a"
},
"_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.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 50
},
"_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__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "d0VpVFkVtJl402mQ/V9+el",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "单独红灯 - 001",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 58
}
],
"_prefab": {
"__id__": 59
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 139,
"height": 144
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-450,
-270,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 57
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "d6f378bf-949e-42a7-b1cb-c6a3c8753b30"
},
"_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__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "1eZAEZkGRL6Jw6LeN/Yf0r",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "单独蓝灯 - 001",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 61
}
],
"_prefab": {
"__id__": 62
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 146,
"height": 153
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
250,
-270,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 60
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "067750c4-d229-46b2-aea7-557039efe4a1"
},
"_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__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "6dJTCgYgJLmLD51thr2eYC",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "lb_red",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 64
}
],
"_prefab": {
"__id__": 65
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 253,
"g": 165,
"b": 10,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 22.25,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-380,
-270,
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__": 63
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "1",
"_N$string": "1",
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_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.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "c6mQvagTZMXYBKSxCKd6cI",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "lb_blue",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 67
}
],
"_prefab": {
"__id__": 68
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 253,
"g": 165,
"b": 10,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 22.25,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
320,
-270,
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__": 66
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "1",
"_N$string": "1",
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_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.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "adkxAS8n9OzpjttuFq0B/J",
"sync": false
},
{
"__type__": "b7a11wHwv9EcKALZlTwOu20",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"winRoot": {
"__id__": 10
},
"loseRoot": {
"__id__": 21
},
"redIcon": {
"__id__": 34
},
"blueIcon": {
"__id__": 43
},
"lb_red": {
"__id__": 64
},
"lb_blue": {
"__id__": 67
},
"replayNode": {
"__id__": 50
},
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"alignMode": 1,
"_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": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "84b72720-2013-4f2b-b787-52900432f34f"
},
"fileId": "",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "84b72720-2013-4f2b-b787-52900432f34f",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
......@@ -25,6 +25,7 @@ export default class Keyboard extends cc.Component {
_wordList = [];
private _normaly: number;
private _moving: boolean;
private _endCall: any;
onLoad() {
......@@ -61,8 +62,11 @@ export default class Keyboard extends cc.Component {
sendWords() {
console.log(this._wordList.join(""));
this._endCall && this._endCall(this._wordList.join(""));
this.showOut();
}
set InputEndCall(endCall: Function) {
this._endCall = endCall;
}
showIn() {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
import { delayCall } from "../../../form/src/app/play/Unit";
import EndView from "../prefabs/endView/EndView";
import Keyboard from "../prefabs/keyboards/Keyboard";
import LoadingLayer from "../script/BoardGame_yyh_LoadingLayer";
import MsgData from "../script/msgDate";
import { MsgType, PlayerData, resultType } from "../script/msgType";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
import { NetworkHelper } from "../script/NetworkHelper";
import { GameServer } from "../script/Server";
import { asyncTweenTo, asyncDelay, onHomeworkFinish } from "../script/util";
import { asyncTweenTo, asyncDelay, onHomeworkFinish, asyncPlayDragonBoneAnimation } from "../script/util";
import BoardCardItem from "./boardCardItem";
const DOLOG = false;
const { ccclass, property } = cc._decorator;
@ccclass
......@@ -16,26 +21,29 @@ export default class SceneComponent extends MyCocosSceneComponent {
loadingLayerPrefab = null;
@property(cc.Prefab)
keyboardLayerPrefab = null
@property(cc.Prefab)
endViewPrefab = null
@property(cc.Node)
cat = null
@property(cc.Node)
clockNode = null
bfly: cc.Node = null
@property(cc.Node)
cover = null
@property(cc.Node)
recordCat = null
@property(cc.Node)
btn_keyboard = null
btn_keyboard: cc.Node = null
_cardList: Array<cc.Node> = [];
private _isRolling: any;
_randomList = [];
_gameWordList = [];
excellent: any;
_nowData: any;
private _myData: any;
private _loadingDone: boolean = false;
private _loadingCall: Function
private _playingAudio: boolean;
private _canClick: any;
private _recordBefore: boolean = false;
......@@ -49,12 +57,24 @@ export default class SceneComponent extends MyCocosSceneComponent {
private _lastIndex: any;
private _checkLast: boolean;
private _keyboard: any;
private _blueHeadIcon: cc.Node;
private _redHeadIcon: cc.Node;
private _clockNode: any;
private _clockTime: any;
private _wordCardRoot: cc.Node;
private _redLightList: any;
private _blueLightList: any;
private _round2WordList: Array<string>;
private _stepWord: string;
private _birdsRoot: cc.Node;
private _redUrl: any;
private _blueUrl: any;
lb_round2: cc.Node;
onLoad() {
super.onLoad();
// this.addLoadingLayer();
this.addKeyboard();
this.addLoadingLayer();
}
addLoadingLayer() {
const loadingLayerNode = cc.instantiate(this.loadingLayerPrefab);
......@@ -70,11 +90,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
this._keyboard = keyboard.getComponent(Keyboard);
this._keyboard.setNormalData(-cc.winSize.height / 2)
this.btn_keyboard.on("click", this._showKeyboard, this);
this._keyboard.InputEndCall = this._inputWords.bind(this);
}
_showKeyboard() {
this._keyboard.showIn();
}
_inputWords(word) {
this._sendMsg(MsgType.USER_REQ_ERQ, { word: word, uuid: this.playerId })
}
addPreloadImage() {
// TODO 根据自己的配置预加载图片资源
// this._imageResList.push({ url: this.data.pic_url });
......@@ -94,12 +118,135 @@ export default class SceneComponent extends MyCocosSceneComponent {
onLoadEnd() {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.log("onLoadEnd");
// this.initData();
// this.initView();
// this.initListener();
this.initView();
this.initNetSever();
}
loadingLayer: LoadingLayer;
initLoadingLayer() {
this.loadingLayer.setMaxPlayerNumber(2);
this.loadingLayer.onLoadFinished(() => {
this.playAudioByUrl(this.data.gameStartAudio);
this._loadingDone = true;
if (this._loadingCall) {
this._loadingCall();
this._loadingCall = null;
}
});
this.playAudioByUrl(this.data.gameLoadingAudio);
}
initView() {
this.initProtory();
this.addKeyboard();
this.initLoadingLayer();
this._hideKeyBoardBtn();
}
initProtory() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
this.cover.width = cc.winSize.width;
this.cover.height = cc.winSize.height;
this.cover.getChildByName("bg").scale = this._mapScaleMax;
let topRoot = cc.find("Canvas/topRoot");
this._redLightList = topRoot.getChildByName("lights").getChildByName("red");
this._blueLightList = topRoot.getChildByName("lights").getChildByName("blue");
this._blueHeadIcon = topRoot.getChildByName("blue").getChildByName("headIcon");
this._redHeadIcon = topRoot.getChildByName("red").getChildByName("headIcon");
this._redLb = topRoot.getChildByName("lb_red").getComponent(cc.Label)
this._blueLb = topRoot.getChildByName("lb_blue").getComponent(cc.Label)
this._clockNode = this.cat.parent.getChildByName("clock");
this._clockTime = this._clockNode.getChildByName("lb").getComponent(cc.Label);
this._wordCardRoot = cc.find("Canvas/center/wordBgRoot");
this._birdsRoot = cc.find("Canvas/center/birdsRoot");
this.lb_round2 = cc.find("Canvas/lb_round2");
this.cat.getComponent(dragonBones.ArmatureDisplay).addEventListener(dragonBones.EventObject.COMPLETE, () => {
console.log("ani complite");
this.catAni();
});
this.bfly.getComponent(dragonBones.ArmatureDisplay).addEventListener(dragonBones.EventObject.COMPLETE, () => {
this.bfly.getComponent(dragonBones.ArmatureDisplay).playAnimation("normal", 0);
});
// this.cat.getChildByName("btn").on("click", () => {
// if (this._playingAudio) {
// return;
// }
// this._playingAudio = true;
// this.catAni(true);
// })
}
loadPlayerHeadImage() {
this._playerList.forEach((player) => {
this.getSpriteFrimeByUrl(player.headUrl, (sf) => {
if (player.side == "Red") {
this._redHeadIcon.getComponent(cc.Sprite).spriteFrame = sf;
this._redUrl = player.headUrl
} else {
this._blueHeadIcon.getComponent(cc.Sprite).spriteFrame = sf;
this._blueUrl = player.headUrl
}
});
});
}
_showKeyBoardBtn() {
this.btn_keyboard.active = true;
}
_hideKeyBoardBtn() {
this.btn_keyboard.active = false;
}
catAni(playAudio?) {
let state = this._status.state
if (this._checkLast) {
this._checkLast = false
this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("normal", 0);
return
}
// if (!this.isMySide) {
// this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("begin", 0);
// playAudio && this.playAudioByUrl(this.data.waitingTurn, () => {
// this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("normal", 0);
// this._playingAudio = false;
// })
// return
// }
if (state == -1) {
this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("normal", 0);
this._playingAudio = false;
} else if (state == 0) {
this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("begin", 0);
playAudio && this.playAudioByUrl(this.data.waitingWheel, () => {
this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("normal", 0);
this._playingAudio = false;
})
} else if (state == 1) {
playAudio && this.playAudioByUrl(this.data.waitingPiece, () => {
this._playingAudio = false;
})
}
else if (state == 2) {
this._playingAudio = false;
}
}
_status = {
state: 0,// -1:未开始 0 准备阶段 1 roll 2 判定
......@@ -115,13 +262,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
isRoomOwner;
server: GameServer;
networkHelper: NetworkHelper;
async initData() {
// this.initCards();
async initNetSever() {
this._initGameData()
this.networkHelper = new NetworkHelper();
this.initNetworkListener();
do {
this.playerId = await this.networkHelper.init("op_L4_R4", 2);
this.playerId = await this.networkHelper.init("op_L5_R1_bingo", 2);
if (this.playerId === null) {
this.log("onDestroy");
this.networkHelper.onDestroy();
......@@ -135,13 +283,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.isRoomOwner = true;
this.server = new GameServer(2, this.networkHelper);
this.server.randomList = this._randomList;
this.server.TotalStep = this._cardList.length;
this.server.wordList = this._gameWordList;
await this.networkHelper.startFrameSync();
this.server.addPlayer({
uuid: this.playerId,
isAI: false,
});
this.server.startMatch();
}
await this.initHeadImgAndName();
......@@ -154,7 +299,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
};
const middleLayer = cc.find("middleLayer");
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent("middleLayer");
middleLayerComponent.log("这里 打log?");
if (middleLayerComponent.getUserInfo && middleLayerComponent.getHeadUrl) {
......@@ -164,417 +308,352 @@ export default class SceneComponent extends MyCocosSceneComponent {
playerInfo.playerName = kidInfo.nick_name || '拼读达人';
}
}
this.networkHelper.sendFrame({
type: "playerInfo",
let playData: PlayerData = {
playerId: this.playerId,
uuid: this.playerId,
playerName: playerInfo.playerName,
playerHeadUrl: playerInfo.playerHeadUrl,
});
name: playerInfo.playerName,
headUrl: playerInfo.playerHeadUrl,
side: "",
isAI: false,
};
this._sendMsg(MsgType.USER_JOIN_ERQ, playData);
}
initCards() {
let cardDatas = [
{
id: 1, rJumpId: null, wJumpId: null, word: "cage", url: "",
},
{
id: 2, rJumpId: null, wJumpId: null, word: "cellphone", url: "",
},
{
id: 3, rJumpId: null, wJumpId: null, word: "cheese", url: "",
},
{
id: 4, rJumpId: null, wJumpId: null, word: "city", url: "",
},
{
id: 5, rJumpId: null, wJumpId: null, word: "desk", url: "",
},
{
id: 6, rJumpId: null, wJumpId: null, word: "giant", url: "",
},
{
id: 7, rJumpId: null, wJumpId: null, word: "giraffe", url: "",
},
{
id: 8, rJumpId: null, wJumpId: null, word: "icecream", url: "",
},
{
id: 9, rJumpId: null, wJumpId: null, word: "jeans", url: "",
},
{
id: 10, rJumpId: null, wJumpId: null, word: "legs", url: "",
},
{
id: 11, rJumpId: null, wJumpId: null, word: "orange", url: "",
},
{
id: 12, rJumpId: null, wJumpId: null, word: "rice", url: "",
},
{
id: 13, rJumpId: null, wJumpId: null, word: "rose", url: "",
},
{
id: 14, rJumpId: null, wJumpId: null, word: "scale", url: "",
},
{
id: 15, rJumpId: null, wJumpId: null, word: "school", url: "",
},
{
id: 16, rJumpId: null, wJumpId: null, word: "skunk", url: "",
},
{
id: 17, rJumpId: null, wJumpId: null, word: "splash", url: "",
},
{
id: 18, rJumpId: null, wJumpId: null, word: "splint", url: "",
},
{
id: 19, rJumpId: null, wJumpId: null, word: "spray", url: "",
},
{
id: 20, rJumpId: null, wJumpId: null, word: "spring", url: "",
},
{
id: 21, rJumpId: null, wJumpId: null, word: "square", url: "",
},
{
id: 22, rJumpId: null, wJumpId: null, word: "squid", url: "",
},
{
id: 23, rJumpId: null, wJumpId: null, word: "string", url: "",
},
{
id: 24, rJumpId: null, wJumpId: null, word: "strong", url: "",
},
]
this._cardList = cc.find("Canvas/road/root/wordCards").children;
let list = cardDatas;
for (let i = 0; i < this._cardList.length; ++i) {
let data = list[i];
let com = this._cardList[i].addComponent(BoardCardItem);
com.cardData = data;
this._randomList.push(i);
_initGameData() {
let cardRoot = cc.find("Canvas/center/cardRoot");
let cards = cardRoot.children;
for (let i = 0; i < cards.length; ++i) {
let card = cards[i];
this._gameWordList.push(card.name)
}
}
initView() {
this.initBg();
this.initLoadingLayer();
}
getJumpList() {
const jumpList = [];
this._cardList.forEach(node => {
const itemData = node.getComponent(BoardCardItem);
if (itemData.rjumpId || itemData.wjumpId) {
const from = itemData.Id;
const rto = itemData.rjumpId;
const wto = itemData.wjumpId;
jumpList.push({ from, rto, wto });
}
_sendMsg(type: MsgType, data: any) {
this.networkHelper.sendFrame({
type: type,
data: data
});
this.log(jumpList);
return jumpList;
}
_isSeverMsgType(type) {
return type == MsgType.USER_JOIN_ERQ ||
type == MsgType.USER_REQ_ERQ ||
type == MsgType.USER_PREPARE_REQ;
}
_playerList;
initNetworkListener() {
this.networkHelper.on("playerJoin", (event) => {
// if (this.server) {
getForceWrongList() {
// this.server.onPlayerJoin({ data: { joinPlayerId: event.playerId } });
// }
this.log("playerJoin" + JSON.stringify(event, null, 2));
});
this.networkHelper.on("playerLeave", (event) => {
cc.log("playerLeave" + JSON.stringify(event));
cc.find("Canvas/PlayerOffLineLayer").active = true;
this.networkHelper.leaveRoom();
});
this.networkHelper.on("playerOffLine", (event) => {
cc.find("Canvas/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) => {
let type: MsgType = item.data.type;
let msgData: MsgData = item.data.data;
console.log("msg type: " + MsgType[item.data.type]);
DOLOG && console.log("msg data :\n" + item.data.data);
DOLOG && this.log("msg type: " + item.data.type);
DOLOG && this.log("msg data :\n" + item.data.data)
// 服务器只处理用户消息, 用户只处理广播消息
if (this.server && this._isSeverMsgType(item.data.type)) {
this.server.onFrameEvent(item.data);
} else {
let msg = typeof msgData == "string" ? JSON.parse(msgData) : msgData
this._onSeverMsg(type, msg);
}
const forceWrongList = [];
this._cardList.forEach((node, index) => {
const itemData = node.getComponent(BoardCardItem);
if (!itemData.word) {
forceWrongList.push(itemData.Id);
}
});
});
this.log(forceWrongList);
return forceWrongList;
}
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
_onSeverMsg(type: MsgType, data: any) {
this.cover.width = cc.winSize.width;
this.cover.height = cc.winSize.height;
this.cover.getChildByName("bg").scale = this._mapScaleMax;
if (type == MsgType.USER_JOIN_EV) {
this._updateUserJoin(new MsgData(data));
} else if (type == MsgType.ROOM_INIT_DONE) {
const endRoot = cc.find("Canvas/endRoot")
endRoot.scale = this._mapScaleMax;
this._doStartGameAni(new MsgData(data));
} else if (type == MsgType.ROOM_ST) {
this._redDot = cc.find("Canvas/redDot");
this._redDot.active = false;
this._blueDot = cc.find("Canvas/blueDot");
this._blueDot.active = false;
this._coinNode = cc.find("Canvas/road/board/coinRoot");
this._coinNode.getChildByName("coinA").active = true;
this._coinNode.getChildByName("coinB").active = false;
const blueHead = cc.find("Canvas/road/blueHead");
const redHead = cc.find("Canvas/road/redHead");
this._redLb = redHead.getChildByName("lb").getComponent(cc.Label)
this._blueLb = blueHead.getChildByName("lb").getComponent(cc.Label)
this._springNode = cc.find("Canvas/road/board/btn");
this.cat.getComponent(dragonBones.ArmatureDisplay).addEventListener(dragonBones.EventObject.COMPLETE, () => {
console.log("ani complite");
this.catAni();
});
this._updateRootSt(new MsgData(data));
}
else if (type == MsgType.ROUND_START_EV) {
if (data.round == 1) {
this.cat.getChildByName("btn").on("click", () => {
} else {
let index = data.index;
this._stepWord = this._round2WordList[index];
this.lb_round2.getComponent(cc.Label).string = "当前发音单词:" + this._stepWord
console.log("========setp word ===========" + this._stepWord);
if (this._playingAudio) {
return;
}
this._playingAudio = true;
this.catAni(true);
})
}
catAni(playAudio?) {
let state = this._status.state
if (this._checkLast) {
this._checkLast = false
this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("normal", 0);
return
}
if (!this.isMySide) {
this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("begin", 0);
playAudio && this.playAudioByUrl(this.data.waitingTurn, () => {
this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("normal", 0);
this._playingAudio = false;
})
return
}
if (state == -1) {
this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("normal", 0);
this._playingAudio = false;
} else if (state == 0) {
this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("begin", 0);
playAudio && this.playAudioByUrl(this.data.waitingWheel, () => {
this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("normal", 0);
this._playingAudio = false;
})
} else if (state == 1) {
playAudio && this.playAudioByUrl(this.data.waitingPiece, () => {
this._playingAudio = false;
})
}
else if (state == 2) {
this._playingAudio = false;
else if (type == MsgType.USER_REQ_EV) {
this._checkUserAnswer(data)
} else if (type == MsgType.ROUND_END_EV) {
this._roundEndCheck(data);
}
}
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();
this._canClick = false;
await this.showYourTurn();
this.blinkTheDice();
this._canClick = true;
} else {
this.greyDice();
asyncDelay(0.2).then(() => {
this.playLocalAudio("otherturn")
})
}
this._redLb.string = `${this._status.Red}/10`;
this._blueLb.string = `${this._status.Blue}/10`;
let costTime = this._status.current == "Red" ? this._status.RedTime : this._status.BlueTime;
this._leftTime = 150 - (+costTime)
break;
case 1:
if (this.isMySide) {
_updateUserJoin(data: MsgData) {
data.PlayerList.forEach((player) => {
if (!this._playerList) {
this._playerList = [];
}
} else {
this.greyDice();
}
if (
!this._playerList.find(
(listPlayer) => listPlayer.uuid == player.uuid
)
) {
this._playerList.push({
uuid: player.uuid,
name: player.name,
side: player.side,
headUrl: player.headUrl,
});
}
break;
case 2:
if (this.isMySide) {
this.loadPlayerHeadImage();
} else {
this.greyDice();
}
this._leftTime = -1;
break;
this.loadingLayer.addPlayer(
player.name,
player.uuid == this.playerId,
player.headUrl,
player.uuid
);
});
}
_doStartGameAni(data: MsgData) {
cc.log("_doStartGameAni")
this._updateClock(data.Time);
let aniCall = () => {
let wp1 = this.bfly.convertToWorldSpaceAR(cc.Vec2.ZERO);
let wp2 = this.btn_keyboard.convertToWorldSpaceAR(cc.Vec2.ZERO)
let offsetX = wp2.x - wp1.x;
console.log("offset x =" + offsetX)
cc.tween(this.bfly).by(1, { x: offsetX }).call(() => {
this.bfly.getComponent(dragonBones.ArmatureDisplay).playAnimation("begin", 1);
}).delay(3).call(() => {
this._sendMsg(MsgType.USER_PREPARE_REQ, {});
this._showKeyBoardBtn();
}).by(1, { x: -offsetX }).start();
}
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;
if (this._loadingDone) {
aniCall();
} else {
blinkFrame = blueFrame;
stopBlinkFrame = redFrame;
this._loadingCall = aniCall;
}
blinkFrame.getComponent(cc.Button).interactable = true;
stopBlinkFrame.getComponent(cc.Button).interactable = false;
}
_updateRootSt(data: MsgData) {
DOLOG && console.log(data);
if (data.Round == 1) {
loadingLayer;
initLoadingLayer() {
this._updateCards(data.getAnswerList())
} else {
this.loadingLayer.setMaxPlayerNumber(2);
this.loadingLayer.onLoadFinished(() => {
this.playAudioByUrl(this.data.gameStartAudio);
this._loadingDone = true;
this.updateStatus();
});
}
this._updateClock(data.Time);
this._updateProgrss(data.RedScore, data.BuleSocre, data.Round)
}
_roundEndCheck(data) {
if (data.round == 1) {
this._round2WordList = data.answerList
console.log("====_round2WordList====");
console.log(this._round2WordList);
// resaon 1 全部完成, 2 时间到了
this._hideKeyBoardBtn();
this._keyboard.showOut();
let wp1 = this.bfly.convertToWorldSpaceAR(cc.Vec2.ZERO);
let wp2 = this.btn_keyboard.convertToWorldSpaceAR(cc.Vec2.ZERO)
let offsetX = wp2.x - wp1.x;
console.log("offset x =" + offsetX)
cc.tween(this.bfly).by(1, { x: offsetX }).call(() => {
this.bfly.getComponent(dragonBones.ArmatureDisplay).playAnimation("begin", 1);
}).delay(3).call(() => {
this._sendMsg(MsgType.USER_PREPARE_REQ, {});
this._initCardClickEvent();
}).by(1, { x: -offsetX }).start();
this.playAudioByUrl(this.data.gameLoadingAudio);
}
} else {
blinkTheDice() {
let finger = cc.find("Canvas/road/board/finger")
finger.zIndex = 10;
finger.active = true;
cc.tween(finger)
.set({ scale: 3 })
.to(0.2, { scale: 3.3 })
.to(0.2, { scale: 3.0 })
.union()
.repeatForever()
.start();
// 鸟飞走
}
let endview = cc.instantiate(this.endViewPrefab);
endview.parent = this.node;
endview.zIndex = 1000;
let endViewCom: EndView = endview.getComponent(EndView);
normaltheDice() {
let realRedScore = (Math.floor(data.redScore / 100) + data.redScore % 100);
let realBlueScore = (Math.floor(data.blueScore / 100) + data.blueScore % 100);
let finger = cc.find("Canvas/road/board/finger")
finger.active = false;
endViewCom.showView(
this.playerId == data.uuid,
realRedScore,
realBlueScore,
this._redUrl,
this._blueUrl
)
// cc.find("Canvas/road/board").children.forEach((node) => {
// node.stopAllActions();
// node.color = cc.color(250, 250, 250);
// });
}
}
_initCardClickEvent() {
this._wordCardRoot.children.forEach((card, index) => {
if (!card.getComponent(cc.Button)) {
card.addComponent(cc.Button)
}
card.on("click", () => {
console.log("===click birds===");
this._sendMsg(
MsgType.USER_REQ_ERQ,
{
uuid: this.playerId,
index: index,
}
)
greyDice() {
let finger = cc.find("Canvas/road/board/finger")
finger.active = false;
})
// cc.find("Canvas/road/board").children.forEach((node) => {
// node.color = cc.color(150, 150, 150);
// });
})
}
_updateProgrss(redScore, blueScore, round) {
let realRedScore = (Math.floor(redScore / 100) + redScore % 100);
let realBlueScore = (Math.floor(blueScore / 100) + blueScore % 100);
this._redLb.string = "" + realRedScore;
this._blueLb.string = "" + realBlueScore;
initListener() {
// this.boardBtn.on("click", () => {
if (!this.isMySide || this._status.state != 0 || !this._canClick) {
return;
if (round == 1) {
this._redLightList.children.forEach((node) => {
node.active = +node.name <= redScore % 100
})
this._blueLightList.children.forEach((node) => {
node.active = +node.name <= blueScore % 100
})
} else {
this._redLightList.children.forEach((node) => {
node.active = +node.name <= Math.floor(redScore / 100)
})
this._blueLightList.children.forEach((node) => {
node.active = +node.name <= Math.floor(blueScore / 100)
})
}
this.playLocalAudio("btn");
this.normaltheDice();
this.networkHelper.sendFrame({
type: "roll",
uuid: this.myData.uuid,
});
// });
}
_updateCards(list) {
for (let i = 0; i < list.length; ++i) {
let data = list[i];
let word = data.word;
let uuid = data.uuid;
let cardBg = this._wordCardRoot.children[i];
backCoin(right = false) {
let board = cc.find("Canvas/road/board")
this._coinNode.parent = board;
this._coinNode.position = cc.v3(-80, 184);
this._coinNode.getChildByName("coinA").active = true;
this._coinNode.getChildByName("coinB").active = false;
if (right) {
let point = this._cardList[this._lastIndex].getChildByName("p");
let dot = this._redDot;
if (this._status.current == "Blue") {
dot = this._blueDot;
if (cardBg.getChildByName("word")) {
continue;
} else {
let wordNode = this.getSprNode(word)
wordNode.parent = cardBg;
wordNode.name = "word";
wordNode.x = 0;
wordNode.y = 0;
wordNode.zIndex = 10;
let side = this._getSideByUuid(uuid);
if (side == "Red") {
let coverBg = this.getSprNode("RedBox");
coverBg.parent = cardBg;
coverBg.x = 0;
coverBg.y = 0;
} else if (side == "Blue") {
let coverBg = this.getSprNode("BlueBox");
coverBg.parent = cardBg;
coverBg.x = 0;
coverBg.y = 0;
}
}
let dotNode = cc.instantiate(dot);
dotNode.active = true;
dotNode.parent = point;
dotNode.position = cc.Vec3.ZERO;
}
}
_getSideByUuid(uuid) {
let side = "";
this._playerList.forEach((player) => {
if (player.uuid == uuid) {
side = player.side
}
});
return side;
}
_updateClock(time: number) {
if (this._leftTime == time) return
this._leftTime = time;
this._clockTime.string = "" + Math.round(time);
cc.tween(this._clockTime.node).to(0.3, { scale: 1.2 }).to(0.7, { scale: 1 }).start();
}
_checkUserAnswer(data: { round: number, uuid: string, index: number, result: resultType }) {
if (data.round == 1) {
if (this.playerId == data.uuid) {
if (data.result == resultType.REPEAT) {
cc.log("这个单词已经存在了");
jumpBlock(idx) {
} else if (data.result == resultType.WRONG) {
cc.log("抱歉 你答错了");
const targetNode = this._cardList[idx];
return targetNode;
}
} else if (data.result == resultType.RIGHT) {
getNextRightIdx() {
cc.log("恭喜你答对了");
}
}
} else {
const startIdx = this._status[this._status.current];
}
let bird = this._birdsRoot.children[data.index]
if (data.result == resultType.WRONG) {
cc.log("抱歉 你答错了");
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;
this.playLocalAudio("piece");
let word = this._cardList[this._status.step].getComponent(BoardCardItem)._word
if (this.isMySide) {
let card = this._cardList[this._status.step];
await asyncDelay(0.5);
this.openCoursView(card, word);
asyncPlayDragonBoneAnimation(bird, "wrong").then(() => {
bird.getComponent(dragonBones.ArmatureDisplay).playAnimation("normal", 0);
})
}
} else if (data.result == resultType.RIGHT) {
}
bird.getComponent(dragonBones.ArmatureDisplay).playAnimation("right", 0);
cc.log("恭喜你答对了");
}
}
async peaceJumpAndBack() {
let node = cc.find(`Canvas/road/root/piece${this._status.current}`);
let nowIdx = this._status[this._status.current];
let nextIdx = nowIdx + this._status.step;
this.playLocalAudio("piece");
await this.pieceMove();
//todo
this.playLocalAudio("wrong");
await this.pieceGoBack();
}
async openCoursView(node, word) {
this.cover.active = true;
this.cat.active = false;
this.clockNode.active = false;
this._clockNode.active = false;
let probar = this.cover.getChildByName("bg").getChildByName("probar");
let pass = this.cover.getChildByName("bg").getChildByName("pass");
let loss = this.cover.getChildByName("bg").getChildByName("loss");
......@@ -669,12 +748,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.cover.active = false;
this.cat.active = true;
this.clockNode.active = true;
this._clockNode.active = true;
this.log("====评测通过=====");
this.networkHelper.sendFrame({
type: "right",
uuid: this.myData.uuid,
});
// this.networkHelper.sendFrame({
// type: "right",
// uuid: this.myData.uuid,
// });
} else {
......@@ -687,12 +766,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
await asyncDelay(1);
this.cover.active = false;
this.cat.active = true;
this.clockNode.active = true;
this._clockNode.active = true;
this.log("====评测不通过=====");
this.networkHelper.sendFrame({
type: "wrong",
uuid: this.myData.uuid,
});
// this.networkHelper.sendFrame({
// type: "wrong",
// uuid: this.myData.uuid,
// });
}
......@@ -709,10 +788,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (isRight) {
if (this.isMySide) {
this._checkLast = true
this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("right", 1);
}
// if (this.isMySide) {
// this._checkLast = true
// this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("right", 1);
// }
if (this._status.current == "Red") {
redHead.getChildByName("spine").getComponent(dragonBones.ArmatureDisplay).playAnimation("normal", 1);
......@@ -721,41 +800,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
} else {
if (this.isMySide) {
this._checkLast = true
this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("wrong", 1);
}
// if (this.isMySide) {
// this._checkLast = true
// this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("wrong", 1);
// }
}
this.networkHelper.sendFrame({
type: "stateUpdate",
uuid: this.myData.uuid,
});
}
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");
// }
// this.networkHelper.sendFrame({
// type: "stateUpdate",
// uuid: this.myData.uuid,
// });
}
showYourTurn() {
this.log("=====showYourTurn===========");
return new Promise((resolve, reject) => {
const yourTurn = cc.find("Canvas/yourturn");
......@@ -773,174 +831,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
});
}
async fixStep() {
}
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 } });
}
this.log("playerJoin" + JSON.stringify(event, null, 2));
});
this.networkHelper.on("playerLeave", (event) => {
cc.log("playerLeave" + JSON.stringify(event));
cc.find("Canvas/PlayerOffLineLayer").active = true;
this.networkHelper.leaveRoom();
});
this.networkHelper.on("playerOffLine", (event) => {
cc.find("Canvas/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") {
this.log(
"SERVER_allPlayerInfo: " + JSON.stringify(item.data.playerData, null, 2)
);
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();
}
let rollNum = this._status.step
this._lastIndex = rollNum;
await this.rollTheDice(rollNum);
this.log("rollTheDice done");
await this.peaceJumpAndSpeak();
this.log("peaceJumpAndSpeak done");
this.roundEndCheck();
}
else if (item.data.type == "SERVER_playerRight") {
this._leftTime = -1;
!this.isMySide && this.playLocalAudio("right");
this._status = JSON.parse(JSON.stringify(item.data.status));
this.backCoin(true)
await asyncDelay(2);
this.roundEndCheck(true);
} else if (item.data.type == "SERVER_playerWrong") {
this._leftTime = -1;
!this.isMySide && this.playLocalAudio("wrong");
this._status = JSON.parse(JSON.stringify(item.data.status));
this.backCoin()
await asyncDelay(2);
this.roundEndCheck();
} else if (item.data.type == "SERVER_playerWin") {
this._leftTime = -1;
this._status = JSON.parse(JSON.stringify(item.data.status));
const node = cc.find(
`Canvas/road/root/piece${this._status.current}`
);
await this.fixStep();
await this.toEnd()
if (this.isMySide) {
this.showWin();
onHomeworkFinish({ isWin: true });
} else {
this.showLoss();
onHomeworkFinish({ isWin: false });
}
}
});
});
}
update(dt) {
if (this._leftTime > 0) {
this._leftTime -= dt;
this.clockNode.getChildByName("lb").getComponent(cc.Label).string = "" + Math.round(this._leftTime);
this.clockNode.getChildByName("lb").color = this._status.current == "Red" ? cc.Color.RED : cc.Color.BLUE;
}
}
pieceGoBack() {
this.backCoin();
}
pieceMove() { }
async toEnd() {
const blueHead = cc.find("Canvas/road/blueHead");
const redHead = cc.find("Canvas/road/redHead");
blueHead.getChildByName("tree").getComponent(cc.ProgressBar).progress = this._status.Blue / 10;
......@@ -962,12 +854,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
// { x: pos.x, y: pos.y },
// { easing: "cubicOut" }
// );
if (this.isMySide) {
this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("finish", 1);
} else {
// if (this.isMySide) {
// this.cat.getComponent(dragonBones.ArmatureDisplay).playAnimation("finish", 1);
// } else {
}
await asyncDelay(0.2);
// }
// await asyncDelay(0.2);
}
......@@ -990,23 +882,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.playLocalAudio("loss");
}
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();
......
import BoardCardItem from "../scene/boardCardItem";
import MsgData from "./msgDate";
import { MsgType } from "./msgType";
import { NetworkHelper } from "./NetworkHelper";
import { asyncDelay } from "./util";
const countDelay = 4; // 距离上次答对 间隔4s 开始答题下一题
export class AI {
networkHelper: NetworkHelper;
playerData: any;
_status = {
state: -1,// -1:未开始 0 准备阶段 1 roll 2 判定
Red: -1,
Blue: 0,
step: 0,
current: "Blue",
jump: null,
};
_startAi: boolean = false;
_answerpro = 0;
private _gameData: MsgData;
private _countDelay: number;
private _stepIndex: any;
constructor(networkHelper: NetworkHelper, playerData: any) {
this.networkHelper = networkHelper;
this.playerData = playerData;
}
async onFrameEvent(data) {
console.log("AI get event: " + JSON.stringify(data));
// console.log("AI get event: " + data);
if (data.type == "SERVER_updateStatus") {
let type: MsgType = data.type;
let msgData = data.data;
this._status = JSON.parse(JSON.stringify(data.status));
if (type == MsgType.ROOM_ST) {
if (this.playerData.color != this._status.current) return
this._gameData = new MsgData(JSON.parse(msgData));
if (!this._status.step) {
await asyncDelay(Math.random() * 3 + 2);
if (!this._startAi) return;
console.log("AI rolling");
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,
});
if (this._gameData.Round == 1 && this._gameData.BuleSocre < 14) {
cc.log("ai check")
this._countDelay--;
if (this._countDelay <= 0) {
let wordList = this._gameData.LeftList;
let word = wordList[Math.floor(Math.random() * wordList.length * 0.99)]
cc.log("ai answer word" + word)
this._sendMsg({ type: MsgType.USER_REQ_ERQ, data: { word: word, uuid: this.playerData.uuid } })
this._countDelay = Math.floor(10 + Math.random() * 10);;
}
} else if (this._gameData.Round == 2) {
this._countDelay--;
if (this._countDelay <= 0) {
this._sendMsg({ type: MsgType.USER_REQ_ERQ, data: { index: this._stepIndex, uuid: this.playerData.uuid } })
this._countDelay = 10000
}
}
}
else if (type == MsgType.ROUND_START_EV) {
let data = msgData;
if (data.round == 1) {
this._startAi = true;
this._countDelay = Math.floor(10 + Math.random() * 10);
} else {
this._startAi = true;
this._stepIndex = data.index;
this._countDelay = Math.floor(7 + Math.random() * 5);
}
} else if (type == MsgType.ROUND_END_EV) {
let data = msgData;
if (data.round == 1) {
} else {
}
}
}
_sendMsg(data: { type: MsgType, data: any }) {
this.networkHelper.sendFrame({
type: data.type,
data: data.data
});
}
}
import BoardCardItem from "../scene/boardCardItem";
import { asyncDelay, RandomInt } from "../script/util";
import { AI } from "./AI";
import MsgData from "./msgDate";
import { MsgType, PlayerData, resultType } from "./msgType";
import { NetworkHelper } from "./NetworkHelper";
export class GameServer {
......@@ -29,11 +30,26 @@ export class GameServer {
"http://staging-teach.cdn.ireadabc.com/f40ce4a8630039c4cf48a63fc1399c52.png",
];
_checkList = [
[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15],
[0, 4, 8, 12], [1, 5, 9, 13], [2, 6, 10, 14], [3, 7, 11, 15],
[0, 5, 10, 15], [3, 6, 9, 12]
]
private _totalStep: any;
randomList = [];
wordList = [];
_answerList = []
private _useAI: boolean;
private _timer: number;
private _totalTime: number = 150;
private _totalTime: number = 16;
private _gameData: MsgData;
private _userPrepareCount: number;
private _lastTime: number;
private _nowAnswerIndex: number;
private _round_1_cardList: any[] = [];
private _nowStepAnswerIndex: number;
private _round2OutIndex;
constructor(playerMaxNumber, networkHelper) {
this.playerMaxNumber = playerMaxNumber;
......@@ -45,28 +61,36 @@ export class GameServer {
this.headUrls = this.headUrls.sort((a, b) => RandomInt(2) - 1);
this.nameList = this.nameList.sort((a, b) => RandomInt(2) - 1);
this._userPrepareCount = 0;
this._gameData = new MsgData();
this._gameData.Time = this._totalTime;
this._gameData.Round = 1;
this.networkHelper.startFrameSync();
}
async addPlayer(player) {
async addPlayer(player: PlayerData) {
console.log("addPlayer");
this.playerList.push({
this._gameData.addPlayer({
playerId: player.uuid,
name: this.nameList.splice(0, 1)[0],
uuid: player.uuid,
color:
side:
player.uuid == this.networkHelper.room.roomInfo.owner ? "Red" : "Blue",
isAI: player.isAI,
headUrl: this.headUrls.splice(0, 1)[0],
})
this._senMsg({
type: MsgType.USER_JOIN_EV,
data: this._gameData.Msg
});
if (player.isAI) {
this._useAI = true;
await asyncDelay(1);
this.networkHelper.sendFrame({
type: "SERVER_allPlayerInfo",
playerData: this.playerList,
});
if (this.playerList.length == this.playerMaxNumber) {
if (this._gameData.PlayerList.length == this.playerMaxNumber) {
this.networkHelper.closeRoom();
await asyncDelay(0.5);
this.startGame();
......@@ -75,33 +99,29 @@ export class GameServer {
}
}
gameStatus = {
state: 0,// -1:未开始 0 准备阶段 1 roll 2 判定
Red: 0,
Blue: 0,
RedTime: 0,
BlueTime: 0,
step: 0,
current: "Red",
time: "0"
};
startGame() {
startGame() {
this.openTimerCounter();
console.log("startGame set time ------");
this.networkHelper.sendFrame({
type: "SERVER_updateStatus",
status: this.gameStatus,
let left = this.wordList.join(",").split(",");
this._gameData.LeftList = left;
console.log("========start game===========");
this._senMsg({
type: MsgType.ROOM_INIT_DONE,
data: this._gameData.Msg
});
//this._senMsg({
// type: "SERVER_updateStatus",
// status: this.gameStatus,
// });
}
onPlayerJoin(event) {
this.addPlayer({
uuid: event.data.joinPlayerId,
isAI: false,
});
// this.addPlayer({
// uuid: event.data.joinPlayerId,
// isAI: false,
// });
}
_aiPlayerList = [];
......@@ -109,12 +129,12 @@ export class GameServer {
for (let i = 0; i < this.playerMaxNumber; i++) {
this._timeoutIds.push(
setTimeout(() => {
const count = this.playerMaxNumber - this.playerList.length;
let playerList = this._gameData.PlayerList;
const count = this.playerMaxNumber - playerList.length;
if (count > 0) {
const playerInfo = {
uuid: "ai_" + i,
isAI: true,
color: "Blue",
};
this._aiPlayerList.push(new AI(this.networkHelper, playerInfo));
this.addPlayer(playerInfo);
......@@ -124,140 +144,438 @@ export class GameServer {
}
}
async onFrameEvent(data) {
if (this.gameStatus['gameOver']) {
return;
}
let sender = this.playerList.find(p => p.uuid == data.uuid);
if (sender) {
sender.name = data.playerName;
sender.headUrl = data.playerHeadUrl;
}
_senMsg(data: { type: MsgType, data: any }) {
this.networkHelper.sendFrame({
type: data.type,
data: data.data
});
if (data.type == "playerInfo") {
this._aiPlayerList.forEach((ai: AI) => {
ai.onFrameEvent(data);
});
}
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;
}
_shecduleTimer() {
if (sender.color == this.gameStatus.current) {
let now = Date.now()
this._gameData.Time -= (now - this._lastTime) / 1000;
let i = Math.floor(Math.random() * this.randomList.length)
let index = this.randomList[i];
if (this._gameData.Time <= 0) {
if (this._gameData.Round == 1) {
let len = this._gameData.getAnswerList().length;
for (let i = 0; i < 16 - len; ++i) {
let index = Math.floor(Math.random() * (this.wordList.length * 0.99));
let word = this.wordList[index];
this.wordList.splice(index, 1);
this._gameData.addAnswerList({ word: word, uuid: "none" })
}
console.log("random index ===" + index);
this.gameStatus.step = index;
this.gameStatus.state = 1;
clearInterval(this._timer)
this._senMsg({
type: MsgType.ROOM_ST,
data: this._gameData.Msg
});
let answerList = this._gameData.getAnswerList();
for (let i = 0; i < answerList.length; ++i) {
this._round_1_cardList.push(answerList[i].word);
}
this.networkHelper.sendFrame({
type: "SERVER_playerRoll",
status: this.gameStatus,
this._senMsg({
type: MsgType.ROUND_END_EV,
data: { round: this._gameData.Round, reason: 2, answerList: this._round_1_cardList }
});
this._initRound2();
} else {
console.warn("data uuid not match");
this._senMsg({
type: MsgType.USER_REQ_EV,
data: { round: this._gameData.Round, uuid: "none", result: resultType.RIGHT, index: this._nowStepAnswerIndex, }
})
this._gameData.addAnswerList({ uuid: "none", index: this._nowStepAnswerIndex })
this._initRound2Step();
}
}
else if (data.type == "right") {
let posIndex = this.gameStatus.step
this.gameStatus[this.gameStatus.current]++;
let lastTime = +this.gameStatus.time;
console.log("lasttime = " + lastTime);
let costTime = (Math.floor(Date.now() / 1000) - lastTime).toFixed(1)
console.log("=right===cost time = " + costTime);
if (this.gameStatus.current == "Red") {
this.gameStatus.RedTime += +costTime
} else {
this.gameStatus.BlueTime += +costTime
} else {
this._lastTime = now;
this._senMsg({
type: MsgType.ROOM_ST,
data: this._gameData.Msg
}
let i = this.randomList.indexOf(posIndex);
this.randomList[i] = this.randomList[this.randomList.length - 1];
this.randomList.length--;
);
}
}
_initRound2() {
this._gameData.Round = 2;
this._round_1_cardList = [];
let answerList = this._gameData.getAnswerList();
for (let i = 0; i < answerList.length; ++i) {
this._round_1_cardList.push(answerList[i].word);
}
this._gameData.clearAnswerList();
}
_initRound2Step() {
if (this.gameStatus[this.gameStatus.current] < 10) {
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.gameStatus.step = null;
this.networkHelper.sendFrame({
type: "SERVER_playerWin",
status: this.gameStatus,
});
this.gameStatus['gameOver'] = true;
clearTimeout(this._timer);
clearInterval(this._timer)
let ary: Array<any> = this._checkRound2Over()
if (ary.length > 0) {
this._senMsg({
type: MsgType.ROOM_ST,
data: this._gameData.Msg
})
let winSide = "Red"
if (this._gameData.BuleSocre > this._gameData.RedScore) {
winSide = "Blue"
} else if (this._gameData.BuleSocre == this._gameData.RedScore) {
let answerList = this._gameData.getAnswerList();
for (let i = answerList.length - 1; i >= 0; ++i) {
let answer = answerList[i];
let uuid = answer.uuid;
if (uuid == "none") continue;
this._gameData.PlayerList.forEach((player) => {
if (player.uuid == uuid) {
winSide = player.side;
}
})
break;
}
}
} else if (data.type == "wrong") {
let uuid = "";
this._gameData.PlayerList.forEach((player) => {
if (player.side == winSide) {
uuid = player.uuid;
}
})
this._senMsg({
type: MsgType.ROUND_END_EV,
data: { round: this._gameData.Round, redScore: this._gameData.RedScore, blueScore: this._gameData.BuleSocre, uuid: uuid, ary: ary }
})
return;
}
let lastTime = +this.gameStatus.time;
let costTime = (Math.floor(Date.now() / 1000) - lastTime).toFixed(1)
console.log("=wrong and ===cost time = " + costTime);
if (this.gameStatus.current == "Red") {
this.gameStatus.RedTime += +costTime
this._nowStepAnswerIndex = this._getNewStepIndex();
this._senMsg({
type: MsgType.ROUND_START_EV,
data: { round: this._gameData.Round, index: this._nowStepAnswerIndex }
});
this._userPrepareCount = 0;
this._lastTime = Date.now();
this._gameData.Time = 10;
this._shecduleTimer();
this._timer = setInterval(this._shecduleTimer.bind(this), 1000);
}
_getNewStepIndex() {
this._round2OutIndex = this._round2OutIndex || [];
let index;
do {
index = Math.floor(Math.random() * this._round_1_cardList.length * 0.99);
} while (this._round2OutIndex.indexOf(index) > -1)
this._round2OutIndex.push(index)
return index;
}
_checkRound2Over() {
let gameAnswerList = this._gameData.getAnswerList();
if (gameAnswerList.length < 4) return [];
for (let i = 0; i < this._checkList.length; ++i) {
let done = true;
let ary = this._checkList[i];
for (let k = 0; k < ary.length; ++k) {
done = done && gameAnswerList.some((val) => {
return val.index == ary[k]
})
}
if (done) return ary;
}
return [];
}
async onFrameEvent(data) {
// if (this.gameStatus['gameOver']) {
// return;
// }
let type: MsgType = data.type;
let msgDate = data.data;
if (type == MsgType.USER_JOIN_ERQ) {
this.addPlayer(<PlayerData>msgDate)
}
else if (type == MsgType.USER_PREPARE_REQ) {
if (this._gameData.Round == 1) {
this._userPrepareCount++;
if (this._userPrepareCount == this.playerMaxNumber - (this._useAI ? 1 : 0)) {
this._senMsg({
type: MsgType.ROUND_START_EV,
data: { round: this._gameData.Round }
});
this._userPrepareCount = 0;
this._lastTime = Date.now();
this._shecduleTimer();
this._timer = setInterval(this._shecduleTimer.bind(this), 1000)
}
} else {
this.gameStatus.BlueTime += +costTime
this._userPrepareCount++;
if (this._userPrepareCount == this.playerMaxNumber - (this._useAI ? 1 : 0)) {
this._initRound2Step();
}
}
this.gameStatus.step = null;
this.gameStatus.state = 2;
}
else if (type == MsgType.USER_REQ_ERQ) {
if (this._gameData.Round == 1) {
let userId = msgDate.uuid;
let word = msgDate.word;
cc.log("uuid=" + userId + " input words =" + word);
//todo 判断单词是否正确
let index1 = this.wordList.indexOf(word);
let index2 = this._answerList.indexOf(word);
let result = resultType.WRONG;
if (index1 > -1) {
result = resultType.RIGHT;
this._answerList.push(word);
this.wordList.splice(index1, 1);
let left = this.wordList.join(",").split(",");
this._gameData.LeftList = left;
this._gameData.addAnswerList({ word: word, uuid: userId });
let side = "Red";
this._gameData.PlayerList.forEach((player) => {
if (player.uuid == userId) {
side = player.side;
}
})
this._gameData.RedScore += (side == "Red" ? 1 : 0);
this._gameData.BuleSocre += (side == "Blue" ? 1 : 0);
} else if (index2 > -1) {
result = resultType.REPEAT;
}
this._senMsg({
type: MsgType.USER_REQ_EV,
data: { round: this._gameData.Round, uuid: userId, result: result }
});
if (this._gameData.getAnswerList().length == 16) {
let answerList = this._gameData.getAnswerList();
for (let i = 0; i < answerList.length; ++i) {
this._round_1_cardList.push(answerList[i].word);
}
this._senMsg({
type: MsgType.ROUND_END_EV,
data: { round: this._gameData.Round, reason: 1, answerList: this._round_1_cardList }
});
this.networkHelper.sendFrame({
type: "SERVER_playerWrong",
status: this.gameStatus,
});
this.changeSide();
this._initRound2();
} else if (data.type == "stateUpdate") {
} else {
if (this._useAI || sender.color == this.gameStatus.current) {
this._senMsg({
type: MsgType.ROOM_ST,
data: this._gameData.Msg
});
if (this.gameStatus.state == 2) {
this.gameStatus.state = 0;
}
if (this.gameStatus.state == 0) {
this.openTimerCounter();
} else {
let userId = msgDate.uuid;
let index = msgDate.index;
if (index == this._nowStepAnswerIndex) {
this._senMsg({
type: MsgType.USER_REQ_EV,
data: { round: this._gameData.Round, uuid: userId, result: resultType.RIGHT, index: index, }
})
let side = "";
this._gameData.PlayerList.forEach((player) => {
if (player.uuid == userId) {
side = player.side;
}
})
this._gameData.RedScore += (side == "Red" ? 100 : 0);
this._gameData.BuleSocre += (side == "Blue" ? 100 : 0);
this._gameData.addAnswerList({ uuid: userId, index: index })
this._initRound2Step();
} else {
this._senMsg({
type: MsgType.USER_REQ_EV,
data: { round: this._gameData.Round, uuid: userId, result: resultType.WRONG, index: index, }
})
}
this.networkHelper.sendFrame({
type: "SERVER_updateStatus",
status: this.gameStatus,
});
}
}
else {
this._aiPlayerList.forEach((ai: AI) => {
ai.onFrameEvent(data);
});
}
// else if (type == MsgType.USER_REQ_ERQ) {
// }
// let sender = this.playerList.find(p => p.uuid == data.uuid);
// if (sender) {
// sender.name = data.playerName;
// sender.headUrl = data.playerHeadUrl;
// }
// if (data.type == "playerInfo") {
// this._senMsg({
// 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 i = Math.floor(Math.random() * this.randomList.length)
// let index = this.randomList[i];
// console.log("random index ===" + index);
// this.gameStatus.step = index;
// this.gameStatus.state = 1;
// this._senMsg({
// type: "SERVER_playerRoll",
// status: this.gameStatus,
// });
// } else {
// console.warn("data uuid not match");
// }
// }
// else if (data.type == "right") {
// let posIndex = this.gameStatus.step
// this.gameStatus[this.gameStatus.current]++;
// let lastTime = +this.gameStatus.time;
// console.log("lasttime = " + lastTime);
// let costTime = (Math.floor(Date.now() / 1000) - lastTime).toFixed(1)
// console.log("=right===cost time = " + costTime);
// if (this.gameStatus.current == "Red") {
// this.gameStatus.RedTime += +costTime
// } else {
// this.gameStatus.BlueTime += +costTime
// }
// let i = this.randomList.indexOf(posIndex);
// this.randomList[i] = this.randomList[this.randomList.length - 1];
// this.randomList.length--;
// if (this.gameStatus[this.gameStatus.current] < 10) {
// this.gameStatus.step = null;
// this.gameStatus.state = 2;
// this._senMsg({
// type: "SERVER_playerRight",
// status: this.gameStatus,
// });
// this.changeSide();
// } else {
// this.gameStatus.state = 2;
// this.gameStatus.step = null;
// this._senMsg({
// type: "SERVER_playerWin",
// status: this.gameStatus,
// });
// this.gameStatus['gameOver'] = true;
// clearTimeout(this._timer);
// }
// } else if (data.type == "wrong") {
// let lastTime = +this.gameStatus.time;
// let costTime = (Math.floor(Date.now() / 1000) - lastTime).toFixed(1)
// console.log("=wrong and ===cost time = " + costTime);
// if (this.gameStatus.current == "Red") {
// this.gameStatus.RedTime += +costTime
// } else {
// this.gameStatus.BlueTime += +costTime
// }
// this.gameStatus.step = null;
// this.gameStatus.state = 2;
// this._senMsg({
// 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;
// }
// if (this.gameStatus.state == 0) {
// this.openTimerCounter();
// }
// this._senMsg({
// type: "SERVER_updateStatus",
// status: this.gameStatus,
// });
// }
// }
// else {
// this._aiPlayerList.forEach((ai: AI) => {
// ai.onFrameEvent(data);
// });
// }
}
set TotalStep(step) {
......@@ -268,60 +586,60 @@ export class GameServer {
let prepareTime = 4;
// AI 无准备时间
if (this._useAI && this.gameStatus.current == "Blue") {
prepareTime = 0
}
this.gameStatus.time = "" + (Math.floor(Date.now() / 1000) + prepareTime);
console.log(" openTimerCounter set time ------");
clearTimeout(this._timer)
let leftTime = this.gameStatus.BlueTime
if (this.gameStatus.current == "Red") {
leftTime = this.gameStatus.RedTime;
}
leftTime = this._totalTime - leftTime + prepareTime;
console.log(`${this.gameStatus.current} left time ${leftTime}, now time ${Date.now() / 1000}`)
this._timer = setTimeout(this.timeOver.bind(this), leftTime * 1000);
// if (this._useAI && this.gameStatus.current == "Blue") {
// prepareTime = 0
// }
// this.gameStatus.time = "" + (Math.floor(Date.now() / 1000) + prepareTime);
// console.log(" openTimerCounter set time ------");
// clearTimeout(this._timer)
// let leftTime = this.gameStatus.BlueTime
// if (this.gameStatus.current == "Red") {
// leftTime = this.gameStatus.RedTime;
// }
// leftTime = this._totalTime - leftTime + prepareTime;
// console.log(`${this.gameStatus.current} left time ${leftTime}, now time ${Date.now() / 1000}`)
// this._timer = setTimeout(this.timeOver.bind(this), leftTime * 1000);
}
timeOver() {
let lastTime = +this.gameStatus.time;
let costTime = (Math.floor(Date.now() / 1000) - lastTime).toFixed(1)
console.log(`time over and time now ${Date.now() / 1000}`);
console.log("=wrong and ===cost time = " + costTime);
if (this.gameStatus.current == "Red") {
this.gameStatus.RedTime += +costTime
} else {
this.gameStatus.BlueTime += +costTime
}
if (this.gameStatus.current == "Red") {
this.gameStatus.current = "Blue"
}
this.gameStatus.state = 2;
this.gameStatus.step = null;
this.networkHelper.sendFrame({
type: "SERVER_playerWin",
status: this.gameStatus,
});
this.gameStatus['gameOver'] = true;
// let lastTime = +this.gameStatus.time;
// let costTime = (Math.floor(Date.now() / 1000) - lastTime).toFixed(1)
// console.log(`time over and time now ${Date.now() / 1000}`);
// console.log("=wrong and ===cost time = " + costTime);
// if (this.gameStatus.current == "Red") {
// this.gameStatus.RedTime += +costTime
// } else {
// this.gameStatus.BlueTime += +costTime
// }
// if (this.gameStatus.current == "Red") {
// this.gameStatus.current = "Blue"
// }
// this.gameStatus.state = 2;
// this.gameStatus.step = null;
//this._senMsg({
// type: "SERVER_playerWin",
// status: this.gameStatus,
// });
// this.gameStatus['gameOver'] = true;
}
changeSide() {
console.log("=====changeSide=======");
// console.log("=====changeSide=======");
console.log("=====old =======" + this.gameStatus.current);
// console.log("=====old =======" + this.gameStatus.current);
if (this.gameStatus.current == "Red") {
this.gameStatus.current = "Blue";
} else {
this.gameStatus.current = "Red";
}
// if (this.gameStatus.current == "Red") {
// this.gameStatus.current = "Blue";
// } else {
// this.gameStatus.current = "Red";
// }
console.log("=====now =======" + this.gameStatus.current);
// console.log("=====now =======" + this.gameStatus.current);
}
startAI() {
......
import { MsgType, PlayerData } from "./msgType";
export default class MsgData {
_playerList: Array<PlayerData>;
_redScore: number = 0;
_buleSocre: number = 0;
_time: number = 0;
_round: number = 0;
_answerList: Array<any> = [];
_leftList: Array<any> = [];
constructor(data?: {
playerList,
redScore,
buleSocre,
time,
round,
answerList,
leftList,
}) {
this._playerList = data?.playerList || [];
this._redScore = data?.redScore || 0;
this._buleSocre = data?.buleSocre || 0;
this._time = data?.time || 0;
this._round = data?.round || 0;
this._answerList = data?.answerList || [];
this._leftList = data?.leftList || [];
}
get PlayerList() {
return this._playerList;
}
addPlayer(val: PlayerData) {
this._playerList.push(val);
}
get Time() {
return this._time;
}
set Time(val: number) {
this._time = val;
}
get Round() {
return this._round;
}
set Round(val: number) {
this._round = val;
}
get RedScore() {
return this._redScore;
}
set RedScore(val: number) {
this._redScore = val;
}
get BuleSocre() {
return this._buleSocre;
}
set BuleSocre(val: number) {
this._buleSocre = val;
}
get LeftList() {
return this._leftList;
}
set LeftList(val) {
this._leftList = val;
}
getAnswerList() {
return this._answerList;
}
addAnswerList(val: { word?: string, uuid: string, index?: number }) {
this._answerList.push(val);
}
clearAnswerList() {
this._answerList = [];
}
get Msg() {
let data =
{
playerList: this._playerList,
redScore: this._redScore,
buleSocre: this._buleSocre,
time: this._time,
round: this._round,
answerList: this._answerList,
leftList: this._leftList
}
return JSON.stringify(data);
}
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "29f56073-02a9-44f4-9a64-6bc431ec4dd9",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
export enum MsgType {
ROOM_INIT_DONE = 0,//匹配完成
ROOM_ST = 1,// 同步房间数据
USER_PREPARE_REQ = 11,// 玩家准备完成
ROUND_START_EV = 15,// 回合开始
ROUND_END_EV = 16,// 回合结束
USER_JOIN_ERQ = 22,//玩家加入房间请求
USER_JOIN_EV = 23,//玩家加入房间广播
USER_REQ_EV = 34,//玩家操作广播
USER_REQ_ERQ = 35,//玩家操作上报
}
export enum resultType {
WRONG = 1,
REPEAT = 2,
RIGHT = 3,
}
export interface PlayerData {
playerId?: string,
name?: string,
uuid: string,
side?: string,
isAI?: boolean,
headUrl?: string,
}
{
"ver": "1.0.8",
"uuid": "3237dea0-16c8-4b66-b7a1-ae0e9a782ed2",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
......@@ -11,7 +11,7 @@
"height": 44,
"platformSettings": {},
"subMetas": {
"surse": {
"urse": {
"ver": "1.0.4",
"uuid": "993da591-bc95-464c-9561-4b837ed41c79",
"rawTextureUuid": "9e028138-b982-4688-8918-9613409d5868",
......
{
"ver": "2.3.5",
"uuid": "26979cc4-ebac-4f64-af12-cc2852501ca7",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 474,
"height": 157,
"platformSettings": {},
"subMetas": {
"云": {
"ver": "1.0.4",
"uuid": "bdf337e5-7615-4f2d-92b3-f8e3c47fb2d8",
"rawTextureUuid": "26979cc4-ebac-4f64-af12-cc2852501ca7",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 474,
"height": 157,
"rawWidth": 474,
"rawHeight": 157,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "dbf079ba-5b6f-4aa0-b213-70a22ba5ac9f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 193,
"height": 263,
"platformSettings": {},
"subMetas": {
"clockmini": {
"ver": "1.0.4",
"uuid": "39989176-9301-48ec-b538-29c6315f7863",
"rawTextureUuid": "dbf079ba-5b6f-4aa0-b213-70a22ba5ac9f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 193,
"height": 263,
"rawWidth": 193,
"rawHeight": 263,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "661689d5-6442-43eb-84ba-ff3ee8d01b3a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 139,
"height": 144,
"platformSettings": {},
"subMetas": {
"单独红灯 - 001": {
"ver": "1.0.4",
"uuid": "d6f378bf-949e-42a7-b1cb-c6a3c8753b30",
"rawTextureUuid": "661689d5-6442-43eb-84ba-ff3ee8d01b3a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 139,
"height": 144,
"rawWidth": 139,
"rawHeight": 144,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "52853bea-56e7-4816-af13-c66b81fc1ca7",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 146,
"height": 153,
"platformSettings": {},
"subMetas": {
"单独蓝灯 - 001": {
"ver": "1.0.4",
"uuid": "067750c4-d229-46b2-aea7-557039efe4a1",
"rawTextureUuid": "52853bea-56e7-4816-af13-c66b81fc1ca7",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 146,
"height": 153,
"rawWidth": 146,
"rawHeight": 153,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "a255aeb1-8f74-4215-b846-87f9a79fefaf",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2160,
"height": 1600,
"platformSettings": {},
"subMetas": {
"鸟和树背景": {
"ver": "1.0.4",
"uuid": "8e1802d9-ce29-4802-95f3-22fe0d66dcdb",
"rawTextureUuid": "a255aeb1-8f74-4215-b846-87f9a79fefaf",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 2160,
"height": 1600,
"rawWidth": 2160,
"rawHeight": 1600,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
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