From 87d7bbf3b855d4a64ccd35ae6812a2b877508ac8 Mon Sep 17 00:00:00 2001 From: ruanwujing <1220792244@qq.com> Date: Fri, 2 Feb 2024 11:47:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8D=95=E9=9A=8F=E6=9C=BA=E5=9C=B0?= =?UTF-8?q?=E7=A9=B4=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/resources/scenes/drag.scene | 116 ++ assets/resources/scenes/drag.scene.meta | 2 +- assets/resources/scenes/randomCave.scene | 1415 +++++++++++++++++ assets/resources/scenes/randomCave.scene.meta | 11 + assets/resources/scenes/roundbox.scene.meta | 2 +- assets/resources/scenes/sdf2d.scene.meta | 2 +- .../resources/scenes/sdf2d_shapes.scene.meta | 2 +- assets/scripts/components/GPDrag.ts | 6 +- assets/scripts/randomCave.meta | 9 + .../scripts/randomCave/RandomCaveGenerator.ts | 48 + .../randomCave/RandomCaveGenerator.ts.meta | 9 + .../scripts/randomCave/randomCaveExample.ts | 49 + .../randomCave/randomCaveExample.ts.meta | 9 + 13 files changed, 1673 insertions(+), 7 deletions(-) create mode 100644 assets/resources/scenes/randomCave.scene create mode 100644 assets/resources/scenes/randomCave.scene.meta create mode 100644 assets/scripts/randomCave.meta create mode 100644 assets/scripts/randomCave/RandomCaveGenerator.ts create mode 100644 assets/scripts/randomCave/RandomCaveGenerator.ts.meta create mode 100644 assets/scripts/randomCave/randomCaveExample.ts create mode 100644 assets/scripts/randomCave/randomCaveExample.ts.meta diff --git a/assets/resources/scenes/drag.scene b/assets/resources/scenes/drag.scene index cc269c7..aac22de 100644 --- a/assets/resources/scenes/drag.scene +++ b/assets/resources/scenes/drag.scene @@ -484,6 +484,29 @@ "_isUnderline": false, "_underlineHeight": 2, "_cacheMode": 0, + "_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": "49Mt6u3ylAhIjwUjPL/7hO" }, { @@ -728,6 +751,29 @@ "_isUnderline": false, "_underlineHeight": 2, "_cacheMode": 0, + "_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": "28WdAu1Z5MH72mVIZBx9Zf" }, { @@ -972,6 +1018,29 @@ "_isUnderline": false, "_underlineHeight": 2, "_cacheMode": 0, + "_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": "3788BizyZKEKxXNzRYnqkE" }, { @@ -1219,6 +1288,29 @@ "_isUnderline": false, "_underlineHeight": 2, "_cacheMode": 0, + "_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": "adiMFX1khPFoPqgS1WlUy4" }, { @@ -1475,6 +1567,29 @@ "_isUnderline": false, "_underlineHeight": 2, "_cacheMode": 0, + "_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": "46OSFJAOlLa5icud6LYf4t" }, { @@ -2057,6 +2172,7 @@ "z": 0 }, "_distance": 0, + "_planeBias": 1, "_shadowColor": { "__type__": "cc.Color", "r": 76, diff --git a/assets/resources/scenes/drag.scene.meta b/assets/resources/scenes/drag.scene.meta index 014e3bf..cf04d6d 100644 --- a/assets/resources/scenes/drag.scene.meta +++ b/assets/resources/scenes/drag.scene.meta @@ -1,5 +1,5 @@ { - "ver": "1.1.49", + "ver": "1.1.50", "importer": "scene", "imported": true, "uuid": "3fd7ab19-8a50-470c-8dc7-0cd664f0fb5b", diff --git a/assets/resources/scenes/randomCave.scene b/assets/resources/scenes/randomCave.scene new file mode 100644 index 0000000..18131d1 --- /dev/null +++ b/assets/resources/scenes/randomCave.scene @@ -0,0 +1,1415 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "randomCave", + "_objFlags": 0, + "__editorExtras__": {}, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_name": "randomCave", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 5 + } + ], + "_active": true, + "_components": [], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "autoReleaseAssets": false, + "_globals": { + "__id__": 33 + }, + "_id": "310fd3ed-a1d3-4adb-8766-8b82bb6508c1" + }, + { + "__type__": "cc.Node", + "_name": "Main Light", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 3 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": -0.06397656665577071, + "y": -0.44608233363525845, + "z": -0.8239028751062036, + "w": -0.3436591377065261 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": -117.894, + "y": -194.909, + "z": 38.562 + }, + "_id": "c0y6F5f+pAvI805TdmxIjx" + }, + { + "__type__": "cc.DirectionalLight", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 250, + "b": 240, + "a": 255 + }, + "_useColorTemperature": false, + "_colorTemperature": 6550, + "_staticSettings": { + "__id__": 4 + }, + "_visibility": -325058561, + "_illuminanceHDR": 65000, + "_illuminance": 65000, + "_illuminanceLDR": 1.6927083333333335, + "_shadowEnabled": false, + "_shadowPcf": 0, + "_shadowBias": 0.00001, + "_shadowNormalBias": 0, + "_shadowSaturation": 1, + "_shadowDistance": 50, + "_shadowInvisibleOcclusionRange": 200, + "_csmLevel": 4, + "_csmLayerLambda": 0.75, + "_csmOptimizationMode": 2, + "_csmAdvancedOptions": false, + "_csmLayersTransition": false, + "_csmTransitionRange": 0.05, + "_shadowFixedArea": false, + "_shadowNear": 0.1, + "_shadowFar": 10, + "_shadowOrthoSize": 5, + "_id": "597uMYCbhEtJQc0ffJlcgA" + }, + { + "__type__": "cc.StaticLightSettings", + "_baked": false, + "_editorOnly": false, + "_castShadow": false + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 6 + }, + { + "__id__": 8 + }, + { + "__id__": 11 + }, + { + "__id__": 14 + }, + { + "__id__": 22 + } + ], + "_active": true, + "_components": [ + { + "__id__": 30 + }, + { + "__id__": 31 + }, + { + "__id__": 32 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 640, + "y": 360, + "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": "bd2aZNzhlGlINcgvSdFTlo" + }, + { + "__type__": "cc.Node", + "_name": "Camera", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 5 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 7 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 1000 + }, + "_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": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "b63IfTS2BKGqyy1792fN7o" + }, + { + "__type__": "cc.Camera", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 6 + }, + "_enabled": true, + "__prefab": null, + "_projection": 0, + "_priority": 1073741824, + "_fov": 45, + "_fovAxis": 0, + "_orthoHeight": 360, + "_near": 1, + "_far": 2000, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_depth": 1, + "_stencil": 0, + "_clearFlags": 6, + "_rect": { + "__type__": "cc.Rect", + "x": 0, + "y": 0, + "width": 1, + "height": 1 + }, + "_aperture": 19, + "_shutter": 7, + "_iso": 0, + "_screenScale": 1, + "_visibility": 41943040, + "_targetTexture": null, + "_postProcess": null, + "_usePostProcess": false, + "_cameraType": -1, + "_trackingType": 0, + "_id": "7ewZ13OXVJ6ZFMQbbC58h3" + }, + { + "__type__": "cc.Node", + "_name": "Node", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 5 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 9 + }, + { + "__id__": 10 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "89V+NZelpKvKn9cujkQ1Dx" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 8 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "5cQMLTdxxJ1JuP+XEBLRjw" + }, + { + "__type__": "4a0c2lgaKlCd6hiqUZG5Yo0", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 8 + }, + "_enabled": true, + "__prefab": null, + "cell": { + "__id__": 11 + }, + "_id": "41ABfm27lMBZUa8FTxvGKg" + }, + { + "__type__": "cc.Node", + "_name": "cell", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 5 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 12 + }, + { + "__id__": 13 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": -335.338, + "y": 267.488, + "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": "76DBATC7dPXKd8buyykWkE" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 11 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 10, + "height": 10 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "38FliiDjtH0rJP086h9JLL" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 11 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "dfjCi166FHh5ZRUXDKFscG" + }, + { + "__type__": "cc.Node", + "_name": "Button", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 5 + }, + "_children": [ + { + "__id__": 15 + } + ], + "_active": true, + "_components": [ + { + "__id__": 18 + }, + { + "__id__": 19 + }, + { + "__id__": 20 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -267.942, + "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": "efML0y/TNC+LR+RHhwBq17" + }, + { + "__type__": "cc.Node", + "_name": "Label", + "_objFlags": 512, + "__editorExtras__": {}, + "_parent": { + "__id__": 14 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 16 + }, + { + "__id__": 17 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "63MmqNG7NLt5aZ5LTzfBh7" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 15 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 40 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "63Zt1X+1ROT7bQIy+0bmkk" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 15 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_string": "初始化", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 20, + "_fontSize": 20, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 1, + "_enableWrapText": false, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_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": "cbx9x/2ntAgaXN5OfIg1cn" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 14 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 40 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "99yWKFKlFKA54judjSmgmG" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 14 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 1, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "19uqx+z1lJK45GjuItJGrm" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 14 + }, + "_enabled": true, + "__prefab": null, + "clickEvents": [ + { + "__id__": 21 + } + ], + "_interactable": true, + "_transition": 2, + "_normalColor": { + "__type__": "cc.Color", + "r": 214, + "g": 214, + "b": 214, + "a": 255 + }, + "_hoverColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "_pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_disabledColor": { + "__type__": "cc.Color", + "r": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_normalSprite": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_hoverSprite": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_pressedSprite": { + "__uuid__": "544e49d6-3f05-4fa8-9a9e-091f98fc2ce8@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_disabledSprite": { + "__uuid__": "951249e0-9f16-456d-8b85-a6ca954da16b@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_duration": 0.1, + "_zoomScale": 1.2, + "_target": { + "__id__": 14 + }, + "_id": "c8r2tauv9EravnyhKOf69V" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 8 + }, + "component": "", + "_componentId": "4a0c2lgaKlCd6hiqUZG5Yo0", + "handler": "randomInit", + "customEventData": "" + }, + { + "__type__": "cc.Node", + "_name": "Button-001", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 5 + }, + "_children": [ + { + "__id__": 23 + } + ], + "_active": true, + "_components": [ + { + "__id__": 26 + }, + { + "__id__": 27 + }, + { + "__id__": 28 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 130.622, + "y": -267.942, + "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": "3acqIZqOhC/II4VkEq6xSj" + }, + { + "__type__": "cc.Node", + "_name": "Label", + "_objFlags": 512, + "__editorExtras__": {}, + "_parent": { + "__id__": 22 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 24 + }, + { + "__id__": 25 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "b0OPpndxJM5Zp4zLrWIItt" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 23 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 40 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "ect/WOl7FGWKWo+ls67Ulp" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 23 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_string": "下一步", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 20, + "_fontSize": 20, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 1, + "_enableWrapText": false, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_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": "e7iRaGcd9CApsg0paJzxUk" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 22 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 40 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "d65efl+QBCZYIvMtQG3N3L" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 22 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 1, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "dd9gymht1HJ7LBtqy6bhnn" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 22 + }, + "_enabled": true, + "__prefab": null, + "clickEvents": [ + { + "__id__": 29 + } + ], + "_interactable": true, + "_transition": 2, + "_normalColor": { + "__type__": "cc.Color", + "r": 214, + "g": 214, + "b": 214, + "a": 255 + }, + "_hoverColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "_pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_disabledColor": { + "__type__": "cc.Color", + "r": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_normalSprite": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_hoverSprite": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_pressedSprite": { + "__uuid__": "544e49d6-3f05-4fa8-9a9e-091f98fc2ce8@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_disabledSprite": { + "__uuid__": "951249e0-9f16-456d-8b85-a6ca954da16b@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_duration": 0.1, + "_zoomScale": 1.2, + "_target": { + "__id__": 22 + }, + "_id": "2dXp+ilNlFA4FOfJDwtKgG" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 8 + }, + "component": "", + "_componentId": "4a0c2lgaKlCd6hiqUZG5Yo0", + "handler": "step", + "customEventData": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 5 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 1280, + "height": 720 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "d9j7TkY5VMAYk80EDCnOPt" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 5 + }, + "_enabled": true, + "__prefab": null, + "_cameraComponent": { + "__id__": 7 + }, + "_alignCanvasWithScreen": true, + "_id": "91owIOX9xMr4km7RXPG1l7" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 5 + }, + "_enabled": true, + "__prefab": null, + "_alignFlags": 45, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "baRK5bolxAF43x7kohFaR0" + }, + { + "__type__": "cc.SceneGlobals", + "ambient": { + "__id__": 34 + }, + "shadows": { + "__id__": 35 + }, + "_skybox": { + "__id__": 36 + }, + "fog": { + "__id__": 37 + }, + "octree": { + "__id__": 38 + }, + "skin": { + "__id__": 39 + }, + "lightProbeInfo": { + "__id__": 40 + }, + "postSettings": { + "__id__": 41 + }, + "bakedWithStationaryMainLight": false, + "bakedWithHighpLightmap": false + }, + { + "__type__": "cc.AmbientInfo", + "_skyColorHDR": { + "__type__": "cc.Vec4", + "x": 0.2, + "y": 0.5, + "z": 0.8, + "w": 0.520833125 + }, + "_skyColor": { + "__type__": "cc.Vec4", + "x": 0.2, + "y": 0.5, + "z": 0.8, + "w": 0.520833125 + }, + "_skyIllumHDR": 20000, + "_skyIllum": 20000, + "_groundAlbedoHDR": { + "__type__": "cc.Vec4", + "x": 0.2, + "y": 0.2, + "z": 0.2, + "w": 1 + }, + "_groundAlbedo": { + "__type__": "cc.Vec4", + "x": 0.2, + "y": 0.2, + "z": 0.2, + "w": 1 + }, + "_skyColorLDR": { + "__type__": "cc.Vec4", + "x": 0.452588, + "y": 0.607642, + "z": 0.755699, + "w": 0 + }, + "_skyIllumLDR": 0.8, + "_groundAlbedoLDR": { + "__type__": "cc.Vec4", + "x": 0.618555, + "y": 0.577848, + "z": 0.544564, + "w": 0 + } + }, + { + "__type__": "cc.ShadowsInfo", + "_enabled": false, + "_type": 0, + "_normal": { + "__type__": "cc.Vec3", + "x": 0, + "y": 1, + "z": 0 + }, + "_distance": 0, + "_planeBias": 1, + "_shadowColor": { + "__type__": "cc.Color", + "r": 76, + "g": 76, + "b": 76, + "a": 255 + }, + "_maxReceived": 4, + "_size": { + "__type__": "cc.Vec2", + "x": 1024, + "y": 1024 + } + }, + { + "__type__": "cc.SkyboxInfo", + "_envLightingType": 0, + "_envmapHDR": { + "__uuid__": "d032ac98-05e1-4090-88bb-eb640dcb5fc1@b47c0", + "__expectedType__": "cc.TextureCube" + }, + "_envmap": { + "__uuid__": "d032ac98-05e1-4090-88bb-eb640dcb5fc1@b47c0", + "__expectedType__": "cc.TextureCube" + }, + "_envmapLDR": { + "__uuid__": "6f01cf7f-81bf-4a7e-bd5d-0afc19696480@b47c0", + "__expectedType__": "cc.TextureCube" + }, + "_diffuseMapHDR": null, + "_diffuseMapLDR": null, + "_enabled": true, + "_useHDR": true, + "_editableMaterial": null, + "_reflectionHDR": null, + "_reflectionLDR": null, + "_rotationAngle": 0 + }, + { + "__type__": "cc.FogInfo", + "_type": 0, + "_fogColor": { + "__type__": "cc.Color", + "r": 200, + "g": 200, + "b": 200, + "a": 255 + }, + "_enabled": false, + "_fogDensity": 0.3, + "_fogStart": 0.5, + "_fogEnd": 300, + "_fogAtten": 5, + "_fogTop": 1.5, + "_fogRange": 1.2, + "_accurate": false + }, + { + "__type__": "cc.OctreeInfo", + "_enabled": false, + "_minPos": { + "__type__": "cc.Vec3", + "x": -1024, + "y": -1024, + "z": -1024 + }, + "_maxPos": { + "__type__": "cc.Vec3", + "x": 1024, + "y": 1024, + "z": 1024 + }, + "_depth": 8 + }, + { + "__type__": "cc.SkinInfo", + "_enabled": true, + "_blurRadius": 0.01, + "_sssIntensity": 3 + }, + { + "__type__": "cc.LightProbeInfo", + "_giScale": 1, + "_giSamples": 1024, + "_bounces": 2, + "_reduceRinging": 0, + "_showProbe": true, + "_showWireframe": true, + "_showConvex": false, + "_data": null, + "_lightProbeSphereVolume": 1 + }, + { + "__type__": "cc.PostSettingsInfo", + "_toneMappingType": 0 + } +] \ No newline at end of file diff --git a/assets/resources/scenes/randomCave.scene.meta b/assets/resources/scenes/randomCave.scene.meta new file mode 100644 index 0000000..0033d4c --- /dev/null +++ b/assets/resources/scenes/randomCave.scene.meta @@ -0,0 +1,11 @@ +{ + "ver": "1.1.50", + "importer": "scene", + "imported": true, + "uuid": "310fd3ed-a1d3-4adb-8766-8b82bb6508c1", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": {} +} diff --git a/assets/resources/scenes/roundbox.scene.meta b/assets/resources/scenes/roundbox.scene.meta index 7e3db06..48ebb9b 100644 --- a/assets/resources/scenes/roundbox.scene.meta +++ b/assets/resources/scenes/roundbox.scene.meta @@ -1,5 +1,5 @@ { - "ver": "1.1.49", + "ver": "1.1.50", "importer": "scene", "imported": true, "uuid": "64bd0402-59ce-4670-ae7d-24b450f09bb9", diff --git a/assets/resources/scenes/sdf2d.scene.meta b/assets/resources/scenes/sdf2d.scene.meta index 2573dce..9cfb753 100644 --- a/assets/resources/scenes/sdf2d.scene.meta +++ b/assets/resources/scenes/sdf2d.scene.meta @@ -1,5 +1,5 @@ { - "ver": "1.1.49", + "ver": "1.1.50", "importer": "scene", "imported": true, "uuid": "2d052f05-f3ae-4ade-a629-7dc0680a169b", diff --git a/assets/resources/scenes/sdf2d_shapes.scene.meta b/assets/resources/scenes/sdf2d_shapes.scene.meta index e8f69ea..05f3d3d 100644 --- a/assets/resources/scenes/sdf2d_shapes.scene.meta +++ b/assets/resources/scenes/sdf2d_shapes.scene.meta @@ -1,5 +1,5 @@ { - "ver": "1.1.49", + "ver": "1.1.50", "importer": "scene", "imported": true, "uuid": "d3d4c22a-8da8-4e57-94c4-1cfa29c09130", diff --git a/assets/scripts/components/GPDrag.ts b/assets/scripts/components/GPDrag.ts index 0c0bb98..38362d4 100644 --- a/assets/scripts/components/GPDrag.ts +++ b/assets/scripts/components/GPDrag.ts @@ -26,10 +26,10 @@ export enum EasingString { } @ccclass('GPDrag') export class GPDrag extends Component { - @property({type:CCBoolean, tooltip:"触碰点偏移量敏感"}) + @property({tooltip:"触碰点偏移量敏感"}) public touchOffsetSensitive = true - @property({type:CCBoolean, tooltip:"失败时回到起始位置"}) + @property({tooltip:"失败时回到起始位置"}) public backHomeWhenFailed = true @property({type:Enum(DragBackHomeType), tooltip:"回家的方式", visible:function(this){ @@ -56,7 +56,7 @@ export class GPDrag extends Component { }}) public topLayerNode:Node - @property({type:CCBoolean, tooltip:"松开后返回原来的层级", visible:function(){ + @property({tooltip:"松开后返回原来的层级", visible:function(){ return this.floatType != FloatType.None }}) public backToOriZ = true; diff --git a/assets/scripts/randomCave.meta b/assets/scripts/randomCave.meta new file mode 100644 index 0000000..b86bfb9 --- /dev/null +++ b/assets/scripts/randomCave.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "a7782b29-017e-412b-9975-3e3c4adc9caa", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/scripts/randomCave/RandomCaveGenerator.ts b/assets/scripts/randomCave/RandomCaveGenerator.ts new file mode 100644 index 0000000..f36cb5c --- /dev/null +++ b/assets/scripts/randomCave/RandomCaveGenerator.ts @@ -0,0 +1,48 @@ +import { _decorator, Component, Node } from 'cc'; +const { ccclass, property } = _decorator; + +export class RandomCaveGenerator { + public columns = 30 + public rows = 35 + public data:boolean[] = [] + private cache:boolean[] = [] + + public initRate = 0.5; + public init() { + for (let i = 0; i < this.columns * this.rows; i++) { + this.data[i] = Math.random() < this.initRate; + } + } + public isWall(c: number, r: number) { + let idx = c + r * this.columns + if (idx < 0 || idx >= this.columns * this.rows) + return true + return this.data[idx] + } + public count(c: number, r: number, n: number) { + let count = 0; + for (let i = -n; i <= n; i++) { + for (let j = -n; j <= n; j++) { + if (this.isWall(c + i, r + j)) { + count++ + } + } + } + return count + } + public setCache(c:number, r:number, b:boolean) { + this.cache[c + r * this.columns] = b; + } + public step() { + for (let c = 0; c < this.columns; c++) { + for (let r = 0; r < this.rows; r++) { + let count = this.count(c, r, 1) + let count2 = this.count(c, r, 2) + this.setCache(c, r, count >= 5 || count2 <= 2) + } + } + this.data = Array.from(this.cache) + } +} + + diff --git a/assets/scripts/randomCave/RandomCaveGenerator.ts.meta b/assets/scripts/randomCave/RandomCaveGenerator.ts.meta new file mode 100644 index 0000000..5790889 --- /dev/null +++ b/assets/scripts/randomCave/RandomCaveGenerator.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "e4eccc10-5bc2-4921-9ab7-69896f59e3bf", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/scripts/randomCave/randomCaveExample.ts b/assets/scripts/randomCave/randomCaveExample.ts new file mode 100644 index 0000000..49bcb21 --- /dev/null +++ b/assets/scripts/randomCave/randomCaveExample.ts @@ -0,0 +1,49 @@ +import { _decorator, Color, Component, instantiate, Node, Sprite, v3 } from 'cc'; +import { RandomCaveGenerator } from './RandomCaveGenerator'; +const { ccclass, property } = _decorator; + +@ccclass('randomCaveExample') +export class randomCaveExample extends Component { + @property({type:Node}) + public cell:Node + private generator = new RandomCaveGenerator() + private nodes:Node[] = [] + start() { + this.generator.init(); + let startX = -this.generator.columns / 2 * 10 + let startY = -this.generator.rows / 2 * 10 + for (let i = 0; i < this.generator.columns; i++) { + for (let j = 0; j < this.generator.rows; j++) { + let node = instantiate(this.cell); + this.node.addChild(node) + node.setPosition(v3(i * 10 + startX, j * 10 + startY, 0)) + if (this.generator.isWall(i, j)) + node.getComponent(Sprite).color = Color.GRAY + this.nodes[i + j * this.generator.rows] = node; + } + } + } + + public randomInit() { + this.generator.init(); + this.apply() + } + + public step() { + this.generator.step(); + this.apply() + } + private apply() { + let startX = -this.generator.columns / 2 * 10 + let startY = -this.generator.rows / 2 * 10 + for (let i = 0; i < this.generator.columns; i++) { + for (let j = 0; j < this.generator.rows; j++) { + let node = this.nodes[i + j * this.generator.rows] + node.setPosition(v3(i * 10 + startX, j * 10 + startY, 0)) + node.getComponent(Sprite).color = this.generator.isWall(i, j) ? Color.GRAY: Color.WHITE + } + } + } +} + + diff --git a/assets/scripts/randomCave/randomCaveExample.ts.meta b/assets/scripts/randomCave/randomCaveExample.ts.meta new file mode 100644 index 0000000..f4e526d --- /dev/null +++ b/assets/scripts/randomCave/randomCaveExample.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "4a0c2960-68a9-4277-a862-a94646e58a34", + "files": [], + "subMetas": {}, + "userData": {} +}