Commit ca381601 authored by zjz1994's avatar zjz1994

调整storage兼容

parent 83a2ee94
This diff is collapsed.
...@@ -598,14 +598,28 @@ ...@@ -598,14 +598,28 @@
//# sourceMappingURL=uiConfig.js.map //# sourceMappingURL=uiConfig.js.map
var getGuideInfo = (function () { 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 0;
} }
return localStorage.getItem('recyclingGuide');
}); });
var setGuide = function () { var setGuide = function () {
if (window.localStorage) try {
if (window.localStorage && window.localStorage.setItem) {
localStorage.setItem('recyclingGuide', '1'); localStorage.setItem('recyclingGuide', '1');
}
}
catch (e) {
console.log("setguide--err", e);
}
}; };
//# sourceMappingURL=getGuideInfo.js.map //# sourceMappingURL=getGuideInfo.js.map
...@@ -838,6 +852,7 @@ ...@@ -838,6 +852,7 @@
function GameView() { function GameView() {
var _this = _super.call(this) || this; var _this = _super.call(this) || this;
_this._timeCounter = 0; _this._timeCounter = 0;
_this.guidenew = false;
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this); _this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
return _this; return _this;
} }
...@@ -927,13 +942,13 @@ ...@@ -927,13 +942,13 @@
return tslib.__generator(this, function (_a) { return tslib.__generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
console.log('on start');
this._timeCounter = 0; this._timeCounter = 0;
if (!!getGuideInfo()) return [3, 2]; if (!(!getGuideInfo() && !this.guidenew)) return [3, 2];
return [4, this.guide.startGuide()]; return [4, this.guide.startGuide()];
case 1: case 1:
_a.sent(); _a.sent();
setGuide(); setGuide();
this.guidenew = true;
_a.label = 2; _a.label = 2;
case 2: case 2:
this.conveyors.clear(); 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 { ...@@ -124,22 +124,19 @@ export default class GameView extends engine.Container {
engine.Tween.removeTweens(i); engine.Tween.removeTweens(i);
}) })
} }
guidenew:boolean = false;
async start() { async start() {
console.log('on start') // console.log('on start',getGuideInfo());
this._timeCounter = 0; this._timeCounter = 0;
if (!getGuideInfo()) { if (!getGuideInfo()&&!this.guidenew) {
await this.guide.startGuide(); await this.guide.startGuide();
setGuide(); setGuide();
this.guidenew = true;
} }
this.conveyors.clear() this.conveyors.clear()
await this.countdown.startCountDown(); await this.countdown.startCountDown();
this.startGame(); this.startGame();
engine.globalEvent.dispatchEvent('recycling-time-update', { engine.globalEvent.dispatchEvent('recycling-time-update', {
second: this.getSecond(), second: this.getSecond(),
}); });
......
export default () => { export default () => {
//0 未引导 //0 未引导
if (!window.localStorage) { try{
if(window.localStorage&&window.localStorage.getItem){
return localStorage.getItem('recyclingGuide')
}else{
return 0 return 0
} }
}catch(e){
return localStorage.getItem('recyclingGuide') console.log("getguideinfo--error",e);
return 0;
}
} }
export const setGuide = () => { export const setGuide = () => {
if (window.localStorage) try{
localStorage.setItem('recyclingGuide', '1') 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