This commit is contained in:
silas
2018-10-21 22:07:45 +02:00
parent 703edc8526
commit 98fc403e9e
12 changed files with 91 additions and 39 deletions

View File

@@ -5516,13 +5516,15 @@ class ParentSegment extends Segment {
return locked;
}
isSolved() {
for (let i = 0, n = this.children.length; i < n; i++) {
if (!this.children[i].isSolved()) {
return false;
isSolved(checkChildren) {
checkChildren = Helper.nonNull(checkChildren, true);
if (checkChildren) {
for (let i = 0, n = this.children.length; i < n; i++) {
if (!this.children[i].isSolved()) {
return false;
}
}
}
console.log(this.rotation, this.children, this.children[0].sameAs(this.children[3]), this.children[1].sameAs(this.children[2]), this.children[0].sameAs(this.children[1]));
return (this.rotation === 0 || (
this.children[0].sameAs(this.children[3]) && this.children[1].sameAs(this.children[2]) && (
this.rotation === 180 || this.children[0].sameAs(this.children[1]))))
@@ -5698,7 +5700,7 @@ class Level {
if (this.rootSegment.isSolved()){
this.hasWon = true;
const self = this;
delayPromise.then(()=>{
Promise.resolve(delayPromise).then(()=>{
self.wonResolver(true);
});
return true;
@@ -6193,11 +6195,10 @@ class LevelSite extends WordRotatorBaseSite {
this.coinPromise = Promise.resolve();
let settingsManager = SettingsManager.getInstance();
let soundManager = SoundManager.getInstance();
soundManager.set({
audio: "sound/single_coin_fall_on_concrete_.mp3",
muted: !settingsManager.getSetting("play-sound", true),
muted: (settingsManager.getSetting("play-sound", "1") !== "1"),
volume: 0.7
}, SoundManager.CHANNELS.SOUND);
@@ -6294,6 +6295,7 @@ class LevelSite extends WordRotatorBaseSite {
this.level = level;
let res = this.tutorial();
Matomo.push(["trackEvent", "LevelSite", "LoadLastLevel"]);
this.level.checkHasWon();
return res;
}
}
@@ -6342,10 +6344,10 @@ class LevelSite extends WordRotatorBaseSite {
this.wonParams.aborted = true;
clearTimeout(this.wonParams.coinCounterTimer);
//LevelCounter * 2 - 1, damit der durchschnittswert stimmt
// Matomo.push(["trackEvent", "LevelSite", "NextLevel", "Level Number Average", this.levelCounter*2-1]);
Matomo.push(["trackEvent", "LevelSite", "NextLevel", "Level Number Normal", this.levelCounter]);
this.level.checkHasWon();
return this.tutorial();
}
catch (e) {
@@ -6363,6 +6365,15 @@ class LevelSite extends WordRotatorBaseSite {
this.levelCounterActionContainer.classList.add("visible");
}
this.levelScaler();
let settingsManager = SettingsManager.getInstance();
let soundManager = SoundManager.getInstance();
soundManager.set({
audio: "sound/single_coin_fall_on_concrete_.mp3",
muted: (settingsManager.getSetting("play-sound", "1") !== "1"),
volume: 0.7
}, SoundManager.CHANNELS.SOUND);
return res;
}
@@ -6415,7 +6426,7 @@ class LevelSite extends WordRotatorBaseSite {
this.coinPromise = this.coinPromise.then(() => {
return new Promise(r => {
let timeout = 350;
console.log("coinPromise - won", this.wonParams);
// console.log("coinPromise - won", this.wonParams);
if (!this.wonParams.aborted) {
coinElem.fadeIn(timeout / 1000);
soundManager.play(SoundManager.CHANNELS.SOUND);
@@ -6465,8 +6476,9 @@ class LevelSite extends WordRotatorBaseSite {
let rotatables = this.level.getRotatableSegments();
rotatables = rotatables.filter((segment) => {
return (segment.rotation !== 0);
return (!segment.isSolved(false));
});
console.log(rotatables);
let index = Math.floor(Math.random() * rotatables.length);