Update highlighting colors
And fix a bug where the two preferences would get mixed up.
This commit is contained in:
parent
bfbbda2624
commit
fc959d9619
Binary file not shown.
16
package.json
16
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "minesweeper",
|
||||
"version": "0.85.3",
|
||||
"version": "0.85.4",
|
||||
"description": "Just Minesweeper!",
|
||||
"author": "Florine W. Dekker",
|
||||
"browser": "dist/bundle.js",
|
||||
|
@ -17,21 +17,21 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"alea": "^1.0.1",
|
||||
"canvas-confetti": "^1.6.0"
|
||||
"canvas-confetti": "^1.9.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "^1.5.3",
|
||||
"grunt": "^1.6.1",
|
||||
"grunt-cli": "^1.4.3",
|
||||
"grunt-contrib-clean": "^2.0.1",
|
||||
"grunt-contrib-copy": "^1.0.0",
|
||||
"grunt-contrib-watch": "^1.1.0",
|
||||
"grunt-focus": "^1.0.0",
|
||||
"grunt-text-replace": "^0.4.0",
|
||||
"grunt-webpack": "^5.0.0",
|
||||
"ts-loader": "^9.4.1",
|
||||
"grunt-webpack": "^6.0.0",
|
||||
"ts-loader": "^9.5.1",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.9.3",
|
||||
"webpack": "^5.75.0",
|
||||
"webpack-cli": "^5.0.0"
|
||||
"typescript": "^5.3.2",
|
||||
"webpack": "^5.89.0",
|
||||
"webpack-cli": "^5.1.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,9 @@ import {Preferences} from "./Preferences";
|
|||
*/
|
||||
export class Display {
|
||||
private readonly errorColor: string = "rgba(255, 0, 0, 0.3)";
|
||||
private readonly hintColor: string = "rgba(0, 0, 255, 0.3)";
|
||||
private readonly safeColor: string = "rgba(0, 255, 0, 0.5)";
|
||||
private readonly hintColor: string = "rgba(128, 0, 128, 0.3)";
|
||||
private readonly chordableColor: string = "rgba(0, 0, 255, 0.5)";
|
||||
private readonly allNeighborsAreMinesColor: string = "rgba(0, 255, 0, 0.5)";
|
||||
|
||||
private readonly scale: number = 30;
|
||||
|
||||
|
@ -321,7 +322,6 @@ export class Display {
|
|||
(this.preferences.showChordableHints || this.preferences.showAllNeighborsAreMinesHints)
|
||||
) {
|
||||
ctx.save();
|
||||
ctx.fillStyle = this.safeColor;
|
||||
this.field.squareList
|
||||
.filter(it => !it.isCovered)
|
||||
.filter(it => {
|
||||
|
@ -329,12 +329,14 @@ export class Display {
|
|||
const flags = it.getNeighborCount(it => it.hasFlag);
|
||||
const covered = it.getNeighborCount(it => it.isCovered);
|
||||
|
||||
return (
|
||||
(this.preferences.showChordableHints && mines === flags && covered !== flags) ||
|
||||
(this.preferences.showAllNeighborsAreMinesHints && mines === covered && mines !== flags)
|
||||
);
|
||||
})
|
||||
.forEach(square => ctx.fillRect(square.x * this.scale, square.y * this.scale, this.scale, this.scale));
|
||||
if (this.preferences.showChordableHints && mines === covered && mines !== flags) {
|
||||
ctx.fillStyle = this.chordableColor;
|
||||
ctx.fillRect(it.x * this.scale, it.y * this.scale, this.scale, this.scale)
|
||||
} else if (this.preferences.showAllNeighborsAreMinesHints && mines === flags && covered !== flags) {
|
||||
ctx.fillStyle = this.allNeighborsAreMinesColor;
|
||||
ctx.fillRect(it.x * this.scale, it.y * this.scale, this.scale, this.scale)
|
||||
}
|
||||
});
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue