bugfix
This commit is contained in:
@@ -36,11 +36,10 @@ export 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);
|
||||
|
||||
@@ -137,6 +136,7 @@ export class LevelSite extends WordRotatorBaseSite {
|
||||
this.level = level;
|
||||
let res = this.tutorial();
|
||||
Matomo.push(["trackEvent", "LevelSite", "LoadLastLevel"]);
|
||||
this.level.checkHasWon();
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -185,10 +185,10 @@ export 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) {
|
||||
@@ -206,6 +206,15 @@ export 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;
|
||||
}
|
||||
|
||||
@@ -258,7 +267,7 @@ export 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);
|
||||
@@ -308,8 +317,9 @@ export 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);
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ export class Level {
|
||||
if (this.rootSegment.isSolved()){
|
||||
this.hasWon = true;
|
||||
const self = this;
|
||||
delayPromise.then(()=>{
|
||||
Promise.resolve(delayPromise).then(()=>{
|
||||
self.wonResolver(true);
|
||||
});
|
||||
return true;
|
||||
|
||||
@@ -171,13 +171,15 @@ export 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]))))
|
||||
|
||||
@@ -10,7 +10,7 @@ use Zend\View\Model\ViewModel;
|
||||
|
||||
class IndexController extends OnlineController
|
||||
{
|
||||
const LENGTH_WORDS_MIN = 6;
|
||||
const LENGTH_WORDS_MIN = 12;
|
||||
const LENGTH_WORDS_MAX = 12;
|
||||
|
||||
const NUMBER_WORDS_TO_CHECK_SIMULTANEOUSLY = 8;
|
||||
@@ -33,6 +33,7 @@ class IndexController extends OnlineController
|
||||
$wordsDeleted = $wordManager->countDeleted(self::LENGTH_WORDS_MIN, self::LENGTH_WORDS_MAX);
|
||||
$wordsChecked = $wordManager->countChecked(self::LENGTH_WORDS_MIN, self::LENGTH_WORDS_MAX);
|
||||
$wordsUnsure = $wordManager->countUnsure(self::LENGTH_WORDS_MIN, self::LENGTH_WORDS_MAX);
|
||||
$wordsNotUsed = $wordManager->countNotUsed(self::LENGTH_WORDS_MIN, self::LENGTH_WORDS_MAX);
|
||||
|
||||
$wordsToCheck = [];
|
||||
for ($i = 0; $i < self::NUMBER_WORDS_TO_CHECK_SIMULTANEOUSLY; $i++) {
|
||||
@@ -45,6 +46,7 @@ class IndexController extends OnlineController
|
||||
"wordsChecked" => $wordsChecked,
|
||||
"wordsUnsure" => $wordsUnsure,
|
||||
"wordsToCheck" => $wordsToCheck,
|
||||
"wordsNotUsed" => $wordsNotUsed,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -134,4 +134,9 @@ class WordManager extends StandardManager
|
||||
{
|
||||
return $this->repository->findWordsForLength($length);
|
||||
}
|
||||
|
||||
public function countNotUsed($minLength = 0, $maxLength = 100)
|
||||
{
|
||||
return $this->repository->countNotUsed($minLength, $maxLength);
|
||||
}
|
||||
}
|
||||
@@ -141,4 +141,20 @@ class WordRepository extends StandardRepository
|
||||
$queryBuilder->setParameter("length", $length);
|
||||
return $queryBuilder->getQuery()->getResult();
|
||||
}
|
||||
|
||||
public function countNotUsed(int $minLength, int $maxLength)
|
||||
{
|
||||
$queryBuilder = $this->_em->createQueryBuilder();
|
||||
$queryBuilder->select("COUNT(w.id)")->from(Word::class, "w");
|
||||
|
||||
$queryBuilder->andWhere($queryBuilder->expr()->eq("w.checked", "1"));
|
||||
$queryBuilder->andWhere($queryBuilder->expr()->eq("w.deleted", "0"));
|
||||
$queryBuilder->andWhere($queryBuilder->expr()->eq("w.used", "0"));
|
||||
$queryBuilder->andWhere($queryBuilder->expr()->gte($queryBuilder->expr()->length("w.word"), ":minLength"));
|
||||
$queryBuilder->andWhere($queryBuilder->expr()->lte($queryBuilder->expr()->length("w.word"), ":maxLength"));
|
||||
$queryBuilder->setParameter("minLength", $minLength);
|
||||
$queryBuilder->setParameter("maxLength", $maxLength);
|
||||
$queryBuilder->setMaxResults(1);
|
||||
return $queryBuilder->getQuery()->getSingleScalarResult();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user