|
@@ -50,6 +50,8 @@
|
|
|
let CHANGE_SECRETARY = "CHANGE_SECRETARY";
|
|
|
let POWER_CHANGE = "POWER_CHANGE";
|
|
|
let POWER_TIME = "POWER_TIME";
|
|
|
+ let LOGIN_OUT = "LOGIN_OUT";
|
|
|
+ let LOGIN_IN = "LOGIN_IN";
|
|
|
let keyForLoginInfo = "userInfo";
|
|
|
let TIP_MSG_key = {
|
|
|
loginTimeOut: "Login timed out, please log in again.",
|
|
@@ -153,6 +155,8 @@
|
|
|
CHANGE_SECRETARY: CHANGE_SECRETARY,
|
|
|
POWER_CHANGE: POWER_CHANGE,
|
|
|
POWER_TIME: POWER_TIME,
|
|
|
+ LOGIN_OUT: LOGIN_OUT,
|
|
|
+ LOGIN_IN: LOGIN_IN,
|
|
|
keyForLoginInfo: keyForLoginInfo,
|
|
|
TIP_MSG_key: TIP_MSG_key,
|
|
|
baseHeadUrl: baseHeadUrl,
|
|
@@ -6981,8 +6985,13 @@
|
|
|
"buySpids": { 1: false, 7: false }
|
|
|
};
|
|
|
LocalStorageManager.setItem(keyStr, jsonStr);
|
|
|
+ let myu = Moyu.getUserInfo();
|
|
|
+ console.log('zh:myu = ' + JSON.stringify(myu));
|
|
|
+ DataMgr.updateUserNickName(res.username);
|
|
|
+ Moyu.updateUserInfo(res.username);
|
|
|
xGame.uiMgr.Show(UIMsg, msg);
|
|
|
DataMgr.getUserZiChanInfo();
|
|
|
+ xGame.eventMgr.event(LOGIN_IN);
|
|
|
this.closeSelf();
|
|
|
}
|
|
|
else {
|
|
@@ -7554,6 +7563,8 @@
|
|
|
xGame.eventMgr.on(RESTART_GAME, this, this.beginGame);
|
|
|
xGame.eventMgr.on(GET_USER_INFO, this, this.onGetUserInfo);
|
|
|
xGame.eventMgr.on(CHANGE_SECRETARY, this, this.changeSecretary);
|
|
|
+ xGame.eventMgr.on(LOGIN_OUT, this, this.setUserDefaultNickname);
|
|
|
+ xGame.eventMgr.on(LOGIN_IN, this, this.event_login_in);
|
|
|
let curUse = DataMgr.getCurSecretary();
|
|
|
this.changeSecretary(curUse);
|
|
|
this.ui.talkNode.visible = false;
|
|
@@ -7565,7 +7576,9 @@
|
|
|
console.log("zh:播放小秘书每天语音");
|
|
|
}
|
|
|
this.onGetUserInfo();
|
|
|
- DataMgr.getUserZiChanInfo();
|
|
|
+ if (LocalStorageManager.hasJosnKey(keyForLoginInfo)) {
|
|
|
+ DataMgr.getUserZiChanInfo();
|
|
|
+ }
|
|
|
this.ui.n83.visible = false;
|
|
|
if (LocalStorageManager.hasJosnKey(keyForLoginInfo)) {
|
|
|
const d = LocalStorageManager.getItem(keyForLoginInfo);
|
|
@@ -7575,6 +7588,7 @@
|
|
|
this.c_btn_for_user();
|
|
|
window['nativeCallJs'] = this.nativeCallJs.bind(this);
|
|
|
this.loadUserSpOrderForAd();
|
|
|
+ this.ui.n_fuli.visible = false;
|
|
|
}
|
|
|
Logout() {
|
|
|
if (LocalStorageManager.hasJosnKey(keyForLoginInfo)) {
|
|
@@ -7582,6 +7596,13 @@
|
|
|
this.freshUser();
|
|
|
}
|
|
|
JSBridgeUtils.instance.loginOutForApp();
|
|
|
+ this.setUserDefaultNickname();
|
|
|
+ }
|
|
|
+ setUserDefaultNickname() {
|
|
|
+ let defUsername = "player";
|
|
|
+ this.ui.headNode.nameTxt.text = defUsername;
|
|
|
+ DataMgr.updateUserNickName(defUsername);
|
|
|
+ Moyu.updateUserInfo(defUsername);
|
|
|
}
|
|
|
gotoLogin() {
|
|
|
xGame.uiMgr.Show(UILogin);
|
|
@@ -7645,7 +7666,12 @@
|
|
|
checkForShowFuLi17(spid) {
|
|
|
let userInfo = LocalStorageManager.getItem(keyForLoginInfo);
|
|
|
if (userInfo == null) {
|
|
|
- console.log('zh:没有登录就不显示福利弹框了');
|
|
|
+ if (spid === 1) {
|
|
|
+ xGame.uiMgr.Show(UIFuli1);
|
|
|
+ }
|
|
|
+ if (spid === 7) {
|
|
|
+ xGame.uiMgr.Show(UIFuli2);
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
console.log('zh:是否需要展示福利 ' + spid + ' 的弹窗');
|
|
@@ -7784,6 +7810,14 @@
|
|
|
}
|
|
|
Laya.timer.once(randTime, this, () => {
|
|
|
});
|
|
|
+ Laya.timer.once(1000, this, () => {
|
|
|
+ console.log('zh: 1秒后 showFuLiSp1');
|
|
|
+ this.showFuLiSp1();
|
|
|
+ });
|
|
|
+ Laya.timer.once(10000, this, () => {
|
|
|
+ console.log('zh: 10秒后 showFuLiSp1');
|
|
|
+ this.showFuLiSp7();
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
checkActive(show) {
|
|
@@ -7995,6 +8029,10 @@
|
|
|
}
|
|
|
this.freshUser();
|
|
|
}
|
|
|
+ event_login_in() {
|
|
|
+ console.log("zh:event_login_in被触发");
|
|
|
+ this.freshUser();
|
|
|
+ }
|
|
|
freshUser() {
|
|
|
let user = Moyu.getUserInfo();
|
|
|
if (!user.isAuth) {
|
|
@@ -18617,6 +18655,17 @@
|
|
|
xGame.eventMgr.event(event, arg);
|
|
|
});
|
|
|
}
|
|
|
+ static updateUserNickName(loginUserName) {
|
|
|
+ let kyeStr = 'moyudata_180';
|
|
|
+ console.log('zh:################### kyeStr=' + kyeStr);
|
|
|
+ const moyudata = Laya.LocalStorage.getItem(kyeStr);
|
|
|
+ if (moyudata) {
|
|
|
+ const obj = JSON.parse(moyudata);
|
|
|
+ obj.nickName = loginUserName;
|
|
|
+ Laya.LocalStorage.setItem(kyeStr, JSON.stringify(obj));
|
|
|
+ console.log('zh:################### updateUserNickName');
|
|
|
+ }
|
|
|
+ }
|
|
|
static saveGameData() {
|
|
|
if (this.gameSaving)
|
|
|
return;
|
|
@@ -23791,8 +23840,13 @@
|
|
|
"buySpids": { 1: false, 7: false }
|
|
|
};
|
|
|
LocalStorageManager.setItem(keyStr, jsonStr);
|
|
|
+ let myu = Moyu.getUserInfo();
|
|
|
+ console.log('zh:myu = ' + JSON.stringify(myu));
|
|
|
+ DataMgr.updateUserNickName(res.username);
|
|
|
+ Moyu.updateUserInfo(res.username);
|
|
|
xGame.uiMgr.Show(UIMsg$1, msg);
|
|
|
DataMgr.getUserZiChanInfo();
|
|
|
+ xGame.eventMgr.event(LOGIN_IN);
|
|
|
this.closeSelf();
|
|
|
}
|
|
|
else {
|
|
@@ -24428,6 +24482,8 @@
|
|
|
xGame.eventMgr.on(RESTART_GAME, this, this.beginGame);
|
|
|
xGame.eventMgr.on(GET_USER_INFO, this, this.onGetUserInfo);
|
|
|
xGame.eventMgr.on(CHANGE_SECRETARY, this, this.changeSecretary);
|
|
|
+ xGame.eventMgr.on(LOGIN_OUT, this, this.setUserDefaultNickname);
|
|
|
+ xGame.eventMgr.on(LOGIN_IN, this, this.event_login_in);
|
|
|
let curUse = DataMgr.getCurSecretary();
|
|
|
this.changeSecretary(curUse);
|
|
|
this.ui.talkNode.visible = false;
|
|
@@ -24439,7 +24495,9 @@
|
|
|
console.log("zh:播放小秘书每天语音");
|
|
|
}
|
|
|
this.onGetUserInfo();
|
|
|
- DataMgr.getUserZiChanInfo();
|
|
|
+ if (LocalStorageManager.hasJosnKey(keyForLoginInfo)) {
|
|
|
+ DataMgr.getUserZiChanInfo();
|
|
|
+ }
|
|
|
this.ui.n83.visible = false;
|
|
|
if (LocalStorageManager.hasJosnKey(keyForLoginInfo)) {
|
|
|
const d = LocalStorageManager.getItem(keyForLoginInfo);
|
|
@@ -24449,6 +24507,7 @@
|
|
|
this.c_btn_for_user();
|
|
|
window['nativeCallJs'] = this.nativeCallJs.bind(this);
|
|
|
this.loadUserSpOrderForAd();
|
|
|
+ this.ui.n_fuli.visible = false;
|
|
|
}
|
|
|
Logout() {
|
|
|
if (LocalStorageManager.hasJosnKey(keyForLoginInfo)) {
|
|
@@ -24456,6 +24515,13 @@
|
|
|
this.freshUser();
|
|
|
}
|
|
|
JSBridgeUtils.instance.loginOutForApp();
|
|
|
+ this.setUserDefaultNickname();
|
|
|
+ }
|
|
|
+ setUserDefaultNickname() {
|
|
|
+ let defUsername = "player";
|
|
|
+ this.ui.headNode.nameTxt.text = defUsername;
|
|
|
+ DataMgr.updateUserNickName(defUsername);
|
|
|
+ Moyu.updateUserInfo(defUsername);
|
|
|
}
|
|
|
gotoLogin() {
|
|
|
xGame.uiMgr.Show(UILogin$1);
|
|
@@ -24519,7 +24585,12 @@
|
|
|
checkForShowFuLi17(spid) {
|
|
|
let userInfo = LocalStorageManager.getItem(keyForLoginInfo);
|
|
|
if (userInfo == null) {
|
|
|
- console.log('zh:没有登录就不显示福利弹框了');
|
|
|
+ if (spid === 1) {
|
|
|
+ xGame.uiMgr.Show(UIFuli1$1);
|
|
|
+ }
|
|
|
+ if (spid === 7) {
|
|
|
+ xGame.uiMgr.Show(UIFuli2$1);
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
console.log('zh:是否需要展示福利 ' + spid + ' 的弹窗');
|
|
@@ -24658,6 +24729,14 @@
|
|
|
}
|
|
|
Laya.timer.once(randTime, this, () => {
|
|
|
});
|
|
|
+ Laya.timer.once(1000, this, () => {
|
|
|
+ console.log('zh: 1秒后 showFuLiSp1');
|
|
|
+ this.showFuLiSp1();
|
|
|
+ });
|
|
|
+ Laya.timer.once(10000, this, () => {
|
|
|
+ console.log('zh: 10秒后 showFuLiSp1');
|
|
|
+ this.showFuLiSp7();
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
checkActive(show) {
|
|
@@ -24869,6 +24948,10 @@
|
|
|
}
|
|
|
this.freshUser();
|
|
|
}
|
|
|
+ event_login_in() {
|
|
|
+ console.log("zh:event_login_in被触发");
|
|
|
+ this.freshUser();
|
|
|
+ }
|
|
|
freshUser() {
|
|
|
let user = Moyu.getUserInfo();
|
|
|
if (!user.isAuth) {
|