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
d2d92e18
Commit
d2d92e18
authored
Nov 25, 2024
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
57192aa8
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
2147 additions
and
253 deletions
+2147
-253
MainGame.scene
assets/Bundles/MainGame/MainGame.scene
+738
-212
排行榜他人.png
assets/Bundles/MainGame/png/排行榜他人.png
+0
-0
排行榜他人.png.meta
assets/Bundles/MainGame/png/排行榜他人.png.meta
+134
-0
排行榜自己.png
assets/Bundles/MainGame/png/排行榜自己.png
+0
-0
排行榜自己.png.meta
assets/Bundles/MainGame/png/排行榜自己.png.meta
+134
-0
排行榜他人.prefab
assets/Bundles/MainGame/prefab/排行榜他人.prefab
+501
-0
排行榜他人.prefab.meta
assets/Bundles/MainGame/prefab/排行榜他人.prefab.meta
+13
-0
排行榜自己.prefab
assets/Bundles/MainGame/prefab/排行榜自己.prefab
+501
-0
排行榜自己.prefab.meta
assets/Bundles/MainGame/prefab/排行榜自己.prefab.meta
+13
-0
AISnake.ts
assets/Scripts/Scenes/MainGame/AISnake.ts
+2
-2
Rank.ts
assets/Scripts/Scenes/MainGame/Components/Rank.ts
+76
-0
Rank.ts.meta
assets/Scripts/Scenes/MainGame/Components/Rank.ts.meta
+9
-0
MainGame.ts
assets/Scripts/Scenes/MainGame/MainGame.ts
+22
-37
Snake.ts
assets/Scripts/Scenes/MainGame/Snake.ts
+4
-2
Test.meta
assets/Test.meta
+0
-0
MainGame1.ts
assets/Test/MainGame1.ts
+0
-0
MainGame1.ts.meta
assets/Test/MainGame1.ts.meta
+0
-0
Snake1.ts
assets/Test/Snake1.ts
+0
-0
Snake1.ts.meta
assets/Test/Snake1.ts.meta
+0
-0
SnakeNode.prefab
assets/Test/SnakeNode.prefab
+0
-0
SnakeNode.prefab.meta
assets/Test/SnakeNode.prefab.meta
+0
-0
No files found.
assets/Bundles/MainGame/MainGame.scene
View file @
d2d92e18
This diff is collapsed.
Click to expand it.
assets/Bundles/MainGame/png/排行榜他人.png
0 → 100644
View file @
d2d92e18
1.41 KB
assets/Bundles/MainGame/png/排行榜他人.png.meta
0 → 100644
View file @
d2d92e18
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "cbd167b9-62d1-46a8-8a05-99214bbb21ab",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "cbd167b9-62d1-46a8-8a05-99214bbb21ab@6c48a",
"displayName": "排行榜他人",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "cbd167b9-62d1-46a8-8a05-99214bbb21ab",
"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": "cbd167b9-62d1-46a8-8a05-99214bbb21ab@f9941",
"displayName": "排行榜他人",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 199,
"height": 40,
"rawWidth": 199,
"rawHeight": 40,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-99.5,
-20,
0,
99.5,
-20,
0,
-99.5,
20,
0,
99.5,
20,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
40,
199,
40,
0,
0,
199,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-99.5,
-20,
0
],
"maxPos": [
99.5,
20,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "cbd167b9-62d1-46a8-8a05-99214bbb21ab@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "cbd167b9-62d1-46a8-8a05-99214bbb21ab@6c48a"
}
}
assets/Bundles/MainGame/png/排行榜自己.png
0 → 100644
View file @
d2d92e18
773 Bytes
assets/Bundles/MainGame/png/排行榜自己.png.meta
0 → 100644
View file @
d2d92e18
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "5cf6ec7d-518e-445a-8b30-81fc930c2ba4",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "5cf6ec7d-518e-445a-8b30-81fc930c2ba4@6c48a",
"displayName": "排行榜自己",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "5cf6ec7d-518e-445a-8b30-81fc930c2ba4",
"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": "5cf6ec7d-518e-445a-8b30-81fc930c2ba4@f9941",
"displayName": "排行榜自己",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 200,
"height": 40,
"rawWidth": 200,
"rawHeight": 40,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-100,
-20,
0,
100,
-20,
0,
-100,
20,
0,
100,
20,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
40,
200,
40,
0,
0,
200,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-100,
-20,
0
],
"maxPos": [
100,
20,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "5cf6ec7d-518e-445a-8b30-81fc930c2ba4@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "5cf6ec7d-518e-445a-8b30-81fc930c2ba4@6c48a"
}
}
assets/Bundles/MainGame/prefab/排行榜他人.prefab
0 → 100644
View file @
d2d92e18
[
{
"__type__": "cc.Prefab",
"_name": "排行榜他人",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "排行榜他人",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 8
}
],
"_active": true,
"_components": [
{
"__id__": 14
},
{
"__id__": 16
},
{
"__id__": 18
}
],
"_prefab": {
"__id__": 20
},
"_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
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "rank",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
},
{
"__id__": 5
}
],
"_prefab": {
"__id__": 7
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 14,
"y": -20,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 4
},
"_contentSize": {
"__type__": "cc.Size",
"width": 8.27,
"height": 22
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "93H/4SamREtJlsDe0C3mtG"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 6
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_string": "1",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 22,
"_fontSize": 22,
"_fontFamily": "Arial",
"_lineHeight": 22,
"_overflow": 0,
"_enableWrapText": true,
"_font": {
"__uuid__": "51c12289-a516-4991-8323-ac98cee8b520",
"__expectedType__": "cc.TTFFont"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_isItalic": false,
"_isBold": false,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 2,
"_enableOutline": false,
"_outlineColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_outlineWidth": 2,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "cfCpcf2wtO7790r1xY+1LM"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "5bPu7e339Ic7SSq+U2BmL+",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "nick",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 9
},
{
"__id__": 11
}
],
"_prefab": {
"__id__": 13
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 45,
"y": -20,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 8
},
"_enabled": true,
"__prefab": {
"__id__": 10
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 27.72
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "58ynnO97ZCwaJiBcCgMFOL"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 8
},
"_enabled": true,
"__prefab": {
"__id__": 12
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_string": "",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 22,
"_fontSize": 22,
"_fontFamily": "Arial",
"_lineHeight": 22,
"_overflow": 0,
"_enableWrapText": true,
"_font": {
"__uuid__": "51c12289-a516-4991-8323-ac98cee8b520",
"__expectedType__": "cc.TTFFont"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_isItalic": false,
"_isBold": false,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 1,
"_enableOutline": false,
"_outlineColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_outlineWidth": 2,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "38ljvC9plFc7XcUIquCPBY"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "311ilSh3hLra+aZMHk4Xai",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 15
},
"_contentSize": {
"__type__": "cc.Size",
"width": 199,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 1
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "2b6t122gBJ7oP26I9enTTj"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 17
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "cbd167b9-62d1-46a8-8a05-99214bbb21ab@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": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "b4gxlxZ8NEAZyRggbfdZIq"
},
{
"__type__": "cc.UIOpacity",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 19
},
"_opacity": 255,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8dnW/RiydB4L9Vampq6FOB"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "9dGFpVDhJNSbeu33oaQCW+",
"instance": null,
"targetOverrides": null
}
]
\ No newline at end of file
assets/Bundles/MainGame/prefab/排行榜他人.prefab.meta
0 → 100644
View file @
d2d92e18
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "816e734e-d8ca-49bc-be1e-8c23e023cdd5",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "排行榜他人"
}
}
assets/Bundles/MainGame/prefab/排行榜自己.prefab
0 → 100644
View file @
d2d92e18
[
{
"__type__": "cc.Prefab",
"_name": "排行榜自己",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "排行榜自己",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 8
}
],
"_active": true,
"_components": [
{
"__id__": 14
},
{
"__id__": 16
},
{
"__id__": 18
}
],
"_prefab": {
"__id__": 20
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -220,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "rank",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
},
{
"__id__": 5
}
],
"_prefab": {
"__id__": 7
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 14,
"y": -20,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 4
},
"_contentSize": {
"__type__": "cc.Size",
"width": 9.77,
"height": 23
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8bUrMCxWlMTLSd91dV1ErQ"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 6
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_string": "1",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 22,
"_fontSize": 22,
"_fontFamily": "Arial",
"_lineHeight": 22,
"_overflow": 0,
"_enableWrapText": true,
"_font": {
"__uuid__": "51c12289-a516-4991-8323-ac98cee8b520",
"__expectedType__": "cc.TTFFont"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_isItalic": false,
"_isBold": true,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 2,
"_enableOutline": true,
"_outlineColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_outlineWidth": 0.5,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "83JFgtWhhPp65JtsWzacKf"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "71R0DHp6VKMZneDgj0W3GG",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "nick",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 9
},
{
"__id__": 11
}
],
"_prefab": {
"__id__": 13
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 45,
"y": -20,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 8
},
"_enabled": true,
"__prefab": {
"__id__": 10
},
"_contentSize": {
"__type__": "cc.Size",
"width": 22,
"height": 27.72
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "64r5xR0opEzLEEpgUaVudJ"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 8
},
"_enabled": true,
"__prefab": {
"__id__": 12
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_string": "我",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 22,
"_fontSize": 22,
"_fontFamily": "Arial",
"_lineHeight": 22,
"_overflow": 0,
"_enableWrapText": true,
"_font": {
"__uuid__": "51c12289-a516-4991-8323-ac98cee8b520",
"__expectedType__": "cc.TTFFont"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_isItalic": false,
"_isBold": true,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 1,
"_enableOutline": false,
"_outlineColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_outlineWidth": 2,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "449Y3xNt5MtrSbfOYNf0tg"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "44tiUwt4xB1pgR+8oBeVzG",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 15
},
"_contentSize": {
"__type__": "cc.Size",
"width": 200,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 1
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "abyW/EFwNF/YUtdBtjoBue"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 17
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "5cf6ec7d-518e-445a-8b30-81fc930c2ba4@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": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "74Nh0ih2hHtrQISSenhjB+"
},
{
"__type__": "cc.UIOpacity",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 19
},
"_opacity": 255,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "6a3GsGVhVK5brHHaMFhOqv"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "49A5rcXXVEt7bJwMc/vvkp",
"instance": null,
"targetOverrides": null
}
]
\ No newline at end of file
assets/Bundles/MainGame/prefab/排行榜自己.prefab.meta
0 → 100644
View file @
d2d92e18
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "279fb523-a195-4d19-9e7c-1a05f1af2c6b",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "排行榜自己"
}
}
assets/Scripts/Scenes/MainGame/AISnake.ts
View file @
d2d92e18
...
...
@@ -57,7 +57,7 @@ export class AISnake extends Snake {
// 碰到其他蛇身
// this.setAngle(this.head.angle + 180);
// this.isFast = true;
this
.
setState
(
AIState
.
ESCAPING
,
otherCollider
.
node
.
parent
.
getComponent
(
Snake
));
this
.
setState
(
AIState
.
ESCAPING
,
otherCollider
.
node
?.
parent
?
.
getComponent
(
Snake
));
}
}
...
...
@@ -68,7 +68,7 @@ export class AISnake extends Snake {
aiPool
.
put
(
this
.
node
);
MainGame
.
ins
.
initA
nimal
(
1
);
MainGame
.
ins
.
initA
iSnake
(
this
.
nickName
,
this
.
tag
);
}
private
get
difficultyParams
()
{
...
...
assets/Scripts/Scenes/MainGame/Components/Rank.ts
0 → 100644
View file @
d2d92e18
import
{
_decorator
,
Component
,
v3
,
instantiate
,
Label
,
math
,
Node
,
Prefab
,
tween
,
UIOpacity
}
from
"cc"
;
import
{
MainGame
}
from
"../MainGame"
;
import
{
Snake
}
from
"../Snake"
;
const
{
ccclass
,
property
}
=
_decorator
;
@
ccclass
(
"Rank"
)
export
class
Rank
extends
Component
{
@
property
(
Prefab
)
otherRankPrefab
:
Prefab
;
@
property
(
Prefab
)
selfRankPrefab
:
Prefab
;
@
property
(
Node
)
selfNode
:
Node
;
nodeMap
=
new
Map
<
number
,
Node
>
();
start
()
{
this
.
nodeMap
.
set
(
MainGame
.
ins
.
player
.
tag
,
this
.
selfNode
);
this
.
schedule
(()
=>
{
this
.
updateRank
();
},
1
);
}
updateRank
()
{
const
snakes
=
MainGame
.
ins
.
animalNode
.
children
.
map
((
snakeNode
)
=>
{
const
snake
=
snakeNode
.
getComponent
(
Snake
);
if
(
!
this
.
nodeMap
.
has
(
snake
.
tag
))
{
const
node
=
instantiate
(
this
.
otherRankPrefab
);
node
.
position
.
set
(
0
,
-
220
-
44
);
node
.
getComponent
(
UIOpacity
).
opacity
=
0
;
node
.
getChildByName
(
"nick"
).
getComponent
(
Label
).
string
=
snake
.
nickName
;
this
.
node
.
addChild
(
node
);
this
.
nodeMap
.
set
(
snake
.
tag
,
node
);
}
return
snake
;
});
snakes
.
push
(
MainGame
.
ins
.
player
);
snakes
.
sort
((
a
,
b
)
=>
{
return
b
.
length
-
a
.
length
;
});
const
playerIndex
=
snakes
.
indexOf
(
MainGame
.
ins
.
player
);
for
(
let
i
=
0
;
i
<
snakes
.
length
;
i
++
)
{
const
node
=
this
.
nodeMap
.
get
(
snakes
[
i
].
tag
);
node
.
getChildByName
(
"rank"
).
getComponent
(
Label
).
string
=
`
${
i
+
1
}
`
;
let
rankIndex
=
i
;
if
(
i
==
playerIndex
)
{
rankIndex
=
Math
.
min
(
rankIndex
,
5
);
}
else
if
(
playerIndex
>
5
&&
rankIndex
>=
5
)
{
rankIndex
=
7
;
}
tween
(
node
)
.
to
(
0.288
,
{
position
:
v3
(
0
,
-
44
*
rankIndex
,
0
)
})
.
start
();
tween
(
node
.
getComponent
(
UIOpacity
))
.
to
(
0.288
,
{
opacity
:
rankIndex
>
5
?
0
:
255
})
.
start
();
}
}
update
(
deltaTime
:
number
)
{
}
}
assets/Scripts/Scenes/MainGame/Components/Rank.ts.meta
0 → 100644
View file @
d2d92e18
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "98e42767-981a-4465-babd-59db437eb4b9",
"files": [],
"subMetas": {},
"userData": {}
}
assets/Scripts/Scenes/MainGame/MainGame.ts
View file @
d2d92e18
...
...
@@ -52,7 +52,7 @@ export class MainGame extends Scene {
@
property
({
type
:
FastBtn
,
displayName
:
"快进按钮"
})
private
fastBtn
:
FastBtn
=
null
;
@
property
(
UITransform
)
private
uiBg
:
UITransform
=
null
;
@
property
(
Node
)
private
uiBg
:
Node
=
null
;
@
property
(
Player
)
player
:
Player
=
null
;
...
...
@@ -106,25 +106,8 @@ export class MainGame extends Scene {
// EPhysics2DDrawFlags.Joint |
// EPhysics2DDrawFlags.Shape;
Global
.
MAP_WIDTH
=
this
.
uiBg
.
contentSize
.
x
;
Global
.
MAP_HEIGHT
=
this
.
uiBg
.
contentSize
.
y
;
// 初始化墙壁
const
wallTop
=
this
.
uiBg
.
node
.
getChildByName
(
"WALL_TOP"
);
wallTop
.
setPosition
(
0
,
Global
.
MAP_HEIGHT
/
2
);
wallTop
.
getComponent
(
UITransform
).
width
=
Global
.
MAP_WIDTH
;
const
wallBottom
=
this
.
uiBg
.
node
.
getChildByName
(
"WALL_BOTTOM"
);
wallBottom
.
setPosition
(
0
,
-
Global
.
MAP_HEIGHT
/
2
);
wallBottom
.
getComponent
(
UITransform
).
width
=
Global
.
MAP_WIDTH
;
const
wallLeft
=
this
.
uiBg
.
node
.
getChildByName
(
"WALL_LEFT"
);
wallLeft
.
setPosition
(
-
Global
.
MAP_WIDTH
/
2
,
0
);
wallLeft
.
getComponent
(
UITransform
).
height
=
Global
.
MAP_HEIGHT
;
const
wallRight
=
this
.
uiBg
.
node
.
getChildByName
(
"WALL_RIGHT"
);
wallRight
.
setPosition
(
Global
.
MAP_WIDTH
/
2
,
0
);
wallRight
.
getComponent
(
UITransform
).
height
=
Global
.
MAP_HEIGHT
;
this
.
uiBg
.
getComponent
(
UITransform
)
.
setContentSize
(
Global
.
MAP_WIDTH
,
Global
.
MAP_HEIGHT
);
this
.
player
.
init
({
// initEnergy: 10000
...
...
@@ -246,28 +229,30 @@ export class MainGame extends Scene {
console
.
log
(
"showGOver"
,
this
.
player
.
getSnakeLen
());
}
async
initAnimal
(
count
:
number
)
{
initAiSnake
(
nickName
?:
string
,
tag
?:
number
)
{
const
node
=
aiPool
.
get
()
||
instantiate
(
this
.
animalPrefab
);
const
x
=
math
.
randomRangeInt
(
-
(
Global
.
MAP_WIDTH
/
2
-
50
),
Global
.
MAP_WIDTH
/
2
-
50
);
const
y
=
math
.
randomRangeInt
(
-
(
Global
.
MAP_HEIGHT
/
2
-
50
),
Global
.
MAP_HEIGHT
/
2
-
50
);
node
.
getComponent
(
AISnake
)?.
init
({
nickName
:
nickName
,
tag
:
tag
,
x
,
y
,
// x: 50,
// y: 50,
// bodyCount: 100,
angle
:
math
.
randomRangeInt
(
0
,
360
),
skinName
:
"s0"
,
});
this
.
animalNode
.
addChild
(
node
);
}
async
initAnimal
(
count
:
number
)
{
const
nickArr
=
useNick
(
count
);
const
initItem
=
(
index
:
number
)
=>
{
const
node
=
aiPool
.
get
()
||
instantiate
(
this
.
animalPrefab
);
const
x
=
math
.
randomRangeInt
(
-
(
Global
.
MAP_WIDTH
/
2
-
50
),
Global
.
MAP_WIDTH
/
2
-
50
);
const
y
=
math
.
randomRangeInt
(
-
(
Global
.
MAP_HEIGHT
/
2
-
50
),
Global
.
MAP_HEIGHT
/
2
-
50
);
node
.
getComponent
(
AISnake
)?.
init
({
nickName
:
nickArr
[
index
],
x
,
y
,
// x: 50,
// y: 50,
// bodyCount: 100,
angle
:
math
.
randomRangeInt
(
0
,
360
),
skinName
:
"s0"
,
});
this
.
animalNode
.
addChild
(
node
);
this
.
initAiSnake
(
nickArr
[
index
]);
};
await
executePreFrame
(
getItemGenerator
(
count
,
initItem
),
1
,
this
);
}
...
...
assets/Scripts/Scenes/MainGame/Snake.ts
View file @
d2d92e18
...
...
@@ -32,6 +32,7 @@ export interface IInitConfig {
scale
?:
number
;
bodyCount
?:
number
;
initEnergy
?:
number
,
tag
?:
number
;
}
@
ccclass
(
"Snake"
)
...
...
@@ -59,7 +60,7 @@ export class Snake extends Component {
private
scale
:
number
=
0.2
;
speed
:
number
=
300
;
private
energy
:
number
=
0
;
protected
tag
:
number
=
0
;
tag
:
number
=
0
;
// 位置相关
private
ready
:
boolean
=
false
;
...
...
@@ -88,6 +89,7 @@ export class Snake extends Component {
x
=
0
,
y
=
0
,
angle
=
0
,
scale
=
0.5
,
skinName
=
"default"
,
initEnergy
=
5
,
tag
=
Snake
.
getTag
(),
}
=
config
;
this
.
nickName
=
nickName
;
...
...
@@ -98,7 +100,7 @@ export class Snake extends Component {
this
.
energy
=
0
;
this
.
bodyArr
=
[];
this
.
scale
=
scale
;
this
.
tag
=
Snake
.
getTag
()
;
this
.
tag
=
tag
;
// 设置头部
this
.
head
.
angle
=
angle
;
...
...
assets/
Scripts/Scenes/
Test.meta
→
assets/Test.meta
View file @
d2d92e18
File moved
assets/
Scripts/Scenes/
Test/MainGame1.ts
→
assets/Test/MainGame1.ts
View file @
d2d92e18
File moved
assets/
Scripts/Scenes/
Test/MainGame1.ts.meta
→
assets/Test/MainGame1.ts.meta
View file @
d2d92e18
File moved
assets/
Scripts/Scenes/
Test/Snake1.ts
→
assets/Test/Snake1.ts
View file @
d2d92e18
File moved
assets/
Scripts/Scenes/
Test/Snake1.ts.meta
→
assets/Test/Snake1.ts.meta
View file @
d2d92e18
File moved
assets/
Bundles/MainGame/prefab
/SnakeNode.prefab
→
assets/
Test
/SnakeNode.prefab
View file @
d2d92e18
File moved
assets/
Bundles/MainGame/prefab
/SnakeNode.prefab.meta
→
assets/
Test
/SnakeNode.prefab.meta
View file @
d2d92e18
File moved
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