Skip to content

Commit

Permalink
feat: Activity period and five points
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustl22 committed Jul 14, 2024
1 parent 4175e8f commit eb9c080
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ class BoutActionControls extends StatelessWidget {
prepareCallback(const BoutScreenActionIntent.redFour(), const BoutScreenActionIntent.blueFour()),
color,
),
displayActionControl(
'5',
prepareCallback(const BoutScreenActionIntent.redFive(), const BoutScreenActionIntent.blueFive()),
color,
),
displayActionControl(
'P',
prepareCallback(const BoutScreenActionIntent.redPassivity(), const BoutScreenActionIntent.bluePassivity()),
Expand All @@ -44,11 +49,11 @@ class BoutActionControls extends StatelessWidget {
prepareCallback(const BoutScreenActionIntent.redCaution(), const BoutScreenActionIntent.blueCaution()),
color,
),
/*displayActionControl(
'D',
prepareCallback(const BoutScreenActionIntent.RedDismissal(), BoutScreenActionIntent.BlueDismissal()),
color,
padding),*/
displayActionControl(
'D',
prepareCallback(const BoutScreenActionIntent.redDismissal(), const BoutScreenActionIntent.blueDismissal()),
color,
),
displayActionControl(
AppLocalizations.of(context)!.activityTimeAbbr, // AZ Activity Time, Aktivitätszeit
prepareCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum BoutScreenActions {
redTwo,
redThree,
redFour,
redFive,
redPassivity,
redCaution,
redDismissal,
Expand All @@ -33,6 +34,7 @@ enum BoutScreenActions {
blueTwo,
blueThree,
blueFour,
blueFive,
bluePassivity,
blueCaution,
blueDismissal,
Expand Down Expand Up @@ -70,6 +72,8 @@ class BoutScreenActionIntent extends Intent {

const BoutScreenActionIntent.redFour() : type = BoutScreenActions.redFour;

const BoutScreenActionIntent.redFive() : type = BoutScreenActions.redFive;

const BoutScreenActionIntent.redPassivity() : type = BoutScreenActions.redPassivity;

const BoutScreenActionIntent.redCaution() : type = BoutScreenActions.redCaution;
Expand All @@ -90,6 +94,8 @@ class BoutScreenActionIntent extends Intent {

const BoutScreenActionIntent.blueFour() : type = BoutScreenActions.blueFour;

const BoutScreenActionIntent.blueFive() : type = BoutScreenActions.blueFive;

const BoutScreenActionIntent.bluePassivity() : type = BoutScreenActions.bluePassivity;

const BoutScreenActionIntent.blueCaution() : type = BoutScreenActions.blueCaution;
Expand Down Expand Up @@ -188,6 +194,16 @@ class BoutScreenActionIntent extends Intent {
);
await dataManager.createOrUpdateSingle(action);
break;
case BoutScreenActions.redFive:
var action = BoutAction(
bout: bout,
role: BoutRole.red,
duration: stopwatch.elapsed,
actionType: BoutActionType.points,
pointCount: 5,
);
await dataManager.createOrUpdateSingle(action);
break;
case BoutScreenActions.redPassivity:
var action = BoutAction(
bout: bout, role: BoutRole.red, duration: stopwatch.elapsed, actionType: BoutActionType.passivity);
Expand Down Expand Up @@ -255,6 +271,15 @@ class BoutScreenActionIntent extends Intent {
pointCount: 4);
await dataManager.createOrUpdateSingle(action);
break;
case BoutScreenActions.blueFive:
var action = BoutAction(
bout: bout,
role: BoutRole.blue,
duration: stopwatch.elapsed,
actionType: BoutActionType.points,
pointCount: 5);
await dataManager.createOrUpdateSingle(action);
break;
case BoutScreenActions.bluePassivity:
var action = BoutAction(
bout: bout, role: BoutRole.blue, duration: stopwatch.elapsed, actionType: BoutActionType.passivity);
Expand Down Expand Up @@ -343,11 +368,14 @@ class BoutActionHandler extends ConsumerWidget {
const redTwoIntent = BoutScreenActionIntent.redTwo();
const redThreeIntent = BoutScreenActionIntent.redThree();
const redFourIntent = BoutScreenActionIntent.redFour();
const redFiveIntent = BoutScreenActionIntent.redFive();

const blueOneIntent = BoutScreenActionIntent.blueOne();
const blueTwoIntent = BoutScreenActionIntent.blueTwo();
const blueThreeIntent = BoutScreenActionIntent.blueThree();
const blueFourIntent = BoutScreenActionIntent.blueFour();
const blueFiveIntent = BoutScreenActionIntent.blueFive();

return Shortcuts(
shortcuts: <LogicalKeySet, Intent>{
LogicalKeySet(LogicalKeyboardKey.space): const BoutScreenActionIntent.startStop(),
Expand All @@ -361,10 +389,12 @@ class BoutActionHandler extends ConsumerWidget {
LogicalKeySet(LogicalKeyboardKey.digit2): redTwoIntent,
LogicalKeySet(LogicalKeyboardKey.digit3): redThreeIntent,
LogicalKeySet(LogicalKeyboardKey.digit4): redFourIntent,
LogicalKeySet(LogicalKeyboardKey.digit5): redFiveIntent,
LogicalKeySet(LogicalKeyboardKey.numpad1): blueOneIntent,
LogicalKeySet(LogicalKeyboardKey.numpad2): blueTwoIntent,
LogicalKeySet(LogicalKeyboardKey.numpad3): blueThreeIntent,
LogicalKeySet(LogicalKeyboardKey.numpad4): blueFourIntent,
LogicalKeySet(LogicalKeyboardKey.numpad5): blueFiveIntent,
},
child: Actions(
actions: <Type, Action<Intent>>{
Expand All @@ -382,21 +412,23 @@ class BoutActionHandler extends ConsumerWidget {
} else if (event.physicalKey == PhysicalKeyboardKey.keyD) {
handleIntent(redTwoIntent, context: context);
} else if (event.physicalKey == PhysicalKeyboardKey.keyS) {
handleIntent(redThreeIntent, context: context);
} else if (event.physicalKey == PhysicalKeyboardKey.keyA) {
handleIntent(redFourIntent, context: context);
} else if (event.physicalKey == PhysicalKeyboardKey.keyA) {
handleIntent(redFiveIntent, context: context);
} else if (event.physicalKey == PhysicalKeyboardKey.keyJ ||
(HardwareKeyboard.instance.isShiftPressed && event.physicalKey == PhysicalKeyboardKey.digit1)) {
handleIntent(blueOneIntent, context: context);
} else if (event.physicalKey == PhysicalKeyboardKey.keyK ||
(HardwareKeyboard.instance.isShiftPressed && event.physicalKey == PhysicalKeyboardKey.digit2)) {
handleIntent(blueTwoIntent, context: context);
} else if (event.physicalKey == PhysicalKeyboardKey.keyL ||
(HardwareKeyboard.instance.isShiftPressed && event.physicalKey == PhysicalKeyboardKey.digit3)) {
} else if (HardwareKeyboard.instance.isShiftPressed && event.physicalKey == PhysicalKeyboardKey.digit3) {
handleIntent(blueThreeIntent, context: context);
} else if (event.physicalKey == PhysicalKeyboardKey.semicolon ||
} else if (event.physicalKey == PhysicalKeyboardKey.keyL ||
(HardwareKeyboard.instance.isShiftPressed && event.physicalKey == PhysicalKeyboardKey.digit4)) {
handleIntent(blueFourIntent, context: context);
} else if (event.physicalKey == PhysicalKeyboardKey.semicolon ||
(HardwareKeyboard.instance.isShiftPressed && event.physicalKey == PhysicalKeyboardKey.digit5)) {
handleIntent(blueFiveIntent, context: context);
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
enum BoutActionType {
points,
passivity, // P
verbal, // V admonition
caution, // yellow card
dismissal; // red card
passivity, // 'P' (in greco) or 'A' (in free style)
verbal, // V admonition 'V'
caution, // yellow card 'O'
dismissal; // red card 'D'

String get name => toString().split('.').last;
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class NrwGermanyWrestlingReporter extends WrestlingReporter {
final boutInfos = boutMap.entries.map((entry) {
final bout = entry.key;
var points = entry.value.map((BoutAction action) {
return '${action.actionValue}${action.role == BoutRole.red ? 'R' : 'B'}${action.duration.inSeconds}';
return '${bout.weightClass?.style == WrestlingStyle.free && action.actionType == BoutActionType.passivity ? 'A' : action.actionValue}${action.role == BoutRole.red ? 'R' : 'B'}${action.duration.inSeconds}';
}).join(',');
if (points.isNotEmpty) {
points = '(points $points)';
Expand Down

0 comments on commit eb9c080

Please sign in to comment.