blindfold chess!
This commit is contained in:
parent
e1cf15de41
commit
491a127de0
|
@ -36,6 +36,10 @@
|
|||
<h2>@trans.moveListWhilePlaying()</h2>
|
||||
@base.radios(form("replay"), translatedMoveListWhilePlayingChoices)
|
||||
</li>
|
||||
<li>
|
||||
<h2>Blindfold Chess (play without seeing the pieces)</h2>
|
||||
@base.radios(form("blindfold"), Pref.Blindfold.choices)
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
|
|
|
@ -25,7 +25,7 @@ underchat = views.html.game.watchers().some,
|
|||
moreJs = moreJs,
|
||||
openGraph = povOpenGraph(pov),
|
||||
chessground = false) {
|
||||
<div class="round cg-512">@miniBoardContent</div>
|
||||
<div class="round cg-512@if(ctx.pref.isBlindfold){ blindfold}">@miniBoardContent</div>
|
||||
<div class="crosstable" style="display:none">
|
||||
@cross.map { c =>
|
||||
@views.html.game.crosstable(ctx.userId.fold(c)(c.fromPov), pov.gameId.some)
|
||||
|
|
|
@ -19,6 +19,7 @@ private[pref] final class DataForm(api: PrefApi) {
|
|||
"destination" -> number.verifying(Set(0, 1) contains _),
|
||||
"coords" -> number.verifying(Pref.Coords.choices.toMap contains _),
|
||||
"replay" -> number.verifying(Pref.Replay.choices.toMap contains _),
|
||||
"blindfold" -> number.verifying(Pref.Blindfold.choices.toMap contains _),
|
||||
"challenge" -> number.verifying(Pref.Challenge.choices.toMap contains _),
|
||||
"premove" -> number.verifying(Set(0, 1) contains _),
|
||||
"animation" -> number.verifying(Set(0, 1, 2, 3) contains _),
|
||||
|
@ -37,6 +38,7 @@ private[pref] final class DataForm(api: PrefApi) {
|
|||
destination: Int,
|
||||
coords: Int,
|
||||
replay: Int,
|
||||
blindfold: Int,
|
||||
challenge: Int,
|
||||
premove: Int,
|
||||
animation: Int,
|
||||
|
@ -54,6 +56,7 @@ private[pref] final class DataForm(api: PrefApi) {
|
|||
destination = destination == 1,
|
||||
coords = coords,
|
||||
replay = replay,
|
||||
blindfold = blindfold,
|
||||
challenge = challenge,
|
||||
premove = premove == 1,
|
||||
animation = animation,
|
||||
|
@ -74,6 +77,7 @@ private[pref] final class DataForm(api: PrefApi) {
|
|||
destination = pref.destination.fold(1, 0),
|
||||
coords = pref.coords,
|
||||
replay = pref.replay,
|
||||
blindfold = pref.blindfold,
|
||||
challenge = pref.challenge,
|
||||
premove = pref.premove.fold(1, 0),
|
||||
animation = pref.animation,
|
||||
|
|
|
@ -14,6 +14,7 @@ case class Pref(
|
|||
pieceSet: String,
|
||||
theme3d: String,
|
||||
pieceSet3d: String,
|
||||
blindfold: Int,
|
||||
autoQueen: Int,
|
||||
autoThreefold: Int,
|
||||
takeback: Int,
|
||||
|
@ -72,6 +73,8 @@ case class Pref(
|
|||
case Animation.SLOW => 2
|
||||
case _ => 1
|
||||
}
|
||||
|
||||
def isBlindfold = blindfold == Pref.Blindfold.YES
|
||||
}
|
||||
|
||||
object Pref {
|
||||
|
@ -113,6 +116,15 @@ object Pref {
|
|||
PREMOVE -> "When premoving")
|
||||
}
|
||||
|
||||
object Blindfold {
|
||||
val NO = 0
|
||||
val YES = 1
|
||||
|
||||
val choices = Seq(
|
||||
NO -> "What? No!",
|
||||
YES -> "Yes, hide the pieces")
|
||||
}
|
||||
|
||||
object AutoThreefold {
|
||||
val NEVER = 1
|
||||
val TIME = 2
|
||||
|
@ -203,6 +215,7 @@ object Pref {
|
|||
pieceSet = PieceSet.default.name,
|
||||
theme3d = Theme3d.default.name,
|
||||
pieceSet3d = PieceSet3d.default.name,
|
||||
blindfold = Blindfold.NO,
|
||||
autoQueen = AutoQueen.PREMOVE,
|
||||
autoThreefold = AutoThreefold.TIME,
|
||||
takeback = Takeback.ALWAYS,
|
||||
|
|
|
@ -28,6 +28,7 @@ final class PrefApi(coll: Coll, cacheTtl: Duration) {
|
|||
pieceSet = r.getD("pieceSet", Pref.default.pieceSet),
|
||||
theme3d = r.getD("theme3d", Pref.default.theme3d),
|
||||
pieceSet3d = r.getD("pieceSet3d", Pref.default.pieceSet3d),
|
||||
blindfold = r.getD("blindfold", Pref.default.blindfold),
|
||||
autoQueen = r.getD("autoQueen", Pref.default.autoQueen),
|
||||
autoThreefold = r.getD("autoThreefold", Pref.default.autoThreefold),
|
||||
takeback = r.getD("takeback", Pref.default.takeback),
|
||||
|
@ -55,6 +56,7 @@ final class PrefApi(coll: Coll, cacheTtl: Duration) {
|
|||
"pieceSet" -> o.pieceSet,
|
||||
"theme3d" -> o.theme3d,
|
||||
"pieceSet3d" -> o.pieceSet3d,
|
||||
"blindfold" -> o.blindfold,
|
||||
"autoQueen" -> o.autoQueen,
|
||||
"autoThreefold" -> o.autoThreefold,
|
||||
"takeback" -> o.takeback,
|
||||
|
|
|
@ -105,9 +105,10 @@ final class JsonView(
|
|||
"round" -> s"/$fullId"
|
||||
),
|
||||
"pref" -> Json.obj(
|
||||
"blindfold" -> pref.isBlindfold,
|
||||
"animationDuration" -> animationDuration(pov, pref),
|
||||
"highlight" -> pref.highlight,
|
||||
"destination" -> pref.destination,
|
||||
"highlight" -> (pref.highlight || pref.isBlindfold),
|
||||
"destination" -> (pref.destination && !pref.isBlindfold),
|
||||
"coords" -> pref.coords,
|
||||
"replay" -> pref.replay,
|
||||
"autoQueen" -> (pov.game.variant == chess.variant.Antichess).fold(Pref.AutoQueen.NEVER, pref.autoQueen),
|
||||
|
|
|
@ -149,6 +149,9 @@ body.base .cg-board .cg-square.exploding {
|
|||
-ms-transform: none;
|
||||
z-index: initial;
|
||||
}
|
||||
.lichess_board.blindfold .cg-piece {
|
||||
opacity: 0;
|
||||
}
|
||||
.is3d .cg-piece {
|
||||
/* original size:
|
||||
width: 140.625%;
|
||||
|
|
|
@ -56,7 +56,8 @@ function renderVariantReminder(ctrl) {
|
|||
|
||||
function visualBoard(ctrl) {
|
||||
return m('div.lichess_board_wrap', [
|
||||
m('div.lichess_board.' + ctrl.data.game.variant.key, {
|
||||
m('div', {
|
||||
class: 'lichess_board ' + ctrl.data.game.variant.key + (ctrl.data.pref.blindfold ? ' blindfold' : ''),
|
||||
config: function(el, isUpdate) {
|
||||
if (!isUpdate) el.addEventListener('wheel', function(e) {
|
||||
return wheel(ctrl, e);
|
||||
|
|
Loading…
Reference in a new issue