登录流程优化 增加错误码弹窗提醒
This commit is contained in:
@@ -132,7 +132,9 @@ export default class GameRootUI extends Component {
|
|||||||
this.LayerNodeGroups[key] = newNode;
|
this.LayerNodeGroups[key] = newNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
showDefault() {
|
||||||
//默认打开的界面
|
//默认打开的界面
|
||||||
if (this.DefaultUI.length > 0) {
|
if (this.DefaultUI.length > 0) {
|
||||||
ResManager.I.loadSubpackagePrefab(this.DefaultUI, (res) => {
|
ResManager.I.loadSubpackagePrefab(this.DefaultUI, (res) => {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export default class ResManager {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
assetManager.loadBundle(
|
assetManager.loadBundle(
|
||||||
"PB",
|
"Chat18x",
|
||||||
(err: Error, _bundle: AssetManager.Bundle) => {
|
(err: Error, _bundle: AssetManager.Bundle) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.log(err);
|
logger.log(err);
|
||||||
@@ -137,7 +137,7 @@ export default class ResManager {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
assetManager.loadBundle(
|
assetManager.loadBundle(
|
||||||
"PB",
|
"Chat18x",
|
||||||
(err: Error, _bundle: AssetManager.Bundle) => {
|
(err: Error, _bundle: AssetManager.Bundle) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.log(err);
|
logger.log(err);
|
||||||
|
|||||||
@@ -25,21 +25,5 @@ export class MainScene extends Component {
|
|||||||
gameRootUI.InitByCreate(this.UIRoot, this.UILayerMod, "NavigationPanel");
|
gameRootUI.InitByCreate(this.UIRoot, this.UILayerMod, "NavigationPanel");
|
||||||
}
|
}
|
||||||
GameRootUI.MainCamera = this.MainCamera;
|
GameRootUI.MainCamera = this.MainCamera;
|
||||||
|
|
||||||
// 初始化MainController并预加载数据
|
|
||||||
this.initMainController();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化MainController并预加载数据
|
|
||||||
*/
|
|
||||||
private async initMainController(): Promise<void> {
|
|
||||||
try {
|
|
||||||
logger.log("[MainScene] 开始初始化MainController");
|
|
||||||
await MainController.I.init();
|
|
||||||
logger.log("[MainScene] MainController初始化完成");
|
|
||||||
} catch (error) {
|
|
||||||
logger.error("[MainScene] MainController初始化失败:", error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ import { prodConfig } from "../../chat18x/config/env/prod";
|
|||||||
import { logger } from "db://assets/Scripts/Main/Common/Logger";
|
import { logger } from "db://assets/Scripts/Main/Common/Logger";
|
||||||
import AudioManager from "../../Main/Manager/AudioManager";
|
import AudioManager from "../../Main/Manager/AudioManager";
|
||||||
import { Config18x } from "../../Main/Config/Config18x";
|
import { Config18x } from "../../Main/Config/Config18x";
|
||||||
|
import { MainController } from "../../chat18x/core/MainController";
|
||||||
|
import GameRootUI from "../../Main/Common/GameRootUI";
|
||||||
|
import { TipsPanel } from "../../chat18x/ui/panels/TipsPanel";
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@@ -115,6 +118,8 @@ export class PreloadUI extends Component {
|
|||||||
SDKManager.init();
|
SDKManager.init();
|
||||||
|
|
||||||
this.preloadFiles();
|
this.preloadFiles();
|
||||||
|
|
||||||
|
this.mainScene.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected onDestroy(): void {}
|
protected onDestroy(): void {}
|
||||||
@@ -225,6 +230,8 @@ export class PreloadUI extends Component {
|
|||||||
this.reqMyInfo();
|
this.reqMyInfo();
|
||||||
this.reqGlobalData();
|
this.reqGlobalData();
|
||||||
this.reqAiCharacterData();
|
this.reqAiCharacterData();
|
||||||
|
} else {
|
||||||
|
TipsPanel.show(LanguageUtils.getText("error_code_" + res.code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,6 +245,8 @@ export class PreloadUI extends Component {
|
|||||||
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
|
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
|
||||||
walletData.balance = Number(resData.balance);
|
walletData.balance = Number(resData.balance);
|
||||||
walletData.vipExpire = Number(resData.vipExpire);
|
walletData.vipExpire = Number(resData.vipExpire);
|
||||||
|
} else {
|
||||||
|
TipsPanel.show(LanguageUtils.getText("error_code_" + res.code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,6 +260,8 @@ export class PreloadUI extends Component {
|
|||||||
// 保存数据
|
// 保存数据
|
||||||
const globalData = DataManager.I.getDataById<GlobalData>(DataId.Global);
|
const globalData = DataManager.I.getDataById<GlobalData>(DataId.Global);
|
||||||
globalData.globals = res.data;
|
globalData.globals = res.data;
|
||||||
|
} else {
|
||||||
|
TipsPanel.show(LanguageUtils.getText("error_code_" + res.code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,12 +277,15 @@ export class PreloadUI extends Component {
|
|||||||
DataId.AiCharacter
|
DataId.AiCharacter
|
||||||
);
|
);
|
||||||
aiCharacterData.aiCharacter = res.data;
|
aiCharacterData.aiCharacter = res.data;
|
||||||
|
} else {
|
||||||
|
TipsPanel.show(LanguageUtils.getText("error_code_" + res.code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private enterGame() {
|
private async enterGame() {
|
||||||
this.mainScene.init();
|
await MainController.I.init();
|
||||||
this.node.destroy();
|
this.node.destroy();
|
||||||
|
GameRootUI.I.showDefault();
|
||||||
//ResManager.I.goMainScene();
|
//ResManager.I.goMainScene();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,14 +33,14 @@ export class MainController {
|
|||||||
*/
|
*/
|
||||||
async init(): Promise<void> {
|
async init(): Promise<void> {
|
||||||
logger.log("[MainController] 开始初始化并预加载数据");
|
logger.log("[MainController] 开始初始化并预加载数据");
|
||||||
|
|
||||||
// 并行预加载所有数据
|
// 并行预加载所有数据
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.preloadThemeData(),
|
this.preloadThemeData(),
|
||||||
this.preloadDailyRecommend(),
|
this.preloadDailyRecommend(),
|
||||||
this.preloadShopList()
|
this.preloadShopList(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
logger.log("[MainController] 数据预加载完成");
|
logger.log("[MainController] 数据预加载完成");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ export class MainController {
|
|||||||
logger.log("[MainController] 开始预加载主题数据");
|
logger.log("[MainController] 开始预加载主题数据");
|
||||||
const reqData = {};
|
const reqData = {};
|
||||||
const res = await ThemeService.I.reqHallTheme(reqData);
|
const res = await ThemeService.I.reqHallTheme(reqData);
|
||||||
|
|
||||||
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
||||||
// 保存数据到DataManager
|
// 保存数据到DataManager
|
||||||
const themeData = DataManager.I.getDataById<ThemeData>(DataId.Theme);
|
const themeData = DataManager.I.getDataById<ThemeData>(DataId.Theme);
|
||||||
@@ -88,7 +88,7 @@ export class MainController {
|
|||||||
logger.log("[MainController] 开始预加载每日推荐数据");
|
logger.log("[MainController] 开始预加载每日推荐数据");
|
||||||
const reqData = {};
|
const reqData = {};
|
||||||
const res = await GirlService.I.reqDailyRecommend(reqData);
|
const res = await GirlService.I.reqDailyRecommend(reqData);
|
||||||
|
|
||||||
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
||||||
// 保存数据到DataManager
|
// 保存数据到DataManager
|
||||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
@@ -119,7 +119,7 @@ export class MainController {
|
|||||||
logger.log("[MainController] 开始预加载商品列表数据");
|
logger.log("[MainController] 开始预加载商品列表数据");
|
||||||
const reqData = {};
|
const reqData = {};
|
||||||
const res = await ShopService.I.reqShopList(reqData);
|
const res = await ShopService.I.reqShopList(reqData);
|
||||||
|
|
||||||
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
||||||
// 保存数据到DataManager
|
// 保存数据到DataManager
|
||||||
const shopData = DataManager.I.getDataById<ShopData>(DataId.Shop);
|
const shopData = DataManager.I.getDataById<ShopData>(DataId.Shop);
|
||||||
@@ -141,7 +141,11 @@ export class MainController {
|
|||||||
* 检查数据是否已预加载
|
* 检查数据是否已预加载
|
||||||
*/
|
*/
|
||||||
isDataPreloaded(): boolean {
|
isDataPreloaded(): boolean {
|
||||||
return this.isThemeDataPreloaded && this.isDailyRecommendPreloaded && this.isShopListPreloaded;
|
return (
|
||||||
|
this.isThemeDataPreloaded &&
|
||||||
|
this.isDailyRecommendPreloaded &&
|
||||||
|
this.isShopListPreloaded
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -152,7 +156,7 @@ export class MainController {
|
|||||||
themeData: this.isThemeDataPreloaded,
|
themeData: this.isThemeDataPreloaded,
|
||||||
dailyRecommend: this.isDailyRecommendPreloaded,
|
dailyRecommend: this.isDailyRecommendPreloaded,
|
||||||
shopList: this.isShopListPreloaded,
|
shopList: this.isShopListPreloaded,
|
||||||
allComplete: this.isDataPreloaded()
|
allComplete: this.isDataPreloaded(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +178,7 @@ export class MainController {
|
|||||||
try {
|
try {
|
||||||
const reqData = {};
|
const reqData = {};
|
||||||
const res = await ThemeService.I.reqHallTheme(reqData);
|
const res = await ThemeService.I.reqHallTheme(reqData);
|
||||||
|
|
||||||
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
||||||
// 保存数据到DataManager
|
// 保存数据到DataManager
|
||||||
const themeData = DataManager.I.getDataById<ThemeData>(DataId.Theme);
|
const themeData = DataManager.I.getDataById<ThemeData>(DataId.Theme);
|
||||||
@@ -200,7 +204,7 @@ export class MainController {
|
|||||||
try {
|
try {
|
||||||
const reqData = {};
|
const reqData = {};
|
||||||
const res = await GirlService.I.reqDailyRecommend(reqData);
|
const res = await GirlService.I.reqDailyRecommend(reqData);
|
||||||
|
|
||||||
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
||||||
// 保存数据到DataManager
|
// 保存数据到DataManager
|
||||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
|
|||||||
Reference in New Issue
Block a user