|
|
@@ -17,6 +17,11 @@ 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;
|
|
|
|
|
|
@@ -27,8 +32,16 @@ export default class Login extends cc.Component {
|
|
|
|
|
|
private hasCheckAnti = false;
|
|
|
|
|
|
+ private loadSceneState = false;
|
|
|
+
|
|
|
+ private hasCheckPermission = false;
|
|
|
+
|
|
|
+ private hasCheckPrivacy = false;
|
|
|
+
|
|
|
onLoad() {
|
|
|
this.setProgress(0);
|
|
|
+ this.node_loadPart.active = true;
|
|
|
+ this.node_btnLogin.active = false;
|
|
|
}
|
|
|
|
|
|
start() {
|
|
|
@@ -43,20 +56,19 @@ export default class Login extends cc.Component {
|
|
|
else {
|
|
|
mk.aliRiskManager.init();
|
|
|
}
|
|
|
-
|
|
|
- this.init();
|
|
|
}
|
|
|
|
|
|
update() {
|
|
|
- if (!gData.appData.getDeviceInfoCompelete) {
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
if (!this.hasDeviceBackInit) {
|
|
|
this.hasDeviceBackInit = true;
|
|
|
- this.getDeviceInfoBack();
|
|
|
+ this.getAppVersion();
|
|
|
}
|
|
|
|
|
|
+ // if (!this.hasDeviceBackInit) {
|
|
|
+ // this.hasDeviceBackInit = true;
|
|
|
+ // this.getDeviceInfoBack();
|
|
|
+ // }
|
|
|
+
|
|
|
//如果更新没有结束,就不进入正常加载流程
|
|
|
if (gData.appData.updateState == UpdateState.ForceUpdateFinish) {
|
|
|
gData.appData.updateState = UpdateState.CheckHot;
|
|
|
@@ -73,6 +85,25 @@ export default class Login extends cc.Component {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if (!this.hasCheckPrivacy) {
|
|
|
+ this.hasCheckPrivacy = true
|
|
|
+ this.checkPrivacy()
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!gData.loginData.passPrivacy) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!this.hasCheckPermission) {
|
|
|
+ this.hasCheckPermission = true;
|
|
|
+ //获取手机授权
|
|
|
+ JsbSystem.checkPermission();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!gData.appData.getDeviceInfoCompelete) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
if (!CC_DEBUG) {
|
|
|
if (gData.loginData.popIdentifySwitch) {
|
|
|
if (!this.hasCheckAnti) {
|
|
|
@@ -99,16 +130,18 @@ export default class Login extends cc.Component {
|
|
|
this.login();
|
|
|
}
|
|
|
else if (gData.gameData.dataFinish) {//登录流程完毕
|
|
|
- if (mk.storage.getStorage("agreementTip", false) != 1) {
|
|
|
- mk.ui.openPanel("module/login/agreementTip");
|
|
|
- mk.storage.setStorage("agreementTip", 1, false);
|
|
|
+ if (gData.loginData.isAuth || CC_DEBUG) {
|
|
|
+ if (!this.loadSceneState) {
|
|
|
+ this.loadSceneState = true;
|
|
|
+ this.loadMain();
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
- mk.ui.openPanel("game/prefab/game");
|
|
|
- console.log("===[Jsbsystem 显示开屏广告================================")
|
|
|
- JsbSystem.showSplash();
|
|
|
+ this.node_loadPart.active = false;
|
|
|
+ this.node_btnLogin.active = true;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
gData.gameData.dataFinish = false;
|
|
|
}
|
|
|
}
|
|
|
@@ -117,19 +150,34 @@ export default class Login extends cc.Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private async loadMain() {
|
|
|
+ mk.ui.openPanel("game/prefab/game");
|
|
|
+ console.log("===[Jsbsystem 显示开屏广告================================")
|
|
|
+ JsbSystem.showSplash();
|
|
|
+ }
|
|
|
+
|
|
|
+ private checkPrivacy() {
|
|
|
+ if (mk.storage.getStorage("agreementTip") != 1) {
|
|
|
+ mk.ui.openPanel("module/login/agreementTip");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ gData.loginData.passPrivacy = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/** 设置进度 */
|
|
|
private setProgress(current) {
|
|
|
this.bar.setProgress(current);
|
|
|
this.lbl_progress.string = "加载不消耗流量 " + current + "%";
|
|
|
}
|
|
|
|
|
|
- /** 初始化 */
|
|
|
- public async init() {
|
|
|
- //获取appid 和 配置version
|
|
|
- JsbSystem.getWxAppId();
|
|
|
- //获取手机授权
|
|
|
- JsbSystem.checkPermission();
|
|
|
- }
|
|
|
+ // /** 初始化 */
|
|
|
+ // public async init() {
|
|
|
+ // //获取appid 和 配置version
|
|
|
+ // JsbSystem.getWxAppId();
|
|
|
+ // //获取手机授权
|
|
|
+ // JsbSystem.checkPermission();
|
|
|
+ // }
|
|
|
|
|
|
/** 获取设备信息后 */
|
|
|
public async getDeviceInfoBack() {
|
|
|
@@ -140,6 +188,17 @@ export default class Login extends cc.Component {
|
|
|
mk.audio.init();
|
|
|
}
|
|
|
|
|
|
+ /** 获取appid 和 version */
|
|
|
+ public async getAppVersion() {
|
|
|
+ //获取appid 和 配置version
|
|
|
+ JsbSystem.getWxAppId();
|
|
|
+ //获取登录需要的sessionkey
|
|
|
+ gData.loginData.init();
|
|
|
+ await this.checkForceUpate();
|
|
|
+ this.checkRemoveLocalHot();
|
|
|
+ mk.audio.init();
|
|
|
+ }
|
|
|
+
|
|
|
//整包更新和新流程--------------------------------------------------------
|
|
|
/** 新包覆盖安装后清除热更版本,重启 */
|
|
|
checkRemoveLocalHot() {
|
|
|
@@ -247,5 +306,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;
|
|
|
+ }, 3)
|
|
|
+
|
|
|
+ JsbSystem.WxAuth();
|
|
|
+ }
|
|
|
}
|
|
|
|