Tutorial fertig gestellt, Theme geupdated, Tests angepasst
This commit is contained in:
@@ -3097,7 +3097,7 @@ class Theme
|
||||
}
|
||||
}
|
||||
|
||||
function applyPolyfills(){
|
||||
function applyPolyfills() {
|
||||
if (!String.prototype.format) {
|
||||
String.prototype["format"] = function (args) {
|
||||
return this.replace(/{(\d+)}/g, function (match, number) {
|
||||
@@ -3190,6 +3190,7 @@ function applyPolyfills(){
|
||||
elem.removeEventListener("transitioncancel", transCancelledLis);
|
||||
elem.style.opacity = null;
|
||||
elem.style.transition = null;
|
||||
console.log("transEnd");
|
||||
resolve(true, e);
|
||||
};
|
||||
|
||||
@@ -3198,16 +3199,26 @@ function applyPolyfills(){
|
||||
elem.removeEventListener("transitioncancel", transCancelledLis);
|
||||
elem.style.opacity = null;
|
||||
elem.style.transition = null;
|
||||
console.log("transCancelled");
|
||||
resolve(false, e);
|
||||
};
|
||||
elem.addEventListener("transitionend", transEndLis);
|
||||
elem.addEventListener("transitioncancel", transCancelledLis);
|
||||
});
|
||||
|
||||
//Nach Seitenneuzeichnen, damit chrome das immer macht (und FF auch)
|
||||
requestAnimationFrame(function () {
|
||||
console.log(getComputedStyle(elem).getPropertyValue("opacity"));
|
||||
if (getComputedStyle(elem).getPropertyValue("opacity") === "1"){
|
||||
resolve(false);
|
||||
}
|
||||
//Fallback
|
||||
setTimeout(() => {
|
||||
resolve(false);
|
||||
}, time*1000);
|
||||
|
||||
//Nach Seitenneuzeichnen, damit chrome das immer macht (und FF auch)
|
||||
requestAnimationFrame(function () {
|
||||
elem.style.opacity = 1;
|
||||
requestAnimationFrame(function () {
|
||||
elem.style.opacity = 1;
|
||||
});
|
||||
});
|
||||
});
|
||||
return animPromise;
|
||||
@@ -5896,6 +5907,7 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
|
||||
if (nextLevelJson === null) {
|
||||
this.startSite(EndSite);
|
||||
this.finish();
|
||||
return;
|
||||
}
|
||||
const level = LevelHelper.inflateLevel(nextLevelJson, this.templateContainer);
|
||||
@@ -5977,9 +5989,14 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
}).then(() => {
|
||||
return Promise.all([new Promise((r) => {
|
||||
setTimeout(() => {
|
||||
r(continueButton.fadeIn());
|
||||
console.log("fadeIn");
|
||||
r(continueButton.fadeIn().then(() => {
|
||||
console.log("fade in ended!");
|
||||
}));
|
||||
}, 500);
|
||||
}), audioOptions.loadedPromise.catch(e => {
|
||||
}), audioOptions.loadedPromise.then(() => {
|
||||
console.log("audio loaded");
|
||||
}).catch(e => {
|
||||
console.error(e);
|
||||
})]);
|
||||
});
|
||||
@@ -5992,7 +6009,7 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
this.coinPromise = this.coinPromise.then(() => {
|
||||
return new Promise(r => {
|
||||
let timeout = 350;
|
||||
|
||||
console.log("coinPromise - won", this.wonParams);
|
||||
if (!this.wonParams.aborted) {
|
||||
coinElem.fadeIn(timeout / 1000);
|
||||
soundManager.play(SoundManager.CHANNELS.SOUND);
|
||||
@@ -6003,17 +6020,19 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
this.coinAction.redraw();
|
||||
}
|
||||
}, timeout / 2);
|
||||
setTimeout(r, timeout);
|
||||
}
|
||||
else {
|
||||
r();
|
||||
}
|
||||
//Always do the next promise for garbage collection
|
||||
setTimeout(r, timeout);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
this.coinPromise = this.coinPromise.catch((e) => {console.error(e);});
|
||||
this.coinPromise = this.coinPromise.catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
|
||||
this.wonTextScaler();
|
||||
this.continueButtonScaler();
|
||||
@@ -6086,6 +6105,8 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
this._siteContent.classList.remove("step-2");
|
||||
localStorage.removeItem("tutorial-step");
|
||||
this.coinPromise = this.coinPromise.then(() => {
|
||||
console.log("coinPromise - tutorial", this.wonParams);
|
||||
|
||||
FlashMessenger.addMessage("extra-coins-after-first-level");
|
||||
localStorage.setItem("coins", parseInt(Helper.nonNull(localStorage.getItem("coins"), "0")) + 50);
|
||||
this.coinAction.setTitle(Helper.nonNull(localStorage.getItem("coins"), "0"));
|
||||
@@ -6103,18 +6124,18 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
else if (this.level.id === LevelSite.TUTORIAL.SECOND_LEVEL) {
|
||||
let currentStep = Helper.nonNull(localStorage.getItem("tutorial-step"), "3");
|
||||
|
||||
let scaleHelper = new ScaleHelper();
|
||||
|
||||
this._siteContent.classList.add("tutorial");
|
||||
this._siteContent.classList.add("step-" + currentStep);
|
||||
this.levelScaler();
|
||||
|
||||
switch (currentStep) {
|
||||
case "3": {
|
||||
let scaleHelper = new ScaleHelper();
|
||||
|
||||
this._siteContent.classList.add("tutorial");
|
||||
this._siteContent.classList.add("step-" + currentStep);
|
||||
this.levelScaler();
|
||||
|
||||
let eventListener = () => {
|
||||
this._siteContent.classList.remove("tutorial");
|
||||
this._siteContent.classList.remove("step-2");
|
||||
localStorage.removeItem("tutorial-step");
|
||||
this._siteContent.classList.remove("step-3");
|
||||
localStorage.setItem("tutorial-step", "4");
|
||||
this.findBy("#help-button").removeEventListener("click", eventListener);
|
||||
};
|
||||
this.findBy("#help-button").addEventListener("click", eventListener);
|
||||
@@ -6125,12 +6146,47 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.level.id === LevelSite.TUTORIAL.BIG_SEGMENT_LEVEL) {
|
||||
let currentStep = Helper.nonNull(localStorage.getItem("tutorial-step"), "4");
|
||||
|
||||
switch (currentStep) {
|
||||
case "4": {
|
||||
|
||||
let scaleHelper = new ScaleHelper();
|
||||
this._siteContent.classList.add("tutorial");
|
||||
this._siteContent.classList.add("step-" + currentStep);
|
||||
this.levelScaler();
|
||||
|
||||
let rotatableSegments = this.level.getRotatableSegments();
|
||||
let firstSegment = rotatableSegments[0];
|
||||
|
||||
let pointer = this.findBy("#tutorial-pointer");
|
||||
pointer.remove();
|
||||
firstSegment.element.appendChild(pointer);
|
||||
|
||||
this.level.setSegmentClickedListener((segment) => {
|
||||
|
||||
if (firstSegment === segment) {
|
||||
this._siteContent.classList.remove("tutorial");
|
||||
this._siteContent.classList.remove("step-4");
|
||||
localStorage.setItem("tutorial-step", "5");
|
||||
}
|
||||
});
|
||||
|
||||
let textElem = this.findBy(".tutorial-text .step-4");
|
||||
scaleHelper.scaleToFull(textElem, textElem.parentElement, null, true, null, 2);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LevelSite.TUTORIAL = {
|
||||
FIRST_LEVEL: 67,
|
||||
SECOND_LEVEL: 15,
|
||||
BIG_SEGMENT_LEVEL: 341
|
||||
};
|
||||
|
||||
class MainMenuLevel extends FourWordsLevel{
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user