-
-
Notifications
You must be signed in to change notification settings - Fork 310
Over the board feats: Resign, Offer Draw and notification on threefold repetition #1571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! :)
| ), | ||
| BottomSheetAction( | ||
| makeLabel: (context) => Text(context.l10n.flipBoard), | ||
| onPressed: onFlipBoard, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there already a bottom bar button for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is. I'll remove the option from the menu. This will leave the hamburger menu with only one option (New game) at the start of a game, making the menu pointless for that state. However, when the game starts and the Resign and Draw options come into play, the hamburger menu is needed. So if it's fine by you, I'll make the bottom bar button switch between the plus icon and the menu icon as required.
Alternatively, we could just leave it as is (regular online games have a resign button in the bottom bar AND in the menu. Also I'm lazy haha)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah that makes sense, got it! I think switching between hamburger/plus icon sounds good, but I'm also ok with leaving it like it is is right now.
@veloce has the final word on that as the maintainer, so let's wait for his opinion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the flip button that important so it needs to be in the bottom bar? Because we can also remove it from the bottom bar.
If not I prefer leaving the hamburger menu all the time and not switching between icons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
1fac83c to
9543b9b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! only a couple of small comments.
|
|
||
| if (previous?.game.isThreefoldRepetition == false && | ||
| newGameState.game.isThreefoldRepetition == true) { | ||
| ref.read(overTheBoardClockProvider.notifier).pause(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the clock be paused at the same time the dialog is displayed? It is weird to pause it before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was done the same way in the previous if check for gameState.finished. Would you like me to change both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well no, because if the game is finished it makes sense to stop the clock immediately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| bool get abortable => | ||
| playable && | ||
| lastPosition.fullmoves <= 1 && | ||
| (meta.rules == null || !meta.rules!.contains(GameRule.noAbort)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove that. meta is only available in online games.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| (meta.rules == null || !meta.rules!.contains(GameRule.noAbort)); | ||
|
|
||
| bool get resignable => playable && !abortable; | ||
| bool get drawable => playable && lastPosition.fullmoves >= 2 && !(me?.offeringDraw == true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the me?.offeringDraw, it is only available in online games.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
This pr adds three new features to over the board games: resign, offer draw, and a notification on threefold repetition. No new widget or class was added, and these features were implemented much like they are in regular online games.
Fixes #1029
Changes made:
Tests performed:
draw.mp4
resign.mp4
threefold.mp4