|
|
@@ -19,6 +19,10 @@ export default class Login extends cc.Component {
|
|
|
private lbl_server: cc.Label = null;
|
|
|
@property({ displayName: '隐私协议', type: cc.Label })
|
|
|
private lbl_privacy: cc.Label = null;
|
|
|
+ @property({ displayName: '加载部分', type: cc.Node })
|
|
|
+ private node_loadPart: cc.Node = null;
|
|
|
+ @property({ displayName: '登录按钮', type: cc.Node })
|
|
|
+ private node_btnLogin: cc.Node = null;
|
|
|
/** 加载进度 */
|
|
|
private process: number = 0;
|
|
|
|
|
|
@@ -33,13 +37,19 @@ export default class Login extends cc.Component {
|
|
|
|
|
|
private hasCheckPrivacy = false;
|
|
|
|
|
|
+ private loadSceneState = false;
|
|
|
+
|
|
|
+ private coreGame = null;
|
|
|
+
|
|
|
onLoad() {
|
|
|
this.lbl_progress.node.active = false;
|
|
|
this.node_load.active = true;
|
|
|
+ this.node_loadPart.active = true;
|
|
|
+ this.node_btnLogin.active = false;
|
|
|
this.setProgress(0);
|
|
|
}
|
|
|
|
|
|
- start() {
|
|
|
+ async start() {
|
|
|
if (mk.storage.getStorage("alifengkong") == 1) {
|
|
|
return;
|
|
|
}
|
|
|
@@ -52,7 +62,8 @@ export default class Login extends cc.Component {
|
|
|
mk.aliRiskManager.init();
|
|
|
}
|
|
|
|
|
|
- mk.loader.preload('game/coregame/coregame', cc.Prefab);
|
|
|
+ // mk.loader.preload('game/coregame/coregame', cc.Prefab);
|
|
|
+ this.coreGame = await mk.loader.load('game/coregame/coregame', cc.Prefab);
|
|
|
}
|
|
|
|
|
|
update() {
|
|
|
@@ -108,22 +119,31 @@ export default class Login extends cc.Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (this.process < 100) {
|
|
|
- this.process += 2;
|
|
|
- this.setProgress(this.process);
|
|
|
+ if (!this.loadSceneState) {
|
|
|
+ this.loadSceneState = true;
|
|
|
+ this.loadMain();
|
|
|
}
|
|
|
+ // if (this.process < 100) {
|
|
|
+ // this.process += 2;
|
|
|
+ // this.setProgress(this.process);
|
|
|
+ // }
|
|
|
|
|
|
if (gData.loginData.loadResCompelete) {
|
|
|
if (mk.aliRiskManager.getRiskCode) {
|
|
|
mk.aliRiskManager.getRiskCode = false;
|
|
|
this.login();
|
|
|
}
|
|
|
- else if (gData.gameData.dataFinish) {//登录流程完毕
|
|
|
- let node = cc.find('Canvas/主界面层');
|
|
|
- mk.ui.openPanel("game/prefab/game", OpenActionType.closeOther, node);
|
|
|
- console.log("===[Jsbsystem 显示开屏广告================================")
|
|
|
- if (mk.ad.ifShowAd) {
|
|
|
- JsbSystem.showSplash();
|
|
|
+ else if (gData.gameData.dataFinish && this.coreGame) {//登录流程完毕
|
|
|
+ if (gData.loginData.isAuth || CC_DEBUG) {
|
|
|
+ this.addToScene();
|
|
|
+ console.log("===[Jsbsystem 显示开屏广告================================")
|
|
|
+ if (mk.ad.ifShowAd) {
|
|
|
+ JsbSystem.showSplash();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.node_loadPart.active = false;
|
|
|
+ this.node_btnLogin.active = true;
|
|
|
}
|
|
|
|
|
|
gData.gameData.dataFinish = false;
|
|
|
@@ -134,6 +154,18 @@ export default class Login extends cc.Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private async loadMain() {
|
|
|
+ this.coreGame = await mk.loader.load('game/coregame/coregame', cc.Prefab, this.setProgress.bind(this));
|
|
|
+ }
|
|
|
+
|
|
|
+ private addToScene() {
|
|
|
+ let mainNode = cc.find('Canvas/主容器');
|
|
|
+ let node = cc.find('Canvas/主界面层');
|
|
|
+ mk.ui.openPanel("game/prefab/game", OpenActionType.closeOther, node);
|
|
|
+
|
|
|
+ mainNode.addChild(cc.instantiate(this.coreGame));
|
|
|
+ }
|
|
|
+
|
|
|
private checkPrivacy() {
|
|
|
if (mk.storage.getStorage("agreementTip") != 1) {
|
|
|
mk.ui.openPanel("module/login/agreementTip");
|
|
|
@@ -145,8 +177,11 @@ export default class Login extends cc.Component {
|
|
|
|
|
|
/** 设置进度 */
|
|
|
private setProgress(current) {
|
|
|
- this.bar.fillRange = current / 100;
|
|
|
- this.lbl_progress.string = "加载中 " + current + "%";
|
|
|
+ let cur = current / 100;
|
|
|
+ if (cur > this.bar.fillRange) {
|
|
|
+ this.bar.fillRange = cur;
|
|
|
+ this.lbl_progress.string = "加载中 " + current + "%";
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/** 获取设备信息后 */
|
|
|
@@ -269,5 +304,21 @@ export default class Login extends cc.Component {
|
|
|
mk.ui.openPanel('module/certification/CertificationNode');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private cool = false;
|
|
|
+ clickLogin() {
|
|
|
+ mk.audio.playEffect('button');
|
|
|
+ if (this.cool) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.cool = true;
|
|
|
+
|
|
|
+ this.scheduleOnce(() => {
|
|
|
+ this.cool = false;
|
|
|
+ }, 2)
|
|
|
+
|
|
|
+ JsbSystem.WxAuth();
|
|
|
+ }
|
|
|
}
|
|
|
|