diff --git a/src-ui/p.html b/src-ui/p.html index 01d2939f0..f6701335f 100644 --- a/src-ui/p.html +++ b/src-ui/p.html @@ -218,6 +218,7 @@

読み込み中です...

__光の照らす領域に背景色をつける__Paint background of each illuminated block__ __線が2本以上になったら点をグレーにする__Grey each letter which links over two segments__ __異なる数字の間にグレーの境界線を引く__Grey border between different areas__ + __(please translate) Skeleton for connected numbers__Skeleton for connected numbers__
diff --git a/src/puzzle/Config.js b/src/puzzle/Config.js index 7857b64c7..2e18dfc86 100644 --- a/src/puzzle/Config.js +++ b/src/puzzle/Config.js @@ -120,6 +120,7 @@ // config.getCurrentName() 以前のconfig名から現在使用している名称を取得する // config.getNormalizedName() Config名が@付きだった場合varietyのpidを返す //--------------------------------------------------------------------------- + // this seems to be about migrating settings from old to new name getCurrentName: function(name) { switch (name) { case "color_qanscolor": @@ -130,11 +131,6 @@ name = "autocmp"; } break; - case "autocmp_border": - if (this.getexec("autocmp")) { - name = "autocmp"; - } - break; } return name; }, diff --git a/src/variety/shakashaka.js b/src/variety/shakashaka.js index 0744a2674..7d76dc190 100644 --- a/src/variety/shakashaka.js +++ b/src/variety/shakashaka.js @@ -366,42 +366,11 @@ return cell.isTri(); }; return this.qnum === this.countDir4Cell(is_tri); - }, - - posthook: { - qnum: function() { - this.redrawAdjacent(); - }, - qans: function() { - this.redrawAdjacent(); - }, - qsub: function() { - this.redrawAdjacent(); - } - }, - - redrawAdjacent: function() { - var ad = this.adjacent; - var cells = new this.klass.CellList([ - ad.top, - ad.right, - ad.bottom, - ad.left - ]); - this.board.redrawAffected(cells); } }, Board: { addExtraInfo: function() { this.wrectmgr = this.addInfoList(this.klass.AreaWrectGraph); - }, - redrawAffected: function(cells) { - for (var i = 0; i < cells.length; i++) { - var c = cells[i]; - if (!c.isnull && c.qnum !== -1 && c.qnum !== -2) { - c.draw(); - } - } } }, BoardExec: { @@ -476,6 +445,19 @@ fontShadecolor: "white", qcmpcolor: "rgb(127,127,127)", + setRange: function(x1, y1, x2, y2) { + var puzzle = this.puzzle, + bd = puzzle.board; + if (puzzle.execConfig("autocmp")) { + x1 = bd.minbx - 2; + y1 = bd.minby - 2; + x2 = bd.maxbx + 2; + y2 = bd.maxby + 2; + } + + this.common.setRange.call(this, x1, y1, x2, y2); + }, + paint: function() { this.drawBGCells(); this.drawDotCells(); diff --git a/src/variety/sukoro.js b/src/variety/sukoro.js index ce73092cf..f8c192883 100644 --- a/src/variety/sukoro.js +++ b/src/variety/sukoro.js @@ -10,13 +10,95 @@ })(["sukoro", "view", "sukororoom"], { //--------------------------------------------------------- // マウス入力系 + MouseEvent: { + dragnumber_sukoro: function() { + var cell = this.getcell(); + if (cell.isnull || cell === this.mouseCell) { + return; + } + if (this.mouseCell.isnull) { + this.inputData = cell.isNumberObj() ? -2 : -3; + this.mouseCell = cell; + } else if (cell.qnum === -1) { + cell.setNum(this.inputData); + this.mouseCell = cell; + cell.draw(); + } + }, + // like normal, except we sort qsub=1 to the front + getNewNumber: function(cell, num) { + var puzzle = this.puzzle; + var max = cell.getmaxnum(), + min = cell.getminnum(), + val = -1, + qs = cell.qsub; + + var subtype = 0; + if (puzzle.editmode) { + subtype = -1; + } else { + subtype = 2; + qs = cell.qsub; + } + + // playmode: subtypeは0以上、 qsにqsub値が入る + // editmode: subtypeは-1固定、qsは常に0が入る + if (this.btn === "left") { + if (num >= max) { + val = subtype >= 1 ? -3 : -1; + } else if (qs === 1) { + val = min; + } else if (qs === 2) { + val = -1; + } else if (num === -1) { + val = -2; + } else if (num < min) { + val = min; + } else { + val = num + 1; + } + } else if (this.btn === "right") { + if (qs === 1) { + val = -1; + } else if (qs === 2) { + val = max; + } else if (num === -1) { + if (subtype === 1) { + val = -2; + } else if (subtype === 2) { + val = -3; + } else { + val = max; + } + } else if (num > max) { + val = max; + } else if (num <= min) { + val = -2; + } else if (num === -2) { + val = -1; + } else { + val = num - 1; + } + } + return val; + } + }, "MouseEvent@sukoro,view": { inputModes: { edit: ["number", "clear"], play: ["number", "numexist", "numblank", "clear"] }, mouseinput_auto: function() { - if (this.mousestart) { + if (this.puzzle.playmode) { + if (this.mousestart || this.mousemove) { + if (this.btn === "left") { + this.dragnumber_sukoro(); + } + } else if (this.mouseend && this.notInputted()) { + this.mouseCell = this.board.emptycell; + this.inputqnum(); + } + } else if (this.puzzle.editmode) { this.inputqnum(); } } @@ -104,15 +186,16 @@ minnum: 0 }, + Board: { + hasborder: 1 + }, "Board@view": { cols: 8, rows: 8 }, "Board@sukororoom": { cols: 8, - rows: 8, - - hasborder: 1 + rows: 8 }, AreaNumberGraph: { @@ -125,11 +208,29 @@ //--------------------------------------------------------- // 画像表示系 Graphic: { + autocmp: "skeleton", + skelcolor: "rgb(160, 255, 160)", // bcolor + qcmpcolor: "darkgray", + + setRange: function(x1, y1, x2, y2) { + var puzzle = this.puzzle, + bd = puzzle.board; + if (puzzle.execConfig("autocmp")) { + x1 = bd.minbx - 2; + y1 = bd.minby - 2; + x2 = bd.maxbx + 2; + y2 = bd.maxby + 2; + } + + this.common.setRange.call(this, x1, y1, x2, y2); + }, + paint: function() { this.drawBGCells(); if (this.pid === "view") { this.drawTargetSubNumber(); } + this.drawSkeleton(); this.drawGrid(); if (this.pid === "sukororoom") { @@ -142,10 +243,120 @@ } this.drawAnsNumbers(); this.drawQuesNumbers(); + this.drawCmpNumbers(); this.drawChassis(); this.drawCursor(); + }, + + drawCmpNumbers: function() { + this.vinc("cell_cmp_number", "auto"); + this.drawNumbers_com( + this.getCmpNumberText, + this.getCmpNumberColor, + "cell_cmp_text_", + { ratio: 0.45 } + ); + }, + getCmpNumberText: function(cell) { + if ( + !this.puzzle.execConfig("autocmp") || + cell.anum >= 0 || + cell.qnum >= 0 + ) { + return ""; + } + if (cell.qsub === 1) { + var c = cell.countDir4Cell(function(cell) { + return cell.isNumberObj(); + }); + return this.getNumberText(cell, c); + } + return ""; + }, + getCmpNumberColor: function(cell) { + if ((cell.error || cell.qinfo) === 1) { + return this.errcolor1; + } + return this.qcmpcolor; + }, + + drawMBs: function() { + var g = this.vinc("cell_mb", "auto", true); + g.lineWidth = 1; + + var rsize = this.cw * 0.35; + var clist = this.range.cells; + for (var i = 0; i < clist.length; i++) { + var cell = clist[i], + px, + py; + if (cell.qsub > 0) { + px = cell.bx * this.bw; + py = cell.by * this.bh; + g.strokeStyle = !cell.trial ? this.mbcolor : "rgb(192, 192, 192)"; + } + + g.vid = "c_MB1_" + cell.id; + if (cell.qsub === 1 && !this.puzzle.execConfig("autocmp")) { + g.strokeCircle(px, py, rsize); + } else { + g.vhide(); + } + + g.vid = "c_MB2_" + cell.id; + if (cell.qsub === 2) { + g.strokeCross(px, py, rsize); + } else { + g.vhide(); + } + } + }, + drawSkeleton: function() { + this.drawSkeletonDots(); + this.drawSkeletonEdges(); + }, + drawSkeletonDots: function() { + var g = this.vinc("cell_skel_dot", "auto", true); + var autocmp = this.puzzle.execConfig("autocmp"); + + var dsize = this.cw * 0.2; + var clist = this.range.cells; + for (var i = 0; i < clist.length; i++) { + var cell = clist[i]; + + g.vid = "c_dot_" + cell.id; + if (autocmp && cell.isNumberObj()) { + g.fillStyle = this.skelcolor; + g.fillCircle(cell.bx * this.bw, cell.by * this.bh, dsize); + } else { + g.vhide(); + } + } + }, + drawSkeletonEdges: function() { + var g = this.vinc("cell_skel_edge", "auto", true); + var autocmp = this.puzzle.execConfig("autocmp"); + + var dsize = this.cw * 0.2; + var blist = this.range.borders; + for (var i = 0; i < blist.length; i++) { + var b = blist[i]; + + g.vid = "b_skel_" + b.id; + var isedgevalid = + this.board.nblkmgr.isnodevalid(b.sidecell[0]) && + this.board.nblkmgr.isnodevalid(b.sidecell[1]); + if (autocmp && isedgevalid) { + var w = b.isvert ? this.bh : dsize; + var h = b.isvert ? dsize : this.bw; + g.fillStyle = this.skelcolor; + g.fillRectCenter(b.bx * this.bw, b.by * this.bh, w, h); + } else { + g.vhide(); + } + } } }, "Graphic@view": {