修改为单场景

This commit is contained in:
2025-09-20 18:41:10 +08:00
parent 86059e7525
commit 5eb3abacc8
11 changed files with 1531 additions and 3508 deletions
File diff suppressed because it is too large Load Diff
-1
View File
@@ -1 +0,0 @@
{"ver":"1.1.50","importer":"scene","imported":true,"uuid":"dab4ae00-c26e-4176-9c7e-709d8899e525","files":[".json"],"subMetas":{},"userData":{}}
+39 -190
View File
@@ -23,7 +23,7 @@
"_active": true,
"_components": [],
"_prefab": {
"__id__": 31
"__id__": 27
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -54,13 +54,13 @@
},
"autoReleaseAssets": false,
"_globals": {
"__id__": 32
"__id__": 28
},
"_id": "1a23cd3e-e487-4fd1-a415-346c2087464d"
},
{
"__type__": "cc.Node",
"_name": "UICanvas",
"_name": "MainScene",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -81,24 +81,21 @@
},
{
"__id__": 20
},
{
"__id__": 23
}
],
"_active": true,
"_components": [
{
"__id__": 27
"__id__": 23
},
{
"__id__": 28
"__id__": 24
},
{
"__id__": 29
"__id__": 25
},
{
"__id__": 30
"__id__": 26
}
],
"_prefab": null,
@@ -129,7 +126,7 @@
"y": 0,
"z": 0
},
"_id": "beI88Z2HpFELqR4T5EMHpg"
"_id": "71PSAm0U5EN513SjB0jM8O"
},
{
"__type__": "cc.Node",
@@ -174,7 +171,7 @@
"y": 0,
"z": 0
},
"_id": "ebFwiq8gBFaYpqYbdoDODe"
"_id": "8dIONDYHFFl7DVZ3t3zyFU"
},
{
"__type__": "cc.Camera",
@@ -220,7 +217,7 @@
"_usePostProcess": false,
"_cameraType": -1,
"_trackingType": 0,
"_id": "63WIch3o5BEYRlXzTT0oWc"
"_id": "893BHdWlxBRLC6eoG3YKzX"
},
{
"__type__": "cc.Node",
@@ -275,7 +272,7 @@
"y": 0,
"z": 0
},
"_id": "f2um9njPVFUrw07IxJZ2Ah"
"_id": "19P2dUiM9B2rzTU9tEzCTu"
},
{
"__type__": "cc.Node",
@@ -326,7 +323,7 @@
"y": 0,
"z": 0
},
"_id": "62NcZ+WhRKnaIB9Nn886pg"
"_id": "00yBofC6RHjKVN24SuYkWU"
},
{
"__type__": "cc.UITransform",
@@ -348,7 +345,7 @@
"x": 0.5,
"y": 0.5
},
"_id": "e9cMt7vAhIc4a7k9vEIMWF"
"_id": "96J/qF3g1Hu5KCifHBHTSI"
},
{
"__type__": "cc.VideoPlayer",
@@ -376,7 +373,7 @@
"__id__": 9
}
],
"_id": "4eO0OJtSRAuJxLXluDHDbn"
"_id": "32b260vq1LvpZUbTAjk2Pq"
},
{
"__type__": "cc.ClickEvent",
@@ -398,7 +395,7 @@
},
"_enabled": true,
"__prefab": null,
"_id": "b5k2KOjKtLkaxD5pVR6wCQ"
"_id": "4968xgbr1J74FIwzQMKo2w"
},
{
"__type__": "cc.UITransform",
@@ -420,7 +417,7 @@
"x": 0.5,
"y": 0.5
},
"_id": "30mG8HUqRBI5nTm2oK6AzE"
"_id": "1eiVEkUPZOPL/vO+yeE189"
},
{
"__type__": "cc.Widget",
@@ -450,7 +447,7 @@
"_originalHeight": 100,
"_alignMode": 2,
"_lockFlags": 0,
"_id": "88uIpLSUpFcq1yB9nA16Xu"
"_id": "7dOmfIfktI0IDkzVF4Zsm0"
},
{
"__type__": "5caf8//TmZHLJgls9ahUjBU",
@@ -463,7 +460,7 @@
"_enabled": true,
"__prefab": null,
"m_rootNode": null,
"_id": "80UNyz/UdPILGcK/mJl5q5"
"_id": "30yWHGlSxCP4xfT2YvFQeM"
},
{
"__type__": "cc.Node",
@@ -511,7 +508,7 @@
"y": 0,
"z": 0
},
"_id": "99E25LLUhLPZB2mQ2YjsDD"
"_id": "cce3MYA5lPhqXH4KfpgYGE"
},
{
"__type__": "cc.UITransform",
@@ -533,7 +530,7 @@
"x": 0.5,
"y": 0.5
},
"_id": "d0IL3iFVRAvqQ8EJZ31nFY"
"_id": "2dNvIYF2BA5ZS2iUJN2+JZ"
},
{
"__type__": "cc.Widget",
@@ -563,7 +560,7 @@
"_originalHeight": 100,
"_alignMode": 2,
"_lockFlags": 0,
"_id": "e6M4zdUS1N6bIBwqHwnARY"
"_id": "ebrXdl5AhKhK+1/qSIaRpM"
},
{
"__type__": "cc.Node",
@@ -611,7 +608,7 @@
"y": 0,
"z": 0
},
"_id": "12LOWX4llOJKCGaYZD4frU"
"_id": "592j375INCiaJVhUg43jSm"
},
{
"__type__": "cc.UITransform",
@@ -633,7 +630,7 @@
"x": 0.5,
"y": 0.5
},
"_id": "77KhXGIbxFXoWO9LOs4fwe"
"_id": "aeqdUq+ilEaYPL6uwi7JdF"
},
{
"__type__": "cc.Widget",
@@ -663,7 +660,7 @@
"_originalHeight": 100,
"_alignMode": 2,
"_lockFlags": 0,
"_id": "96K4zn3IlDvoIbb1I7ctPL"
"_id": "92UKbCz9xGOLw7kGjojijO"
},
{
"__type__": "cc.Node",
@@ -711,7 +708,7 @@
"y": 0,
"z": 0
},
"_id": "f061eJiSBKN5PguQygisF7"
"_id": "f4kNREfSZMCILejO7dA8U+"
},
{
"__type__": "cc.UITransform",
@@ -733,7 +730,7 @@
"x": 0.5,
"y": 0.5
},
"_id": "9bsrrdIjlNVaLy/kkNM/4Q"
"_id": "a0/2HJepNFoZRWQ+ZGhWNo"
},
{
"__type__": "cc.AudioSource",
@@ -752,149 +749,7 @@
"_loop": true,
"_playOnAwake": true,
"_volume": 1,
"_id": "030kCofjFAmI5HlV2BrAD6"
},
{
"__type__": "cc.Node",
"_name": "test",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 24
},
{
"__id__": 25
},
{
"__id__": 26
}
],
"_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": "3eM7mCdfROdaOWSbccQmmQ"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 23
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 1080,
"height": 2115
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "4bzm4tl4VJwZDKcaQMFTmm"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 23
},
"_enabled": true,
"__prefab": null,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "8426dfa7-c0bd-4bfc-8ea1-90d9f957fa73@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": "fd5aPdKARIe4KoMy2wyxvh"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 23
},
"_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": 255,
"_originalHeight": 255,
"_alignMode": 2,
"_lockFlags": 0,
"_id": "cdikCeObJEaoGZ5FWImPkl"
"_id": "e0dBsb0fFFeIlcmZR39o89"
},
{
"__type__": "cc.UITransform",
@@ -916,7 +771,7 @@
"x": 0.5,
"y": 0.5
},
"_id": "d6rUX5yfhMlKoWX2bSbawx"
"_id": "a45zYXLkdB5p21cBR3Jhwj"
},
{
"__type__": "cc.Canvas",
@@ -932,7 +787,7 @@
"__id__": 4
},
"_alignCanvasWithScreen": true,
"_id": "12O/ljcVlEqLmVm3U2gEOQ"
"_id": "1etPCOcLVNCp217Ewk7Uf2"
},
{
"__type__": "cc.Widget",
@@ -962,7 +817,7 @@
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 45,
"_id": "c5V1EV8IpMtrIvY1OE9t2u"
"_id": "f1ZdtMSHBJU5jobLqI2dYT"
},
{
"__type__": "fb227p/84NJBbVq0Iq6yVqT",
@@ -974,16 +829,10 @@
},
"_enabled": true,
"__prefab": null,
"UIRoot": {
"__id__": 14
},
"UILayerMod": {
"__id__": 17
},
"MainCamera": {
"__id__": 4
},
"_id": "98EWBIubZPlZT+LFQb4IYI"
"_id": "28MjFWW29O+IabrSgIO0op"
},
{
"__type__": "cc.PrefabInfo",
@@ -996,28 +845,28 @@
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 33
"__id__": 29
},
"shadows": {
"__id__": 34
"__id__": 30
},
"_skybox": {
"__id__": 35
"__id__": 31
},
"fog": {
"__id__": 36
"__id__": 32
},
"octree": {
"__id__": 37
"__id__": 33
},
"skin": {
"__id__": 38
"__id__": 34
},
"lightProbeInfo": {
"__id__": 39
"__id__": 35
},
"postSettings": {
"__id__": 40
"__id__": 36
},
"bakedWithStationaryMainLight": false,
"bakedWithHighpLightmap": false
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-26
View File
@@ -1,26 +0,0 @@
import { _decorator, Camera, Component, Node } from "cc";
import GameRootUI from "../Main/Common/GameRootUI";
const { ccclass, property } = _decorator;
//游戏场景
@ccclass('GameScene')
export class GameScene extends Component {
@property(Node)
UIRoot: Node = null
@property(Node)
UILayerMod: Node = null
@property(Camera)
MainCamera: Camera = null
start() {
//每个场景必须添加的
let gameRootUI = this.node.getComponent(GameRootUI)
if (!gameRootUI){
gameRootUI = this.node.addComponent(GameRootUI)
gameRootUI.InitByCreate(this.UIRoot, this.UILayerMod, "UI/GameUI/Game_UI");
}
GameRootUI.MainCamera = this.MainCamera
}
}
-9
View File
@@ -1,9 +0,0 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "d9d41102-bfd6-4256-8356-bfca87f844ec",
"files": [],
"subMetas": {},
"userData": {}
}
+4 -2
View File
@@ -14,7 +14,9 @@ export class MainScene extends Component {
@property(Camera)
MainCamera: Camera = null;
start() {
start() {}
init() {
//每个场景必须添加的
let gameRootUI = this.node.getComponent(GameRootUI);
if (!gameRootUI) {
@@ -22,7 +24,7 @@ export class MainScene extends Component {
gameRootUI.InitByCreate(this.UIRoot, this.UILayerMod, "NavigationPanel");
}
GameRootUI.MainCamera = this.MainCamera;
// 初始化MainController并预加载数据
this.initMainController();
}
-104
View File
@@ -1,104 +0,0 @@
import { _decorator, Button, Component, Node } from "cc";
import li_BaseView from "../../Main/Common/li_BaseView";
import Utils from "../../Main/Common/Utils";
import { GButton } from "../../Main/Common/GButton";
import ResManager from "../../Main/Manager/ResManager";
import { DataManager, DataId } from "../../chat18x/data/DataManager";
import { LoginData } from "../../chat18x/data/LoginData";
import { PlayerData } from "../../chat18x/data/PlayerData";
import { AccountData } from "../../chat18x/data/AccountData";
import { WalletData } from "../../chat18x/data/WalletData";
import { GlobalData } from "../../chat18x/data/GlobalData";
import { EnvData } from "../../chat18x/data/EnvData";
import DeviceIdService from "db://assets/Scripts/chat18x/foundation/identity/DeviceIdService";
import MachineInfoService from "db://assets/Scripts/chat18x/foundation/identity/MachineInfoService";
import { AuthService } from "db://assets/Scripts/chat18x/network/services/AuthService";
import { PlayerDataService } from "db://assets/Scripts/chat18x/network/services/PlayerDataService";
import { CommonService } from "db://assets/Scripts/chat18x/network/services/CommonService";
import proto from "db://assets/Scripts/proto/proto.pb.js";
const { ccclass, property } = _decorator;
@ccclass("LoginUI")
export class LoginUI extends li_BaseView {
private _nodeTab: any = {};
private loginFinish = false;
loginBtn: Node;
protected start(): void {
Utils.parseNode(this.node, this._nodeTab);
this.loginBtn = this._nodeTab.btnLogin;
GButton.BandClick(this.loginBtn, this.onLogin, this);
}
update(deltaTime: number) {
if (this.loginFinish) {
this.loginFinish = false;
this.enterGame();
}
}
async onLogin() {
const deviceId = DeviceIdService.I.id;
const os = MachineInfoService.I.getMachineOs();
const reqData = {
platType: "guest",
userId: deviceId,
device: deviceId,
os,
};
console.log("登录请求数据:", reqData);
let res = await AuthService.I.login(reqData);
console.log("登录响应数据:", res);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
const resData = res.data;
const loginData = DataManager.I.getDataById<LoginData>(DataId.Login);
loginData.token = resData.token;
loginData.refreshToken = resData.refreshToken;
loginData.expire = Number(resData.expire);
const playerData = DataManager.I.getDataById<PlayerData>(DataId.Player);
playerData.name = resData.name;
const accountData = DataManager.I.getDataById<AccountData>(
DataId.Account
);
accountData.accId = resData.accId;
const envData = DataManager.I.getDataById<EnvData>(DataId.Env);
envData.cdn = resData.cdn;
this.loginFinish = true;
this.reqMyInfo();
this.reqGlobalData();
}
}
// 请求个人数据
private async reqMyInfo() {
const reqData = {};
let res = await PlayerDataService.I.reqMyInfo(reqData);
console.log("个人信息响应数据:", res);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
const resData = res.data;
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
walletData.balance = Number(resData.balance);
walletData.vipExpire = Number(resData.vipExpire);
}
}
// 请求全局数据
private async reqGlobalData() {
const reqData = {
resName: "TbGlobalConfig",
};
let res = await CommonService.I.reqResConfig(reqData);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
// 保存数据
const globalData = DataManager.I.getDataById<GlobalData>(DataId.Global);
globalData.globals = res.data;
}
}
private enterGame() {
ResManager.I.goMainScene();
}
}
-9
View File
@@ -1,9 +0,0 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "0fa6dc01-de0d-4847-ae6c-624111814d80",
"files": [],
"subMetas": {},
"userData": {}
}
+113 -52
View File
@@ -6,6 +6,7 @@ import {
Button,
Component,
ImageAsset,
instantiate,
JsonAsset,
Label,
Material,
@@ -25,22 +26,48 @@ import Utils from "../../Main/Common/Utils";
import { InnerMsgCode } from "../../Main/Config/InnerMsgCode";
import { promptItem } from "../Item/promptItem";
import LanguageUtils, { LanguageType } from "../../Main/Common/LanguageUtils";
import { DataManager } from "../../chat18x/data/DataManager";
import { DataId, DataManager } from "../../chat18x/data/DataManager";
import { ConfigManager } from "../../chat18x/manager/ConfigManager";
import { AppConfig } from "db://assets/Scripts/chat18x/config/env/appConfig";
import DeviceIdService from "db://assets/Scripts/chat18x/foundation/identity/DeviceIdService";
import { AccountData } from "../../chat18x/data/AccountData";
import { EnvData } from "../../chat18x/data/EnvData";
import { GlobalData } from "../../chat18x/data/GlobalData";
import { LoginData } from "../../chat18x/data/LoginData";
import { PlayerData } from "../../chat18x/data/PlayerData";
import { WalletData } from "../../chat18x/data/WalletData";
import MachineInfoService from "../../chat18x/foundation/identity/MachineInfoService";
import { AuthService } from "../../chat18x/network/services/AuthService";
import { CommonService } from "../../chat18x/network/services/CommonService";
import { PlayerDataService } from "../../chat18x/network/services/PlayerDataService";
import proto from "db://assets/Scripts/proto/proto.pb.js";
import { ViewManager } from "../../Main/Manager/ViewManager";
import { MainScene } from "../MainScene";
const { ccclass, property } = _decorator;
@ccclass("PreloadUI")
export class PreloadUI extends Component {
private preloadFinish = false; //资源加载完成
@property(MainScene)
mainScene: MainScene = null;
private _nodeTab: any = {};
private preloadFinish = false; //资源加载完成
private loginFinish = false; //登录完成
loginBtn: Node;
private jinduBar: Node = null;
private jinduFilled: Sprite = null;
start() {
//Utils.addInnerEL(InnerMsgCode.UI_ShowPrompt, this, this.resiveShowPrompt)
Utils.parseNode(this.node, this._nodeTab);
this.loginBtn = this._nodeTab.btnLogin;
this.loginBtn.active = false;
GButton.BandClick(this.loginBtn, this.onLogin, this);
this.jinduBar = this.node.getChildByName("jinduBar");
this.jinduFilled = this.jinduBar
@@ -48,8 +75,8 @@ export class PreloadUI extends Component {
.getComponent(Sprite);
//适配背景图
let BG = this.node.getChildByName("BG");
Utils.adjustBgPixelRatio(BG, 1);
//let BG = this.node.getChildByName("BG");
//Utils.adjustBgPixelRatio(BG, 1);
this.jinduFilled.fillRange = 0;
@@ -77,9 +104,16 @@ export class PreloadUI extends Component {
}
update(deltaTime: number) {
if (this.preloadFinish) {
if (!this.preloadFinish) {
return;
//this.goToLoginScene();
}
if (this.loginFinish) {
this.loginFinish = false;
this.preloadFinish = false;
this.goToLoginScene();
this.enterGame();
}
}
@@ -100,25 +134,6 @@ export class PreloadUI extends Component {
{ path: "ChatPanel", bundleName: "Chat18x", ftype: Prefab },
{ path: "GirlDetailPanel", bundleName: "Chat18x", ftype: Prefab },
{ path: "GirlListPanel", bundleName: "Chat18x", ftype: Prefab },
// {path:"Music/music_interface", bundleName: "Audio", ftype: AudioClip},
// {path:"bg/mengli_stage_bg", bundleName: "Raw", ftype: ImageAsset},
// {path:"cg0/mengli_0_cg", bundleName: "Raw", ftype: ImageAsset},
// {path:"cg1/mengli_1_cg", bundleName: "Raw", ftype: ImageAsset},
// {path:"cg2/mengli_2_cg", bundleName: "Raw", ftype: ImageAsset},
// {path:"cg3/mengli_3_cg", bundleName: "Raw", ftype: ImageAsset},
// {path:"emo_1/mengli_shy", bundleName: "Raw", ftype: ImageAsset},
// {path:"emo_2/mengli_laugh", bundleName: "Raw", ftype: ImageAsset},
// {path:"emo_3/mengli_disgust", bundleName: "Raw", ftype: ImageAsset},
// {path:"role/mengli_default", bundleName: "Raw", ftype: ImageAsset},
// {path:"Zjm/raw1", bundleName: "Raw", ftype: ImageAsset},
// {path:"touming", bundleName: "common", ftype: ImageAsset},
// // {path:"chanpin_1_0", bundleName: "daoju", ftype: ImageAsset}, //有合图加载失败
// {path:"zjm_1", bundleName: "Zhujiemian", ftype: ImageAsset},
// {path:"zjm_19", bundleName: "Zhujiemian", ftype: ImageAsset},
// {path:"zjm_30", bundleName: "Zhujiemian", ftype: ImageAsset},
// {path:"mohu", bundleName: "Materials", ftype: Material},
// {path:"UI/Cross/Cross_UI", bundleName: "PB", ftype: Prefab},
// {path:"UI/StartUI/Start_UI", bundleName: "PB", ftype: Prefab},
{ path: "tblanguage", bundleName: "DataTable", ftype: BufferAsset },
];
let num_prefab = 0; //已加载数量
@@ -145,7 +160,7 @@ export class PreloadUI extends Component {
);
} else {
if (num_succeed >= num_prefab) {
this.loadDataTable();
this.startloginProcess();
}
}
};
@@ -153,29 +168,10 @@ export class PreloadUI extends Component {
}
//加载配置表
loadDataTable() {
let dataArr = [
//"commonGlobal",
// "levelHole",
//"Music",
//"Sound",
];
//配置表使用方法: let cfgs = Resource.getConfig("Sound")
let num_prefab = 0;
let preloadFunc = () => {
if (num_prefab < dataArr.length) {
let cfgname = dataArr[num_prefab];
ResManager.I.loadSubpackageDataTable(cfgname, (ret: JsonAsset) => {
num_prefab++;
Resource.addSubJsonConfig(cfgname, ret.json);
preloadFunc();
});
} else {
this.preloadFinish = true;
}
};
preloadFunc();
startloginProcess() {
this.jinduBar.active = false;
this.preloadFinish = true;
this.loginBtn.active = true;
}
//显示加载进度
@@ -184,8 +180,73 @@ export class PreloadUI extends Component {
}
// 跳转到登录场景
private goToLoginScene() {
this.jinduBar.active = false;
ResManager.I.goCustomScene("LoginScene");
// private goToLoginScene() {
// this.jinduBar.active = false;
// ResManager.I.goCustomScene("LoginScene");
// }
async onLogin() {
const deviceId = DeviceIdService.I.id;
const os = MachineInfoService.I.getMachineOs();
const reqData = {
platType: "guest",
userId: deviceId,
device: deviceId,
os,
};
console.log("登录请求数据:", reqData);
let res = await AuthService.I.login(reqData);
console.log("登录响应数据:", res);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
const resData = res.data;
const loginData = DataManager.I.getDataById<LoginData>(DataId.Login);
loginData.token = resData.token;
loginData.refreshToken = resData.refreshToken;
loginData.expire = Number(resData.expire);
const playerData = DataManager.I.getDataById<PlayerData>(DataId.Player);
playerData.name = resData.name;
const accountData = DataManager.I.getDataById<AccountData>(
DataId.Account
);
accountData.accId = resData.accId;
const envData = DataManager.I.getDataById<EnvData>(DataId.Env);
envData.cdn = resData.cdn;
this.loginFinish = true;
this.reqMyInfo();
this.reqGlobalData();
}
}
// 请求个人数据
private async reqMyInfo() {
const reqData = {};
let res = await PlayerDataService.I.reqMyInfo(reqData);
console.log("个人信息响应数据:", res);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
const resData = res.data;
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
walletData.balance = Number(resData.balance);
walletData.vipExpire = Number(resData.vipExpire);
}
}
// 请求全局数据
private async reqGlobalData() {
const reqData = {
resName: "TbGlobalConfig",
};
let res = await CommonService.I.reqResConfig(reqData);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
// 保存数据
const globalData = DataManager.I.getDataById<GlobalData>(DataId.Global);
globalData.globals = res.data;
}
}
private enterGame() {
this.mainScene.init();
this.node.destroy();
//ResManager.I.goMainScene();
}
}