This commit is contained in:
chen wei bo
2025-08-16 01:07:50 +08:00
parent 682393b639
commit 4518a679c6
3 changed files with 316 additions and 94 deletions
+36 -6
View File
@@ -29,6 +29,8 @@ import { 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 { AuthService } from "db://assets/Scripts/chat18x/network/services/AuthService";
import { ApiCode } from "db://assets/Scripts/chat18x/network/client/types";
const { ccclass, property } = _decorator;
@@ -41,7 +43,8 @@ export class PreloadUI extends Component {
private jinduBar: Node = null;
private jinduFilled: Sprite = null;
private LabProgress: Label = null;
//private btnLogin: Sprite = null; //登录按钮
private loginNode: Node = null;
private btnLogin: Node = null; //登录按钮
start() {
//Utils.addInnerEL(InnerMsgCode.UI_ShowPrompt, this, this.resiveShowPrompt)
@@ -53,14 +56,16 @@ export class PreloadUI extends Component {
this.LabProgress = this.node
.getChildByName("LabProgress")
.getComponent(Label);
//this.btnLogin = this.node.getChildByName("btnLogin").getComponent(Sprite);
this.loginNode = this.node.getChildByName("loginNode");
this.btnLogin = this.loginNode.getChildByName("btnLogin");
//适配背景图
let BG = this.node.getChildByName("BG");
Utils.adjustBgPixelRatio(BG, 1);
this.jinduFilled.fillRange = 0;
//this.btnLogin.node.active = false;
// 注册监听
this.registerListener();
// 初始化环境配置
AppConfig.I;
@@ -181,7 +186,7 @@ export class PreloadUI extends Component {
});
} else {
this.preloadFinish = true;
this.onLogin();
this.enterLoginModule();
}
};
preloadFunc();
@@ -192,8 +197,15 @@ export class PreloadUI extends Component {
this.jinduFilled.fillRange = percent;
}
// 进入登录模块
private enterLoginModule() {
this.LabProgress.node.active = false;
this.jinduBar.active = false;
this.loginNode.active = true;
}
//登录
onLogin() {
async onLogin() {
//初始化SDK信息
// SDKManager.init(() => {
// //检测是否有授权,有授权直接登录,没有授权就先进主界面,到主界面获取权限
@@ -234,7 +246,21 @@ export class PreloadUI extends Component {
// }
// })
// })
this.loginFinish = true;
const reqData = {
GameName: "123",
Identifier: "abc",
IdentityType: 1,
OperateType: 1,
ShareDeposit: "",
MachineIdentifier: "aaa",
SdkUid: "",
};
let res = await AuthService.I.login(reqData);
console.log("登录响应数据:", res);
if (res && res.code === ApiCode.OK) {
this.loginFinish = true;
};
}
enterGame() {
@@ -254,4 +280,8 @@ export class PreloadUI extends Component {
ResManager.I.goMainScene(); //进入下一个场景
// ResManager.I.goCustomScene("Test2DScene"); //进入自定义场景
}
private registerListener() {
GButton.BandClick(this.btnLogin, this.onLogin, this);
}
}