From 354c40bd9b15e0683f87e6b282270649c97b675c Mon Sep 17 00:00:00 2001 From: janing Date: Sun, 14 Dec 2025 22:41:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=9C=BA=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/assets/scenes.meta | 9 + client/assets/scenes/main.scene | 705 +++++++++++++++++++++++ client/assets/scenes/main.scene.meta | 11 + client/assets/scripts.meta | 9 + client/assets/scripts/App/AppStatus.meta | 9 + client/assets/scripts/Boot.meta | 9 + client/assets/scripts/Boot/Boot.ts | 81 +++ client/assets/scripts/Boot/Boot.ts.meta | 9 + 8 files changed, 842 insertions(+) create mode 100644 client/assets/scenes.meta create mode 100644 client/assets/scenes/main.scene create mode 100644 client/assets/scenes/main.scene.meta create mode 100644 client/assets/scripts.meta create mode 100644 client/assets/scripts/App/AppStatus.meta create mode 100644 client/assets/scripts/Boot.meta create mode 100644 client/assets/scripts/Boot/Boot.ts create mode 100644 client/assets/scripts/Boot/Boot.ts.meta diff --git a/client/assets/scenes.meta b/client/assets/scenes.meta new file mode 100644 index 0000000..abd7e1b --- /dev/null +++ b/client/assets/scenes.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "0c114b5d-84d5-4ae1-a491-6bfba7e77ce5", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/client/assets/scenes/main.scene b/client/assets/scenes/main.scene new file mode 100644 index 0000000..e68811b --- /dev/null +++ b/client/assets/scenes/main.scene @@ -0,0 +1,705 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "main", + "_objFlags": 0, + "__editorExtras__": {}, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_name": "main", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 5 + }, + { + "__id__": 7 + }, + { + "__id__": 8 + } + ], + "_active": true, + "_components": [], + "_prefab": { + "__id__": 14 + }, + "_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__": 15 + }, + "_id": "bfc16657-6cbe-4167-b6ba-2766e0864cf2" + }, + { + "__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": "Main Camera", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 6 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": -10, + "y": 10, + "z": 10 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": -0.27781593346944056, + "y": -0.36497167621709875, + "z": -0.11507512748638377, + "w": 0.8811195706053617 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": -35, + "y": -45, + "z": 0 + }, + "_id": "c9DMICJLFO5IeO07EPon7U" + }, + { + "__type__": "cc.Camera", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 5 + }, + "_enabled": true, + "__prefab": null, + "_projection": 1, + "_priority": 0, + "_fov": 45, + "_fovAxis": 0, + "_orthoHeight": 10, + "_near": 1, + "_far": 1000, + "_color": { + "__type__": "cc.Color", + "r": 51, + "g": 51, + "b": 51, + "a": 255 + }, + "_depth": 1, + "_stencil": 0, + "_clearFlags": 14, + "_rect": { + "__type__": "cc.Rect", + "x": 0, + "y": 0, + "width": 1, + "height": 1 + }, + "_aperture": 19, + "_shutter": 7, + "_iso": 0, + "_screenScale": 1, + "_visibility": 1074790400, + "_targetTexture": null, + "_postProcess": null, + "_usePostProcess": false, + "_cameraType": -1, + "_trackingType": 0, + "_id": "7dWQTpwS5LrIHnc1zAPUtf" + }, + { + "__type__": "cc.Node", + "_name": "Plane", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_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 + }, + "_id": "9emVSyd4FGs44YVqfPmIY0" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 9 + } + ], + "_active": true, + "_components": [ + { + "__id__": 11 + }, + { + "__id__": 12 + }, + { + "__id__": 13 + } + ], + "_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": "917ZNBP8lFl6QtL6HdUGVv" + }, + { + "__type__": "cc.Node", + "_name": "Camera", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 8 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 10 + } + ], + "_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": "b0QvhuM8VJLJqxUQvrm8nO" + }, + { + "__type__": "cc.Camera", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 9 + }, + "_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": "718x5Z5JlHJKQTU3SIPvlZ" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 8 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 1280, + "height": 720 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "f3E6tFsFtIOJjS3BX0pOPZ" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 8 + }, + "_enabled": true, + "__prefab": null, + "_cameraComponent": { + "__id__": 10 + }, + "_alignCanvasWithScreen": true, + "_id": "f88L9qlk9IaaDk9C04yl0H" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 8 + }, + "_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": "845MM0J/FB74UYhIeYO2+T" + }, + { + "__type__": "cc.PrefabInfo", + "root": null, + "asset": null, + "fileId": "bfc16657-6cbe-4167-b6ba-2766e0864cf2", + "instance": null, + "targetOverrides": [] + }, + { + "__type__": "cc.SceneGlobals", + "ambient": { + "__id__": 16 + }, + "shadows": { + "__id__": 17 + }, + "_skybox": { + "__id__": 18 + }, + "fog": { + "__id__": 19 + }, + "octree": { + "__id__": 20 + }, + "skin": { + "__id__": 21 + }, + "lightProbeInfo": { + "__id__": 22 + }, + "postSettings": { + "__id__": 23 + }, + "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/client/assets/scenes/main.scene.meta b/client/assets/scenes/main.scene.meta new file mode 100644 index 0000000..07e9b1f --- /dev/null +++ b/client/assets/scenes/main.scene.meta @@ -0,0 +1,11 @@ +{ + "ver": "1.1.50", + "importer": "scene", + "imported": true, + "uuid": "bfc16657-6cbe-4167-b6ba-2766e0864cf2", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": {} +} diff --git a/client/assets/scripts.meta b/client/assets/scripts.meta new file mode 100644 index 0000000..2d01fa2 --- /dev/null +++ b/client/assets/scripts.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "411a8b79-dfcf-4814-bee8-075f787510c8", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/client/assets/scripts/App/AppStatus.meta b/client/assets/scripts/App/AppStatus.meta new file mode 100644 index 0000000..9ebc927 --- /dev/null +++ b/client/assets/scripts/App/AppStatus.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "e9decc58-bdc5-45ad-b085-aabd2012b936", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/client/assets/scripts/Boot.meta b/client/assets/scripts/Boot.meta new file mode 100644 index 0000000..0b7261f --- /dev/null +++ b/client/assets/scripts/Boot.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "be7fbdee-0511-4b30-bcde-9b890c6121ea", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/client/assets/scripts/Boot/Boot.ts b/client/assets/scripts/Boot/Boot.ts new file mode 100644 index 0000000..35aef16 --- /dev/null +++ b/client/assets/scripts/Boot/Boot.ts @@ -0,0 +1,81 @@ +import { _decorator, Component } from 'cc'; +import { AppStatusManager } from '../App/AppStatus/AppStatusManager'; + +const { ccclass, property } = _decorator; + +/** + * Boot启动组件 + * + * 使用方法: + * 1. 在Cocos Creator中打开主场景(main.scene) + * 2. 创建一个空节点,命名为 "Boot" + * 3. 将此脚本挂载到Boot节点上 + * 4. 运行游戏,应用将自动启动 + * + * 职责: + * - 作为整个应用的入口点 + * - 初始化AppStatusManager + * - 启动应用状态流转 + * - 在每帧更新状态机 + */ +@ccclass('Boot') +export class Boot extends Component { + private _appStatusManager: AppStatusManager | null = null; + + /** + * 组件首次激活时调用 + */ + start() { + console.log("================================="); + console.log(" Cocos3.x Roguelike Game"); + console.log(" Boot Component Started"); + console.log("================================="); + + // 初始化并启动应用 + this.initApp(); + } + + /** + * 初始化应用 + */ + private initApp(): void { + console.log("[Boot] 初始化应用..."); + + try { + // 1. 获取AppStatusManager单例 + this._appStatusManager = AppStatusManager.getInstance(); + + // 2. 启动应用(从Boot状态开始) + this._appStatusManager.start(); + + console.log("[Boot] 应用启动成功"); + + } catch (error) { + console.error("[Boot] 应用启动失败:", error); + } + } + + /** + * 每帧更新 + * @param deltaTime 距离上一帧的时间增量(秒) + */ + update(deltaTime: number) { + // 更新应用状态机 + if (this._appStatusManager) { + this._appStatusManager.update(deltaTime); + } + } + + /** + * 组件销毁时调用 + */ + onDestroy() { + console.log("[Boot] 组件销毁"); + + // 销毁应用状态管理器 + if (this._appStatusManager) { + this._appStatusManager.destroy(); + this._appStatusManager = null; + } + } +} diff --git a/client/assets/scripts/Boot/Boot.ts.meta b/client/assets/scripts/Boot/Boot.ts.meta new file mode 100644 index 0000000..c952118 --- /dev/null +++ b/client/assets/scripts/Boot/Boot.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "324af443-86c7-4983-b726-c1ca5c603593", + "files": [], + "subMetas": {}, + "userData": {} +}