From f6947de396a89a6779d440a9beabe7a3650bd6ed Mon Sep 17 00:00:00 2001 From: xukuan Date: Fri, 7 Mar 2025 13:33:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=BA=E6=99=AF=E5=88=87=E6=8D=A2=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=BF=87=E6=B8=A1=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../level1/Script/WoodenManGame.ts | 6 +- .../level2/Script/CircularButton.ts | 21 +- .../module_arean/scripts/AreanLobbyScene.ts | 5 +- .../assets/module_basic/scene_loading.meta | 9 + .../scene_loading/LoadingScene.scene | 1139 +++++++++++++++++ .../scene_loading/LoadingScene.scene.meta | 1 + .../scene_loading/LoadingScene.ts | 52 + .../scene_loading/LoadingScene.ts.meta | 1 + .../module_basic/scene_lobby/lobby.scene | 178 ++- .../module_basic/scripts/FrontConfig.ts | 4 +- .../assets/module_basic/scripts/LobbyScene.ts | 2 +- .../assets/module_basic/scripts/UserMgr.ts | 33 +- tgx-games-client/assets/scripts/SceneDef.ts | 12 + .../slider_icontype_00_bot_fill_yellow2.png | Bin 0 -> 450 bytes ...ider_icontype_00_bot_fill_yellow2.png.meta | 134 ++ tgx-games-server/ecosystem.config.js | 8 +- 16 files changed, 1494 insertions(+), 111 deletions(-) create mode 100644 tgx-games-client/assets/module_basic/scene_loading.meta create mode 100644 tgx-games-client/assets/module_basic/scene_loading/LoadingScene.scene create mode 100644 tgx-games-client/assets/module_basic/scene_loading/LoadingScene.scene.meta create mode 100644 tgx-games-client/assets/module_basic/scene_loading/LoadingScene.ts create mode 100644 tgx-games-client/assets/module_basic/scene_loading/LoadingScene.ts.meta create mode 100644 tgx-games-client/assets/start/slider_icontype_00_bot_fill_yellow2.png create mode 100644 tgx-games-client/assets/start/slider_icontype_00_bot_fill_yellow2.png.meta diff --git a/tgx-games-client/assets/module_arean/level1/Script/WoodenManGame.ts b/tgx-games-client/assets/module_arean/level1/Script/WoodenManGame.ts index f4d5b6a..094f3b9 100644 --- a/tgx-games-client/assets/module_arean/level1/Script/WoodenManGame.ts +++ b/tgx-games-client/assets/module_arean/level1/Script/WoodenManGame.ts @@ -4,6 +4,7 @@ import { tgxAudioMgr } from 'db://assets/core_tgx/tgx'; import { ModuleDef } from 'db://assets/scripts/ModuleDef'; import { resLoader } from 'db://assets/core_tgx/base/utils/ResLoader'; import { EMusicDefine } from 'db://assets/module_basic/scripts/MusicDefine'; +import { SceneDef } from 'db://assets/scripts/SceneDef'; const { ccclass, property } = _decorator; @@ -438,7 +439,10 @@ export class WoodenManGame extends Component { n.getChildByPath("settlementNode/btnOK").on(Node.EventType.TOUCH_START, () => { if (isWin) { - director.loadScene("level2/scene/level2Scene"); + SceneDef.Next_Scene = "level2/scene/level2Scene"; + // 切换到加载场景 + director.loadScene('LoadingScene'); + // director.loadScene("level2/scene/level2Scene"); } else { director.loadScene("lobby_arean"); diff --git a/tgx-games-client/assets/module_arean/level2/Script/CircularButton.ts b/tgx-games-client/assets/module_arean/level2/Script/CircularButton.ts index 63b4287..8880a32 100644 --- a/tgx-games-client/assets/module_arean/level2/Script/CircularButton.ts +++ b/tgx-games-client/assets/module_arean/level2/Script/CircularButton.ts @@ -3,6 +3,7 @@ import { resLoader } from 'db://assets/core_tgx/base/utils/ResLoader'; import { tgxUIAlert } from 'db://assets/core_tgx/tgx'; import { ModuleDef } from 'db://assets/scripts/ModuleDef'; import { AreanNetMgr } from '../../scripts/AreanNetMgr'; +import { SceneDef } from 'db://assets/scripts/SceneDef'; const { ccclass, property } = _decorator; @ccclass('CircularButton') @@ -79,7 +80,10 @@ export class CircularButton extends Component { } changeGameScene() { - director.loadScene("BallScene"); + SceneDef.Next_Scene = "BallScene"; + // 切换到加载场景 + director.loadScene('LoadingScene'); + // director.loadScene("BallScene"); } @@ -186,7 +190,10 @@ export class CircularButton extends Component { n.getChildByPath("settlementNode/btnOK").on(Node.EventType.TOUCH_START, () => { if (isWin) { - director.loadScene("level3/scene/BallScene"); + SceneDef.Next_Scene = "level3/scene/BallScene"; + // 切换到加载场景 + director.loadScene('LoadingScene'); + // director.loadScene("level3/scene/BallScene"); } else { @@ -207,10 +214,16 @@ export class CircularButton extends Component { tween(this.node).delay(5).call(() => { var bundle = assetManager.getBundle('level3'); if (bundle) { - director.loadScene("scene/BallScene"); + SceneDef.Next_Scene = "scene/BallScene"; + // 切换到加载场景 + director.loadScene('LoadingScene'); + // director.loadScene("scene/BallScene"); } else { assetManager.loadBundle("level3", () => { - director.loadScene("scene/BallScene"); + SceneDef.Next_Scene = "scene/BallScene"; + // 切换到加载场景 + director.loadScene('LoadingScene'); + // director.loadScene("scene/BallScene"); }) } }).start(); diff --git a/tgx-games-client/assets/module_arean/scripts/AreanLobbyScene.ts b/tgx-games-client/assets/module_arean/scripts/AreanLobbyScene.ts index a9b5883..4feed2e 100644 --- a/tgx-games-client/assets/module_arean/scripts/AreanLobbyScene.ts +++ b/tgx-games-client/assets/module_arean/scripts/AreanLobbyScene.ts @@ -205,7 +205,10 @@ export class AreanLobbyScene extends Component { } private async loadGame(params?: any) { - director.loadScene("level1/scene/WoodenManScene"); + SceneDef.Next_Scene = "level1/scene/WoodenManScene"; + // 切换到加载场景 + director.loadScene('LoadingScene'); + // director.loadScene("level1/scene/WoodenManScene"); } onBtnCreate() { diff --git a/tgx-games-client/assets/module_basic/scene_loading.meta b/tgx-games-client/assets/module_basic/scene_loading.meta new file mode 100644 index 0000000..541e3bb --- /dev/null +++ b/tgx-games-client/assets/module_basic/scene_loading.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "e25e1a2c-bad2-4ec0-ab1a-bcf6b3d33622", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/tgx-games-client/assets/module_basic/scene_loading/LoadingScene.scene b/tgx-games-client/assets/module_basic/scene_loading/LoadingScene.scene new file mode 100644 index 0000000..2b8cdf2 --- /dev/null +++ b/tgx-games-client/assets/module_basic/scene_loading/LoadingScene.scene @@ -0,0 +1,1139 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "LoadingScene", + "_objFlags": 0, + "__editorExtras__": {}, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_name": "LoadingScene", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [ + { + "__id__": 2 + } + ], + "_active": true, + "_components": [], + "_prefab": { + "__id__": 27 + }, + "_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__": 28 + }, + "_id": "a6628ac9-af4b-40ce-aaed-e897cf04a52c" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + }, + { + "__id__": 5 + }, + { + "__id__": 10 + } + ], + "_active": true, + "_components": [ + { + "__id__": 23 + }, + { + "__id__": 24 + }, + { + "__id__": 25 + }, + { + "__id__": 26 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 375, + "y": 720, + "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": "c2Xj72kYdPI6aMzAEre7O6" + }, + { + "__type__": "cc.Node", + "_name": "Camera", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 4 + } + ], + "_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": "b6JT+7jDlK+rP48JbF0rjL" + }, + { + "__type__": "cc.Camera", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 3 + }, + "_enabled": true, + "__prefab": null, + "_projection": 0, + "_priority": 6553, + "_fov": 45, + "_fovAxis": 0, + "_orthoHeight": 720, + "_near": 1, + "_far": 2000, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_depth": 1, + "_stencil": 0, + "_clearFlags": 7, + "_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": "76KHZBsq1F7KB0g+SU7nPa" + }, + { + "__type__": "cc.Node", + "_name": "bg", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 6 + }, + { + "__id__": 7 + }, + { + "__id__": 8 + }, + { + "__id__": 9 + } + ], + "_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": "b8TI6VQE9LuqFv2d+iFNGv" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 5 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 749.9999999999998, + "height": 1440 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "39RNUC8NRMOrG1PGtyItzz" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 5 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "79a33ee6-ba55-4382-a18f-1a99a227d1ff@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": "6fdFqTuPFBu5N1cfHuoMFG" + }, + { + "__type__": "319759POytNIqL7hZiZjOI8", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 5 + }, + "_enabled": true, + "__prefab": null, + "_id": "fdVNDSNf9IO5SmiVaKC89J" + }, + { + "__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": 720, + "_originalHeight": 1607, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "964w08EWdE5owUuy4Mqndk" + }, + { + "__type__": "cc.Node", + "_name": "loading_bar", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [ + { + "__id__": 11 + }, + { + "__id__": 14 + }, + { + "__id__": 17 + } + ], + "_active": true, + "_components": [ + { + "__id__": 21 + }, + { + "__id__": 22 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -635.104, + "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": "adVeAZL3FMt6TXXjt191+y" + }, + { + "__type__": "cc.Node", + "_name": "loadingBar_bg", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 10 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 12 + }, + { + "__id__": 13 + } + ], + "_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": "63tqUWFRtEApEfeScoi1Gx" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 11 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 600, + "height": 33 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "97RibZd8hGT5kJSJSyImRG" + }, + { + "__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__": "e08cafbf-b86e-47ab-b600-61e59effb6e5@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": "f5RU9hOtRNJ6zrFP516V8T" + }, + { + "__type__": "cc.Node", + "_name": "loadingBar", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 10 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 15 + }, + { + "__id__": 16 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": -300, + "y": 2, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 0, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "abYkyUEXFHCrigi92BM8nP" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 14 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 600, + "height": 27 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0.5 + }, + "_id": "e0WHPMH+dJPr9Tl3PKu0YQ" + }, + { + "__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__": "587149a6-7237-43e5-8e91-144702008891@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": "8aFAOK0pdBsK+JH4lAuMMK" + }, + { + "__type__": "cc.Node", + "_name": "txt_loading", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 10 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 18 + }, + { + "__id__": 19 + }, + { + "__id__": 20 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 15.611999999999998, + "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": "c8sLlFnUZMbqVSccvPAxSO" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 17 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 171.34375, + "height": 54.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "e13BqRw/lMVJCQukGRGGDE" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 17 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "Loading...", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 35, + "_fontSize": 35, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 0, + "_enableWrapText": true, + "_font": { + "__uuid__": "f40babd5-d5a5-4df0-ae5c-6d5c04f6f25b", + "__expectedType__": "cc.TTFFont" + }, + "_isSystemFontUsed": false, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": true, + "_outlineColor": { + "__type__": "cc.Color", + "r": 31, + "g": 6, + "b": 31, + "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": "059MljtclJr4iE2mRgTzDb" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 17 + }, + "_enabled": true, + "__prefab": null, + "_alignFlags": 4, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 38.412, + "_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": "aev7i3Sg1HdbacpASbX2Oi" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 10 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "37tfBWrxVK84ogAMQlIAbd" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 10 + }, + "_enabled": true, + "__prefab": null, + "_alignFlags": 4, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 34.896000000000015, + "_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": "c8s4Vto4FBm42Rvyze1dK2" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 749.9999999999998, + "height": 1440 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "1cSuiSKIdL5KuKoxPSfQV0" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_cameraComponent": { + "__id__": 4 + }, + "_alignCanvasWithScreen": true, + "_id": "b1UjfMPBZENom5zTVaCs1u" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_alignFlags": 45, + "_target": null, + "_left": 1.1368683772161603e-13, + "_right": 1.1368683772161603e-13, + "_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": "e0VlJd/xxOebC0g7BegLq8" + }, + { + "__type__": "8bd3bZMHqlAoJB0rwKCBOiN", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "txtLoading": { + "__id__": 19 + }, + "loadingBar": { + "__id__": 14 + }, + "_id": "a4Da52YvVJqZP6mO6lA8xq" + }, + { + "__type__": "cc.PrefabInfo", + "root": null, + "asset": null, + "fileId": "9e293cde-e27b-4902-808b-e884f3e9da32", + "instance": null, + "targetOverrides": null + }, + { + "__type__": "cc.SceneGlobals", + "ambient": { + "__id__": 29 + }, + "shadows": { + "__id__": 30 + }, + "_skybox": { + "__id__": 31 + }, + "fog": { + "__id__": 32 + }, + "octree": { + "__id__": 33 + }, + "skin": { + "__id__": 34 + }, + "lightProbeInfo": { + "__id__": 35 + }, + "postSettings": { + "__id__": 36 + }, + "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": null, + "_envmap": null, + "_envmapLDR": null, + "_diffuseMapHDR": null, + "_diffuseMapLDR": null, + "_enabled": false, + "_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/tgx-games-client/assets/module_basic/scene_loading/LoadingScene.scene.meta b/tgx-games-client/assets/module_basic/scene_loading/LoadingScene.scene.meta new file mode 100644 index 0000000..93f18da --- /dev/null +++ b/tgx-games-client/assets/module_basic/scene_loading/LoadingScene.scene.meta @@ -0,0 +1 @@ +{"ver":"1.1.50","importer":"scene","imported":true,"uuid":"a6628ac9-af4b-40ce-aaed-e897cf04a52c","files":[".json"],"subMetas":{},"userData":{}} diff --git a/tgx-games-client/assets/module_basic/scene_loading/LoadingScene.ts b/tgx-games-client/assets/module_basic/scene_loading/LoadingScene.ts new file mode 100644 index 0000000..6d96567 --- /dev/null +++ b/tgx-games-client/assets/module_basic/scene_loading/LoadingScene.ts @@ -0,0 +1,52 @@ +import { _decorator, assetManager, Component, director, game, Label, Prefab, Node, profiler, Sprite } from 'cc'; + +import { PREVIEW } from 'cc/env'; +import { SceneDef } from '../../scripts/SceneDef'; +import { tgxSceneUtil } from '../../core_tgx/tgx'; + +const { ccclass, property } = _decorator; + +// ========== config begin ================= +//the first scene after preloading completes. + +const _loadingText = ['Loading.', 'Loading..', 'Loading...']; + +@ccclass('LoadingScene') +export class LoadingScene extends Component { + @property(Label) + txtLoading: Label; + + @property(Node) + loadingBar: Node; + + + start() { + // 初始化进度条和文本 + // this.loadingBar.fillRange = 0.5; + this.loadingBar.setScale(0, 1, 1) + this.txtLoading.string = 'Loading... 0%'; + this.loadTargetScene(); + } + + private loadTargetScene() { + let targetScene = SceneDef.Next_Scene; + console.log("要切换的场景 === ",targetScene); + let sceneName = typeof targetScene === 'string' ? targetScene : targetScene.name; + // 预加载目标场景 + director.preloadScene(sceneName, (completedCount, totalCount) => { + let progress = completedCount / totalCount; + // this.loadingBar.fillRange = progress; + this.loadingBar.setScale(progress, 1, 1); + this.txtLoading.string = `Loading... ${Math.floor(progress * 100)}%`; + }, async () => { + // 预加载完成后,切换到目标场景 + if(typeof targetScene === 'string'){ + director.loadScene(targetScene); + }else{ + await tgxSceneUtil.loadScene(targetScene) + } + }); + } +} + + diff --git a/tgx-games-client/assets/module_basic/scene_loading/LoadingScene.ts.meta b/tgx-games-client/assets/module_basic/scene_loading/LoadingScene.ts.meta new file mode 100644 index 0000000..ad836f0 --- /dev/null +++ b/tgx-games-client/assets/module_basic/scene_loading/LoadingScene.ts.meta @@ -0,0 +1 @@ +{"ver":"4.0.24","importer":"typescript","imported":true,"uuid":"8bd3b64c-1ea9-40a0-9074-af028204e88d","files":[],"subMetas":{},"userData":{}} diff --git a/tgx-games-client/assets/module_basic/scene_lobby/lobby.scene b/tgx-games-client/assets/module_basic/scene_lobby/lobby.scene index 0b104e7..1b5469b 100644 --- a/tgx-games-client/assets/module_basic/scene_lobby/lobby.scene +++ b/tgx-games-client/assets/module_basic/scene_lobby/lobby.scene @@ -98,7 +98,7 @@ "_prefab": null, "_lpos": { "__type__": "cc.Vec3", - "x": 375.00000000000006, + "x": 375, "y": 720, "z": 0 }, @@ -282,7 +282,7 @@ "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 750.0000000000001, + "width": 750, "height": 1440 }, "_anchorPoint": { @@ -438,22 +438,19 @@ "__id__": 12 }, { - "__id__": 15 + "__id__": 17 }, { - "__id__": 18 + "__id__": 20 } ], "_active": true, "_components": [ - { - "__id__": 22 - }, - { - "__id__": 23 - }, { "__id__": 24 + }, + { + "__id__": 25 } ], "_prefab": null, @@ -502,6 +499,9 @@ }, { "__id__": 14 + }, + { + "__id__": 15 } ], "_prefab": null, @@ -595,6 +595,70 @@ "_atlas": null, "_id": "a1wy0sN7BH+qI+Bz47IQnb" }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 12 + }, + "_enabled": true, + "__prefab": null, + "clickEvents": [ + { + "__id__": 16 + } + ], + "_interactable": true, + "_transition": 0, + "_normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "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": null, + "_hoverSprite": null, + "_pressedSprite": null, + "_disabledSprite": null, + "_duration": 0.1, + "_zoomScale": 1.2, + "_target": null, + "_id": "a5pcHyUhFLyqbGye3k76mN" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 2 + }, + "component": "", + "_componentId": "06d1dOr+4tPwJ3XDU/oibTv", + "handler": "onBtnSubGameClicked", + "customEventData": "arean" + }, { "__type__": "cc.Node", "_name": "btn_rectangle_01_n_red", @@ -607,10 +671,10 @@ "_active": true, "_components": [ { - "__id__": 16 + "__id__": 18 }, { - "__id__": 17 + "__id__": 19 } ], "_prefab": null, @@ -649,7 +713,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 15 + "__id__": 17 }, "_enabled": true, "__prefab": null, @@ -671,7 +735,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 15 + "__id__": 17 }, "_enabled": true, "__prefab": null, @@ -715,14 +779,14 @@ "_children": [], "_active": true, "_components": [ - { - "__id__": 19 - }, - { - "__id__": 20 - }, { "__id__": 21 + }, + { + "__id__": 22 + }, + { + "__id__": 23 } ], "_prefab": null, @@ -761,7 +825,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 18 + "__id__": 20 }, "_enabled": true, "__prefab": null, @@ -783,7 +847,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 18 + "__id__": 20 }, "_enabled": true, "__prefab": null, @@ -848,7 +912,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 18 + "__id__": 20 }, "_enabled": true, "__prefab": null, @@ -913,72 +977,6 @@ "_atlas": null, "_id": "d92CY6NoZOYb0fNb5GS8YJ" }, - { - "__type__": "cc.Button", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 11 - }, - "_enabled": true, - "__prefab": null, - "clickEvents": [ - { - "__id__": 25 - } - ], - "_interactable": true, - "_transition": 0, - "_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": null, - "_hoverSprite": null, - "_pressedSprite": null, - "_disabledSprite": null, - "_duration": 0.3, - "_zoomScale": 0.95, - "_target": { - "__id__": 11 - }, - "_id": "64YwGR+5JDB7GK84hPaAld" - }, - { - "__type__": "cc.ClickEvent", - "target": { - "__id__": 2 - }, - "component": "", - "_componentId": "06d1dOr+4tPwJ3XDU/oibTv", - "handler": "onBtnSubGameClicked", - "customEventData": "arean" - }, { "__type__": "cc.UITransform", "_name": "", @@ -1187,7 +1185,7 @@ "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 750.0000000000001, + "width": 750, "height": 1440 }, "_anchorPoint": { diff --git a/tgx-games-client/assets/module_basic/scripts/FrontConfig.ts b/tgx-games-client/assets/module_basic/scripts/FrontConfig.ts index ed844e0..1f9148a 100644 --- a/tgx-games-client/assets/module_basic/scripts/FrontConfig.ts +++ b/tgx-games-client/assets/module_basic/scripts/FrontConfig.ts @@ -15,7 +15,7 @@ export const GameServerListFileURL = ""; //'http://192.168.0.104:7456/web-mobile */ export const GameServerURLs = [ // 'wss://chengchennet.cn:15005',//wss远程链接 - "ws://150.158.100.241:8092", //ws远程链接 - // "ws://127.0.0.1:8092", //ws本地连接 + // "ws://150.158.100.241:8092", //ws远程链接 + "ws://127.0.0.1:8092", //ws本地连接 // 'wss://squidgameserver.gryphon.fun' ]; diff --git a/tgx-games-client/assets/module_basic/scripts/LobbyScene.ts b/tgx-games-client/assets/module_basic/scripts/LobbyScene.ts index cafa1a0..94a084e 100644 --- a/tgx-games-client/assets/module_basic/scripts/LobbyScene.ts +++ b/tgx-games-client/assets/module_basic/scripts/LobbyScene.ts @@ -108,7 +108,7 @@ export class LobbyScene extends Component { } private async _checkAccount(): Promise { - // localStorage.clear(); + localStorage.clear(); let account = UserLocalCache.inst.account; let password = UserLocalCache.inst.password; if (account && password) { diff --git a/tgx-games-client/assets/module_basic/scripts/UserMgr.ts b/tgx-games-client/assets/module_basic/scripts/UserMgr.ts index 9b983a4..5fb752e 100644 --- a/tgx-games-client/assets/module_basic/scripts/UserMgr.ts +++ b/tgx-games-client/assets/module_basic/scripts/UserMgr.ts @@ -1,4 +1,4 @@ -import { Sprite, Label, resources, SpriteFrame, assetManager, Prefab, instantiate, v3 } from "cc"; +import { Sprite, Label, resources, SpriteFrame, assetManager, Prefab, instantiate, v3, Scene, director } from "cc"; import { tgxUIWaiting, tgxUIAlert, tgxSceneUtil, tgxAudioMgr } from "../../core_tgx/tgx"; import {UserLocalCache} from "db://assets/module_basic/scripts/UserLocalCache"; import {NetGameServer} from "db://assets/module_basic/scripts/NetGameServer"; @@ -118,9 +118,10 @@ export class UserMgr { if (!ret3.isSucc) { tgxUIAlert.show('认证失败'); return ret3; - }else if(!ret.res.gameServerInfo){ - await this.doCreateRole(); } + // else if(!ret.res.gameServerInfo){ + // await this.doCreateRole(); + // } } else { if (ret.err.message == 'USER_NOT_EXISTS' || ret.err.message == 'PASSWORD_WRONG') { @@ -169,31 +170,47 @@ export class UserMgr { //进入大厅 UserMgr._inst.roomId = params.roomId; UserMgr._inst.reTrayGameParmas = params; - await tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN); + this._changeToLoadingScene(SceneDef.LOBBY_AREAN); + // await tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN); // } }else{ let ret2 = await UserMgr.inst.doTryEnterRoom(params.roomId); if (!ret2.isSucc) { //进入大厅 - await tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN); + this._changeToLoadingScene(SceneDef.LOBBY_AREAN); + // await tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN); } } } else { //进入大厅 - await tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN); + this._changeToLoadingScene(SceneDef.LOBBY_AREAN); + // await tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN); } return { isSucc: true }; } + private _changeToLoadingScene(sceneName: { name: string, bundle: string }) { + SceneDef.Next_Scene = sceneName; + // 切换到加载场景 + director.loadScene('LoadingScene'); + } + async doCreateRole(_name: string = "", _visualId: number = 1) { + + let LAST_NAMES = ['勇敢的', '怂包的', '无辜的', '残暴的', '天真的', '胆小的', '幽默的', '好色的']; + let GIVEN_NAMES = ['角斗士', '仲裁者', '看守者', '黑色教长', '格里芬', '好战者', '和平使者', '征服者', '百夫长']; let visualId = this.getRandomBetween(410001,410003); - let name = "玩家" ;//areanMgr.cfgMgr.NameData.getRandomName(); + + let firstName = LAST_NAMES[this.getRandomBetween(0,LAST_NAMES.length - 1)] + let secondName = GIVEN_NAMES[this.getRandomBetween(0,GIVEN_NAMES.length - 1)] + let name = `${firstName}${secondName}` ;//areanMgr.cfgMgr.NameData.getRandomName(); let ret = await NetGameServer.inst.callApi('login/CreateRole', { name: name, visualId: visualId }); if (ret.isSucc) { this._userInfo.name = ret.res.name; this._userInfo.visualId = ret.res.visualId; - tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN); + this._changeToLoadingScene(SceneDef.LOBBY_AREAN); + // tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN); } return ret; } diff --git a/tgx-games-client/assets/scripts/SceneDef.ts b/tgx-games-client/assets/scripts/SceneDef.ts index 74453be..528d447 100644 --- a/tgx-games-client/assets/scripts/SceneDef.ts +++ b/tgx-games-client/assets/scripts/SceneDef.ts @@ -80,4 +80,16 @@ export class SceneDef { * @zh 斗蛐蛐游戏场景 */ public static Arean = { name: 'game_arean', bundle: ModuleDef.Arean }; + + /** + * @en lobby scene of loading + * @zh 过渡场景 + */ + public static LoadingScene = { name: 'LoadingScene', bundle: ModuleDef.BASIC }; + + /** + * @en next scene + * @zh 下个场景 + * */ + public static Next_Scene : any= this.Arean; } \ No newline at end of file diff --git a/tgx-games-client/assets/start/slider_icontype_00_bot_fill_yellow2.png b/tgx-games-client/assets/start/slider_icontype_00_bot_fill_yellow2.png new file mode 100644 index 0000000000000000000000000000000000000000..a1f5cfcbcd829b0b7fb1796a124958f77bf87c0c GIT binary patch literal 450 zcmV;z0X_bSP)0004rNkl6M|u^vGbyn%>2K}r{1N)O}#S`n9my?_)1H+9jCr42Ssn?&9V)kDnx zcZ1VH4jzO=bLGM;k`%(LXb{K#$`A$tsocOv4K>)UFcT!c4 z4s$_55P&^-ajI_rLJ9~$00z01I0%R8#DpLKgPOVE$jt=_K>+r+)xceOqjr20ar^*G z%8OL>=9&-$V3TW!>uf{_0)V6 z{lK!CC~e}85CmY$+Rp