Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MingSnake_241120
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
MingSnake_241120
Commits
28c24165
Commit
28c24165
authored
Nov 20, 2024
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
25358c2f
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1136 additions
and
618 deletions
+1136
-618
MainGame.scene
assets/Bundles/MainGame/MainGame.scene
+9
-12
Animal.prefab
assets/Bundles/MainGame/prefab/Animal.prefab
+1
-5
food.prefab
assets/Bundles/MainGame/prefab/food.prefab
+1
-4
skin.meta
assets/Bundles/MainGame/skin.meta
+0
-0
body1.png
assets/Bundles/MainGame/skin/body1.png
+0
-0
body1.png.meta
assets/Bundles/MainGame/skin/body1.png.meta
+33
-33
body2.png
assets/Bundles/MainGame/skin/body2.png
+0
-0
body2.png.meta
assets/Bundles/MainGame/skin/body2.png.meta
+134
-0
default.plist
assets/Bundles/MainGame/skin/default.plist
+14
-44
default.plist.meta
assets/Bundles/MainGame/skin/default.plist.meta
+155
-0
default.png
assets/Bundles/MainGame/skin/default.png
+0
-0
default.png.meta
assets/Bundles/MainGame/skin/default.png.meta
+134
-0
Enums.ts
assets/Scripts/Scenes/MainGame/Enums.ts
+30
-17
FastBtn.ts
assets/Scripts/Scenes/MainGame/FastBtn.ts
+8
-8
FlagSystem.ts
assets/Scripts/Scenes/MainGame/FlagSystem.ts
+81
-0
FlagSystem.ts.meta
assets/Scripts/Scenes/MainGame/FlagSystem.ts.meta
+9
-0
MainGame.ts
assets/Scripts/Scenes/MainGame/MainGame.ts
+227
-170
Snake.ts
assets/Scripts/Scenes/MainGame/Snake.ts
+284
-324
uitl.ts
assets/Scripts/Scenes/MainGame/uitl.ts
+16
-1
s0.png
assets/resources/skin/s0.png
+0
-0
No files found.
assets/Bundles/MainGame/MainGame.scene
View file @
28c24165
...
...
@@ -190,7 +190,7 @@
"_priority": 40000,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 9
47.8725099601594
,
"_orthoHeight": 9
75.3705179282869
,
"_near": 0,
"_far": 2000,
"_color": {
...
...
@@ -875,7 +875,7 @@
"__type__": "Item",
"type": 0,
"sp": {
"__uuid__": "
8f21f897-8cb9-448d-a674-e0574c83e228@da8cd
",
"__uuid__": "
74a5a14c-636e-4b82-a474-43ef9ca6a905@f9941
",
"__expectedType__": "cc.SpriteFrame"
}
},
...
...
@@ -1094,10 +1094,7 @@
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "8f21f897-8cb9-448d-a674-e0574c83e228@9296f",
"__expectedType__": "cc.SpriteFrame"
},
"_spriteFrame": null,
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
...
...
@@ -1197,7 +1194,7 @@
},
"_enabled": true,
"__prefab": null,
"
H
ead": {
"
h
ead": {
"__id__": 27
},
"bodyPrefab": {
...
...
@@ -1293,7 +1290,7 @@
"joystick": {
"__id__": 38
},
"fas
h
Btn": {
"fas
t
Btn": {
"__id__": 46
},
"uiBg": {
...
...
@@ -1512,7 +1509,7 @@
"_priority": 50000,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 9
47.8725099601594
,
"_orthoHeight": 9
75.3705179282869
,
"_near": 1,
"_far": 2000,
"_color": {
...
...
@@ -1641,7 +1638,7 @@
"a": 255
},
"_spriteFrame": {
"__uuid__": "
57520716-48c8-4a19-8acf-41c9f8777fb0
@f9941",
"__uuid__": "
0d8d3b9f-f695-4e4b-b6cb-969a79079832
@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
...
...
@@ -2028,7 +2025,7 @@
"a": 255
},
"_spriteFrame": {
"__uuid__": "
8f21f897-8cb9-448d-a674-e0574c83e228@da8cd
",
"__uuid__": "
0d8d3b9f-f695-4e4b-b6cb-969a79079832@f9941
",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
...
...
@@ -2089,7 +2086,7 @@
"a": 255
},
"_spriteFrame": {
"__uuid__": "
8f21f897-8cb9-448d-a674-e0574c83e228@7ca68
",
"__uuid__": "
74a5a14c-636e-4b82-a474-43ef9ca6a905@f9941
",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
...
...
assets/Bundles/MainGame/prefab/Animal.prefab
View file @
28c24165
...
...
@@ -169,10 +169,7 @@
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "57520716-48c8-4a19-8acf-41c9f8777fb0@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_spriteFrame": null,
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
...
...
@@ -312,7 +309,6 @@
"Head": {
"__id__": 2
},
"water": null,
"bodyPrefab": {
"__uuid__": "8c4f22c7-20c7-4868-88ea-dedb8004999f",
"__expectedType__": "cc.Prefab"
...
...
assets/Bundles/MainGame/prefab/food.prefab
View file @
28c24165
...
...
@@ -115,10 +115,7 @@
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "8f21f897-8cb9-448d-a674-e0574c83e228@da8cd",
"__expectedType__": "cc.SpriteFrame"
},
"_spriteFrame": null,
"_type": 0,
"_fillType": 0,
"_sizeMode": 0,
...
...
assets/
resources
/skin.meta
→
assets/
Bundles/MainGame
/skin.meta
View file @
28c24165
File moved
assets/Bundles/MainGame/skin/body1.png
0 → 100644
View file @
28c24165
10.7 KB
assets/
resources/skin/s0
.png.meta
→
assets/
Bundles/MainGame/skin/body1
.png.meta
View file @
28c24165
...
...
@@ -2,7 +2,7 @@
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "
43c3d349-8e95-48ea-bf1a-e9de526864af
",
"uuid": "
0d8d3b9f-f695-4e4b-b6cb-969a79079832
",
"files": [
".json",
".png"
...
...
@@ -10,14 +10,14 @@
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "
43c3d349-8e95-48ea-bf1a-e9de526864af
@6c48a",
"displayName": "
s0
",
"uuid": "
0d8d3b9f-f695-4e4b-b6cb-969a79079832
@6c48a",
"displayName": "
body1
",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "
43c3d349-8e95-48ea-bf1a-e9de526864af
",
"imageUuidOrDatabaseUri": "
0d8d3b9f-f695-4e4b-b6cb-969a79079832
",
"isUuid": true,
"visible": false,
"minfilter": "linear",
...
...
@@ -34,8 +34,8 @@
},
"f9941": {
"importer": "sprite-frame",
"uuid": "
43c3d349-8e95-48ea-bf1a-e9de526864af
@f9941",
"displayName": "
s0
",
"uuid": "
0d8d3b9f-f695-4e4b-b6cb-969a79079832
@f9941",
"displayName": "
body1
",
"id": "f9941",
"name": "spriteFrame",
"userData": {
...
...
@@ -43,13 +43,13 @@
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY":
0
,
"offsetY":
1.5
,
"trimX": 0,
"trimY": 0,
"width":
493
,
"height": 1
93
,
"rawWidth":
493
,
"rawHeight": 1
9
3,
"width":
100
,
"height": 1
00
,
"rawWidth":
100
,
"rawHeight": 1
0
3,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
...
...
@@ -61,17 +61,17 @@
"meshType": 0,
"vertices": {
"rawPosition": [
-
246.5
,
-
96.5
,
-
50
,
-
50
,
0,
246.5
,
-
96.5
,
50
,
-
50
,
0,
-
246.5
,
96.5
,
-
50
,
50
,
0,
246.5
,
96.5
,
50
,
50
,
0
],
"indexes": [
...
...
@@ -84,37 +84,37 @@
],
"uv": [
0,
1
9
3,
493
,
1
9
3,
1
0
3,
100
,
1
0
3,
0,
0
,
493
,
0
3
,
100
,
3
],
"nuv": [
0,
0,
0
.02912621359223301
,
1,
0,
0
.02912621359223301
,
0,
1,
1,
1
],
"minPos": [
-
246.5
,
-
96.5
,
-
50
,
-
50
,
0
],
"maxPos": [
246.5
,
96.5
,
50
,
50
,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "
43c3d349-8e95-48ea-bf1a-e9de526864af
@6c48a",
"imageUuidOrDatabaseUri": "
0d8d3b9f-f695-4e4b-b6cb-969a79079832
@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
...
...
@@ -129,6 +129,6 @@
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "
43c3d349-8e95-48ea-bf1a-e9de526864af
@6c48a"
"redirect": "
0d8d3b9f-f695-4e4b-b6cb-969a79079832
@6c48a"
}
}
assets/Bundles/MainGame/skin/body2.png
0 → 100644
View file @
28c24165
1.84 KB
assets/Bundles/MainGame/skin/body2.png.meta
0 → 100644
View file @
28c24165
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "74a5a14c-636e-4b82-a474-43ef9ca6a905",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "74a5a14c-636e-4b82-a474-43ef9ca6a905@6c48a",
"displayName": "body2",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "74a5a14c-636e-4b82-a474-43ef9ca6a905",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "74a5a14c-636e-4b82-a474-43ef9ca6a905@f9941",
"displayName": "body2",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0.5,
"trimX": 0,
"trimY": 1,
"width": 100,
"height": 100,
"rawWidth": 100,
"rawHeight": 103,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-50,
-50,
0,
50,
-50,
0,
-50,
50,
0,
50,
50,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
102,
100,
102,
0,
2,
100,
2
],
"nuv": [
0,
0.019417475728155338,
1,
0.019417475728155338,
0,
0.9902912621359223,
1,
0.9902912621359223
],
"minPos": [
-50,
-50,
0
],
"maxPos": [
50,
50,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "74a5a14c-636e-4b82-a474-43ef9ca6a905@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "74a5a14c-636e-4b82-a474-43ef9ca6a905@6c48a"
}
}
assets/
resources/skin/s0
.plist
→
assets/
Bundles/MainGame/skin/default
.plist
View file @
28c24165
...
...
@@ -9,13 +9,13 @@
<
k
e
y
>
aliases
<
/k
e
y
>
<
a
rr
a
y/
>
<
k
e
y
>
spriteOffset
<
/k
e
y
>
<
string
>{
0
,
0
}<
/string
>
<
string
>{
0
,
1
}<
/string
>
<
k
e
y
>
spriteSize
<
/k
e
y
>
<
string
>{
100
,
10
0
}<
/string
>
<
string
>{
100
,
10
1
}<
/string
>
<
k
e
y
>
spriteSourceSize
<
/k
e
y
>
<
string
>{
100
,
10
0
}<
/string
>
<
string
>{
100
,
10
3
}<
/string
>
<
k
e
y
>
textureRect
<
/k
e
y
>
<
string
>{{
290
,
84
}
,
{
100
,
100
}}<
/string
>
<
string
>{{
1
,
211
}
,
{
100
,
101
}}<
/string
>
<
k
e
y
>
textureRotated
<
/k
e
y
>
<
fa
ls
e
/
>
<
/
d
i
c
t
>
...
...
@@ -26,11 +26,11 @@
<
k
e
y
>
spriteOffset
<
/k
e
y
>
<
string
>{
0
,
0
}<
/string
>
<
k
e
y
>
spriteSize
<
/k
e
y
>
<
string
>{
100
,
10
0
}<
/string
>
<
string
>{
100
,
10
3
}<
/string
>
<
k
e
y
>
spriteSourceSize
<
/k
e
y
>
<
string
>{
100
,
10
0
}<
/string
>
<
string
>{
100
,
10
3
}<
/string
>
<
k
e
y
>
textureRect
<
/k
e
y
>
<
string
>{{
392
,
84
}
,
{
100
,
100
}}<
/string
>
<
string
>{{
1
,
1
}
,
{
100
,
103
}}<
/string
>
<
k
e
y
>
textureRotated
<
/k
e
y
>
<
fa
ls
e
/
>
<
/
d
i
c
t
>
...
...
@@ -41,41 +41,11 @@
<
k
e
y
>
spriteOffset
<
/k
e
y
>
<
string
>{
0
,
0
}<
/string
>
<
k
e
y
>
spriteSize
<
/k
e
y
>
<
string
>{
163
,
181
}<
/string
>
<
k
e
y
>
spriteSourceSize
<
/k
e
y
>
<
string
>{
163
,
181
}<
/string
>
<
k
e
y
>
textureRect
<
/k
e
y
>
<
string
>{{
125
,
1
}
,
{
163
,
181
}}<
/string
>
<
k
e
y
>
textureRotated
<
/k
e
y
>
<
fa
ls
e
/
>
<
/
d
i
c
t
>
<
k
e
y
>
tait1.png
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
aliases
<
/k
e
y
>
<
a
rr
a
y/
>
<
k
e
y
>
spriteOffset
<
/k
e
y
>
<
string
>{
0
,
0
}<
/string
>
<
k
e
y
>
spriteSize
<
/k
e
y
>
<
string
>{
164
,
81
}<
/string
>
<
k
e
y
>
spriteSourceSize
<
/k
e
y
>
<
string
>{
164
,
81
}<
/string
>
<
k
e
y
>
textureRect
<
/k
e
y
>
<
string
>{{
290
,
1
}
,
{
164
,
81
}}<
/string
>
<
k
e
y
>
textureRotated
<
/k
e
y
>
<
fa
ls
e
/
>
<
/
d
i
c
t
>
<
k
e
y
>
tait2.png
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
aliases
<
/k
e
y
>
<
a
rr
a
y/
>
<
k
e
y
>
spriteOffset
<
/k
e
y
>
<
string
>{
0
,
0
}<
/string
>
<
k
e
y
>
spriteSize
<
/k
e
y
>
<
string
>{
191
,
122
}<
/string
>
<
string
>{
103
,
100
}<
/string
>
<
k
e
y
>
spriteSourceSize
<
/k
e
y
>
<
string
>{
1
91
,
122
}<
/string
>
<
string
>{
1
03
,
100
}<
/string
>
<
k
e
y
>
textureRect
<
/k
e
y
>
<
string
>{{
1
,
1
}
,
{
191
,
122
}}<
/string
>
<
string
>{{
1
,
1
06
}
,
{
103
,
100
}}<
/string
>
<
k
e
y
>
textureRotated
<
/k
e
y
>
<
tru
e
/
>
<
/
d
i
c
t
>
...
...
@@ -89,13 +59,13 @@
<
k
e
y
>
premultiplyAlpha
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
realTextureFileName
<
/k
e
y
>
<
string
>
s0
.png
<
/string
>
<
string
>
default
.png
<
/string
>
<
k
e
y
>
size
<
/k
e
y
>
<
string
>{
493
,
19
3
}<
/string
>
<
string
>{
102
,
31
3
}<
/string
>
<
k
e
y
>
smartupdate
<
/k
e
y
>
<
string
>
$TexturePacker:SmartUpdate:
6735ea558f0aa7c64bd9e92da816ca23:4da33dda424e9dfc0ce663f9309a5b05:a66884bb0e575156b3af2630252c8c2f
$
<
/string
>
<
string
>
$TexturePacker:SmartUpdate:
e0a7963ab6250bee46680d49eb7b1ca1:156dc7ba41f81cd1436f4ce3a9b505a3:d258758acfd7c2dc4f771a427c5ecb8e
$
<
/string
>
<
k
e
y
>
textureFileName
<
/k
e
y
>
<
string
>
s0
.png
<
/string
>
<
string
>
default
.png
<
/string
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/plist
>
assets/
resources/skin/s0
.plist.meta
→
assets/
Bundles/MainGame/skin/default
.plist.meta
View file @
28c24165
...
...
@@ -2,14 +2,14 @@
"ver": "1.0.8",
"importer": "sprite-atlas",
"imported": true,
"uuid": "8
f21f897-8cb9-448d-a674-e0574c83e228
",
"uuid": "8
9887e9b-e4a4-40bb-9c17-1fd0f88edd35
",
"files": [
".json"
],
"subMetas": {
"da8cd": {
"importer": "sprite-frame",
"uuid": "8
f21f897-8cb9-448d-a674-e0574c83e228
@da8cd",
"uuid": "8
9887e9b-e4a4-40bb-9c17-1fd0f88edd35
@da8cd",
"displayName": "",
"id": "da8cd",
"name": "body1",
...
...
@@ -18,13 +18,13 @@
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY":
0
,
"trimX":
290
,
"trimY":
84
,
"offsetY":
1
,
"trimX":
1
,
"trimY":
211
,
"width": 100,
"height": 10
0
,
"height": 10
1
,
"rawWidth": 100,
"rawHeight": 10
0
,
"rawHeight": 10
3
,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
...
...
@@ -43,8 +43,8 @@
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "
43c3d349-8e95-48ea-bf1a-e9de526864af
@6c48a",
"atlasUuid": "8
f21f897-8cb9-448d-a674-e0574c83e228
"
"imageUuidOrDatabaseUri": "
89abce21-2213-4c4e-91f5-2769291fd9d1
@6c48a",
"atlasUuid": "8
9887e9b-e4a4-40bb-9c17-1fd0f88edd35
"
},
"ver": "1.0.12",
"imported": true,
...
...
@@ -55,7 +55,7 @@
},
"7ca68": {
"importer": "sprite-frame",
"uuid": "8
f21f897-8cb9-448d-a674-e0574c83e228
@7ca68",
"uuid": "8
9887e9b-e4a4-40bb-9c17-1fd0f88edd35
@7ca68",
"displayName": "",
"id": "7ca68",
"name": "body2",
...
...
@@ -65,12 +65,12 @@
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX":
392
,
"trimY":
84
,
"trimX":
1
,
"trimY":
1
,
"width": 100,
"height": 10
0
,
"height": 10
3
,
"rawWidth": 100,
"rawHeight": 10
0
,
"rawHeight": 10
3
,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
...
...
@@ -89,8 +89,8 @@
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "
43c3d349-8e95-48ea-bf1a-e9de526864af
@6c48a",
"atlasUuid": "8
f21f897-8cb9-448d-a674-e0574c83e228
"
"imageUuidOrDatabaseUri": "
89abce21-2213-4c4e-91f5-2769291fd9d1
@6c48a",
"atlasUuid": "8
9887e9b-e4a4-40bb-9c17-1fd0f88edd35
"
},
"ver": "1.0.12",
"imported": true,
...
...
@@ -101,102 +101,10 @@
},
"9296f": {
"importer": "sprite-frame",
"uuid": "8
f21f897-8cb9-448d-a674-e0574c83e228
@9296f",
"uuid": "8
9887e9b-e4a4-40bb-9c17-1fd0f88edd35
@9296f",
"displayName": "",
"id": "9296f",
"name": "head",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 125,
"trimY": 1,
"width": 163,
"height": 181,
"rawWidth": 163,
"rawHeight": 181,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "43c3d349-8e95-48ea-bf1a-e9de526864af@6c48a",
"atlasUuid": "8f21f897-8cb9-448d-a674-e0574c83e228"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"e7dcb": {
"importer": "sprite-frame",
"uuid": "8f21f897-8cb9-448d-a674-e0574c83e228@e7dcb",
"displayName": "",
"id": "e7dcb",
"name": "tait1",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 290,
"trimY": 1,
"width": 164,
"height": 81,
"rawWidth": 164,
"rawHeight": 81,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "43c3d349-8e95-48ea-bf1a-e9de526864af@6c48a",
"atlasUuid": "8f21f897-8cb9-448d-a674-e0574c83e228"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"47d81": {
"importer": "sprite-frame",
"uuid": "8f21f897-8cb9-448d-a674-e0574c83e228@47d81",
"displayName": "",
"id": "47d81",
"name": "tait2",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
...
...
@@ -204,11 +112,11 @@
"offsetX": 0,
"offsetY": 0,
"trimX": 1,
"trimY": 1,
"width": 1
91
,
"height": 1
22
,
"rawWidth": 1
91
,
"rawHeight": 1
22
,
"trimY": 1
06
,
"width": 1
03
,
"height": 1
00
,
"rawWidth": 1
03
,
"rawHeight": 1
00
,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
...
...
@@ -227,8 +135,8 @@
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "
43c3d349-8e95-48ea-bf1a-e9de526864af
@6c48a",
"atlasUuid": "8
f21f897-8cb9-448d-a674-e0574c83e228
"
"imageUuidOrDatabaseUri": "
89abce21-2213-4c4e-91f5-2769291fd9d1
@6c48a",
"atlasUuid": "8
9887e9b-e4a4-40bb-9c17-1fd0f88edd35
"
},
"ver": "1.0.12",
"imported": true,
...
...
@@ -239,9 +147,9 @@
}
},
"userData": {
"atlasTextureName": "
s0
.png",
"atlasTextureName": "
default
.png",
"format": 3,
"uuid": "8
f21f897-8cb9-448d-a674-e0574c83e228
",
"textureUuid": "
43c3d349-8e95-48ea-bf1a-e9de526864af
@6c48a"
"uuid": "8
9887e9b-e4a4-40bb-9c17-1fd0f88edd35
",
"textureUuid": "
89abce21-2213-4c4e-91f5-2769291fd9d1
@6c48a"
}
}
assets/Bundles/MainGame/skin/default.png
0 → 100644
View file @
28c24165
16.3 KB
assets/Bundles/MainGame/skin/default.png.meta
0 → 100644
View file @
28c24165
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "89abce21-2213-4c4e-91f5-2769291fd9d1",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "89abce21-2213-4c4e-91f5-2769291fd9d1@6c48a",
"displayName": "default",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "89abce21-2213-4c4e-91f5-2769291fd9d1",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "89abce21-2213-4c4e-91f5-2769291fd9d1@f9941",
"displayName": "default",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 2,
"width": 102,
"height": 309,
"rawWidth": 102,
"rawHeight": 313,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-51,
-154.5,
0,
51,
-154.5,
0,
-51,
154.5,
0,
51,
154.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
311,
102,
311,
0,
2,
102,
2
],
"nuv": [
0,
0.006389776357827476,
1,
0.006389776357827476,
0,
0.9936102236421726,
1,
0.9936102236421726
],
"minPos": [
-51,
-154.5,
0
],
"maxPos": [
51,
154.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "89abce21-2213-4c4e-91f5-2769291fd9d1@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "89abce21-2213-4c4e-91f5-2769291fd9d1@6c48a"
}
}
assets/Scripts/Scenes/MainGame/Enums.ts
View file @
28c24165
...
...
@@ -2,32 +2,45 @@
import
{
ccenum
}
from
"cc"
;
export
const
Events
=
{
changeSkinId
:
"changeSkinId"
,
// 更换皮肤事件
setGameState
:
"setGameState"
,
// 设置游戏状态事件
showGOver
:
"showGOver"
// 显示游戏结束界面事件
}
changeSkinId
:
"changeSkinId"
,
// 更换皮肤事件
setGameState
:
"setGameState"
,
// 设置游戏状态事件
showGOver
:
"showGOver"
// 显示游戏结束界面事件
}
;
// 食物类型枚举
export
enum
FoodType
{
FOOD
=
0
,
// 普通食物
MONEY
=
1
// 金币
FOOD
=
0
,
// 普通食物
MONEY
=
1
// 金币
}
ccenum
(
FoodType
)
ccenum
(
FoodType
);
// 移动方向枚举
export
enum
DirectionType
{
DEFAULT
=
0
,
// 默认方向
LEFT
=
1
,
// 向左
RIGHT
=
2
// 向右
DEFAULT
=
0
,
// 默认方向
LEFT
=
1
,
// 向左
RIGHT
=
2
// 向右
}
// 游戏状态枚举
export
enum
GameState
{
READY
=
0
,
// 准备状态
PLAY
=
1
,
// 游戏中
PAUSE
=
2
,
// 暂停
OVER
=
3
,
// 游戏结束
WIN
=
4
,
// 游戏胜利
QUIT
=
5
// 退出游戏
}
\ No newline at end of file
READY
=
0
,
// 准备状态
PLAY
=
1
,
// 游戏中
PAUSE
=
2
,
// 暂停
OVER
=
3
,
// 游戏结束
WIN
=
4
,
// 游戏胜利
QUIT
=
5
// 退出游戏
}
export
enum
FlagType
{
SHIELD
=
0
,
MAGNET
=
1
,
SPEED_UP
=
2
,
DOUBLE_SCORE
=
3
}
export
enum
EBodyTag
{
Player
}
assets/Scripts/Scenes/MainGame/FastBtn.ts
View file @
28c24165
...
...
@@ -5,7 +5,7 @@ const { ccclass, property } = _decorator;
@
ccclass
(
"FastBtn"
)
export
class
FastBtn
extends
Component
{
// 是否处于加速状态
isFas
h
:
boolean
=
false
;
isFas
t
:
boolean
=
false
;
// 按钮精灵组件
@
property
(
Sprite
)
...
...
@@ -17,20 +17,20 @@ export class FastBtn extends Component {
onLoad
()
{
// 注册触摸事件
this
.
node
.
on
(
Node
.
EventType
.
TOUCH_START
,
this
.
O
nTouchStart
,
this
);
this
.
node
.
on
(
Node
.
EventType
.
TOUCH_END
,
this
.
O
nTouchEnd
,
this
);
this
.
node
.
on
(
Node
.
EventType
.
TOUCH_CANCEL
,
this
.
O
nTouchEnd
,
this
);
this
.
node
.
on
(
Node
.
EventType
.
TOUCH_START
,
this
.
o
nTouchStart
,
this
);
this
.
node
.
on
(
Node
.
EventType
.
TOUCH_END
,
this
.
o
nTouchEnd
,
this
);
this
.
node
.
on
(
Node
.
EventType
.
TOUCH_CANCEL
,
this
.
o
nTouchEnd
,
this
);
}
// 按下时的处理
O
nTouchStart
()
{
this
.
isFas
h
=
true
;
o
nTouchStart
()
{
this
.
isFas
t
=
true
;
this
.
sp
.
color
=
this
.
c1
;
}
// 松开时的处理
O
nTouchEnd
()
{
this
.
isFas
h
=
false
;
o
nTouchEnd
()
{
this
.
isFas
t
=
false
;
this
.
sp
.
color
=
this
.
c2
;
}
}
\ No newline at end of file
assets/Scripts/Scenes/MainGame/FlagSystem.ts
0 → 100644
View file @
28c24165
import
{
_decorator
}
from
"cc"
;
import
{
FlagType
}
from
"./Enums"
;
const
{
ccclass
}
=
_decorator
;
interface
FlagInfo
{
type
:
FlagType
;
duration
:
number
;
// 持续时间
remainTime
:
number
;
// 剩余时间
value
:
number
;
// 效果值
}
@
ccclass
(
"FlagSystem"
)
export
class
FlagSystem
{
private
flags
:
Map
<
FlagType
,
FlagInfo
>
=
new
Map
();
// Flag 默认配置
private
static
readonly
DEFAULT_CONFIG
:
{
[
key
in
FlagType
]?:
{
duration
:
number
,
value
:
number
}
}
=
{
[
FlagType
.
SHIELD
]:
{
duration
:
10
,
value
:
1
},
// 护盾10秒
[
FlagType
.
MAGNET
]:
{
duration
:
15
,
value
:
100
},
// 磁铁15秒,吸收范围100
[
FlagType
.
SPEED_UP
]:
{
duration
:
8
,
value
:
1.5
},
// 加速8秒,速度1.5倍
[
FlagType
.
DOUBLE_SCORE
]:
{
duration
:
12
,
value
:
2
},
// 双倍积分12秒
};
// 添加一个Flag
addFlag
(
type
:
FlagType
,
duration
?:
number
,
value
?:
number
)
{
const
config
=
FlagSystem
.
DEFAULT_CONFIG
[
type
];
if
(
!
config
)
return
;
const
flagInfo
:
FlagInfo
=
{
type
,
duration
:
duration
||
config
.
duration
,
remainTime
:
duration
||
config
.
duration
,
value
:
value
||
config
.
value
};
this
.
flags
.
set
(
type
,
flagInfo
);
}
// 移除一个Flag
removeFlag
(
type
:
FlagType
)
{
this
.
flags
.
delete
(
type
);
}
// 检查Flag是否存在且有效
hasFlag
(
type
:
FlagType
):
boolean
{
return
this
.
flags
.
has
(
type
)
&&
this
.
flags
.
get
(
type
).
remainTime
>
0
;
}
// 获取Flag的值
getFlagValue
(
type
:
FlagType
):
number
{
const
flag
=
this
.
flags
.
get
(
type
);
return
flag
&&
flag
.
remainTime
>
0
?
flag
.
value
:
0
;
}
// 获取Flag的剩余时间
getFlagRemainTime
(
type
:
FlagType
):
number
{
const
flag
=
this
.
flags
.
get
(
type
);
return
flag
?
flag
.
remainTime
:
0
;
}
// 更新所有Flag状态
update
(
dt
:
number
)
{
this
.
flags
.
forEach
((
flag
,
type
)
=>
{
flag
.
remainTime
-=
dt
;
if
(
flag
.
remainTime
<=
0
)
{
this
.
flags
.
delete
(
type
);
}
});
}
// 清除所有Flag
clearAll
()
{
this
.
flags
.
clear
();
}
// 获取所有活动的Flag
getActiveFlags
():
FlagInfo
[]
{
return
Array
.
from
(
this
.
flags
.
values
()).
filter
(
flag
=>
flag
.
remainTime
>
0
);
}
}
\ No newline at end of file
assets/Scripts/Scenes/MainGame/FlagSystem.ts.meta
0 → 100644
View file @
28c24165
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "c9d3c00d-0519-4dc0-9e9f-103327cfcc08",
"files": [],
"subMetas": {},
"userData": {}
}
assets/Scripts/Scenes/MainGame/MainGame.ts
View file @
28c24165
This diff is collapsed.
Click to expand it.
assets/Scripts/Scenes/MainGame/Snake.ts
View file @
28c24165
This diff is collapsed.
Click to expand it.
assets/Scripts/Scenes/MainGame/uitl.ts
View file @
28c24165
import
{
Vec2
,
Vec3
,
Size
}
from
"cc"
;
import
{
Vec2
,
Vec3
,
Size
,
assetManager
,
SpriteFrame
,
SpriteAtlas
}
from
"cc"
;
/**
* 判断两点是否在指定范围内相交
...
...
@@ -46,4 +46,19 @@ export function formatTime(seconds: number): string {
const
mins
=
Math
.
floor
(
seconds
/
60
);
const
secs
=
Math
.
floor
(
seconds
%
60
);
return
`
${
mins
.
toString
().
padStart
(
2
,
"0"
)}
:
${
secs
.
toString
().
padStart
(
2
,
"0"
)}
`
;
}
export
function
loadSkin
(
skinName
:
string
,
bundleName
:
string
=
"MainGame"
):
Promise
<
SpriteAtlas
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
assetManager
.
getBundle
(
bundleName
).
load
(
`skin/
${
skinName
}
`
,
SpriteAtlas
,
(
err
,
skin
)
=>
{
if
(
err
)
{
reject
(
err
);
return
;
}
resolve
(
skin
);
}
);
});
}
\ No newline at end of file
assets/resources/skin/s0.png
deleted
100644 → 0
View file @
25358c2f
24.7 KB
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