Commit ca381601 authored by zjz1994's avatar zjz1994

调整storage兼容

parent 83a2ee94
This diff is collapsed.
......@@ -598,14 +598,28 @@
//# sourceMappingURL=uiConfig.js.map
var getGuideInfo = (function () {
if (!window.localStorage) {
try {
if (window.localStorage && window.localStorage.getItem) {
return localStorage.getItem('recyclingGuide');
}
else {
return 0;
}
}
catch (e) {
console.log("getguideinfo--error", e);
return 0;
}
return localStorage.getItem('recyclingGuide');
});
var setGuide = function () {
if (window.localStorage)
localStorage.setItem('recyclingGuide', '1');
try {
if (window.localStorage && window.localStorage.setItem) {
localStorage.setItem('recyclingGuide', '1');
}
}
catch (e) {
console.log("setguide--err", e);
}
};
//# sourceMappingURL=getGuideInfo.js.map
......@@ -838,6 +852,7 @@
function GameView() {
var _this = _super.call(this) || this;
_this._timeCounter = 0;
_this.guidenew = false;
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
return _this;
}
......@@ -927,13 +942,13 @@
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0:
console.log('on start');
this._timeCounter = 0;
if (!!getGuideInfo()) return [3, 2];
if (!(!getGuideInfo() && !this.guidenew)) return [3, 2];
return [4, this.guide.startGuide()];
case 1:
_a.sent();
setGuide();
this.guidenew = true;
_a.label = 2;
case 2:
this.conveyors.clear();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -124,22 +124,19 @@ export default class GameView extends engine.Container {
engine.Tween.removeTweens(i);
})
}
guidenew:boolean = false;
async start() {
console.log('on start')
// console.log('on start',getGuideInfo());
this._timeCounter = 0;
if (!getGuideInfo()) {
if (!getGuideInfo()&&!this.guidenew) {
await this.guide.startGuide();
setGuide();
this.guidenew = true;
}
this.conveyors.clear()
await this.countdown.startCountDown();
this.startGame();
engine.globalEvent.dispatchEvent('recycling-time-update', {
second: this.getSecond(),
});
......
export default () => {
//0 未引导
if (!window.localStorage) {
return 0
}
return localStorage.getItem('recyclingGuide')
try{
if(window.localStorage&&window.localStorage.getItem){
return localStorage.getItem('recyclingGuide')
}else{
return 0
}
}catch(e){
console.log("getguideinfo--error",e);
return 0;
}
}
export const setGuide = () => {
if (window.localStorage)
localStorage.setItem('recyclingGuide', '1')
try{
if (window.localStorage&&window.localStorage.setItem){
localStorage.setItem('recyclingGuide', '1');
}
}catch(e){
console.log("setguide--err",e);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment