update to laptop

This commit is contained in:
silas
2018-07-06 12:17:33 +02:00
parent e2cf7e0a34
commit f04c9ec9b7
7 changed files with 218 additions and 141 deletions

View File

@@ -69,8 +69,8 @@ export class LevelSite extends AbstractSite {
this._siteContent.classList.remove('won');
const db = WordRotatorDb.getInstance();
// const nextLevelJson = await db.loadNextLevel([20,40,60]);
const nextLevelJson = await db.loadNextLevel([100]);
const nextLevelJson = await db.loadNextLevel([20,40,60]);
// const nextLevelJson = await db.loadNextLevel([100]);
if (nextLevelJson === null) {
this.startSite(EndSite);
return;

View File

@@ -27,31 +27,77 @@ export class SixWordsRowLevel extends Level {
leafsWords[4] = Level._createLeafsForWord(this.words[0], this.templateContainer.copyLeafTemplate());
leafsWords[5] = Level._createLeafsForWord(this.words[0], this.templateContainer.copyLeafTemplate());
let leafes = [];
let rootSegment = new RowSegment(this.templateContainer.copyRowTemplate());
for (let i = 0, n = this.wordLength / 2; i < n; i++) {
for (let i = 0, n = this.wordLength / 4; i < n; i++) {
let parents = [];
parents[0] = new ParentSegment(this.templateContainer.copyParentTemplate());
parents[1] = new ParentSegment(this.templateContainer.copyParentTemplate());
parents[2] = new ParentSegment(this.templateContainer.copyParentTemplate());
parents[3] = new ParentSegment(this.templateContainer.copyParentTemplate());
parents[4] = new ParentSegment(this.templateContainer.copyParentTemplate());
parents[5] = new ParentSegment(this.templateContainer.copyParentTemplate());
parents[0].addChild(leafsWords[0][4*i]);
parents[0].addChild(leafsWords[0][4*i+1]);
parents[0].addChild(leafsWords[1][4*i]);
parents[0].addChild(leafsWords[1][4*i+1]);
parents[1].addChild(leafsWords[0][4*i+2]);
parents[1].addChild(leafsWords[0][4*i+3]);
parents[1].addChild(leafsWords[1][4*i+2]);
parents[1].addChild(leafsWords[1][4*i+3]);
parents[2].addChild(leafsWords[2][4*i]);
parents[2].addChild(leafsWords[2][4*i+1]);
parents[2].addChild(leafsWords[3][4*i]);
parents[2].addChild(leafsWords[3][4*i+1]);
parents[3].addChild(leafsWords[2][4*i+2]);
parents[3].addChild(leafsWords[2][4*i+3]);
parents[3].addChild(leafsWords[3][4*i+2]);
parents[3].addChild(leafsWords[3][4*i+3]);
parents[4].addChild(leafsWords[4][4*i]);
parents[4].addChild(leafsWords[4][4*i+1]);
parents[4].addChild(leafsWords[5][4*i]);
parents[4].addChild(leafsWords[5][4*i+1]);
parents[5].addChild(leafsWords[4][4*i+2]);
parents[5].addChild(leafsWords[4][4*i+3]);
parents[5].addChild(leafsWords[5][4*i+2]);
parents[5].addChild(leafsWords[5][4*i+3]);
let parent = new ParentSegment(this.templateContainer.copyParentTemplate());
let triangle = new TriangleSegment(this.templateContainer.copyTriangleTemplate());
if (i % 2 === 0) {
parent.addChild(leafsWordOne[2 * i]);
parent.addChild(leafsWordOne[2 * i + 1]);
parent.addChild(leafsWordTwo[2 * i]);
parent.addChild(leafsWordTwo[2 * i + 1]);
parent.addChild(parents[0]);
parent.addChild(parents[1]);
parent.addChild(parents[2]);
parent.addChild(parents[3]);
let rowSegment = new RowSegment(this.templateContainer.copyRowTemplate());
rowSegment.addChild(parents[4]);
rowSegment.addChild(parents[5]);
triangle.addChild(parent);
triangle.addChild(leafsWordThree[2 * i]);
triangle.addChild(leafsWordThree[2 * i + 1]);
triangle.addChild(rowSegment);
triangle.getElement().classList.add("type-1");
}
else {
parent.addChild(leafsWordTwo[2 * i]);
parent.addChild(leafsWordTwo[2 * i + 1]);
parent.addChild(leafsWordThree[2 * i]);
parent.addChild(leafsWordThree[2 * i + 1]);
triangle.addChild(leafsWordOne[2 * i]);
triangle.addChild(leafsWordOne[2 * i + 1]);
triangle.addChild(parents[0]);
triangle.addChild(parents[1]);
triangle.addChild(parent);
parent.addChild(parents[2]);
parent.addChild(parents[3]);
parent.addChild(parents[4]);
parent.addChild(parents[5]);
triangle.getElement().classList.add("type-2");
}
rootSegment.addChild(triangle);
}

View File

@@ -100,9 +100,32 @@ $rotationDegrees: (90 180 270 360);
&.segment-parent {
border: solid 1px #a9a9a9;
border-radius: 3px;
.segment {
width: 50%;
> .child-container{
> .segment {
width: 50%;
}
}
.segment {
//width: 50%;
//height: 50%;
}
}
&.segment-triangle {
//display: inline-block;
//width: 100%;
//animation: none !important;
//&.type-1 {
// > .child-container {
// > .segment-parent:first-child {
// //width: 100%;
// }
// > .segment-parent:not(:first-child) {
// //width: 50%;
// }
// }
//}
}
}