Commit 98732f78 authored by unknown's avatar unknown

点阵封锁好了

parent 65450189
{
"ver": "1.0.21",
"importer": "image",
"imported": true,
"uuid": "883de798-5814-4177-8223-4703908d0a54",
"files": [
".png",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "883de798-5814-4177-8223-4703908d0a54@6c48a",
"displayName": "时间框",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "883de798-5814-4177-8223-4703908d0a54"
},
"ver": "1.0.21",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "883de798-5814-4177-8223-4703908d0a54@f9941",
"displayName": "时间框",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 376,
"height": 69,
"rawWidth": 376,
"rawHeight": 69,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "883de798-5814-4177-8223-4703908d0a54@6c48a",
"atlasUuid": ""
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"redirect": "883de798-5814-4177-8223-4703908d0a54@f9941"
}
}
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
}, },
{ {
"__id__": 7 "__id__": 7
},
{
"__id__": 67
} }
], ],
"_active": true, "_active": true,
...@@ -29,7 +32,7 @@ ...@@ -29,7 +32,7 @@
"_prefab": null, "_prefab": null,
"autoReleaseAssets": false, "autoReleaseAssets": false,
"_globals": { "_globals": {
"__id__": 44 "__id__": 70
}, },
"_id": "845f6d9b-e827-48a1-b683-47d3cebc3d1b" "_id": "845f6d9b-e827-48a1-b683-47d3cebc3d1b"
}, },
...@@ -207,21 +210,24 @@ ...@@ -207,21 +210,24 @@
}, },
{ {
"__id__": 16 "__id__": 16
},
{
"__id__": 37
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 37 "__id__": 60
}, },
{ {
"__id__": 39 "__id__": 62
}, },
{ {
"__id__": 41 "__id__": 64
}, },
{ {
"__id__": 43 "__id__": 66
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1088,70 +1094,197 @@ ...@@ -1088,70 +1094,197 @@
"_lockFlags": 0, "_lockFlags": 0,
"_id": "0cBFVwl5xKHarK752QwIil" "_id": "0cBFVwl5xKHarK752QwIil"
}, },
{
"__type__": "cc.Node",
"_name": "Layout",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [
{
"__id__": 38
},
{
"__id__": 44
}
],
"_active": true,
"_components": [
{
"__id__": 55
},
{
"__id__": 57
},
{
"__id__": 59
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 325,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "d46OuBYatHRL43BA5q+omF"
},
{
"__type__": "cc.Node",
"_name": "名称框",
"_objFlags": 0,
"_parent": {
"__id__": 37
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 39
},
{
"__id__": 41
},
{
"__id__": 43
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": -526,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "7aVyvv5QVJmKaRjnFSGapY"
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 7 "__id__": 38
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 38 "__id__": 40
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1334, "width": 262,
"height": 750 "height": 69
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 0.5,
"y": 0.5 "y": 0.5
}, },
"_id": "d6LpdG691D0qj7Vrgz/PGH" "_id": "dd4htx1+BKJ6KCYkMU05PC"
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "0dngp/9gNO34wUQjZfN/CX" "fileId": "f7NISe7HdAD68SLfhnddy8"
}, },
{ {
"__type__": "cc.Canvas", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 7 "__id__": 38
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 40 "__id__": 42
}, },
"_cameraComponent": { "_visFlags": 0,
"__id__": 9 "_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
}, },
"_alignCanvasWithScreen": true, "_spriteFrame": {
"_id": "4dVnIXCa5FAroVF0/ZXgje" "__uuid__": "aca18868-0230-4954-8205-32b580969811@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "a1RFlokKROvbBTRKP4omtX"
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "3f2oTdCepERZdpmIfLsrhd" "fileId": "e71ctEmpxFC4KlSYRZNz/a"
}, },
{ {
"__type__": "cc.Widget", "__type__": "cc.Widget",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 7 "__id__": 38
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": null,
"__id__": 42 "_alignFlags": 9,
},
"_alignFlags": 45,
"_target": null, "_target": null,
"_left": 0, "_left": 10,
"_right": 0, "_right": 0,
"_top": 0, "_top": 15.5,
"_bottom": 0, "_bottom": 0,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
...@@ -1165,56 +1298,578 @@ ...@@ -1165,56 +1298,578 @@
"_originalHeight": 0, "_originalHeight": 0,
"_alignMode": 2, "_alignMode": 2,
"_lockFlags": 0, "_lockFlags": 0,
"_id": "7aSiwgiUNBWLJ46TcZtK+1" "_id": "4fXi9accJPE7cs7TY4zAue"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e8a+bU/8dPDbbJguUzLdoF"
}, },
{ {
"__type__": "1b7b5dE3PpCc717Chwms56+", "__type__": "cc.Node",
"_name": "", "_name": "时间框",
"_objFlags": 0, "_objFlags": 0,
"node": { "_parent": {
"__id__": 7 "__id__": 37
},
"_enabled": true,
"__prefab": null,
"posArrNode": {
"__id__": 32
},
"lineArrNode": {
"__id__": 29
}, },
"bottomSprNode": { "_children": [
"__id__": 17 {
"__id__": 45
}
],
"_active": true,
"_components": [
{
"__id__": 50
},
{
"__id__": 52
},
{
"__id__": 54
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 464,
"y": 0,
"z": 0
}, },
"topSprNode": { "_lrot": {
"__id__": 23 "__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
}, },
"itemPre": { "_lscale": {
"__uuid__": "1d8013b3-f53c-43d1-9439-e87a94ba0f15", "__type__": "cc.Vec3",
"__expectedType__": "cc.Prefab" "x": 1,
"y": 1,
"z": 1
}, },
"linePre": { "_layer": 33554432,
"__uuid__": "438c1fbc-6966-463c-b930-24e54c408162", "_euler": {
"__expectedType__": "cc.Prefab" "__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}, },
"_id": "24ybd376tP05V7cqhtpbf7" "_id": "12nSUSIIpJaZYfV/9qmVAI"
}, },
{ {
"__type__": "cc.SceneGlobals", "__type__": "cc.Node",
"ambient": { "_name": "timeLab",
"__id__": 45 "_objFlags": 0,
"_parent": {
"__id__": 44
}, },
"shadows": { "_children": [],
"__id__": 46 "_active": true,
"_components": [
{
"__id__": 46
},
{
"__id__": 48
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 94.847,
"y": 0,
"z": 0
}, },
"_skybox": { "_lrot": {
"__id__": 47 "__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
}, },
"fog": { "_lscale": {
"__id__": 48 "__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "4d/zlzrNZISKcrXH4dcHjO"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 45
},
"_enabled": true,
"__prefab": {
"__id__": 47
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100.1,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "f4QjUCCSlKyp2mSGqZzS9V"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c68UOAlNhN171Umca6yVvF"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 45
},
"_enabled": true,
"__prefab": {
"__id__": 49
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "00:00",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 40,
"_fontSize": 40,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 0,
"_enableWrapText": true,
"_font": null,
"_isSystemFontUsed": true,
"_isItalic": false,
"_isBold": false,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_id": "6deQWm0OJNPITXsunfWJqu"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "2frm37uaJHQr0AEEaYyM82"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 44
},
"_enabled": true,
"__prefab": {
"__id__": 51
},
"_contentSize": {
"__type__": "cc.Size",
"width": 376,
"height": 69
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "71mQxT5RVPq7PU2AWb99z4"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f7NISe7HdAD68SLfhnddy8"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 44
},
"_enabled": true,
"__prefab": {
"__id__": 53
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "883de798-5814-4177-8223-4703908d0a54@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "0dJMM4pxtGjooHn5500+FQ"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e71ctEmpxFC4KlSYRZNz/a"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 44
},
"_enabled": true,
"__prefab": null,
"_alignFlags": 33,
"_target": null,
"_left": 0,
"_right": 15,
"_top": 15.5,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": "cbuZH6OrJGkanR0edNTjtf"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
},
"_enabled": true,
"__prefab": {
"__id__": 56
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1334,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "8eOR0IOUxJ9bWUazSUkGJv"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "71F9vsVsZH7ZFd+PpN0azA"
},
{
"__type__": "cc.Layout",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
},
"_enabled": false,
"__prefab": {
"__id__": 58
},
"_resizeMode": 1,
"_layoutType": 1,
"_cellSize": {
"__type__": "cc.Size",
"width": 40,
"height": 40
},
"_startAxis": 0,
"_paddingLeft": 0,
"_paddingRight": 0,
"_paddingTop": 0,
"_paddingBottom": 0,
"_spacingX": 0,
"_spacingY": 0,
"_verticalDirection": 1,
"_horizontalDirection": 0,
"_constraint": 0,
"_constraintNum": 2,
"_affectedByScale": false,
"_isAlign": false,
"_id": "d7b6hM/GtJxoXw5EOJESKE"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "eaGEkmlCpANK+GS6CImtZa"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
},
"_enabled": true,
"__prefab": null,
"_alignFlags": 41,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 1334,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": "dcJ0VqQqJAcrWllxwQ6k7S"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": {
"__id__": 61
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1334,
"height": 750
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "d6LpdG691D0qj7Vrgz/PGH"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "0dngp/9gNO34wUQjZfN/CX"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": {
"__id__": 63
},
"_cameraComponent": {
"__id__": 9
},
"_alignCanvasWithScreen": true,
"_id": "4dVnIXCa5FAroVF0/ZXgje"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "3f2oTdCepERZdpmIfLsrhd"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": {
"__id__": 65
},
"_alignFlags": 45,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": "7aSiwgiUNBWLJ46TcZtK+1"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e8a+bU/8dPDbbJguUzLdoF"
},
{
"__type__": "1b7b5dE3PpCc717Chwms56+",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": null,
"posArrNode": {
"__id__": 32
},
"lineArrNode": {
"__id__": 29
},
"bottomSprNode": {
"__id__": 17
},
"topSprNode": {
"__id__": 23
},
"itemPre": {
"__uuid__": "1d8013b3-f53c-43d1-9439-e87a94ba0f15",
"__expectedType__": "cc.Prefab"
},
"linePre": {
"__uuid__": "438c1fbc-6966-463c-b930-24e54c408162",
"__expectedType__": "cc.Prefab"
},
"countdownLab": {
"__id__": 48
},
"totalTime": 30,
"_id": "24ybd376tP05V7cqhtpbf7"
},
{
"__type__": "cc.Node",
"_name": "Audio",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 68
},
{
"__id__": 69
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "55xNihKWdFh7gHNleUfsDE"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 67
},
"_enabled": true,
"__prefab": null,
"_clip": null,
"_loop": false,
"_playOnAwake": true,
"_volume": 1,
"_id": "12UjDe1g5NrrxPdoMukCjY"
},
{
"__type__": "a46f84T2a1GlbP4xSghryjX",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 67
},
"_enabled": true,
"__prefab": null,
"audioSource": {
"__id__": 68
},
"_id": "29vfhfPvVIw7m83TMzy3Tp"
},
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 71
},
"shadows": {
"__id__": 72
},
"_skybox": {
"__id__": 73
},
"fog": {
"__id__": 74
} }
}, },
{ {
......
...@@ -3,7 +3,7 @@ import { _decorator, Component, Node } from 'cc'; ...@@ -3,7 +3,7 @@ import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
export interface LatticeBlockadeIfo { export interface LatticeBlockadeIfo {
s_xy: [number, number], s_xy: [number, number], //开始点坐标 (0,0)作为左上角第一个点(列,行)
row: number, row: number,
column: number, column: number,
numArr: number[][] numArr: number[][]
...@@ -16,4 +16,13 @@ export const LB_LV_1: LatticeBlockadeIfo = { ...@@ -16,4 +16,13 @@ export const LB_LV_1: LatticeBlockadeIfo = {
numArr: [[3, -1, 2] numArr: [[3, -1, 2]
, [-1, -1, 1] , [-1, -1, 1]
, [0, -1, -1]] , [0, -1, -1]]
}
export const LB_LV_2: LatticeBlockadeIfo = {
s_xy: [0, 2],
row: 4,
column: 4,
numArr: [[-1, 3, -1]
, [1, -1, 2]
, [-1, -1, -1]]
} }
\ No newline at end of file
import { _decorator, Component, Node, Vec3, v3, UITransform, Prefab, instantiate, Label, Color, Layers, find, Sprite, SpriteFrame, v2, director, Vec2, EventTouch, Canvas } from 'cc'; import { _decorator, Component, Node, Vec3, v3, UITransform, Prefab, instantiate, Label, Color, Layers, find, Sprite, SpriteFrame, v2, director, Vec2, EventTouch, Canvas, CCFloat } from 'cc';
import { LatticeBlockadeIfo, LB_LV_1 } from './LatticeBlockadeCfg'; import { countdownMus, failMus, succMus } from '../../../../startFolder/script/common/AudioDef';
import { AudioMgr } from '../../../../startFolder/script/common/AudioMgr';
import { Utils } from '../../../../startFolder/script/common/Utils';
import { VIEW_DEF } from '../../../../startFolder/script/common/ViewDef';
import { viewMgr, VIEW_INDEX } from '../../../../startFolder/script/common/ViewMgr';
import { BeginCountdownView } from '../../commonView/script/BeginCountdownView';
import { ChallengeFailView } from '../../commonView/script/ChallengeFailView';
import { ChallengeSuccView } from '../../commonView/script/ChallengeSuccView';
import { LatticeBlockadeIfo, LB_LV_1, LB_LV_2 } from './LatticeBlockadeCfg';
import { LatticeBlockadeItem } from './LatticeBlockadeItem'; import { LatticeBlockadeItem } from './LatticeBlockadeItem';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
...@@ -62,6 +70,12 @@ export class LatticeBlockadeCtr extends Component { ...@@ -62,6 +70,12 @@ export class LatticeBlockadeCtr extends Component {
@property(Prefab) @property(Prefab)
linePre: Prefab = null!; linePre: Prefab = null!;
@property(Label)
countdownLab: Label = null!;
@property(CCFloat)
totalTime: number = 0;
private itemWidth = 100; private itemWidth = 100;
private itemHeight = 100; private itemHeight = 100;
private itemSpaceX = 0; private itemSpaceX = 0;
...@@ -78,16 +92,63 @@ export class LatticeBlockadeCtr extends Component { ...@@ -78,16 +92,63 @@ export class LatticeBlockadeCtr extends Component {
private gameState = GAME_STATE.READY; private gameState = GAME_STATE.READY;
private costTime = 0;
private isPlayCountdownMus = false;
private isShowGameDescViewOnce = false;
showGameDescView() {
this.isShowGameDescViewOnce = true;
viewMgr.openView(VIEW_DEF.NumMatDescView);
}
onCloseGameDescView() {
this.gameState = GAME_STATE.IDLE;
}
setGameData(resData: object) {
//@ts-ignore
if (resData.totalTime) {
//@ts-ignore
this.totalTime = resData.totalTime;
}
//@ts-ignore
if (resData.level) {
//@ts-ignore
this.level = resData.level;
}
//@ts-ignore
if (resData.isShowGuide) {
//@ts-ignore
this.isShowGameDescViewOnce = false;
}
else {
this.isShowGameDescViewOnce = true;
}
}
start() { start() {
// [3] // [3]
this.posArrNode.on(Node.EventType.TOUCH_START, this.onTouchStart, this); this.posArrNode.on(Node.EventType.TOUCH_START, this.onTouchStart, this);
this.posArrNode.on(Node.EventType.TOUCH_MOVE, this.onTouchMove, this); this.posArrNode.on(Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
this.posArrNode.on(Node.EventType.TOUCH_END, this.onTouchEnd, this); this.posArrNode.on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
director.on("begin_countdown_end", () => {
//引导
if (!this.isShowGameDescViewOnce) {
this.gameState = GAME_STATE.PAUSE;
this.showGameDescView();
}
else {
this.gameState = GAME_STATE.IDLE;
}
}, this);
director.on("game_desc_close", this.onCloseGameDescView, this);
this.gameStart(); this.gameStart();
} }
onDestroy() { onDestroy() {
director.off("begin_countdown_end");
director.off("game_desc_close", this.onCloseGameDescView, this);
} }
onTouchStart(event: EventTouch) { onTouchStart(event: EventTouch) {
...@@ -116,6 +177,9 @@ export class LatticeBlockadeCtr extends Component { ...@@ -116,6 +177,9 @@ export class LatticeBlockadeCtr extends Component {
if (this.pathItemPosArr[i].id == this.pathItemPosArr[0].id) continue; if (this.pathItemPosArr[i].id == this.pathItemPosArr[0].id) continue;
this.pathItemPosArr[i].target.getComponent(LatticeBlockadeItem)?.setItemColor(new Color(255, 255, 255, 255)); this.pathItemPosArr[i].target.getComponent(LatticeBlockadeItem)?.setItemColor(new Color(255, 255, 255, 255));
} }
for (let i = 0; i < this.lineArr.length; ++i) {
if (this.lineArr[i].type == LINE_TYPE.FULL) this.lineArr[i].targSpr.color = new Color(255, 255, 255, 255);
}
let idx = -1; let idx = -1;
for (let i = 0; i < this.pathItemPosArr.length; ++i) { for (let i = 0; i < this.pathItemPosArr.length; ++i) {
if (this.pathItemPosArr[i].id == touchItem.getPosIfo().id) { if (this.pathItemPosArr[i].id == touchItem.getPosIfo().id) {
...@@ -151,6 +215,14 @@ export class LatticeBlockadeCtr extends Component { ...@@ -151,6 +215,14 @@ export class LatticeBlockadeCtr extends Component {
console.log(`加一个实线段`); console.log(`加一个实线段`);
if (idx == 0) { if (idx == 0) {
//判断是否成功 //判断是否成功
if (this.checkWin()) {
console.log(`游戏成功`);
this.gameEnd(true);
}
else {
console.log(`游戏没有成功`);
// this.markMoreLine();
}
} }
} }
else if (idx != 0 || (this.pathItemPosArr.length > 1 && this.pathItemPosArr.length <= 3)) { else if (idx != 0 || (this.pathItemPosArr.length > 1 && this.pathItemPosArr.length <= 3)) {
...@@ -190,6 +262,7 @@ export class LatticeBlockadeCtr extends Component { ...@@ -190,6 +262,7 @@ export class LatticeBlockadeCtr extends Component {
this.lineArr.push(line); this.lineArr.push(line);
this.endMarkItemPos = touchPosIfo; this.endMarkItemPos = touchPosIfo;
} }
this.markMoreLine();
} }
onTouchEnd(event: TouchEvent) { onTouchEnd(event: TouchEvent) {
...@@ -208,7 +281,26 @@ export class LatticeBlockadeCtr extends Component { ...@@ -208,7 +281,26 @@ export class LatticeBlockadeCtr extends Component {
return null; return null;
} }
//倒计时
countdownTime(dt: number) {
if (this.gameState == GAME_STATE.READY || this.gameState == GAME_STATE.END || this.gameState == GAME_STATE.PAUSE) {
return;
}
this.costTime += dt;
if (!this.isPlayCountdownMus && this.totalTime - this.costTime < 3.5) {
this.isPlayCountdownMus = true;
AudioMgr.playOneShot(countdownMus);
}
if (this.totalTime - this.costTime <= 0) {
console.log(`游戏时间到`);
this.gameEnd(false);
return;
}
this.countdownLab.string = Utils.formatTime(Math.floor((this.totalTime - this.costTime) * 1000));
}
gameStart() { gameStart() {
this.countdownLab.string = Utils.formatTime(Math.floor(this.totalTime * 1000));
this.levelData = this.getLevelCfg(this.level); this.levelData = this.getLevelCfg(this.level);
this.row = this.levelData.row; this.row = this.levelData.row;
this.column = this.levelData.column; this.column = this.levelData.column;
...@@ -228,9 +320,25 @@ export class LatticeBlockadeCtr extends Component { ...@@ -228,9 +320,25 @@ export class LatticeBlockadeCtr extends Component {
} }
} }
this.endMarkItemPos = null!; this.endMarkItemPos = null!;
this.gameState = GAME_STATE.IDLE; viewMgr.openView(VIEW_DEF.BeginCountdownView, (node) => {
//测试 node.getComponent(BeginCountdownView)?.init();
// this.creLine(this.getItem(0, 0)!, this.getItem(0, 1)!); }, VIEW_INDEX.UPPER);
// this.gameState = GAME_STATE.IDLE;
}
gameEnd(isWin: boolean) {
this.gameState = GAME_STATE.END;
if (isWin) {
viewMgr.openView(VIEW_DEF.ChallengeSuccView, (node) => {
AudioMgr.playOneShot(succMus);
node?.getComponent(ChallengeSuccView)?.init();
}, VIEW_INDEX.TOP);
}
else {
viewMgr.openView(VIEW_DEF.ChallengeFailView, (node) => {
AudioMgr.playOneShot(failMus);
}, VIEW_INDEX.TOP);
}
} }
creAllItem() { creAllItem() {
...@@ -335,6 +443,8 @@ export class LatticeBlockadeCtr extends Component { ...@@ -335,6 +443,8 @@ export class LatticeBlockadeCtr extends Component {
switch (level) { switch (level) {
case 1: case 1:
return LB_LV_1; return LB_LV_1;
case 2:
return LB_LV_2;
default: default:
return LB_LV_1; return LB_LV_1;
} }
...@@ -354,6 +464,22 @@ export class LatticeBlockadeCtr extends Component { ...@@ -354,6 +464,22 @@ export class LatticeBlockadeCtr extends Component {
return null; return null;
} }
checkWin() {
for (let i = 0; i < this.gridIfoArr.length; ++i) {
if (!this.checkGridLine(this.gridIfoArr[i])) return false;
}
return true;
}
markMoreLine() {
for (let i = 0; i < this.gridIfoArr.length; ++i) {
let lineArr = this.getGridMoreLine(this.gridIfoArr[i]);
for (let j = 0; j < lineArr.length; ++j) {
lineArr[j].targSpr.color = new Color(255, 0, 0, 255);
}
}
}
//判断一个格子周围线段是否存在正确数量 //判断一个格子周围线段是否存在正确数量
checkGridLine(grid: GridIfo) { checkGridLine(grid: GridIfo) {
if (grid.count == -1) return true; if (grid.count == -1) return true;
...@@ -367,19 +493,19 @@ export class LatticeBlockadeCtr extends Component { ...@@ -367,19 +493,19 @@ export class LatticeBlockadeCtr extends Component {
//如果一个格子周围的线段多余应有的数量 //如果一个格子周围的线段多余应有的数量
getGridMoreLine(grid: GridIfo) { getGridMoreLine(grid: GridIfo) {
let lineArr: LineIfo[] = []; if (grid.count == -1) return [];
if (grid.count == -1) return lineArr;
let existLineArr: LineIfo[] = []; let existLineArr: LineIfo[] = [];
let count = 0; let count = 0;
if (this.findLine(grid.itemArr[0], grid.itemArr[1], LINE_TYPE.FULL)) { count += 1; existLineArr.push(this.findLine(grid.itemArr[0], grid.itemArr[1], LINE_TYPE.FULL)!) } if (this.findLine(grid.itemArr[0], grid.itemArr[1], LINE_TYPE.FULL)) { count += 1; existLineArr.push(this.findLine(grid.itemArr[0], grid.itemArr[1], LINE_TYPE.FULL)!) }
if (this.findLine(grid.itemArr[0], grid.itemArr[2], LINE_TYPE.FULL)) { count += 1; existLineArr.push(this.findLine(grid.itemArr[0], grid.itemArr[2], LINE_TYPE.FULL)!) } if (this.findLine(grid.itemArr[0], grid.itemArr[2], LINE_TYPE.FULL)) { count += 1; existLineArr.push(this.findLine(grid.itemArr[0], grid.itemArr[2], LINE_TYPE.FULL)!) }
if (this.findLine(grid.itemArr[1], grid.itemArr[3], LINE_TYPE.FULL)) { count += 1; existLineArr.push(this.findLine(grid.itemArr[1], grid.itemArr[3], LINE_TYPE.FULL)!) } if (this.findLine(grid.itemArr[1], grid.itemArr[3], LINE_TYPE.FULL)) { count += 1; existLineArr.push(this.findLine(grid.itemArr[1], grid.itemArr[3], LINE_TYPE.FULL)!) }
if (this.findLine(grid.itemArr[2], grid.itemArr[3], LINE_TYPE.FULL)) { count += 1; existLineArr.push(this.findLine(grid.itemArr[2], grid.itemArr[3], LINE_TYPE.FULL)!) } if (this.findLine(grid.itemArr[2], grid.itemArr[3], LINE_TYPE.FULL)) { count += 1; existLineArr.push(this.findLine(grid.itemArr[2], grid.itemArr[3], LINE_TYPE.FULL)!) }
// for (let i = 0; i < count - grid.count; ++i) { let lineArr: LineIfo[] = [];
// lineArr.push(existLineArr[i]); if (count > grid.count) {
// } for (let i = 0; i < count - grid.count; ++i) {
// return lineArr; lineArr.push(existLineArr[i]);
if (count > grid.count) return existLineArr; }
}
return lineArr; return lineArr;
} }
...@@ -409,7 +535,8 @@ export class LatticeBlockadeCtr extends Component { ...@@ -409,7 +535,8 @@ export class LatticeBlockadeCtr extends Component {
targSpr: spr, targSpr: spr,
} }
} }
// update (deltaTime: number) {
// // [4] update(deltaTime: number) {
// } this.countdownTime(deltaTime);
}
} }
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
}, },
{ {
"__id__": 7 "__id__": 7
},
{
"__id__": 161
} }
], ],
"_active": true, "_active": true,
...@@ -29,7 +32,7 @@ ...@@ -29,7 +32,7 @@
"_prefab": null, "_prefab": null,
"autoReleaseAssets": false, "autoReleaseAssets": false,
"_globals": { "_globals": {
"__id__": 161 "__id__": 164
}, },
"_id": "94d615be-2f2a-47b1-a1a0-aa1f51c47468" "_id": "94d615be-2f2a-47b1-a1a0-aa1f51c47468"
}, },
...@@ -4190,19 +4193,94 @@ ...@@ -4190,19 +4193,94 @@
"totalTime": 30, "totalTime": 30,
"_id": "1326Z2zCRNbah6X48gBQko" "_id": "1326Z2zCRNbah6X48gBQko"
}, },
{
"__type__": "cc.Node",
"_name": "Audio",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 162
},
{
"__id__": 163
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "7e/m1JMVZAdJ3PYWTfgC+v"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 161
},
"_enabled": true,
"__prefab": null,
"_clip": null,
"_loop": false,
"_playOnAwake": true,
"_volume": 1,
"_id": "8cQES2q05LF7hleHp0X39u"
},
{
"__type__": "a46f84T2a1GlbP4xSghryjX",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 161
},
"_enabled": true,
"__prefab": null,
"audioSource": {
"__id__": 162
},
"_id": "25ERdIbWlEbarNxci6Xf2i"
},
{ {
"__type__": "cc.SceneGlobals", "__type__": "cc.SceneGlobals",
"ambient": { "ambient": {
"__id__": 162 "__id__": 165
}, },
"shadows": { "shadows": {
"__id__": 163 "__id__": 166
}, },
"_skybox": { "_skybox": {
"__id__": 164 "__id__": 167
}, },
"fog": { "fog": {
"__id__": 165 "__id__": 168
} }
}, },
{ {
......
...@@ -998,7 +998,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -998,7 +998,7 @@ export const levelCfg: OneVarLevelItf[] = [
comName: "NumMatReasonCtr", comName: "NumMatReasonCtr",
level: 1, level: 1,
resData: { resData: {
totalTime: 60, totalTime: 30,
level: 1, level: 1,
isShowGuide: true isShowGuide: true
} }
...@@ -1009,7 +1009,35 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -1009,7 +1009,35 @@ export const levelCfg: OneVarLevelItf[] = [
comName: "NumMatReasonCtr", comName: "NumMatReasonCtr",
level: 2, level: 2,
resData: { resData: {
totalTime: 120, totalTime: 60,
level: 2
}
}
]
}
, {
gameIdHead: 150,
title: "点阵封锁",
desc: "点阵封锁,第一个版本",
levelArr: [{
gameId: 15001,
sceneUnitIfo: SCENE_DEF.LatticeBlockade_1,
comName: "LatticeBlockadeCtr",
level: 1,
resData: {
totalTime: 20,
level: 1,
isShowGuide: true
}
}
, {
gameId: 15002,
sceneUnitIfo: SCENE_DEF.LatticeBlockade_1,
comName: "LatticeBlockadeCtr",
level: 2,
resData: {
totalTime: 30,
level: 2 level: 2
} }
} }
......
...@@ -26,8 +26,8 @@ export class LevelHomeCtr extends Component { ...@@ -26,8 +26,8 @@ export class LevelHomeCtr extends Component {
// [3] // [3]
if (!levelMgr.loadedOutData) { if (!levelMgr.loadedOutData) {
levelMgr.loadedOutData = true; levelMgr.loadedOutData = true;
levelMgr.gameIdHead = 140; levelMgr.gameIdHead = 150;
levelMgr.unLockCount = 1; levelMgr.unLockCount = 2;
if (Utils.getValueFromHref("gameIdHead")) { if (Utils.getValueFromHref("gameIdHead")) {
levelMgr.gameIdHead = Number(Utils.getValueFromHref("gameIdHead")); levelMgr.gameIdHead = Number(Utils.getValueFromHref("gameIdHead"));
} }
......
...@@ -97,6 +97,8 @@ interface ScenePathItf { ...@@ -97,6 +97,8 @@ interface ScenePathItf {
Sudoku_1: ScenePathUnitItf, Sudoku_1: ScenePathUnitItf,
//数字矩阵 //数字矩阵
NumMatReason_1: ScenePathUnitItf, NumMatReason_1: ScenePathUnitItf,
//点阵封锁
LatticeBlockade_1: ScenePathUnitItf,
} }
export const SCENE_DEF: ScenePathItf = { export const SCENE_DEF: ScenePathItf = {
TestScene: { TestScene: {
...@@ -424,6 +426,11 @@ export const SCENE_DEF: ScenePathItf = { ...@@ -424,6 +426,11 @@ export const SCENE_DEF: ScenePathItf = {
sceneName: "NumMatReason_1", sceneName: "NumMatReason_1",
desc: "数阵推理,第一个版本" desc: "数阵推理,第一个版本"
}, },
LatticeBlockade_1: {
bundleName: "sceneBundle",
sceneName: "LatticeBlockade_1",
desc: "点阵封锁,第一个版本"
},
} }
/** /**
* [1] Class member could be defined like this. * [1] Class member could be defined like this.
......
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