Commit 57192aa8 authored by haiyoucuv's avatar haiyoucuv

init

parent 2c3a3eef
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="JavaScriptLibraryMappings"> <component name="JavaScriptLibraryMappings">
<excludedPredefinedLibrary name="241106_YOGURT_Snake/extensions/duiba-publish/node_modules" /> <includedPredefinedLibrary name="Node.js Core" />
<excludedPredefinedLibrary name="241106_YOGURT_Snake/extensions/prefab-tab/node_modules" />
<excludedPredefinedLibrary name="241106_YOGURT_Snake/node_modules" /> <excludedPredefinedLibrary name="241106_YOGURT_Snake/node_modules" />
</component> </component>
</project> </project>
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "4575500b-29c2-444c-819b-86e44533b9f5",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "4575500b-29c2-444c-819b-86e44533b9f5@6c48a",
"displayName": "福袋@1x",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "4575500b-29c2-444c-819b-86e44533b9f5",
"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": "4575500b-29c2-444c-819b-86e44533b9f5@f9941",
"displayName": "福袋@1x",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 177,
"height": 66,
"rawWidth": 177,
"rawHeight": 66,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-88.5,
-33,
0,
88.5,
-33,
0,
-88.5,
33,
0,
88.5,
33,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
66,
177,
66,
0,
0,
177,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-88.5,
-33,
0
],
"maxPos": [
88.5,
33,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "4575500b-29c2-444c-819b-86e44533b9f5@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "4575500b-29c2-444c-819b-86e44533b9f5@6c48a"
}
}
...@@ -475,6 +475,7 @@ ...@@ -475,6 +475,7 @@
"__uuid__": "8c4f22c7-20c7-4868-88ea-dedb8004999f", "__uuid__": "8c4f22c7-20c7-4868-88ea-dedb8004999f",
"__expectedType__": "cc.Prefab" "__expectedType__": "cc.Prefab"
}, },
"difficulty": 4.6772417976120195,
"_id": "" "_id": ""
}, },
{ {
......
...@@ -115,10 +115,7 @@ ...@@ -115,10 +115,7 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": null,
"__uuid__": "5a57c4ce-88f6-4582-af09-4eff049952e0@da8cd",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0, "_type": 0,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 1, "_sizeMode": 1,
......
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
<key>aliases</key> <key>aliases</key>
<array/> <array/>
<key>spriteOffset</key> <key>spriteOffset</key>
<string>{0,1}</string> <string>{0,0}</string>
<key>spriteSize</key> <key>spriteSize</key>
<string>{100,101}</string> <string>{48,48}</string>
<key>spriteSourceSize</key> <key>spriteSourceSize</key>
<string>{100,103}</string> <string>{48,48}</string>
<key>textureRect</key> <key>textureRect</key>
<string>{{1,211},{100,101}}</string> <string>{{52,1},{48,48}}</string>
<key>textureRotated</key> <key>textureRotated</key>
<false/> <false/>
</dict> </dict>
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
<key>spriteOffset</key> <key>spriteOffset</key>
<string>{0,0}</string> <string>{0,0}</string>
<key>spriteSize</key> <key>spriteSize</key>
<string>{100,103}</string> <string>{48,48}</string>
<key>spriteSourceSize</key> <key>spriteSourceSize</key>
<string>{100,103}</string> <string>{48,48}</string>
<key>textureRect</key> <key>textureRect</key>
<string>{{1,1},{100,103}}</string> <string>{{102,1},{48,48}}</string>
<key>textureRotated</key> <key>textureRotated</key>
<false/> <false/>
</dict> </dict>
...@@ -41,13 +41,13 @@ ...@@ -41,13 +41,13 @@
<key>spriteOffset</key> <key>spriteOffset</key>
<string>{0,0}</string> <string>{0,0}</string>
<key>spriteSize</key> <key>spriteSize</key>
<string>{103,100}</string> <string>{49,48}</string>
<key>spriteSourceSize</key> <key>spriteSourceSize</key>
<string>{103,100}</string> <string>{49,48}</string>
<key>textureRect</key> <key>textureRect</key>
<string>{{1,106},{103,100}}</string> <string>{{1,1},{49,48}}</string>
<key>textureRotated</key> <key>textureRotated</key>
<true/> <false/>
</dict> </dict>
</dict> </dict>
<key>metadata</key> <key>metadata</key>
...@@ -59,11 +59,11 @@ ...@@ -59,11 +59,11 @@
<key>premultiplyAlpha</key> <key>premultiplyAlpha</key>
<false/> <false/>
<key>realTextureFileName</key> <key>realTextureFileName</key>
<string>default.png</string> <string>s0.png</string>
<key>size</key> <key>size</key>
<string>{102,313}</string> <string>{151,50}</string>
<key>smartupdate</key> <key>smartupdate</key>
<string>$TexturePacker:SmartUpdate:e0a7963ab6250bee46680d49eb7b1ca1:156dc7ba41f81cd1436f4ce3a9b505a3:d258758acfd7c2dc4f771a427c5ecb8e$</string> <string>$TexturePacker:SmartUpdate:52b036f600402527de4bd054b8420b69:28f84fb7e8d0519a40a1e5c109cc7e51:56fdd6e86510a688ac97d2b194699cec$</string>
<key>textureFileName</key> <key>textureFileName</key>
<string>s0.png</string> <string>s0.png</string>
</dict> </dict>
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
"ver": "1.0.8", "ver": "1.0.8",
"importer": "sprite-atlas", "importer": "sprite-atlas",
"imported": true, "imported": true,
"uuid": "bb73f165-0a4d-4a48-be3f-9c6b6eb01e04", "uuid": "33125bd5-38b3-46ef-8f30-179db7b935fc",
"files": [ "files": [
".json" ".json"
], ],
"subMetas": { "subMetas": {
"da8cd": { "da8cd": {
"importer": "sprite-frame", "importer": "sprite-frame",
"uuid": "bb73f165-0a4d-4a48-be3f-9c6b6eb01e04@da8cd", "uuid": "33125bd5-38b3-46ef-8f30-179db7b935fc@da8cd",
"displayName": "", "displayName": "",
"id": "da8cd", "id": "da8cd",
"name": "body1", "name": "body1",
...@@ -18,13 +18,13 @@ ...@@ -18,13 +18,13 @@
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": 0, "offsetX": 0,
"offsetY": 1, "offsetY": 0,
"trimX": 1, "trimX": 52,
"trimY": 211, "trimY": 1,
"width": 100, "width": 48,
"height": 101, "height": 48,
"rawWidth": 100, "rawWidth": 48,
"rawHeight": 103, "rawHeight": 48,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
"maxPos": [] "maxPos": []
}, },
"isUuid": true, "isUuid": true,
"imageUuidOrDatabaseUri": "e58815ff-054a-4166-ada0-a9649a89a4f7@6c48a", "imageUuidOrDatabaseUri": "f31b7585-3af8-4e68-a122-45b0060400d7@6c48a",
"atlasUuid": "bb73f165-0a4d-4a48-be3f-9c6b6eb01e04" "atlasUuid": "33125bd5-38b3-46ef-8f30-179db7b935fc"
}, },
"ver": "1.0.12", "ver": "1.0.12",
"imported": true, "imported": true,
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
}, },
"7ca68": { "7ca68": {
"importer": "sprite-frame", "importer": "sprite-frame",
"uuid": "bb73f165-0a4d-4a48-be3f-9c6b6eb01e04@7ca68", "uuid": "33125bd5-38b3-46ef-8f30-179db7b935fc@7ca68",
"displayName": "", "displayName": "",
"id": "7ca68", "id": "7ca68",
"name": "body2", "name": "body2",
...@@ -65,12 +65,12 @@ ...@@ -65,12 +65,12 @@
"rotated": false, "rotated": false,
"offsetX": 0, "offsetX": 0,
"offsetY": 0, "offsetY": 0,
"trimX": 1, "trimX": 102,
"trimY": 1, "trimY": 1,
"width": 100, "width": 48,
"height": 103, "height": 48,
"rawWidth": 100, "rawWidth": 48,
"rawHeight": 103, "rawHeight": 48,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
...@@ -89,8 +89,8 @@ ...@@ -89,8 +89,8 @@
"maxPos": [] "maxPos": []
}, },
"isUuid": true, "isUuid": true,
"imageUuidOrDatabaseUri": "e58815ff-054a-4166-ada0-a9649a89a4f7@6c48a", "imageUuidOrDatabaseUri": "f31b7585-3af8-4e68-a122-45b0060400d7@6c48a",
"atlasUuid": "bb73f165-0a4d-4a48-be3f-9c6b6eb01e04" "atlasUuid": "33125bd5-38b3-46ef-8f30-179db7b935fc"
}, },
"ver": "1.0.12", "ver": "1.0.12",
"imported": true, "imported": true,
...@@ -101,22 +101,22 @@ ...@@ -101,22 +101,22 @@
}, },
"9296f": { "9296f": {
"importer": "sprite-frame", "importer": "sprite-frame",
"uuid": "bb73f165-0a4d-4a48-be3f-9c6b6eb01e04@9296f", "uuid": "33125bd5-38b3-46ef-8f30-179db7b935fc@9296f",
"displayName": "", "displayName": "",
"id": "9296f", "id": "9296f",
"name": "head", "name": "head",
"userData": { "userData": {
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": true, "rotated": false,
"offsetX": 0, "offsetX": 0,
"offsetY": 0, "offsetY": 0,
"trimX": 1, "trimX": 1,
"trimY": 106, "trimY": 1,
"width": 103, "width": 49,
"height": 100, "height": 48,
"rawWidth": 103, "rawWidth": 49,
"rawHeight": 100, "rawHeight": 48,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
...@@ -135,8 +135,8 @@ ...@@ -135,8 +135,8 @@
"maxPos": [] "maxPos": []
}, },
"isUuid": true, "isUuid": true,
"imageUuidOrDatabaseUri": "e58815ff-054a-4166-ada0-a9649a89a4f7@6c48a", "imageUuidOrDatabaseUri": "f31b7585-3af8-4e68-a122-45b0060400d7@6c48a",
"atlasUuid": "bb73f165-0a4d-4a48-be3f-9c6b6eb01e04" "atlasUuid": "33125bd5-38b3-46ef-8f30-179db7b935fc"
}, },
"ver": "1.0.12", "ver": "1.0.12",
"imported": true, "imported": true,
...@@ -147,9 +147,9 @@ ...@@ -147,9 +147,9 @@
} }
}, },
"userData": { "userData": {
"atlasTextureName": "default.png", "atlasTextureName": "s0.png",
"format": 3, "format": 3,
"uuid": "bb73f165-0a4d-4a48-be3f-9c6b6eb01e04", "uuid": "33125bd5-38b3-46ef-8f30-179db7b935fc",
"textureUuid": "e58815ff-054a-4166-ada0-a9649a89a4f7@6c48a" "textureUuid": "f31b7585-3af8-4e68-a122-45b0060400d7@6c48a"
} }
} }
assets/Bundles/MainGame/skin/s0.png

16.3 KB | W: | H:

assets/Bundles/MainGame/skin/s0.png

6.65 KB | W: | H:

assets/Bundles/MainGame/skin/s0.png
assets/Bundles/MainGame/skin/s0.png
assets/Bundles/MainGame/skin/s0.png
assets/Bundles/MainGame/skin/s0.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"ver": "1.0.27", "ver": "1.0.27",
"importer": "image", "importer": "image",
"imported": true, "imported": true,
"uuid": "43c59b6a-9114-43aa-819f-e9e86aa3a0b0", "uuid": "f31b7585-3af8-4e68-a122-45b0060400d7",
"files": [ "files": [
".json", ".json",
".png" ".png"
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
"subMetas": { "subMetas": {
"6c48a": { "6c48a": {
"importer": "texture", "importer": "texture",
"uuid": "43c59b6a-9114-43aa-819f-e9e86aa3a0b0@6c48a", "uuid": "f31b7585-3af8-4e68-a122-45b0060400d7@6c48a",
"displayName": "s0", "displayName": "s0",
"id": "6c48a", "id": "6c48a",
"name": "texture", "name": "texture",
"userData": { "userData": {
"wrapModeS": "clamp-to-edge", "wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge", "wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "43c59b6a-9114-43aa-819f-e9e86aa3a0b0", "imageUuidOrDatabaseUri": "f31b7585-3af8-4e68-a122-45b0060400d7",
"isUuid": true, "isUuid": true,
"visible": false, "visible": false,
"minfilter": "linear", "minfilter": "linear",
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
}, },
"f9941": { "f9941": {
"importer": "sprite-frame", "importer": "sprite-frame",
"uuid": "43c59b6a-9114-43aa-819f-e9e86aa3a0b0@f9941", "uuid": "f31b7585-3af8-4e68-a122-45b0060400d7@f9941",
"displayName": "s0", "displayName": "s0",
"id": "f9941", "id": "f9941",
"name": "spriteFrame", "name": "spriteFrame",
...@@ -45,11 +45,11 @@ ...@@ -45,11 +45,11 @@
"offsetX": 0, "offsetX": 0,
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 2, "trimY": 0,
"width": 102, "width": 151,
"height": 309, "height": 50,
"rawWidth": 102, "rawWidth": 151,
"rawHeight": 313, "rawHeight": 50,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
...@@ -61,17 +61,17 @@ ...@@ -61,17 +61,17 @@
"meshType": 0, "meshType": 0,
"vertices": { "vertices": {
"rawPosition": [ "rawPosition": [
-51, -75.5,
-154.5, -25,
0, 0,
51, 75.5,
-154.5, -25,
0, 0,
-51, -75.5,
154.5, 25,
0, 0,
51, 75.5,
154.5, 25,
0 0
], ],
"indexes": [ "indexes": [
...@@ -84,37 +84,37 @@ ...@@ -84,37 +84,37 @@
], ],
"uv": [ "uv": [
0, 0,
311, 50,
102, 151,
311, 50,
0, 0,
2, 0,
102, 151,
2 0
], ],
"nuv": [ "nuv": [
0, 0,
0.006389776357827476, 0,
1, 1,
0.006389776357827476,
0, 0,
0.9936102236421726, 0,
1,
1, 1,
0.9936102236421726 1
], ],
"minPos": [ "minPos": [
-51, -75.5,
-154.5, -25,
0 0
], ],
"maxPos": [ "maxPos": [
51, 75.5,
154.5, 25,
0 0
] ]
}, },
"isUuid": true, "isUuid": true,
"imageUuidOrDatabaseUri": "43c59b6a-9114-43aa-819f-e9e86aa3a0b0@6c48a", "imageUuidOrDatabaseUri": "f31b7585-3af8-4e68-a122-45b0060400d7@6c48a",
"atlasUuid": "" "atlasUuid": ""
}, },
"ver": "1.0.12", "ver": "1.0.12",
...@@ -129,6 +129,6 @@ ...@@ -129,6 +129,6 @@
"type": "sprite-frame", "type": "sprite-frame",
"hasAlpha": true, "hasAlpha": true,
"fixAlphaTransparencyArtifacts": false, "fixAlphaTransparencyArtifacts": false,
"redirect": "43c59b6a-9114-43aa-819f-e9e86aa3a0b0@6c48a" "redirect": "f31b7585-3af8-4e68-a122-45b0060400d7@6c48a"
} }
} }
const aiNick = [
"微信昵称",
"秋淩",
"一到胃",
"久醉绕心弦",
"羁绊ж",
"余香",
"[旋木]",
"梦游者 🌙✨",
"温暖的光 🌞️",
"静谧时光 🕰️🌸",
"微风轻拂",
"岁月如歌 🎶",
"晨曦初露 🌅",
"时间总能抚平一切",
"夏槿",
"浅笑心柔",
"绝不服输",
"九北折",
"末凉残念浮生若梦",
"幸福已无缘",
"厌倦了吗",
"眼波传意",
"心医",
"温凉少女",
"蹲街守寂寞",
"暮凉",
"甜崽",
"寄居人",
"書冩時光",
"比忠",
"凝鹰",
"街角迷惘",
"等待圉鍢",
"奶坤o(≧v≦、o",
"28、三知你冷暖",
"少女心英雄梦",
"笑衬心酸",
"素手挽清风",
"眉间万般柔情",
"千里故人稀",
"爱上孤独",
"独闯女儿国",
"绳情",
"夏天的巴比伦狠美",
"斗魂如焚",
"别挽留",
"Soul(灵魂)",
"浮华",
"十三预见离别",
"低调的爆发",
"度忆",
"月下凄凉",
"傻孩子",
"赤光旅行",
"血狂暴者",
"转身未来",
"薄幸つ。",
"倾听心跳的旋律",
"捶死心动",
"只知→坚持",
"想有一个有你的家",
"菰单嚤迗轮",
"一十里桃花不如你",
"天会亮心会暖",
"春来赏花",
"携君以终年",
"冥幽",
"把刀藏进衣袖",
"萌翻你",
"还好有你在",
"笑脸如初",
"入玫瑰林",
"浪推晚风",
"浮生醉清风",
"放飞的风筝",
"现世安稳",
"殇ㄨ到此止",
"语过添情",
"帅炸宇宙",
"十里温柔",
"平安喜乐",
"浅笙",
"吧唧你一口",
"暮色兮凉城",
"醉熏君心丶",
"清酒",
"月光下的甜蜜",
"不再入戏",
"一腔孤勇",
"争取第一",
"隔岸观火",
"但却是唯一",
"南巷清风",
"明媚殇",
"月野兔",
"吃不饱",
"笨死的猪",
"妳是的陽光",
"不告而别",
"无人像你"
];
const usedNick = [];
export function useNick(num: number = 1) {
num = Math.max(num, 0);
const nickArr = [];
while (num > 0) {
if (aiNick.length <= 0) {
nickArr.push("微信昵称");
} else {
const index = Math.floor(Math.random() * aiNick.length);
const nick = aiNick.splice(index, 1)[0];
nickArr.push(nick);
usedNick.push(nick);
}
num--;
}
return nickArr;
}
\ No newline at end of file
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "2d3da53d-4bbe-48ab-b891-ecfcb9043463",
"files": [],
"subMetas": {},
"userData": {}
}
...@@ -22,6 +22,7 @@ import { AISnake } from "./AISnake"; ...@@ -22,6 +22,7 @@ import { AISnake } from "./AISnake";
import { Quadtree } from "./QuadTree/QuadTree"; import { Quadtree } from "./QuadTree/QuadTree";
import { QuadTreeNode } from "./QuadTree/QuadTreeNode"; import { QuadTreeNode } from "./QuadTree/QuadTreeNode";
import { aiPool, clearAllPool, foodPool } from "./Manager/CommonPool"; import { aiPool, clearAllPool, foodPool } from "./Manager/CommonPool";
import { useNick } from "./Common/AINick";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
...@@ -49,30 +50,21 @@ export class MainGame extends Scene { ...@@ -49,30 +50,21 @@ export class MainGame extends Scene {
@property({ type: Joystick, displayName: "摇杆" }) joystick: Joystick = null; @property({ type: Joystick, displayName: "摇杆" }) joystick: Joystick = null;
@property({ @property({ type: FastBtn, displayName: "快进按钮" }) private fastBtn: FastBtn = null;
type: FastBtn,
displayName: "快进按钮"
})
private fastBtn: FastBtn = null;
@property(UITransform) @property(UITransform) private uiBg: UITransform = null;
private uiBg: UITransform = null;
@property(Player) @property(Player) player: Player = null;
player: Player = null;
@property(FoodManger) @property(FoodManger) fondManger: FoodManger = null;
fondManger: FoodManger = null;
@property(Node) @property(Node) animalNode: Node = null;
animalNode: Node = null;
@property(Camera) @property(Camera) camera: Camera = null;
camera: Camera = null;
@property({ type: Label, group: "UI" }) killTxt: Label = null; @property({ type: Label, group: "UI" }) killTxt: Label = null;
@property({ type: Label, group: "UI" }) lengthTxt: Label = null; @property({ type: Label, group: "UI" }) lengthTxt: Label = null;
@property({ type: Label, group: "UI" }) luckyNum: Label = null;
private _killNum = 0; private _killNum = 0;
set killNum(n: number) { set killNum(n: number) {
...@@ -136,6 +128,8 @@ export class MainGame extends Scene { ...@@ -136,6 +128,8 @@ export class MainGame extends Scene {
this.player.init({ this.player.init({
// initEnergy: 10000 // initEnergy: 10000
nickName: "我",
// skinName: "s0",
}); });
// 初始化食物和NPC // 初始化食物和NPC
...@@ -252,25 +246,29 @@ export class MainGame extends Scene { ...@@ -252,25 +246,29 @@ export class MainGame extends Scene {
console.log("showGOver", this.player.getSnakeLen()); console.log("showGOver", this.player.getSnakeLen());
} }
initItem = (index: number) => { async initAnimal(count: 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({
x, y,
// x: 50,
// y: 50,
// bodyCount: 100,
angle: math.randomRangeInt(0, 360),
skinName: "default",
});
this.animalNode.addChild(node); 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);
async initAnimal(count: number) { node.getComponent(AISnake)?.init({
await executePreFrame(getItemGenerator(count, this.initItem), 1, this); nickName: nickArr[index],
x, y,
// x: 50,
// y: 50,
// bodyCount: 100,
angle: math.randomRangeInt(0, 360),
skinName: "s0",
});
this.animalNode.addChild(node);
};
await executePreFrame(getItemGenerator(count, initItem), 1, this);
} }
} }
\ No newline at end of file
...@@ -24,6 +24,7 @@ import { Food } from "./Props/Food"; ...@@ -24,6 +24,7 @@ import { Food } from "./Props/Food";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
export interface IInitConfig { export interface IInitConfig {
nickName: string,
x?: number; x?: number;
y?: number; y?: number;
angle?: number; angle?: number;
...@@ -37,6 +38,9 @@ export interface IInitConfig { ...@@ -37,6 +38,9 @@ export interface IInitConfig {
export class Snake extends Component { export class Snake extends Component {
static tag: number = 0; static tag: number = 0;
static getTag() {
return Snake.tag++;
}
// 属性装饰器 // 属性装饰器
@property({ type: Node, displayName: "头部" }) head: Node = null; @property({ type: Node, displayName: "头部" }) head: Node = null;
...@@ -60,6 +64,8 @@ export class Snake extends Component { ...@@ -60,6 +64,8 @@ export class Snake extends Component {
// 位置相关 // 位置相关
private ready: boolean = false; private ready: boolean = false;
nickName: string;
private _length: number = 0; private _length: number = 0;
get length() { get length() {
return this._length; return this._length;
...@@ -75,21 +81,24 @@ export class Snake extends Component { ...@@ -75,21 +81,24 @@ export class Snake extends Component {
} }
// 初始化方法 // 初始化方法
public async init(config: IInitConfig = {}) { public async init(config: IInitConfig) {
const { const {
nickName,
x = 0, y = 0, angle = 0, scale = 0.5, x = 0, y = 0, angle = 0, scale = 0.5,
skinName = "default", skinName = "default",
initEnergy = 5, initEnergy = 5,
} = config; } = config;
this.nickName = nickName;
await this.setSkin(skinName); await this.setSkin(skinName);
this.ready = false; this.ready = false;
this.energy = 0; this.energy = 0;
this.bodyArr = []; this.bodyArr = [];
this.scale = scale; this.scale = scale;
this.tag = Snake.tag++; this.tag = Snake.getTag();
// 设置头部 // 设置头部
this.head.angle = angle; this.head.angle = angle;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Cave Cruiser</title> <title>鸣鸣很忙</title>
<!--http://www.html5rocks.com/en/mobile/mobifying/--> <!--http://www.html5rocks.com/en/mobile/mobifying/-->
<meta name="viewport" <meta name="viewport"
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"@types/node": "^14.5.2", "@types/node": "^14.5.2",
"ali-oss": "^6.19.0", "ali-oss": "^6.19.0",
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
"jszip": "^3.10.1",
"progress": "^2.0.3", "progress": "^2.0.3",
"typescript": "^5.3.3" "typescript": "^5.3.3"
} }
...@@ -411,6 +412,11 @@ ...@@ -411,6 +412,11 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/immediate": {
"version": "3.0.6",
"resolved": "http://npm.dui88.com:80/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
},
"node_modules/inherits": { "node_modules/inherits": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "http://npm.dui88.com:80/inherits/-/inherits-2.0.4.tgz", "resolved": "http://npm.dui88.com:80/inherits/-/inherits-2.0.4.tgz",
...@@ -485,6 +491,25 @@ ...@@ -485,6 +491,25 @@
"integrity": "sha512-OYWlK0j+roh+eyaMROlNbS5cd5R25Y+IUpdl7cNdB8HNrkgwQzIS7L9MegxOiWNBj9dQhA/yAxiMwCC5mwNoBw==", "integrity": "sha512-OYWlK0j+roh+eyaMROlNbS5cd5R25Y+IUpdl7cNdB8HNrkgwQzIS7L9MegxOiWNBj9dQhA/yAxiMwCC5mwNoBw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/jszip": {
"version": "3.10.1",
"resolved": "http://npm.dui88.com:80/jszip/-/jszip-3.10.1.tgz",
"integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==",
"dependencies": {
"lie": "~3.3.0",
"pako": "~1.0.2",
"readable-stream": "~2.3.6",
"setimmediate": "^1.0.5"
}
},
"node_modules/lie": {
"version": "3.3.0",
"resolved": "http://npm.dui88.com:80/lie/-/lie-3.3.0.tgz",
"integrity": "sha1-3Pgt7lRfRgdNryAMfBxaCOD0D2o=",
"dependencies": {
"immediate": "~3.0.5"
}
},
"node_modules/lodash": { "node_modules/lodash": {
"version": "4.17.21", "version": "4.17.21",
"resolved": "http://npm.dui88.com:80/lodash/-/lodash-4.17.21.tgz", "resolved": "http://npm.dui88.com:80/lodash/-/lodash-4.17.21.tgz",
...@@ -608,6 +633,11 @@ ...@@ -608,6 +633,11 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/pako": {
"version": "1.0.11",
"resolved": "http://npm.dui88.com:80/pako/-/pako-1.0.11.tgz",
"integrity": "sha1-bJWZ00DVTf05RjgCUqNXBaa5kr8="
},
"node_modules/pause-stream": { "node_modules/pause-stream": {
"version": "0.0.11", "version": "0.0.11",
"resolved": "http://npm.dui88.com:80/pause-stream/-/pause-stream-0.0.11.tgz", "resolved": "http://npm.dui88.com:80/pause-stream/-/pause-stream-0.0.11.tgz",
...@@ -733,6 +763,11 @@ ...@@ -733,6 +763,11 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/setimmediate": {
"version": "1.0.5",
"resolved": "http://npm.dui88.com:80/setimmediate/-/setimmediate-1.0.5.tgz",
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
},
"node_modules/side-channel": { "node_modules/side-channel": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "http://npm.dui88.com:80/side-channel/-/side-channel-1.0.4.tgz", "resolved": "http://npm.dui88.com:80/side-channel/-/side-channel-1.0.4.tgz",
...@@ -1264,6 +1299,11 @@ ...@@ -1264,6 +1299,11 @@
"safer-buffer": ">= 2.1.2 < 3" "safer-buffer": ">= 2.1.2 < 3"
} }
}, },
"immediate": {
"version": "3.0.6",
"resolved": "http://npm.dui88.com:80/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
},
"inherits": { "inherits": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "http://npm.dui88.com:80/inherits/-/inherits-2.0.4.tgz", "resolved": "http://npm.dui88.com:80/inherits/-/inherits-2.0.4.tgz",
...@@ -1323,6 +1363,25 @@ ...@@ -1323,6 +1363,25 @@
"resolved": "http://npm.dui88.com:80/jstoxml/-/jstoxml-2.2.9.tgz", "resolved": "http://npm.dui88.com:80/jstoxml/-/jstoxml-2.2.9.tgz",
"integrity": "sha512-OYWlK0j+roh+eyaMROlNbS5cd5R25Y+IUpdl7cNdB8HNrkgwQzIS7L9MegxOiWNBj9dQhA/yAxiMwCC5mwNoBw==" "integrity": "sha512-OYWlK0j+roh+eyaMROlNbS5cd5R25Y+IUpdl7cNdB8HNrkgwQzIS7L9MegxOiWNBj9dQhA/yAxiMwCC5mwNoBw=="
}, },
"jszip": {
"version": "3.10.1",
"resolved": "http://npm.dui88.com:80/jszip/-/jszip-3.10.1.tgz",
"integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==",
"requires": {
"lie": "~3.3.0",
"pako": "~1.0.2",
"readable-stream": "~2.3.6",
"setimmediate": "^1.0.5"
}
},
"lie": {
"version": "3.3.0",
"resolved": "http://npm.dui88.com:80/lie/-/lie-3.3.0.tgz",
"integrity": "sha1-3Pgt7lRfRgdNryAMfBxaCOD0D2o=",
"requires": {
"immediate": "~3.0.5"
}
},
"lodash": { "lodash": {
"version": "4.17.21", "version": "4.17.21",
"resolved": "http://npm.dui88.com:80/lodash/-/lodash-4.17.21.tgz", "resolved": "http://npm.dui88.com:80/lodash/-/lodash-4.17.21.tgz",
...@@ -1401,6 +1460,11 @@ ...@@ -1401,6 +1460,11 @@
"minimist": "^1.1.0" "minimist": "^1.1.0"
} }
}, },
"pako": {
"version": "1.0.11",
"resolved": "http://npm.dui88.com:80/pako/-/pako-1.0.11.tgz",
"integrity": "sha1-bJWZ00DVTf05RjgCUqNXBaa5kr8="
},
"pause-stream": { "pause-stream": {
"version": "0.0.11", "version": "0.0.11",
"resolved": "http://npm.dui88.com:80/pause-stream/-/pause-stream-0.0.11.tgz", "resolved": "http://npm.dui88.com:80/pause-stream/-/pause-stream-0.0.11.tgz",
...@@ -1495,6 +1559,11 @@ ...@@ -1495,6 +1559,11 @@
"has-property-descriptors": "^1.0.1" "has-property-descriptors": "^1.0.1"
} }
}, },
"setimmediate": {
"version": "1.0.5",
"resolved": "http://npm.dui88.com:80/setimmediate/-/setimmediate-1.0.5.tgz",
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
},
"side-channel": { "side-channel": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "http://npm.dui88.com:80/side-channel/-/side-channel-1.0.4.tgz", "resolved": "http://npm.dui88.com:80/side-channel/-/side-channel-1.0.4.tgz",
......
...@@ -267,8 +267,8 @@ iconv-lite@^0.4.15: ...@@ -267,8 +267,8 @@ iconv-lite@^0.4.15:
immediate@~3.0.5: immediate@~3.0.5:
version "3.0.6" version "3.0.6"
resolved "https://registry.npmmirror.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" resolved "http://npm.dui88.com:80/immediate/-/immediate-3.0.6.tgz"
integrity sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ== integrity sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=
inherits@^2.0.1, inherits@~2.0.3: inherits@^2.0.1, inherits@~2.0.3:
version "2.0.4" version "2.0.4"
...@@ -330,7 +330,7 @@ jstoxml@^2.0.0: ...@@ -330,7 +330,7 @@ jstoxml@^2.0.0:
jszip@^3.10.1: jszip@^3.10.1:
version "3.10.1" version "3.10.1"
resolved "https://registry.npmmirror.com/jszip/-/jszip-3.10.1.tgz#34aee70eb18ea1faec2f589208a157d1feb091c2" resolved "http://npm.dui88.com:80/jszip/-/jszip-3.10.1.tgz"
integrity sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g== integrity sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==
dependencies: dependencies:
lie "~3.3.0" lie "~3.3.0"
...@@ -340,8 +340,8 @@ jszip@^3.10.1: ...@@ -340,8 +340,8 @@ jszip@^3.10.1:
lie@~3.3.0: lie@~3.3.0:
version "3.3.0" version "3.3.0"
resolved "https://registry.npmmirror.com/lie/-/lie-3.3.0.tgz#dcf82dee545f46074daf200c7c1c5a08e0f40f6a" resolved "http://npm.dui88.com:80/lie/-/lie-3.3.0.tgz"
integrity sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ== integrity sha1-3Pgt7lRfRgdNryAMfBxaCOD0D2o=
dependencies: dependencies:
immediate "~3.0.5" immediate "~3.0.5"
...@@ -372,6 +372,11 @@ mkdirp@^0.5.1: ...@@ -372,6 +372,11 @@ mkdirp@^0.5.1:
dependencies: dependencies:
minimist "^1.2.6" minimist "^1.2.6"
ms@^2.0.0:
version "2.1.3"
resolved "http://npm.dui88.com:80/ms/-/ms-2.1.3.tgz"
integrity sha1-V0yBOM4dK1hh8LRFedut1gxmFbI=
ms@2.0.0: ms@2.0.0:
version "2.0.0" version "2.0.0"
resolved "http://npm.dui88.com:80/ms/-/ms-2.0.0.tgz" resolved "http://npm.dui88.com:80/ms/-/ms-2.0.0.tgz"
...@@ -382,11 +387,6 @@ ms@2.1.2: ...@@ -382,11 +387,6 @@ ms@2.1.2:
resolved "http://npm.dui88.com:80/ms/-/ms-2.1.2.tgz" resolved "http://npm.dui88.com:80/ms/-/ms-2.1.2.tgz"
integrity sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk= integrity sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=
ms@^2.0.0:
version "2.1.3"
resolved "http://npm.dui88.com:80/ms/-/ms-2.1.3.tgz"
integrity sha1-V0yBOM4dK1hh8LRFedut1gxmFbI=
mz@^2.7.0: mz@^2.7.0:
version "2.7.0" version "2.7.0"
resolved "http://npm.dui88.com:80/mz/-/mz-2.7.0.tgz" resolved "http://npm.dui88.com:80/mz/-/mz-2.7.0.tgz"
...@@ -430,8 +430,8 @@ osx-release@^1.0.0: ...@@ -430,8 +430,8 @@ osx-release@^1.0.0:
pako@~1.0.2: pako@~1.0.2:
version "1.0.11" version "1.0.11"
resolved "https://registry.npmmirror.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" resolved "http://npm.dui88.com:80/pako/-/pako-1.0.11.tgz"
integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== integrity sha1-bJWZ00DVTf05RjgCUqNXBaa5kr8=
pause-stream@~0.0.11: pause-stream@~0.0.11:
version "0.0.11" version "0.0.11"
...@@ -523,8 +523,8 @@ set-function-length@^1.1.1: ...@@ -523,8 +523,8 @@ set-function-length@^1.1.1:
setimmediate@^1.0.5: setimmediate@^1.0.5:
version "1.0.5" version "1.0.5"
resolved "https://registry.npmmirror.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" resolved "http://npm.dui88.com:80/setimmediate/-/setimmediate-1.0.5.tgz"
integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA== integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=
side-channel@^1.0.4: side-channel@^1.0.4:
version "1.0.4" version "1.0.4"
......
This diff is collapsed.
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Cave Cruiser</title> <title>鸣鸣很忙</title>
<meta <meta
name="viewport" name="viewport"
content="width=device-width,user-scalable=no,initial-scale=1,minimum-scale=1,maximum-scale=1,minimal-ui=true" content="width=device-width,user-scalable=no,initial-scale=1,minimum-scale=1,maximum-scale=1,minimal-ui=true"
......
...@@ -26,3 +26,14 @@ mobx@^6.12.3: ...@@ -26,3 +26,14 @@ mobx@^6.12.3:
version "6.12.3" version "6.12.3"
resolved "http://npm.dui88.com:80/mobx/-/mobx-6.12.3.tgz" resolved "http://npm.dui88.com:80/mobx/-/mobx-6.12.3.tgz"
integrity sha512-c8NKkO4R2lShkSXZ2Ongj1ycjugjzFFo/UswHBnS62y07DMcTc9Rvo03/3nRyszIvwPNljlkd4S828zIBv/piw== integrity sha512-c8NKkO4R2lShkSXZ2Ongj1ycjugjzFFo/UswHBnS62y07DMcTc9Rvo03/3nRyszIvwPNljlkd4S828zIBv/piw==
node-xlsx@^0.24.0:
version "0.24.0"
resolved "https://registry.npmmirror.com/node-xlsx/-/node-xlsx-0.24.0.tgz#a6a365acb18ad37c66c2b254b6ebe0c22dc9dc6f"
integrity sha512-1olwK48XK9nXZsyH/FCltvGrQYvXXZuxVitxXXv2GIuRm51aBi1+5KwR4rWM4KeO61sFU+00913WLZTD+AcXEg==
dependencies:
xlsx "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz"
"xlsx@https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz":
version "0.20.2"
resolved "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz#0f64eeed3f1a46e64724620c3553f2dbd3cd2d7d"
[
"微信昵称",
"秋淩",
"一到胃",
"久醉绕心弦",
"羁绊ж",
"余香",
"[旋木]",
"梦游者 🌙✨",
"温暖的光 🌞️",
"静谧时光 🕰️🌸",
"微风轻拂",
"岁月如歌 🎶",
"晨曦初露 🌅",
"时间总能抚平一切",
"夏槿",
"浅笑心柔",
"绝不服输",
"九北折",
"末凉残念浮生若梦",
"幸福已无缘",
"厌倦了吗",
"眼波传意",
"心医",
"温凉少女",
"蹲街守寂寞",
"暮凉",
"甜崽",
"寄居人",
"書冩時光",
"比忠",
"凝鹰",
"街角迷惘",
"等待圉鍢",
"奶坤o(≧v≦、o",
"28、三知你冷暖",
"少女心英雄梦",
"笑衬心酸",
"素手挽清风",
"眉间万般柔情",
"千里故人稀",
"爱上孤独",
"独闯女儿国",
"绳情",
"夏天的巴比伦狠美",
"斗魂如焚",
"别挽留",
"Soul(灵魂)",
"浮华",
"十三预见离别",
"低调的爆发",
"度忆",
"月下凄凉",
"傻孩子",
"赤光旅行",
"血狂暴者",
"转身未来",
"薄幸つ。",
"倾听心跳的旋律",
"捶死心动",
"只知→坚持",
"想有一个有你的家",
"菰单嚤迗轮",
"一十里桃花不如你",
"天会亮心会暖",
"春来赏花",
"携君以终年",
"冥幽",
"把刀藏进衣袖",
"萌翻你",
"还好有你在",
"笑脸如初",
"入玫瑰林",
"浪推晚风",
"浮生醉清风",
"放飞的风筝",
"现世安稳",
"殇ㄨ到此止",
"语过添情",
"帅炸宇宙",
"十里温柔",
"平安喜乐",
"浅笙",
"吧唧你一口",
"暮色兮凉城",
"醉熏君心丶",
"清酒",
"月光下的甜蜜",
"不再入戏",
"一腔孤勇",
"争取第一",
"隔岸观火",
"但却是唯一",
"南巷清风",
"明媚殇",
"月野兔",
"吃不饱",
"笨死的猪",
"妳是的陽光",
"不告而别",
"无人像你"
]
\ No newline at end of file
import xlsx from "node-xlsx";
import * as fs from "fs";
const workSheetsFromFile = xlsx.parse(`游戏假昵称100个.xlsx`);
const nickArr = workSheetsFromFile[0].data.map((row)=>{
return row[0];
});
fs.writeFileSync("游戏昵称.json", JSON.stringify(nickArr, null, 4));
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