Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SaveTheDoge
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyễn Quang Sáng
SaveTheDoge
Commits
ff52fdd6
Commit
ff52fdd6
authored
Sep 07, 2023
by
Nguyễn Quang Sáng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
07/09/2023 commit
parent
516cfdc6
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
513 additions
and
390 deletions
+513
-390
10.prefab
assets/Prefabs/Levels/10.prefab
+43
-14
3.prefab
assets/Prefabs/Levels/3.prefab
+174
-4
4.prefab
assets/Prefabs/Levels/4.prefab
+174
-4
gameplay.fire
assets/Scenes/gameplay.fire
+9
-9
levels.fire
assets/Scenes/levels.fire
+63
-63
shop.fire
assets/Scenes/shop.fire
+6
-6
start.fire
assets/Scenes/start.fire
+17
-225
GamePlay.ts
assets/Scripts/Controllers/GamePlay.ts
+24
-25
StartScene.ts
assets/Scripts/Controllers/StartScene.ts
+1
-25
LocalStorage.ts
assets/Scripts/Data/LocalStorage.ts
+2
-15
No files found.
assets/Prefabs/Levels/10.prefab
View file @
ff52fdd6
...
...
@@ -33,17 +33,17 @@
"__id__": 27
},
{
"__id__": 3
6
"__id__": 3
7
}
],
"_active": true,
"_components": [
{
"__id__": 4
2
"__id__": 4
3
}
],
"_prefab": {
"__id__": 4
3
"__id__": 4
4
},
"_opacity": 255,
"_color": {
...
...
@@ -107,7 +107,7 @@
}
],
"_prefab": {
"__id__": 4
1
"__id__": 4
2
},
"_opacity": 255,
"_color": {
...
...
@@ -185,7 +185,7 @@
"__id__": 27
},
{
"__id__": 3
6
"__id__": 3
7
}
],
"_id": ""
...
...
@@ -1087,10 +1087,13 @@
},
{
"__id__": 34
},
{
"__id__": 35
}
],
"_prefab": {
"__id__": 3
5
"__id__": 3
6
},
"_opacity": 255,
"_color": {
...
...
@@ -1360,6 +1363,32 @@
"awakeOnLoad": true,
"_id": ""
},
{
"__type__": "cc.PhysicsBoxCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 27
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_size": {
"__type__": "cc.Size",
"width": 104,
"height": 66
},
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
...
...
@@ -1381,18 +1410,18 @@
"_children": [],
"_active": true,
"_components": [
{
"__id__": 37
},
{
"__id__": 38
},
{
"__id__": 39
},
{
"__id__": 40
}
],
"_prefab": {
"__id__": 4
0
"__id__": 4
1
},
"_opacity": 255,
"_color": {
...
...
@@ -1446,7 +1475,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
6
"__id__": 3
7
},
"_enabled": true,
"_materials": [
...
...
@@ -1478,7 +1507,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
6
"__id__": 3
7
},
"_enabled": true,
"_type": 0,
...
...
@@ -1503,7 +1532,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
6
"__id__": 3
7
},
"_enabled": true,
"tag": 3,
...
...
@@ -1527,7 +1556,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 3
6
"__id__": 3
7
},
"asset": {
"__uuid__": "6673de46-a49c-4db5-8f01-3755cb2d143b"
...
...
assets/Prefabs/Levels/3.prefab
View file @
ff52fdd6
...
...
@@ -31,16 +31,19 @@
},
{
"__id__": 23
},
{
"__id__": 32
}
],
"_active": true,
"_components": [
{
"__id__": 3
3
"__id__": 3
8
}
],
"_prefab": {
"__id__": 3
4
"__id__": 3
9
},
"_opacity": 255,
"_color": {
...
...
@@ -104,7 +107,7 @@
}
],
"_prefab": {
"__id__": 3
2
"__id__": 3
7
},
"_opacity": 255,
"_color": {
...
...
@@ -180,6 +183,9 @@
},
{
"__id__": 4
},
{
"__id__": 32
}
],
"_id": ""
...
...
@@ -236,7 +242,7 @@
"ctor": "Float64Array",
"array": [
-125.515,
-
27.09
,
-
16.448
,
0,
0,
0,
...
...
@@ -1226,6 +1232,170 @@
"fileId": "69T3odTVdOhKA7JTNdpbF7",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "Grass",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 33
},
{
"__id__": 34
},
{
"__id__": 35
}
],
"_prefab": {
"__id__": 36
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 104,
"height": 20
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-123.831,
-76.708,
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__": 32
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "af891a65-5ee9-4e83-9e82-e0dac2d3f807"
},
"_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.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 32
},
"_enabled": true,
"_type": 0,
"_allowSleep": false,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": true,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": ""
},
{
"__type__": "cc.PhysicsBoxCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 32
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_size": {
"__type__": "cc.Size",
"width": 104,
"height": 20
},
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "aeBdIuKAJJJ5NgyScLIct+",
"sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
...
...
assets/Prefabs/Levels/4.prefab
View file @
ff52fdd6
...
...
@@ -34,16 +34,19 @@
},
{
"__id__": 30
},
{
"__id__": 39
}
],
"_active": true,
"_components": [
{
"__id__": 4
0
"__id__": 4
5
}
],
"_prefab": {
"__id__": 4
1
"__id__": 4
6
},
"_opacity": 255,
"_color": {
...
...
@@ -107,7 +110,7 @@
}
],
"_prefab": {
"__id__":
39
"__id__":
44
},
"_opacity": 255,
"_color": {
...
...
@@ -186,6 +189,9 @@
},
{
"__id__": 30
},
{
"__id__": 39
}
],
"_id": ""
...
...
@@ -242,7 +248,7 @@
"ctor": "Float64Array",
"array": [
7.677,
-
54.18
,
-
39.185
,
0,
0,
0,
...
...
@@ -1469,6 +1475,170 @@
"fileId": "1e5KPDwTRAuJpJQuyBjp6H",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "Grass",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 40
},
{
"__id__": 41
},
{
"__id__": 42
}
],
"_prefab": {
"__id__": 43
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 104,
"height": 20
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
9.361,
-99.337,
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__": 39
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "af891a65-5ee9-4e83-9e82-e0dac2d3f807"
},
"_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.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 39
},
"_enabled": true,
"_type": 0,
"_allowSleep": false,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": true,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": ""
},
{
"__type__": "cc.PhysicsBoxCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 39
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_size": {
"__type__": "cc.Size",
"width": 104,
"height": 20
},
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "3c5Eg38j1B9Z+sulSZtZya",
"sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
...
...
assets/Scenes/gameplay.fire
View file @
ff52fdd6
...
...
@@ -4170,8 +4170,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width":
284.08
,
"height":
67
"width":
485
,
"height":
162.2
},
"_anchorPoint": {
"__type__": "cc.Vec2",
...
...
@@ -4205,7 +4205,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
4cMAA4LOlF0LRN8m7Z8N6f
"
"_id": "
33LF4JhN9CDJNF9rm6TDsC
"
},
{
"__type__": "cc.Label",
...
...
@@ -4222,10 +4222,10 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "
Notification
",
"_N$string": "
Notification
",
"_string": "
Successfully doubled coins!
",
"_N$string": "
Successfully doubled coins!
",
"_fontSize": 50,
"_lineHeight":
5
0,
"_lineHeight":
7
0,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "0481a3d3-282a-499e-b2f1-c53edc40ac4c"
...
...
@@ -4238,9 +4238,9 @@
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow":
0
,
"_N$overflow":
3
,
"_N$cacheMode": 0,
"_id": "
09qm0EvAxGp7U6TXNARO5F
"
"_id": "
52nuxe75lGtKA+524/q3LW
"
},
{
"__type__": "cc.LabelOutline",
...
...
@@ -4258,7 +4258,7 @@
"a": 255
},
"_width": 2,
"_id": "
afr+WPSDxH14tm3ICyOsPT
"
"_id": "
db/wAbG9tNSpa00m7O129/
"
},
{
"__type__": "cc.Widget",
...
...
assets/Scenes/levels.fire
View file @
ff52fdd6
This diff is collapsed.
Click to expand it.
assets/Scenes/shop.fire
View file @
ff52fdd6
...
...
@@ -6785,8 +6785,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width":
284.08
,
"height":
67
"width":
485
,
"height":
162.2
},
"_anchorPoint": {
"__type__": "cc.Vec2",
...
...
@@ -6837,10 +6837,10 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "
Notification
",
"_N$string": "
Notification
",
"_string": "
Successfully doubled coins!
",
"_N$string": "
Successfully doubled coins!
",
"_fontSize": 50,
"_lineHeight":
5
0,
"_lineHeight":
7
0,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "0481a3d3-282a-499e-b2f1-c53edc40ac4c"
...
...
@@ -6853,7 +6853,7 @@
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow":
0
,
"_N$overflow":
3
,
"_N$cacheMode": 0,
"_id": "3d7IdpPtRChIc8ZxHNTyEL"
},
...
...
assets/Scenes/start.fire
View file @
ff52fdd6
...
...
@@ -108,13 +108,13 @@
"_active": true,
"_components": [
{
"__id__": 8
5
"__id__": 8
0
},
{
"__id__": 8
6
"__id__": 8
1
},
{
"__id__": 8
7
"__id__": 8
2
}
],
"_prefab": null,
...
...
@@ -471,7 +471,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "
65a2b7d8-d4e8-4571-aedb-766db7693820
"
"__uuid__": "
d2abbacf-3959-4e3a-9fb7-5c1527a74dda
"
},
"_type": 0,
"_sizeMode": 1,
...
...
@@ -1704,7 +1704,7 @@
0,
0,
1,
1,
-
1,
1,
0
]
...
...
@@ -3211,29 +3211,22 @@
},
{
"__type__": "cc.Node",
"_name": "
Intro
",
"_name": "
Opening
",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 77
}
],
"_children": [],
"_active": true,
"_components": [
{
"__id__": 80
},
{
"__id__": 81
"__id__": 77
},
{
"__id__":
82
"__id__":
78
},
{
"__id__":
83
"__id__":
79
}
],
"_prefab": null,
...
...
@@ -3282,126 +3275,26 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "cdjfz9tR1KGagNMSd7GNIf"
},
{
"__type__": "cc.Node",
"_name": "Label",
"_objFlags": 0,
"_parent": {
"__id__": 76
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 78
},
{
"__id__": 79
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 440.5,
"height": 63
},
"_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": "6dAPQo6k5LppgftUJo31S5"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 77
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "TOUCH TO START",
"_N$string": "TOUCH TO START",
"_fontSize": 50,
"_lineHeight": 50,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "0481a3d3-282a-499e-b2f1-c53edc40ac4c"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 1,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "39zrI+bwpE0IR3DzoBxIdK"
"_id": "4dhITFmNZEkaikU4gA+CxM"
},
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
7
"__id__": 7
6
},
"_enabled": true,
"_defaultClip": {
"__uuid__": "2
4b303eb-80f6-41f6-a817-f6bb048c2138
"
"__uuid__": "2
0dd64ba-ba66-4af0-9f75-d3196eca01af
"
},
"_clips": [
{
"__uuid__": "2
4b303eb-80f6-41f6-a817-f6bb048c2138
"
"__uuid__": "2
0dd64ba-ba66-4af0-9f75-d3196eca01af
"
}
],
"playOnLoad": true,
"_id": "
434rgdex9BGbtTN6xHBT0E
"
"_id": "
f49mgoe9pOWYhmAEtWKSU1
"
},
{
"__type__": "cc.Sprite",
...
...
@@ -3433,26 +3326,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "0f8uZ5+zNJY6Z4dAoiMvml"
},
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 76
},
"_enabled": true,
"_defaultClip": {
"__uuid__": "20dd64ba-ba66-4af0-9f75-d3196eca01af"
},
"_clips": [
{
"__uuid__": "20dd64ba-ba66-4af0-9f75-d3196eca01af"
}
],
"playOnLoad": false,
"_id": "98HNEYNVlOaLQER47G6CHp"
"_id": "19pEzs2rNOf4bfgxSbdLiX"
},
{
"__type__": "cc.Widget",
...
...
@@ -3479,89 +3353,7 @@
"_isAbsVerticalCenter": true,
"_originalWidth": 640,
"_originalHeight": 1140,
"_id": "6eDDZbgRNMOrXGgZwJUOUa"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 76
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 84
}
],
"_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": "92U3JaTyFMwZhz+LiTOga4"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 2
},
"component": "",
"_componentId": "221b6Awh/1PLZ7IzVb1f3El",
"handler": "onClickOpenGame",
"customEventData": ""
"_id": "361GRgLa9DwZRYparyKj6X"
},
{
"__type__": "cc.Canvas",
...
...
assets/Scripts/Controllers/GamePlay.ts
View file @
ff52fdd6
...
...
@@ -71,14 +71,14 @@ export default class GamePlay extends cc.Component {
blockedObjects
:
Array
<
cc
.
Node
>
=
new
Array
<
cc
.
Node
>
();
earnedCoin
:
number
=
0
;
clickedNextLevel
:
boolean
=
false
;
clickedAds
:
boolean
=
false
;
protected
onLoad
():
void
{
GamePlay
.
instance
=
this
;
cc
.
director
.
getPhysicsManager
().
enabled
=
true
;
cc
.
director
.
getCollisionManager
().
enabled
=
true
;
window
.
addEventListener
(
"beforeunload"
,
this
.
handleGameReload
);
window
.
addEventListener
(
"unload"
,
this
.
handleGameReload
);
// cc.director.getPhysicsManager().debugDrawFlags = 1;
this
.
highestLevel
=
LocalStorage
.
getHighestLevel
();
this
.
currentLevel
=
LocalStorage
.
getCurrentLevel
();
...
...
@@ -103,17 +103,11 @@ export default class GamePlay extends cc.Component {
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
this
.
onTouchUp
,
this
);
}
handleGameReload
()
{
LocalStorage
.
setGameStarted
(
false
);
}
onPlayerClickAds
()
{
if
(
!
this
.
clickedAds
)
{
showInterstitialAd
(
InterstitialType
.
START
,
"doubleCoin"
);
this
.
clickedAds
=
true
;
}
onDestroy
()
{
window
.
removeEventListener
(
"beforeunload"
,
this
.
handleGameReload
);
window
.
removeEventListener
(
"unload"
,
this
.
handleGameReload
);
}
onShowNotiAds
(
status
:
string
)
{
...
...
@@ -374,6 +368,9 @@ export default class GamePlay extends cc.Component {
onStartCountdown
()
{
this
.
timerLabel
.
string
=
Math
.
floor
(
this
.
countdown
).
toString
();
if
(
!
Dog
.
instance
.
attacked
&&
this
.
countdown
<=
1
)
return
this
.
onLevelCompleted
(
this
.
currentLevel
);
if
(
this
.
countdown
>
0
&&
this
.
isGameover
)
{
this
.
startCount
=
false
;
...
...
@@ -381,10 +378,6 @@ export default class GamePlay extends cc.Component {
this
.
onReloadLevel
();
},
2
);
}
if
(
!
Dog
.
instance
.
attacked
&&
this
.
countdown
<=
1
)
{
this
.
startCount
=
false
;
this
.
onLevelCompleted
(
this
.
currentLevel
);
}
}
onReloadLevel
()
{
...
...
@@ -399,6 +392,7 @@ export default class GamePlay extends cc.Component {
SoundController
.
playNoLoopSound
(
SoundController
.
instance
.
sounds
[
13
]);
SoundController
.
playNoLoopSound
(
SoundController
.
instance
.
sounds
[
10
]);
this
.
startCount
=
false
;
this
.
isCompleted
=
true
;
StageController
.
instance
.
onCompleted
();
if
(
this
.
currentLevel
+
1
==
this
.
highestLevel
)
{
...
...
@@ -409,26 +403,28 @@ export default class GamePlay extends cc.Component {
let
levelName
=
parseInt
(
this
.
prefabToLoad
[
level
].
name
);
if
(
LimitBar
.
instance
.
winStar
==
3
)
{
this
.
earnedCoin
=
Math
.
floor
(
Math
.
random
()
*
6
)
+
25
;
this
.
coinEarned
.
getComponent
(
cc
.
Label
).
string
=
`x
${
this
.
earnedCoin
}
`
;
if
(
LocalStorage
.
getStarAtLevel
(
levelName
)
>=
3
)
return
;
LocalStorage
.
setStarAtLevel
(
levelName
,
3
);
this
.
earnedCoin
=
Math
.
floor
(
Math
.
random
()
*
6
)
+
25
;
}
if
(
LimitBar
.
instance
.
winStar
==
2
)
{
this
.
earnedCoin
=
Math
.
floor
(
Math
.
random
()
*
6
)
+
20
;
this
.
coinEarned
.
getComponent
(
cc
.
Label
).
string
=
`x
${
this
.
earnedCoin
}
`
;
this
.
rewardSprite
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
this
.
starWinSprites
[
1
];
if
(
LocalStorage
.
getStarAtLevel
(
levelName
)
>=
2
)
return
;
LocalStorage
.
setStarAtLevel
(
levelName
,
2
);
this
.
earnedCoin
=
Math
.
floor
(
Math
.
random
()
*
6
)
+
20
;
}
if
(
LimitBar
.
instance
.
winStar
==
1
)
{
this
.
earnedCoin
=
Math
.
floor
(
Math
.
random
()
*
6
)
+
15
;
this
.
coinEarned
.
getComponent
(
cc
.
Label
).
string
=
`x
${
this
.
earnedCoin
}
`
;
this
.
rewardSprite
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
this
.
starWinSprites
[
0
];
if
(
LocalStorage
.
getStarAtLevel
(
levelName
)
>=
1
)
return
;
LocalStorage
.
setStarAtLevel
(
levelName
,
1
);
this
.
earnedCoin
=
Math
.
floor
(
Math
.
random
()
*
6
)
+
15
;
}
this
.
coinEarned
.
getComponent
(
cc
.
Label
).
string
=
`x
${
this
.
earnedCoin
}
`
;
this
.
updateAllStarLabel
();
}
...
...
@@ -447,10 +443,13 @@ export default class GamePlay extends cc.Component {
}
onNextLevel
()
{
if
(
!
this
.
clickedNextLevel
)
{
this
.
onClickCollect
();
this
.
scheduleOnce
(()
=>
{
cc
.
director
.
loadScene
(
"gameplay"
);
},
1
);
this
.
clickedNextLevel
=
true
;
}
}
onClickButtonBack
()
{
...
...
assets/Scripts/Controllers/StartScene.ts
View file @
ff52fdd6
...
...
@@ -29,10 +29,6 @@ export default class StartScene extends cc.Component {
}
this
.
updateButtonSprite
();
window
.
addEventListener
(
"beforeunload"
,
this
.
handleGameReload
);
window
.
addEventListener
(
"unload"
,
this
.
handleGameReload
);
this
.
isStarted
=
LocalStorage
.
getGameStarted
();
if
(
this
.
isStarted
)
this
.
node
.
getChildByName
(
"Intro"
).
active
=
false
;
this
.
highestUnlockedLevel
=
LocalStorage
.
getHighestLevel
();
...
...
@@ -49,27 +45,6 @@ export default class StartScene extends cc.Component {
.
getComponent
(
cc
.
Label
).
string
=
`x
${
LocalStorage
.
getAllCoin
()}
`
;
}
handleGameReload
()
{
LocalStorage
.
setGameStarted
(
false
);
}
onDestroy
()
{
window
.
removeEventListener
(
"beforeunload"
,
this
.
handleGameReload
);
window
.
removeEventListener
(
"unload"
,
this
.
handleGameReload
);
}
onClickOpenGame
()
{
LocalStorage
.
setGameStarted
(
true
);
this
.
node
.
getChildByName
(
"Intro"
)
.
getComponent
(
cc
.
Animation
)
.
play
(
"Opening"
);
this
.
scheduleOnce
(()
=>
{
this
.
node
.
getChildByName
(
"Intro"
).
active
=
false
;
},
0.6
);
}
updateAllStarLabel
()
{
let
sum
=
0
;
for
(
const
item
of
LocalStorage
.
getAllStars
())
{
...
...
@@ -86,6 +61,7 @@ export default class StartScene extends cc.Component {
if
(
this
.
currentAnimation
===
"DogRun"
)
{
this
.
currentAnimation
=
"DogRolling"
;
}
else
{
this
.
animNode
.
getChildByName
(
"Dog"
).
rotation
=
0
;
this
.
currentAnimation
=
"DogRun"
;
}
...
...
assets/Scripts/Data/LocalStorage.ts
View file @
ff52fdd6
...
...
@@ -2,19 +2,6 @@ const { ccclass, property } = cc._decorator;
@
ccclass
export
default
class
LocalStorage
extends
cc
.
Component
{
public
static
setGameStarted
(
value
:
boolean
)
{
cc
.
sys
.
localStorage
.
setItem
(
"SaveTheDoge - GameStarted"
,
value
);
}
public
static
getGameStarted
():
boolean
{
if
(
cc
.
sys
.
localStorage
.
getItem
(
"SaveTheDoge - GameStarted"
)
==
null
)
{
cc
.
sys
.
localStorage
.
setItem
(
"SaveTheDoge - GameStarted"
,
false
);
return
false
;
}
else
return
JSON
.
parse
(
cc
.
sys
.
localStorage
.
getItem
(
"SaveTheDoge - GameStarted"
)
);
}
public
static
setMusic
(
value
:
boolean
)
{
cc
.
sys
.
localStorage
.
setItem
(
"SaveTheDoge - Music"
,
value
);
...
...
@@ -22,8 +9,8 @@ export default class LocalStorage extends cc.Component {
public
static
getMusic
():
boolean
{
if
(
cc
.
sys
.
localStorage
.
getItem
(
"SaveTheDoge - Music"
)
==
null
)
{
cc
.
sys
.
localStorage
.
setItem
(
"SaveTheDoge - Music"
,
tru
e
);
return
tru
e
;
cc
.
sys
.
localStorage
.
setItem
(
"SaveTheDoge - Music"
,
fals
e
);
return
fals
e
;
}
else
return
JSON
.
parse
(
cc
.
sys
.
localStorage
.
getItem
(
"SaveTheDoge - Music"
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment