|
7 | 7 | } else { |
8 | 8 | pzpr.classmgr.makeCustom(pidlist, classbase); |
9 | 9 | } |
10 | | -})(["ripple", "cojun", "meander"], { |
| 10 | +})(["ripple", "cojun", "meander", "suguru"], { |
11 | 11 | //--------------------------------------------------------- |
12 | 12 | // マウス入力系 |
13 | 13 | MouseEvent: { |
14 | 14 | inputModes: { |
15 | | - edit: ["border", "number", "clear"], |
| 15 | + edit: ["border", "empty", "number", "clear"], |
16 | 16 | play: ["number", "clear"] |
17 | 17 | }, |
18 | 18 | autoedit_func: "areanum", |
19 | 19 | autoplay_func: "qnum" |
20 | 20 | }, |
21 | 21 | "MouseEvent@meander": { |
22 | 22 | inputModes: { |
23 | | - edit: ["border", "number", "clear"], |
| 23 | + edit: ["border", "empty", "number", "clear"], |
24 | 24 | play: ["number", "dragnum+", "dragnum-", "clear"] |
25 | 25 | }, |
26 | 26 | mouseinput: function() { |
|
106 | 106 | // キーボード入力系 |
107 | 107 | KeyEvent: { |
108 | 108 | enablemake: true, |
109 | | - enableplay: true |
| 109 | + enableplay: true, |
| 110 | + |
| 111 | + keyinput: function(ca) { |
| 112 | + if ((ca === "q" || ca === "w") && this.puzzle.editmode) { |
| 113 | + var cell = this.cursor.getc(); |
| 114 | + if (!cell.isnull) { |
| 115 | + cell.setValid(cell.ques !== 7 ? 7 : 0); |
| 116 | + } |
| 117 | + } else { |
| 118 | + this.key_inputqnum(ca); |
| 119 | + } |
| 120 | + } |
110 | 121 | }, |
111 | 122 |
|
112 | 123 | //--------------------------------------------------------- |
|
117 | 128 | return this.room.clist.length; |
118 | 129 | } |
119 | 130 | }, |
| 131 | + Border: { |
| 132 | + isQuesBorder: function() { |
| 133 | + return ( |
| 134 | + this.ques || this.sidecell[0].isEmpty() || this.sidecell[1].isEmpty() |
| 135 | + ); |
| 136 | + } |
| 137 | + }, |
120 | 138 | Board: { |
121 | 139 | hasborder: 1 |
122 | 140 | }, |
123 | | - "Board@cojun": { |
| 141 | + "Board@cojun,suguru": { |
124 | 142 | cols: 8, |
125 | 143 | rows: 8 |
126 | 144 | }, |
|
139 | 157 | Graphic: { |
140 | 158 | gridcolor_type: "DLIGHT", |
141 | 159 |
|
| 160 | + getBGCellColor: function(cell) { |
| 161 | + if (!cell.isValid()) { |
| 162 | + return "black"; |
| 163 | + } |
| 164 | + return this.getBGCellColor_error1(cell); |
| 165 | + }, |
| 166 | + |
142 | 167 | paint: function() { |
143 | 168 | this.drawBGCells(); |
144 | 169 | this.drawTargetSubNumber(); |
|
153 | 178 | this.drawChassis(); |
154 | 179 |
|
155 | 180 | this.drawCursor(); |
| 181 | + }, |
| 182 | + |
| 183 | + getBorderColor: function(border) { |
| 184 | + if (border.isQuesBorder()) { |
| 185 | + return border.error === 1 ? this.errcolor1 : "black"; |
| 186 | + } |
| 187 | + |
| 188 | + return this.getBorderColor_qans(border); |
156 | 189 | } |
157 | 190 | }, |
158 | 191 |
|
|
162 | 195 | decodePzpr: function(type) { |
163 | 196 | this.decodeBorder(); |
164 | 197 | this.decodeNumber16(); |
| 198 | + this.decodeEmpty(); |
165 | 199 | }, |
166 | 200 | encodePzpr: function(type) { |
167 | 201 | this.encodeBorder(); |
168 | 202 | this.encodeNumber16(); |
| 203 | + this.encodeEmpty(); |
169 | 204 | }, |
170 | 205 |
|
171 | 206 | decodeKanpen: function() { |
|
212 | 247 | this.encodeCellAnum_XMLAnswer(); |
213 | 248 | }, |
214 | 249 |
|
| 250 | + decodeCellQnum: function() { |
| 251 | + this.decodeCell(function(cell, ca) { |
| 252 | + if (ca === "#") { |
| 253 | + cell.ques = 7; |
| 254 | + } else if (ca === "-") { |
| 255 | + cell.qnum = -2; |
| 256 | + } else if (ca !== ".") { |
| 257 | + cell.qnum = +ca; |
| 258 | + } |
| 259 | + }); |
| 260 | + }, |
| 261 | + encodeCellQnum: function() { |
| 262 | + this.encodeCell(function(cell) { |
| 263 | + if (cell.ques === 7) { |
| 264 | + return "# "; |
| 265 | + } else if (cell.qnum >= 0) { |
| 266 | + return cell.qnum + " "; |
| 267 | + } else if (cell.qnum === -2) { |
| 268 | + return "- "; |
| 269 | + } else { |
| 270 | + return ". "; |
| 271 | + } |
| 272 | + }); |
| 273 | + }, |
| 274 | + |
215 | 275 | UNDECIDED_NUM_XML: 0 |
216 | 276 | }, |
217 | 277 |
|
|
223 | 283 | "checkRippleNumber@ripple", |
224 | 284 | "checkAdjacentDiffNumber@cojun", |
225 | 285 | "checkUpperNumber@cojun", |
226 | | - "checkAdjacentNumbers@meander", |
| 286 | + "checkAdjacentNumbers@meander,suguru", |
227 | 287 | "checkConsecutiveNeighbors@meander", |
228 | 288 | "checkNoNumCell+" |
229 | 289 | ], |
|
0 commit comments