Commit 2b156c67 authored by unknown's avatar unknown

数独基本完成

parent d593838e
{
"ver": "1.0.21",
"importer": "image",
"imported": true,
"uuid": "42cbbdac-76da-4e12-831e-13910dc3835d",
"files": [
".png",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "42cbbdac-76da-4e12-831e-13910dc3835d@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": "42cbbdac-76da-4e12-831e-13910dc3835d"
},
"ver": "1.0.21",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "42cbbdac-76da-4e12-831e-13910dc3835d@f9941",
"displayName": "得分框",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 196,
"height": 63,
"rawWidth": 196,
"rawHeight": 63,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "42cbbdac-76da-4e12-831e-13910dc3835d@6c48a",
"atlasUuid": ""
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"redirect": "42cbbdac-76da-4e12-831e-13910dc3835d@f9941"
}
}
{
"ver": "1.0.21",
"importer": "image",
"imported": true,
"uuid": "36092018-5dae-44cd-8603-c86a799139b1",
"files": [
".png",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "36092018-5dae-44cd-8603-c86a799139b1@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": "36092018-5dae-44cd-8603-c86a799139b1"
},
"ver": "1.0.21",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "36092018-5dae-44cd-8603-c86a799139b1@f9941",
"displayName": "目标分数框",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 196,
"height": 63,
"rawWidth": 196,
"rawHeight": 63,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "36092018-5dae-44cd-8603-c86a799139b1@6c48a",
"atlasUuid": ""
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"redirect": "36092018-5dae-44cd-8603-c86a799139b1@f9941"
}
}
...@@ -22,16 +22,19 @@ ...@@ -22,16 +22,19 @@
}, },
{ {
"__id__": 7 "__id__": 7
},
{
"__id__": 123
} }
], ],
"_active": true, "_active": true,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 100 "__id__": 126
}, },
"autoReleaseAssets": false, "autoReleaseAssets": false,
"_globals": { "_globals": {
"__id__": 101 "__id__": 127
}, },
"_id": "2fa5cb6f-32a4-47a2-afd9-b6c3532d1301" "_id": "2fa5cb6f-32a4-47a2-afd9-b6c3532d1301"
}, },
...@@ -209,21 +212,24 @@ ...@@ -209,21 +212,24 @@
}, },
{ {
"__id__": 16 "__id__": 16
},
{
"__id__": 93
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 93 "__id__": 116
}, },
{ {
"__id__": 95 "__id__": 118
}, },
{ {
"__id__": 97 "__id__": 120
}, },
{ {
"__id__": 99 "__id__": 122
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2523,68 +2529,195 @@ ...@@ -2523,68 +2529,195 @@
"_lockFlags": 0, "_lockFlags": 0,
"_id": "aaqbYV5R9Ky4KErMdlTzP7" "_id": "aaqbYV5R9Ky4KErMdlTzP7"
}, },
{
"__type__": "cc.Node",
"_name": "Layout",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [
{
"__id__": 94
},
{
"__id__": 100
}
],
"_active": true,
"_components": [
{
"__id__": 111
},
{
"__id__": 113
},
{
"__id__": 115
}
],
"_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": "08BQ/gE2FF8LzDaYtXH2KF"
},
{
"__type__": "cc.Node",
"_name": "名称框",
"_objFlags": 0,
"_parent": {
"__id__": 93
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 95
},
{
"__id__": 97
},
{
"__id__": 99
}
],
"_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": "90BeXq6AlMQI1xmKUmqvQp"
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 7 "__id__": 94
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 94 "__id__": 96
}, },
"_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": "78+Yq7KwRDaqZlx4giWXZn" "_id": "4aWiBNTrJMsa8ZotlZgOcP"
}, },
{ {
"__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__": 94
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 96 "__id__": 98
}, },
"_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": "0fpQQ9cj5KW6/uH5VHKM8w" "__uuid__": "529951ff-e67f-4887-8240-54121bfa5daf@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": "bafStLnhNF9Yy6OHYWyDR5"
}, },
{ {
"__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__": 94
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": null,
"__id__": 98 "_alignFlags": 8,
},
"_alignFlags": 45,
"_target": null, "_target": null,
"_left": 0, "_left": 10,
"_right": 0, "_right": 0,
"_top": 0, "_top": 0,
"_bottom": 0, "_bottom": 0,
...@@ -2600,44 +2733,569 @@ ...@@ -2600,44 +2733,569 @@
"_originalHeight": 0, "_originalHeight": 0,
"_alignMode": 2, "_alignMode": 2,
"_lockFlags": 0, "_lockFlags": 0,
"_id": "48M+e9q9NBp6LFOB0Em6B/" "_id": "92dfYw70NCyKM/30S42sUP"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e8a+bU/8dPDbbJguUzLdoF"
}, },
{ {
"__type__": "028ac43h3tHd4EX1Yzc4tdg", "__type__": "cc.Node",
"_name": "", "_name": "时间框",
"_objFlags": 0, "_objFlags": 0,
"node": { "_parent": {
"__id__": 7 "__id__": 93
}, },
"_enabled": true, "_children": [
"__prefab": null, {
"numOptsNode": { "__id__": 101
"__id__": 22 }
],
"_active": true,
"_components": [
{
"__id__": 106
},
{
"__id__": 108
},
{
"__id__": 110
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 464,
"y": 0,
"z": 0
}, },
"_id": "dbxV4XT8pIYbgLw0VIxwni" "_lrot": {
}, "__type__": "cc.Quat",
{ "x": 0,
"__type__": "cc.PrefabInfo", "y": 0,
"fileId": "", "z": 0,
"targetOverrides": [] "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": "10FwWwEpxCaa6ZHwrIRAjF"
}, },
{ {
"__type__": "cc.SceneGlobals", "__type__": "cc.Node",
"ambient": { "_name": "timeLab",
"__id__": 102 "_objFlags": 0,
"_parent": {
"__id__": 100
}, },
"shadows": { "_children": [],
"__id__": 103 "_active": true,
"_components": [
{
"__id__": 102
},
{
"__id__": 104
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 94.847,
"y": 0,
"z": 0
}, },
"_skybox": { "_lrot": {
"__id__": 104 "__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
}, },
"fog": { "_lscale": {
"__id__": 105 "__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "2bLjNFexNOT6oWv6XoIX0P"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 101
},
"_enabled": true,
"__prefab": {
"__id__": 103
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100.1,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "8eMiKO3klDYqnr8553Ob39"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c68UOAlNhN171Umca6yVvF"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 101
},
"_enabled": true,
"__prefab": {
"__id__": 105
},
"_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": "32UNSCGtRLmZKi/d2ID3mX"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "2frm37uaJHQr0AEEaYyM82"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 100
},
"_enabled": true,
"__prefab": {
"__id__": 107
},
"_contentSize": {
"__type__": "cc.Size",
"width": 376,
"height": 69
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "6cZcgeR0hMWr8ml4wzeWfI"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f7NISe7HdAD68SLfhnddy8"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 100
},
"_enabled": true,
"__prefab": {
"__id__": 109
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "f8dcf46a-f6cb-4b3c-8253-4a9945e9391f@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": "bbkZKp/zRCi6CH2mV67vIv"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e71ctEmpxFC4KlSYRZNz/a"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 100
},
"_enabled": true,
"__prefab": null,
"_alignFlags": 32,
"_target": null,
"_left": 0,
"_right": 15,
"_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": "0cUHkqW/REf7EsWhlg9LTB"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 93
},
"_enabled": true,
"__prefab": {
"__id__": 112
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1334,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "8f4J5QLv1DxYEnHNe8ogHi"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "71F9vsVsZH7ZFd+PpN0azA"
},
{
"__type__": "cc.Layout",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 93
},
"_enabled": false,
"__prefab": {
"__id__": 114
},
"_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": "43QvT/OUhA7I3sxdVJj92b"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "eaGEkmlCpANK+GS6CImtZa"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 93
},
"_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": "baJUrvaARPRp+9Xxaeexnd"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": {
"__id__": 117
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1334,
"height": 750
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "78+Yq7KwRDaqZlx4giWXZn"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "0dngp/9gNO34wUQjZfN/CX"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": {
"__id__": 119
},
"_cameraComponent": {
"__id__": 9
},
"_alignCanvasWithScreen": true,
"_id": "0fpQQ9cj5KW6/uH5VHKM8w"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "3f2oTdCepERZdpmIfLsrhd"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": {
"__id__": 121
},
"_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": "48M+e9q9NBp6LFOB0Em6B/"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e8a+bU/8dPDbbJguUzLdoF"
},
{
"__type__": "028ac43h3tHd4EX1Yzc4tdg",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": null,
"numOptsNode": {
"__id__": 22
},
"countdownLab": {
"__id__": 104
},
"remainLab": {
"__id__": 20
},
"totalTime": 10,
"_id": "dbxV4XT8pIYbgLw0VIxwni"
},
{
"__type__": "cc.Node",
"_name": "Audio",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 124
},
{
"__id__": 125
}
],
"_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": "e3gnGlCC1Mo5cA3KyNU7Us"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 123
},
"_enabled": true,
"__prefab": null,
"_clip": null,
"_loop": false,
"_playOnAwake": true,
"_volume": 1,
"_id": "4bj8HMHhJJ/58EllvOClLl"
},
{
"__type__": "a46f84T2a1GlbP4xSghryjX",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 123
},
"_enabled": true,
"__prefab": null,
"audioSource": {
"__id__": 124
},
"_id": "43XyqKQo1PPp8jStX535Q5"
},
{
"__type__": "cc.PrefabInfo",
"fileId": "",
"targetOverrides": []
},
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 128
},
"shadows": {
"__id__": 129
},
"_skybox": {
"__id__": 130
},
"fog": {
"__id__": 131
} }
}, },
{ {
......
import { _decorator, Component, Node, instantiate, Button, Toggle, Label, director } from 'cc'; import { _decorator, Component, Node, instantiate, Button, Toggle, Label, director, CCFloat } from 'cc';
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 { VIEW_DEF } from '../../../../startFolder/script/common/ViewDef';
import { viewMgr } from '../../../../startFolder/script/common/ViewMgr'; 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 { SK_LV_1, SK_LV_2, SK_LV_3, SK_LV_4 } from './SudokuCfg'; import { SK_LV_1, SK_LV_2, SK_LV_3, SK_LV_4 } from './SudokuCfg';
import { SudokuItemCtr } from './SudokuItemCtr'; import { SudokuItemCtr } from './SudokuItemCtr';
import { SudokuLevelViewCtr } from './SudokuLevelCtr'; import { SudokuLevelViewCtr } from './SudokuLevelCtr';
...@@ -20,23 +26,56 @@ export class SudokuCtr extends Component { ...@@ -20,23 +26,56 @@ export class SudokuCtr extends Component {
@property(Node) @property(Node)
numOptsNode: Node = null!; numOptsNode: Node = null!;
@property(Label)
countdownLab: Label = null!;
@property(Label)
remainLab: Label = null!;
@property(CCFloat)
totalTime: number = 0;
private gameState = GAME_STATE.READY; private gameState = GAME_STATE.READY;
private fillNum = 1; private fillNum = 1;
private sqr = 5;; private sqr = 5;
private level = 1;
private costTime = 0;
private isPlayCountdownMus = false;
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;
}
}
start() { start() {
// [3] // [3]
director.on("sk_item_click", this.onItemClick, this); director.on("sk_item_click", this.onItemClick, this);
director.on("begin_countdown_end", () => {
//引导
this.gameState = GAME_STATE.FILL;
}, this);
this.gameStart(); this.gameStart();
} }
onDestroy() { onDestroy() {
director.off("sk_item_click", this.onItemClick, this); director.off("sk_item_click", this.onItemClick, this);
director.off("begin_countdown_end");
} }
onItemClick(item: SudokuItemCtr) { onItemClick(item: SudokuItemCtr) {
if (this.gameState == GAME_STATE.FILL) { if (this.gameState == GAME_STATE.FILL) {
item.setNumStr(this.fillNum.toString()); item.setNumStr(this.fillNum.toString());
this.remainLab.string = "剩余" + viewMgr.getView(VIEW_DEF.SudokuLevelView).getComponent(SudokuLevelViewCtr)?.getWrongItemCount() + "个";
if (this.checkWin()) { if (this.checkWin()) {
console.log(`游戏成功`); console.log(`游戏成功`);
this.gameEnd(true); this.gameEnd(true);
...@@ -53,15 +92,18 @@ export class SudokuCtr extends Component { ...@@ -53,15 +92,18 @@ export class SudokuCtr extends Component {
gameStart() { gameStart() {
this.gameState = GAME_STATE.READY; this.gameState = GAME_STATE.READY;
this.countdownLab.string = Utils.formatTime(Math.floor(this.totalTime * 1000));
this.fillNum = 1; this.fillNum = 1;
let level = 4; let cfg = this.getLevelCfg(this.level)[Math.floor(Math.random() * this.getLevelCfg(this.level).length)];
let cfg = this.getLevelCfg(level)[Math.floor(Math.random() * this.getLevelCfg(level).length)];
this.sqr = cfg.sqr; this.sqr = cfg.sqr;
viewMgr.openView(VIEW_DEF.SudokuLevelView, (node) => { viewMgr.openView(VIEW_DEF.SudokuLevelView, (node) => {
node.getComponent(SudokuLevelViewCtr)?.setItemIfos(cfg); node.getComponent(SudokuLevelViewCtr)?.setItemIfos(cfg);
this.remainLab.string = "剩余" + node.getComponent(SudokuLevelViewCtr)?.getWrongItemCount() + "个";
}); });
this.setNumTogs(); this.setNumTogs();
this.gameState = GAME_STATE.FILL; viewMgr.openView(VIEW_DEF.BeginCountdownView, (node) => {
node.getComponent(BeginCountdownView)?.init();
}, VIEW_INDEX.UPPER);
} }
setNumTogs() { setNumTogs() {
...@@ -73,14 +115,46 @@ export class SudokuCtr extends Component { ...@@ -73,14 +115,46 @@ export class SudokuCtr extends Component {
this.numOptsNode.children[i].getComponent(Toggle)!.clickEvents[0].customEventData = (i + 1) + ""; this.numOptsNode.children[i].getComponent(Toggle)!.clickEvents[0].customEventData = (i + 1) + "";
this.numOptsNode.children[i].getComponentInChildren(Label)!.string = (i + 1) + ""; this.numOptsNode.children[i].getComponentInChildren(Label)!.string = (i + 1) + "";
} }
this.numOptsNode.children[0].getComponent(Toggle)!.isChecked = true;
} }
gameEnd(isWin: boolean) { gameEnd(isWin: boolean) {
this.gameState = GAME_STATE.END; 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);
node?.getComponent(ChallengeFailView);
}, VIEW_INDEX.TOP);
}
} }
update(deltaTime: number) { update(deltaTime: number) {
// [4] // [4]
this.countdownTime(deltaTime);
}
//倒计时
countdownTime(dt: number) {
if (this.gameState == GAME_STATE.READY || this.gameState == GAME_STATE.END) {
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));
} }
onFillNumClick(err: any, numStr: string) { onFillNumClick(err: any, numStr: string) {
......
...@@ -89,6 +89,14 @@ export class SudokuLevelViewCtr extends Component { ...@@ -89,6 +89,14 @@ export class SudokuLevelViewCtr extends Component {
this.bgSprNode.getComponent(UITransform)!.height = minHeight + 20; this.bgSprNode.getComponent(UITransform)!.height = minHeight + 20;
} }
getWrongItemCount(){
let count = 0;
for(let i = 0; i < this.itemPosIfoArr.length; ++ i){
if(!this.itemPosIfoArr[i].target.getComponent(SudokuItemCtr)?.isRight()) count += 1;
}
return count;
}
getSqPosIfoArr(row: number, column: number, s_width: number, s_height: number, spacingX: number, spacingY: number): ItemPosIfo[] { getSqPosIfoArr(row: number, column: number, s_width: number, s_height: number, spacingX: number, spacingY: number): ItemPosIfo[] {
let x_arr: number[] = []; let x_arr: number[] = [];
for (let c = 1; c <= column; ++c) { for (let c = 1; c <= column; ++c) {
......
...@@ -456,7 +456,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -456,7 +456,7 @@ export const levelCfg: OneVarLevelItf[] = [
oneScore: 1 oneScore: 1
} }
} }
, { , {
gameId: 3003, gameId: 3003,
sceneUnitIfo: SCENE_DEF.Classify_3, sceneUnitIfo: SCENE_DEF.Classify_3,
comName: "ClassifyCtr", comName: "ClassifyCtr",
...@@ -467,7 +467,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -467,7 +467,7 @@ export const levelCfg: OneVarLevelItf[] = [
oneScore: 1 oneScore: 1
} }
} }
, { , {
gameId: 3004, gameId: 3004,
sceneUnitIfo: SCENE_DEF.Classify_4, sceneUnitIfo: SCENE_DEF.Classify_4,
comName: "ClassifyCtr", comName: "ClassifyCtr",
...@@ -478,7 +478,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -478,7 +478,7 @@ export const levelCfg: OneVarLevelItf[] = [
oneScore: 1 oneScore: 1
} }
} }
, { , {
gameId: 3005, gameId: 3005,
sceneUnitIfo: SCENE_DEF.Classify_5, sceneUnitIfo: SCENE_DEF.Classify_5,
comName: "ClassifyCtr", comName: "ClassifyCtr",
...@@ -489,7 +489,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -489,7 +489,7 @@ export const levelCfg: OneVarLevelItf[] = [
oneScore: 1 oneScore: 1
} }
} }
, { , {
gameId: 3006, gameId: 3006,
sceneUnitIfo: SCENE_DEF.Classify_6, sceneUnitIfo: SCENE_DEF.Classify_6,
comName: "ClassifyCtr", comName: "ClassifyCtr",
...@@ -539,7 +539,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -539,7 +539,7 @@ export const levelCfg: OneVarLevelItf[] = [
oneScore: 1 oneScore: 1
} }
} }
, { , {
gameId: 3104, gameId: 3104,
sceneUnitIfo: SCENE_DEF.Classify_star4, sceneUnitIfo: SCENE_DEF.Classify_star4,
comName: "ClassifyCtr_1", comName: "ClassifyCtr_1",
...@@ -550,7 +550,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -550,7 +550,7 @@ export const levelCfg: OneVarLevelItf[] = [
oneScore: 1 oneScore: 1
} }
} }
, { , {
gameId: 3105, gameId: 3105,
sceneUnitIfo: SCENE_DEF.Classify_star5, sceneUnitIfo: SCENE_DEF.Classify_star5,
comName: "ClassifyCtr_1", comName: "ClassifyCtr_1",
...@@ -561,7 +561,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -561,7 +561,7 @@ export const levelCfg: OneVarLevelItf[] = [
oneScore: 1 oneScore: 1
} }
} }
, { , {
gameId: 3106, gameId: 3106,
sceneUnitIfo: SCENE_DEF.Classify_star6, sceneUnitIfo: SCENE_DEF.Classify_star6,
comName: "ClassifyCtr_1", comName: "ClassifyCtr_1",
...@@ -779,7 +779,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -779,7 +779,7 @@ export const levelCfg: OneVarLevelItf[] = [
foodNumCount: 6 foodNumCount: 6
} }
} }
, { , {
gameId: 10104, gameId: 10104,
sceneUnitIfo: SCENE_DEF.FoodForTheParty_2, sceneUnitIfo: SCENE_DEF.FoodForTheParty_2,
comName: "FoodForThePartyCtr", comName: "FoodForThePartyCtr",
...@@ -835,7 +835,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -835,7 +835,7 @@ export const levelCfg: OneVarLevelItf[] = [
oneScore: 1 oneScore: 1
} }
} }
,{ , {
gameId: 11002, gameId: 11002,
sceneUnitIfo: SCENE_DEF.QuickQuiz_1, sceneUnitIfo: SCENE_DEF.QuickQuiz_1,
comName: "QuickQuizCtr", comName: "QuickQuizCtr",
...@@ -846,7 +846,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -846,7 +846,7 @@ export const levelCfg: OneVarLevelItf[] = [
oneScore: 1 oneScore: 1
} }
} }
,{ , {
gameId: 11003, gameId: 11003,
sceneUnitIfo: SCENE_DEF.QuickQuiz_1, sceneUnitIfo: SCENE_DEF.QuickQuiz_1,
comName: "QuickQuizCtr", comName: "QuickQuizCtr",
...@@ -857,7 +857,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -857,7 +857,7 @@ export const levelCfg: OneVarLevelItf[] = [
oneScore: 1 oneScore: 1
} }
} }
,{ , {
gameId: 11004, gameId: 11004,
sceneUnitIfo: SCENE_DEF.QuickQuiz_1, sceneUnitIfo: SCENE_DEF.QuickQuiz_1,
comName: "QuickQuizCtr", comName: "QuickQuizCtr",
...@@ -868,7 +868,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -868,7 +868,7 @@ export const levelCfg: OneVarLevelItf[] = [
oneScore: 1 oneScore: 1
} }
} }
,{ , {
gameId: 11005, gameId: 11005,
sceneUnitIfo: SCENE_DEF.QuickQuiz_1, sceneUnitIfo: SCENE_DEF.QuickQuiz_1,
comName: "QuickQuizCtr", comName: "QuickQuizCtr",
...@@ -879,7 +879,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -879,7 +879,7 @@ export const levelCfg: OneVarLevelItf[] = [
oneScore: 1 oneScore: 1
} }
} }
,{ , {
gameId: 11006, gameId: 11006,
sceneUnitIfo: SCENE_DEF.QuickQuiz_1, sceneUnitIfo: SCENE_DEF.QuickQuiz_1,
comName: "QuickQuizCtr", comName: "QuickQuizCtr",
...@@ -890,7 +890,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -890,7 +890,7 @@ export const levelCfg: OneVarLevelItf[] = [
oneScore: 1 oneScore: 1
} }
} }
,{ , {
gameId: 11007, gameId: 11007,
sceneUnitIfo: SCENE_DEF.QuickQuiz_1, sceneUnitIfo: SCENE_DEF.QuickQuiz_1,
comName: "QuickQuizCtr", comName: "QuickQuizCtr",
...@@ -901,7 +901,7 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -901,7 +901,7 @@ export const levelCfg: OneVarLevelItf[] = [
oneScore: 1 oneScore: 1
} }
} }
,{ , {
gameId: 11008, gameId: 11008,
sceneUnitIfo: SCENE_DEF.QuickQuiz_1, sceneUnitIfo: SCENE_DEF.QuickQuiz_1,
comName: "QuickQuizCtr", comName: "QuickQuizCtr",
...@@ -931,4 +931,50 @@ export const levelCfg: OneVarLevelItf[] = [ ...@@ -931,4 +931,50 @@ export const levelCfg: OneVarLevelItf[] = [
} }
] ]
} }
, {
gameIdHead: 130,
title: "锯形数独",
desc: "锯形数独,第一个版本",
levelArr: [{
gameId: 13001,
sceneUnitIfo: SCENE_DEF.Sudoku_1,
comName: "SudokuCtr",
level: 1,
resData: {
totalTime: 60,
level: 1
}
}
, {
gameId: 13002,
sceneUnitIfo: SCENE_DEF.Sudoku_1,
comName: "SudokuCtr",
level: 2,
resData: {
totalTime: 120,
level: 2
}
}
, {
gameId: 13003,
sceneUnitIfo: SCENE_DEF.Sudoku_1,
comName: "SudokuCtr",
level: 3,
resData: {
totalTime: 150,
level: 3
}
}
, {
gameId: 13004,
sceneUnitIfo: SCENE_DEF.Sudoku_1,
comName: "SudokuCtr",
level: 4,
resData: {
totalTime: 150,
level: 4
}
}
]
}
]; ];
\ No newline at end of file
...@@ -23,7 +23,7 @@ export class LevelHomeCtr extends Component { ...@@ -23,7 +23,7 @@ export class LevelHomeCtr extends Component {
// [3] // [3]
if (!levelMgr.loadedOutData) { if (!levelMgr.loadedOutData) {
levelMgr.loadedOutData = true; levelMgr.loadedOutData = true;
levelMgr.gameIdHead = 101; levelMgr.gameIdHead = 130;
levelMgr.unLockCount = 10; levelMgr.unLockCount = 10;
if(Utils.getValueFromHref("gameIdHead")){ if(Utils.getValueFromHref("gameIdHead")){
levelMgr.gameIdHead = Number(Utils.getValueFromHref("gameIdHead")); levelMgr.gameIdHead = Number(Utils.getValueFromHref("gameIdHead"));
......
...@@ -93,6 +93,8 @@ interface ScenePathItf { ...@@ -93,6 +93,8 @@ interface ScenePathItf {
QuickQuiz_1: ScenePathUnitItf, QuickQuiz_1: ScenePathUnitItf,
//魔法咒语 //魔法咒语
MagicSpells_1: ScenePathUnitItf, MagicSpells_1: ScenePathUnitItf,
//锯形数独
Sudoku_1: ScenePathUnitItf,
} }
export const SCENE_DEF: ScenePathItf = { export const SCENE_DEF: ScenePathItf = {
TestScene: { TestScene: {
...@@ -410,6 +412,11 @@ export const SCENE_DEF: ScenePathItf = { ...@@ -410,6 +412,11 @@ export const SCENE_DEF: ScenePathItf = {
sceneName: "MagicSpells_1", sceneName: "MagicSpells_1",
desc: "魔法咒语,第一个版本" desc: "魔法咒语,第一个版本"
}, },
Sudoku_1: {
bundleName: "sceneBundle",
sceneName: "Sudoku_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