Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nnickoloff1234 committed Aug 11, 2024
1 parent bde70e1 commit af8a92d
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 19 deletions.
3 changes: 3 additions & 0 deletions client/bug/lobby.bug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export function switchEnablingLobbyControls(mode: CreateMode, variant: Variant,
export function bugJoinSeek(ctrl: LobbyController, e: Event, seek: Seek, joinAs: string) {
e.stopPropagation();
// seek[player] = ctrl.username;
if (ctrl.anon) {
alert(_("Anon users cannot join bughouse games"));
}
ctrl.doSend({ type: "accept_seek", seekID: seek["seekID"], player: ctrl.username, joinAs: joinAs });
}

Expand Down
2 changes: 1 addition & 1 deletion client/lobby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ export class LobbyController implements ChatController {

createGame(variantName: string = '', chess960: boolean = false) {
this.createMode = 'createGame';
this.renderVariantsDropDown(variantName, chess960, []);
this.renderVariantsDropDown(variantName, chess960, this.anon ? ["bughouse"]: []);
this.renderDialogHeader(createModeStr(this.createMode));
document.getElementById('game-mode')!.style.display = this.anon ? 'none' : 'inline-flex';
document.getElementById('rating-range-setting')!.style.display = 'block';
Expand Down
1 change: 1 addition & 0 deletions server/bug/game_bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ def result_string_from_value(game_result_value, board_which_ended):

def check_checkmate_on_board_and_update_status(self, board: str):
# it is not mate if there are possible move dests on the given board
# todo: if it is check that is blockable, but no pieces in pocket, dests might be empty but it is not mate
if board == "a" and self.dests_a:
return False
elif board == "b" and self.dests_b:
Expand Down
2 changes: 2 additions & 0 deletions server/bug/utils_bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@ async def play_move(


async def handle_accept_seek_bughouse(app_state: PychessGlobalAppState, user, data, seek):
if user.anon:
return
response = await join_seek_bughouse(app_state, user, data["seekID"], None, data["joinAs"])
bug_users = set(
filter(
Expand Down
127 changes: 109 additions & 18 deletions static/bughouse.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,22 @@
}

/* *****************************************************************************************
* round.css
* round.css pocket-top-partner pocket-bot-partner
******************************************************************************************* */

@media (max-width: 799px) and (orientation: portrait) {
.round-app.bug {
grid-template-columns: auto auto;
grid-template-rows: auto
grid-template-columns: calc((var(--cg-width-a) / var(--files)) * var(--pocketLength)) calc(100vw - ((var(--cg-width-a) / var(--files)) * var(--pocketLength)));
grid-template-rows:
min-content
min-content
min-content
min-content
min-content
auto

auto
max-content
min-content
min-content
auto

auto
auto
Expand All @@ -70,21 +73,25 @@
auto
auto
auto;
grid-template-areas: 'pocket-top clock-top'
grid-template-areas:
'boardPartner pocket-top-partner'
'boardPartner clockB-top'
'boardPartner .'
'boardPartner clockB-bot'
'boardPartner pocket-bot-partner'

'pocket-top clock-top'
'board board'
'pocket-bot clock-bot'

'pocket-top-partner clockB-top'
'boardPartner boardPartner'
'pocket-bot-partner clockB-bot'

'tools tools'
'game-controls game-controls'
'offer offer'
'move-controls move-controls'
'toolsB toolsB'
'uboard uboard'
'uleft uleft';
column-gap: 0px;
}
under-left {
display: none;
Expand All @@ -96,18 +103,81 @@
font-size: var(--fs);
}
.pocket-top-partner .bughouse .pocket, .pocket-bot-partner .bughouse .pocket {
width: calc(var(--pocketLength) * (var(--cg-width-b) / var(--files)));
height: calc(var(--cg-height-b) / var(--ranks));
--fs: calc(var(--cg-height-b) / var(--ranks));
/*width: calc((100vw / (var(--files) + var(--pocketLength))) * var(--pocketLength));*/
/* width: auto;*/
width: calc((100vw - ((var(--cg-height-a) / var(--ranks)) * var(--pocketLength))));
height: calc((100vw - ((var(--cg-height-a) / var(--ranks)) * var(--pocketLength))) / var(--pocketLength));

/*height: calc(100cqmin / var(--pocketLength));*/
/* width: calc(var(--pocketLength) * (var(--cg-width-b) / var(--files)));
height: calc(var(--cg-height-b) / var(--ranks));*/
--fs: calc(20px / var(--ranks));
font-size: var(--fs);
}
.clock-wrap {
flex-direction: row-reverse;
}
}

@media (max-height: 600px) and (orientation: landscape) {
body[data-variant='bughouse'] header {
display: none;
}
.round-app.bug {
grid-template-columns: 40vh 40vh 40vh 40vh auto;
grid-template-rows:
10vh
20vh
20vh
20vh
20vh
10vh

auto
auto
auto
auto
auto
auto;
grid-template-areas:

'pocket-top clock-top pocket-top-partner clockB-top tools'
'board board boardPartner boardPartner tools'
'board board boardPartner boardPartner tools'
'board board boardPartner boardPartner tools'
'board board boardPartner boardPartner tools'
'pocket-bot clock-bot pocket-bot-partner clockB-bot tools'

'game-controls game-controls game-controls game-controls game-controls'
'offer offer offer offer offer'
'move-controls move-controls move-controls move-controls move-controls'
'toolsB toolsB toolsB toolsB toolsB'
'uboard uboard uboard uboard uboard'
'uleft uleft uleft uleft uleft';
column-gap: 0px;
}
under-left {
display: none;
}
.pocket-top .bughouse .pocket, .pocket-bot .bughouse .pocket {
width: 40vh;
height: 10vh;
--fs: calc(var(--cg-height-a) / var(--ranks));
font-size: var(--fs);
}
.pocket-top-partner .bughouse .pocket, .pocket-bot-partner .bughouse .pocket {
width: 40vh;
height: 10vh;
--fs: calc(20px / var(--ranks));
font-size: var(--fs);
}
.clock-wrap {
flex-direction: row-reverse;
font-size: 5pt;
}
}

@media (min-width: 800px) {
@media (min-height: 600px) and (orientation: landscape) {
.bug .info-wrap0, .bug .info-wrap1, .bug .clock-wrap {
justify-content: end;
}
Expand Down Expand Up @@ -178,14 +248,29 @@ main.round.bug .pocket.bottom {
margin-top: unset;
}

div#chatpresets{
div#chatpresets {
display: grid;
grid-template-columns: auto auto auto auto auto;
padding-top: 5px;
grid-template-rows: auto auto auto auto;
order: 3;
}

@media (max-width: 799px) and (orientation: portrait) {
div#chatpresets {
grid-template-columns: auto auto auto auto auto auto auto auto auto auto;
}
.chat {
flex-direction: column-reverse;
}
}
@media (max-height: 600px) and (orientation: landscape) {
div#chatpresets {
grid-template-columns: auto auto auto auto auto;
}
}


div#chatpresets button.bugchat {
width: 60%;
/*width: 15%;*/
Expand Down Expand Up @@ -323,13 +408,19 @@ button.bugchat::-moz-focus-inner {
}

@media (max-width: 799px) and (orientation: portrait) {
.bug .info-wrap0 {
.bug .info-wrap0, .info-wrap0 {
flex-direction: column-reverse;
grid-area: clock-top;
justify-self: flex-end;
justify-content: right;
}
.bug .info-wrap1 {
.bug .info-wrap1, .info-wrap1 {
grid-area: clock-bot;
justify-self: flex-end;
justify-content: right;
}
.clock-wrap{
align-self: end;
}
}

Expand Down

0 comments on commit af8a92d

Please sign in to comment.