Merge remote-tracking branch 'origin/feature/xk/loading' into dajun2
# Conflicts: # tgx-games-client/assets/module_basic/scripts/LobbyScene.ts
This commit is contained in:
commit
1a090f43e2
|
@ -4,6 +4,7 @@ import { tgxAudioMgr } from 'db://assets/core_tgx/tgx';
|
||||||
import { ModuleDef } from 'db://assets/scripts/ModuleDef';
|
import { ModuleDef } from 'db://assets/scripts/ModuleDef';
|
||||||
import { resLoader } from 'db://assets/core_tgx/base/utils/ResLoader';
|
import { resLoader } from 'db://assets/core_tgx/base/utils/ResLoader';
|
||||||
import { EMusicDefine } from 'db://assets/module_basic/scripts/MusicDefine';
|
import { EMusicDefine } from 'db://assets/module_basic/scripts/MusicDefine';
|
||||||
|
import { SceneDef } from 'db://assets/scripts/SceneDef';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
|
|
||||||
|
@ -438,7 +439,10 @@ export class WoodenManGame extends Component {
|
||||||
n.getChildByPath("settlementNode/btnOK").on(Node.EventType.TOUCH_START, () => {
|
n.getChildByPath("settlementNode/btnOK").on(Node.EventType.TOUCH_START, () => {
|
||||||
|
|
||||||
if (isWin) {
|
if (isWin) {
|
||||||
director.loadScene("level2/scene/level2Scene");
|
SceneDef.Next_Scene = "level2/scene/level2Scene";
|
||||||
|
// 切换到加载场景
|
||||||
|
director.loadScene('LoadingScene');
|
||||||
|
// director.loadScene("level2/scene/level2Scene");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
director.loadScene("lobby_arean");
|
director.loadScene("lobby_arean");
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { resLoader } from 'db://assets/core_tgx/base/utils/ResLoader';
|
||||||
import { tgxUIAlert } from 'db://assets/core_tgx/tgx';
|
import { tgxUIAlert } from 'db://assets/core_tgx/tgx';
|
||||||
import { ModuleDef } from 'db://assets/scripts/ModuleDef';
|
import { ModuleDef } from 'db://assets/scripts/ModuleDef';
|
||||||
import { AreanNetMgr } from '../../scripts/AreanNetMgr';
|
import { AreanNetMgr } from '../../scripts/AreanNetMgr';
|
||||||
|
import { SceneDef } from 'db://assets/scripts/SceneDef';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('CircularButton')
|
@ccclass('CircularButton')
|
||||||
|
@ -79,7 +80,10 @@ export class CircularButton extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
changeGameScene() {
|
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, () => {
|
n.getChildByPath("settlementNode/btnOK").on(Node.EventType.TOUCH_START, () => {
|
||||||
|
|
||||||
if (isWin) {
|
if (isWin) {
|
||||||
director.loadScene("level3/scene/BallScene");
|
SceneDef.Next_Scene = "level3/scene/BallScene";
|
||||||
|
// 切换到加载场景
|
||||||
|
director.loadScene('LoadingScene');
|
||||||
|
// director.loadScene("level3/scene/BallScene");
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -207,10 +214,16 @@ export class CircularButton extends Component {
|
||||||
tween(this.node).delay(5).call(() => {
|
tween(this.node).delay(5).call(() => {
|
||||||
var bundle = assetManager.getBundle('level3');
|
var bundle = assetManager.getBundle('level3');
|
||||||
if (bundle) {
|
if (bundle) {
|
||||||
director.loadScene("scene/BallScene");
|
SceneDef.Next_Scene = "scene/BallScene";
|
||||||
|
// 切换到加载场景
|
||||||
|
director.loadScene('LoadingScene');
|
||||||
|
// director.loadScene("scene/BallScene");
|
||||||
} else {
|
} else {
|
||||||
assetManager.loadBundle("level3", () => {
|
assetManager.loadBundle("level3", () => {
|
||||||
director.loadScene("scene/BallScene");
|
SceneDef.Next_Scene = "scene/BallScene";
|
||||||
|
// 切换到加载场景
|
||||||
|
director.loadScene('LoadingScene');
|
||||||
|
// director.loadScene("scene/BallScene");
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
|
|
@ -205,7 +205,10 @@ export class AreanLobbyScene extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async loadGame(params?: any) {
|
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() {
|
onBtnCreate() {
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"ver": "1.2.0",
|
||||||
|
"importer": "directory",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "e25e1a2c-bad2-4ec0-ab1a-bcf6b3d33622",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
||||||
|
{"ver":"1.1.50","importer":"scene","imported":true,"uuid":"a6628ac9-af4b-40ce-aaed-e897cf04a52c","files":[".json"],"subMetas":{},"userData":{}}
|
|
@ -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)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
{"ver":"4.0.24","importer":"typescript","imported":true,"uuid":"8bd3b64c-1ea9-40a0-9074-af028204e88d","files":[],"subMetas":{},"userData":{}}
|
|
@ -98,7 +98,7 @@
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 375.00000000000006,
|
"x": 375,
|
||||||
"y": 720,
|
"y": 720,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
|
@ -282,7 +282,7 @@
|
||||||
"__prefab": null,
|
"__prefab": null,
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 750.0000000000001,
|
"width": 750,
|
||||||
"height": 1440
|
"height": 1440
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
|
@ -438,22 +438,19 @@
|
||||||
"__id__": 12
|
"__id__": 12
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 15
|
"__id__": 17
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 18
|
"__id__": 20
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
|
||||||
"__id__": 22
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 23
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"__id__": 24
|
"__id__": 24
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 25
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
|
@ -502,6 +499,9 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 14
|
"__id__": 14
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 15
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
|
@ -595,6 +595,70 @@
|
||||||
"_atlas": null,
|
"_atlas": null,
|
||||||
"_id": "a1wy0sN7BH+qI+Bz47IQnb"
|
"_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",
|
"__type__": "cc.Node",
|
||||||
"_name": "btn_rectangle_01_n_red",
|
"_name": "btn_rectangle_01_n_red",
|
||||||
|
@ -607,10 +671,10 @@
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 16
|
"__id__": 18
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 17
|
"__id__": 19
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
|
@ -649,7 +713,7 @@
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 15
|
"__id__": 17
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": null,
|
"__prefab": null,
|
||||||
|
@ -671,7 +735,7 @@
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 15
|
"__id__": 17
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": null,
|
"__prefab": null,
|
||||||
|
@ -715,14 +779,14 @@
|
||||||
"_children": [],
|
"_children": [],
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
|
||||||
"__id__": 19
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 20
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"__id__": 21
|
"__id__": 21
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 22
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 23
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
|
@ -761,7 +825,7 @@
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 18
|
"__id__": 20
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": null,
|
"__prefab": null,
|
||||||
|
@ -783,7 +847,7 @@
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 18
|
"__id__": 20
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": null,
|
"__prefab": null,
|
||||||
|
@ -848,7 +912,7 @@
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 18
|
"__id__": 20
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": null,
|
"__prefab": null,
|
||||||
|
@ -913,72 +977,6 @@
|
||||||
"_atlas": null,
|
"_atlas": null,
|
||||||
"_id": "d92CY6NoZOYb0fNb5GS8YJ"
|
"_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",
|
"__type__": "cc.UITransform",
|
||||||
"_name": "",
|
"_name": "",
|
||||||
|
@ -1187,7 +1185,7 @@
|
||||||
"__prefab": null,
|
"__prefab": null,
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 750.0000000000001,
|
"width": 750,
|
||||||
"height": 1440
|
"height": 1440
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
|
|
|
@ -15,7 +15,7 @@ export const GameServerListFileURL = ""; //'http://192.168.0.104:7456/web-mobile
|
||||||
*/
|
*/
|
||||||
export const GameServerURLs = [
|
export const GameServerURLs = [
|
||||||
// 'wss://chengchennet.cn:15005',//wss远程链接
|
// 'wss://chengchennet.cn:15005',//wss远程链接
|
||||||
"ws://150.158.100.241:8092", //ws远程链接
|
// "ws://150.158.100.241:8092", //ws远程链接
|
||||||
// "ws://127.0.0.1:8092", //ws本地连接
|
"ws://127.0.0.1:8092", //ws本地连接
|
||||||
// 'wss://squidgameserver.gryphon.fun'
|
// 'wss://squidgameserver.gryphon.fun'
|
||||||
];
|
];
|
||||||
|
|
|
@ -108,7 +108,7 @@ export class LobbyScene extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _checkAccount(): Promise<void> {
|
private async _checkAccount(): Promise<void> {
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
let account = UserLocalCache.inst.account;
|
let account = UserLocalCache.inst.account;
|
||||||
let password = UserLocalCache.inst.password;
|
let password = UserLocalCache.inst.password;
|
||||||
if (account && password) {
|
if (account && password) {
|
||||||
|
|
|
@ -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 { tgxUIWaiting, tgxUIAlert, tgxSceneUtil, tgxAudioMgr } from "../../core_tgx/tgx";
|
||||||
import {UserLocalCache} from "db://assets/module_basic/scripts/UserLocalCache";
|
import {UserLocalCache} from "db://assets/module_basic/scripts/UserLocalCache";
|
||||||
import {NetGameServer} from "db://assets/module_basic/scripts/NetGameServer";
|
import {NetGameServer} from "db://assets/module_basic/scripts/NetGameServer";
|
||||||
|
@ -118,9 +118,10 @@ export class UserMgr {
|
||||||
if (!ret3.isSucc) {
|
if (!ret3.isSucc) {
|
||||||
tgxUIAlert.show('认证失败');
|
tgxUIAlert.show('认证失败');
|
||||||
return ret3;
|
return ret3;
|
||||||
}else if(!ret.res.gameServerInfo){
|
|
||||||
await this.doCreateRole();
|
|
||||||
}
|
}
|
||||||
|
// else if(!ret.res.gameServerInfo){
|
||||||
|
// await this.doCreateRole();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (ret.err.message == 'USER_NOT_EXISTS' || ret.err.message == 'PASSWORD_WRONG') {
|
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.roomId = params.roomId;
|
||||||
UserMgr._inst.reTrayGameParmas = params;
|
UserMgr._inst.reTrayGameParmas = params;
|
||||||
await tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN);
|
this._changeToLoadingScene(SceneDef.LOBBY_AREAN);
|
||||||
|
// await tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN);
|
||||||
// }
|
// }
|
||||||
}else{
|
}else{
|
||||||
let ret2 = await UserMgr.inst.doTryEnterRoom(params.roomId);
|
let ret2 = await UserMgr.inst.doTryEnterRoom(params.roomId);
|
||||||
if (!ret2.isSucc) {
|
if (!ret2.isSucc) {
|
||||||
//进入大厅
|
//进入大厅
|
||||||
await tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN);
|
this._changeToLoadingScene(SceneDef.LOBBY_AREAN);
|
||||||
|
// await tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//进入大厅
|
//进入大厅
|
||||||
await tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN);
|
this._changeToLoadingScene(SceneDef.LOBBY_AREAN);
|
||||||
|
// await tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN);
|
||||||
}
|
}
|
||||||
return { isSucc: true };
|
return { isSucc: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _changeToLoadingScene(sceneName: { name: string, bundle: string }) {
|
||||||
|
SceneDef.Next_Scene = sceneName;
|
||||||
|
// 切换到加载场景
|
||||||
|
director.loadScene('LoadingScene');
|
||||||
|
}
|
||||||
|
|
||||||
async doCreateRole(_name: string = "", _visualId: number = 1) {
|
async doCreateRole(_name: string = "", _visualId: number = 1) {
|
||||||
|
|
||||||
|
let LAST_NAMES = ['勇敢的', '怂包的', '无辜的', '残暴的', '天真的', '胆小的', '幽默的', '好色的'];
|
||||||
|
let GIVEN_NAMES = ['角斗士', '仲裁者', '看守者', '黑色教长', '格里芬', '好战者', '和平使者', '征服者', '百夫长'];
|
||||||
let visualId = this.getRandomBetween(410001,410003);
|
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 });
|
let ret = await NetGameServer.inst.callApi('login/CreateRole', { name: name, visualId: visualId });
|
||||||
if (ret.isSucc) {
|
if (ret.isSucc) {
|
||||||
this._userInfo.name = ret.res.name;
|
this._userInfo.name = ret.res.name;
|
||||||
this._userInfo.visualId = ret.res.visualId;
|
this._userInfo.visualId = ret.res.visualId;
|
||||||
tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN);
|
this._changeToLoadingScene(SceneDef.LOBBY_AREAN);
|
||||||
|
// tgxSceneUtil.loadScene(SceneDef.LOBBY_AREAN);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,4 +80,16 @@ export class SceneDef {
|
||||||
* @zh 斗蛐蛐游戏场景
|
* @zh 斗蛐蛐游戏场景
|
||||||
*/
|
*/
|
||||||
public static Arean = { name: 'game_arean', bundle: ModuleDef.Arean };
|
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;
|
||||||
}
|
}
|
Binary file not shown.
After Width: | Height: | Size: 450 B |
|
@ -0,0 +1,134 @@
|
||||||
|
{
|
||||||
|
"ver": "1.0.27",
|
||||||
|
"importer": "image",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "fbac5e45-83f5-4d2e-a669-02e125a914e7",
|
||||||
|
"files": [
|
||||||
|
".json",
|
||||||
|
".png"
|
||||||
|
],
|
||||||
|
"subMetas": {
|
||||||
|
"6c48a": {
|
||||||
|
"importer": "texture",
|
||||||
|
"uuid": "fbac5e45-83f5-4d2e-a669-02e125a914e7@6c48a",
|
||||||
|
"displayName": "slider_icontype_00_bot_fill_yellow2",
|
||||||
|
"id": "6c48a",
|
||||||
|
"name": "texture",
|
||||||
|
"userData": {
|
||||||
|
"wrapModeS": "clamp-to-edge",
|
||||||
|
"wrapModeT": "clamp-to-edge",
|
||||||
|
"imageUuidOrDatabaseUri": "fbac5e45-83f5-4d2e-a669-02e125a914e7",
|
||||||
|
"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": "fbac5e45-83f5-4d2e-a669-02e125a914e7@f9941",
|
||||||
|
"displayName": "slider_icontype_00_bot_fill_yellow2",
|
||||||
|
"id": "f9941",
|
||||||
|
"name": "spriteFrame",
|
||||||
|
"userData": {
|
||||||
|
"trimType": "auto",
|
||||||
|
"trimThreshold": 1,
|
||||||
|
"rotated": false,
|
||||||
|
"offsetX": 0,
|
||||||
|
"offsetY": 0,
|
||||||
|
"trimX": 0,
|
||||||
|
"trimY": 0,
|
||||||
|
"width": 321,
|
||||||
|
"height": 27,
|
||||||
|
"rawWidth": 321,
|
||||||
|
"rawHeight": 27,
|
||||||
|
"borderTop": 0,
|
||||||
|
"borderBottom": 0,
|
||||||
|
"borderLeft": 0,
|
||||||
|
"borderRight": 0,
|
||||||
|
"packable": true,
|
||||||
|
"pixelsToUnit": 100,
|
||||||
|
"pivotX": 0.5,
|
||||||
|
"pivotY": 0.5,
|
||||||
|
"meshType": 0,
|
||||||
|
"vertices": {
|
||||||
|
"rawPosition": [
|
||||||
|
-160.5,
|
||||||
|
-13.5,
|
||||||
|
0,
|
||||||
|
160.5,
|
||||||
|
-13.5,
|
||||||
|
0,
|
||||||
|
-160.5,
|
||||||
|
13.5,
|
||||||
|
0,
|
||||||
|
160.5,
|
||||||
|
13.5,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"indexes": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
2,
|
||||||
|
1,
|
||||||
|
3
|
||||||
|
],
|
||||||
|
"uv": [
|
||||||
|
0,
|
||||||
|
27,
|
||||||
|
321,
|
||||||
|
27,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
321,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"nuv": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"minPos": [
|
||||||
|
-160.5,
|
||||||
|
-13.5,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"maxPos": [
|
||||||
|
160.5,
|
||||||
|
13.5,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"isUuid": true,
|
||||||
|
"imageUuidOrDatabaseUri": "fbac5e45-83f5-4d2e-a669-02e125a914e7@6c48a",
|
||||||
|
"atlasUuid": ""
|
||||||
|
},
|
||||||
|
"ver": "1.0.12",
|
||||||
|
"imported": true,
|
||||||
|
"files": [
|
||||||
|
".json"
|
||||||
|
],
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"userData": {
|
||||||
|
"type": "sprite-frame",
|
||||||
|
"hasAlpha": true,
|
||||||
|
"fixAlphaTransparencyArtifacts": false,
|
||||||
|
"redirect": "fbac5e45-83f5-4d2e-a669-02e125a914e7@6c48a"
|
||||||
|
}
|
||||||
|
}
|
|
@ -39,11 +39,11 @@ module.exports = {
|
||||||
script: 'ServerApp.js',
|
script: 'ServerApp.js',
|
||||||
env: {
|
env: {
|
||||||
/** 本地测试环境配置 */
|
/** 本地测试环境配置 */
|
||||||
// ip: '127.0.0.1',
|
ip: '127.0.0.1',
|
||||||
// port: 8092,
|
|
||||||
/** 线上环境配置 */
|
|
||||||
ip: '150.158.100.241',
|
|
||||||
port: 8092,
|
port: 8092,
|
||||||
|
/** 线上环境配置 */
|
||||||
|
// ip: '150.158.100.241',
|
||||||
|
// port: 8092,
|
||||||
gameTypes: 'billiards,gomoku,tank,kingtd,arean',
|
gameTypes: 'billiards,gomoku,tank,kingtd,arean',
|
||||||
// publicUrl: 'wss://squidgameserver.gryphon.fun',
|
// publicUrl: 'wss://squidgameserver.gryphon.fun',
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue