Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alternative display mode for Slitherlink #256

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
|`dispqnumbg`|`boolean`|`false`|Set background color of question circles silver for `'Yin Yang'`|
|`undefcell`|`boolean`|`true`|Set background color of undetermined cell for `'School Trip'`|
|`squarecell`|`boolean`|`true`|Set cell on the board always square|
|`altline`|`boolean`|`false`|Alternative display mode for `'Slitherlink'`|

## List of config for input method

Expand Down
6 changes: 6 additions & 0 deletions src-ui/p.html
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ <h2 id="title2">読み込み中です...</h2>
<span>__数字・記号をパネルで入力する__Input numbers by panel__</span>
</label>
</div>
<div class="config" data-config="altline">
<label>
<input type="checkbox">
<span>__ __Alternative display mode__</span>
</label>
</div>
<div class="config" data-config="irowake">
<label>
<input type="checkbox">
Expand Down
5 changes: 5 additions & 0 deletions src/puzzle/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
); /* shakashaka: 三角形の入力補助 (for 2つ以上の壁に接したCell) */

this.add("bgcolor", false); /* slither 背景色入力 */
this.add("altline", false); /* slither 背景色入力 */
this.add(
"singlenum",
!pzpr.env.API.touchevent
Expand Down Expand Up @@ -328,6 +329,9 @@
case "bgcolor":
exec = pid === "slither";
break;
case "altline":
exec = pid === "slither";
break;
case "irowake":
exec = puzzle.painter.irowake;
break;
Expand Down Expand Up @@ -402,6 +406,7 @@
case "disptype_yajilin":
case "disptype_interbd":
case "dispqnumbg":
case "altline":
puzzle.redraw();
break;

Expand Down
2 changes: 1 addition & 1 deletion src/variety-common/Graphic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ pzpr.classmgr.makeCommon({
for (var i = 0; i < blist.length; i++) {
var border = blist[i];
g.vid = "b_peke_" + border.id;
if (border.qsub === 2) {
if (!this.puzzle.execConfig("altline") && border.qsub === 2) {
g.strokeStyle = !border.trial ? this.pekecolor : this.trialcolor;
g.strokeCross(border.bx * this.bw, border.by * this.bh, size - 1);
} else {
Expand Down
13 changes: 13 additions & 0 deletions src/variety/slither.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@

paint: function() {
this.drawBGCells();
this.drawBorders();
this.drawLines();
this.drawBaseMarks();
this.drawQuesNumbers();
Expand All @@ -122,6 +123,18 @@
repaintParts: function(blist) {
this.range.crosses = blist.crossinside();
this.drawBaseMarks();
},

getBorderColor: function(border) {
if (
this.puzzle.execConfig("altline") &&
!border.isLine() &&
border.qsub !== 2
) {
return "rgb(220,220,200)";
} else {
return null;
}
}
},

Expand Down