UI fixes and league

This commit is contained in:
Jan Pleterski
2026-11-28 12:22:02 +01:00
parent 2fc741a9f6
commit 258303deb8
118 changed files with 1439 additions and 537 deletions
+19 -4
View File
@@ -2,7 +2,7 @@ import 'dart:math';
import 'dart:ui';
/// The one scoring rule for a shot, in the 1200 × 1200 space every target
/// design shares (target-designs/v3: centre 600/600, ring 1 at r 510, the
/// design shares (target-designs/v5: centre 600/600, ring 1 at r 510, the
/// black at r 180). Saving, the preview and the target view all use it, so a
/// shot scores the same everywhere and on every design.
///
@@ -17,6 +17,16 @@ class TargetScoring {
static const double bulletRadius = 25;
static const double bulletDiameter = 53; // drawn size of a hit
// Where a hit's centre may be drawn: the 1200 square, less the dot's
// radius and a little air. Outside ring 1 a miss simply lies on the screen
// background, where it landed
static const double _hitInset = bulletDiameter / 2 + 2; // 28.5
/// [p] if its whole dot is inside the target's square, otherwise the
/// nearest place that is (only for shots that landed far off; still 0).
static Offset shown(Offset p) =>
Offset(p.dx.clamp(_hitInset, size - _hitInset), p.dy.clamp(_hitInset, size - _hitInset));
/// Outer edge of ring 10, 9, ... 1, measured from [center].
///
/// A shot touching a ring line counts the higher value, so each edge is the
@@ -50,15 +60,20 @@ class TargetScoring {
/// Where to draw a shot that was scored by hand, in direction [angle]
/// (radians): the middle of the band of positions [scoreAt] gives [score]
/// for, so the dot always scores what was entered.
/// for, so the dot always scores what was entered. A 0 goes towards the
/// corner nearest to [angle], clear of ring 1's decoration.
static Offset positionFor(int score, double angle) {
final s = score.clamp(0, 10);
if (s == 0) {
// Nearest diagonal, keeping a little of the angle so 0s don't stack
final diagonal = ((angle - pi / 4) / (pi / 2)).round() * (pi / 2) + pi / 4;
final a = diagonal + (angle - diagonal) * 0.3;
return shown(center + Offset(cos(a), sin(a)) * 700);
}
// Distance of the bullet's edge from the centre, middle of the band
final double edge;
if (s == 10) {
edge = (-bulletRadius + rings[0]) / 2; // bullet over the centre
} else if (s == 0) {
edge = rings.last + 30; // just outside the target
} else {
edge = (rings[9 - s] + rings[10 - s]) / 2;
}
+26 -9
View File
@@ -4,6 +4,21 @@
const Map<String, Map<String, String>> translationsV2 = {
// Changed wording
'Contacts': {'English': 'Contacts', 'Slovenian': 'Kontakti', 'German': 'Kontakte'},
// Koledar → Liga (liga.bl3kunja.top)
'Magenta': {'English': 'Magenta', 'Slovenian': 'Magenta', 'German': 'Magenta'},
'League': {'English': 'League', 'Slovenian': 'Liga', 'German': 'Liga'},
'Standings': {'English': 'Standings', 'Slovenian': 'Lestvica', 'German': 'Rangliste'},
'{n}. tournament is open': {'English': 'Tournament {n} is open', 'Slovenian': '{n}. turnir je odprt', 'German': '{n}. Turnier ist offen'},
'{n}. tournament': {'English': 'Tournament {n}', 'Slovenian': '{n}. turnir', 'German': '{n}. Turnier'},
'until {d}': {'English': 'until {d}', 'Slovenian': 'do {d}', 'German': 'bis {d}'},
'from {d}': {'English': 'from {d}', 'Slovenian': 'od {d}', 'German': 'ab {d}'},
'Entries: {n}': {'English': 'Entries: {n}', 'Slovenian': 'Oddano: {n}', 'German': 'Abgaben: {n}'},
'The league has finished': {'English': 'The league has finished', 'Slovenian': 'Liga je zaključena', 'German': 'Die Liga ist beendet'},
'Best {n} count': {'English': 'Best {n} count', 'Slovenian': 'Šteje najboljših {n}', 'German': 'Die besten {n} zählen'},
'Could not load the league': {'English': 'Could not load the league', 'Slovenian': 'Lige ni bilo mogoče naložiti', 'German': 'Liga konnte nicht geladen werden'},
'Open the league website': {'English': 'Open the league website', 'Slovenian': 'Odpri stran lige', 'German': 'Liga-Website öffnen'},
'No results yet': {'English': 'No results yet', 'Slovenian': 'Še ni rezultatov', 'German': 'Noch keine Ergebnisse'},
'COMPETITION': {'English': 'COMPETITION', 'Slovenian': 'TEKMA', 'German': 'WETTKAMPF'},
// Streljanje
@@ -53,13 +68,15 @@ const Map<String, Map<String, String>> translationsV2 = {
// Preveri zadetke
'Check hits': {'English': 'Check hits', 'Slovenian': 'Preveri zadetke', 'German': 'Treffer prüfen'},
'{n} hits detected · correct them if needed': {'English': '{n} hits detected · correct them if needed', 'Slovenian': '{n} zadetkov zaznanih · popravi, če je treba', 'German': '{n} Treffer erkannt · bei Bedarf korrigieren'},
'{n} hits detected': {'English': '{n} hits detected', 'Slovenian': '{n} zadetkov zaznanih', 'German': '{n} Treffer erkannt'},
'Save to': {'English': 'Save to', 'Slovenian': 'Shrani v', 'German': 'Speichern in'},
'new': {'English': 'new', 'Slovenian': 'nova', 'German': 'neu'},
'today': {'English': 'today', 'Slovenian': 'danes', 'German': 'heute'},
'Add hit': {'English': 'Add hit', 'Slovenian': 'Dodaj zadetek', 'German': 'Treffer hinzufügen'},
'Remove hit': {'English': 'Remove hit', 'Slovenian': 'Odstrani zadetek', 'German': 'Treffer entfernen'},
'Save target': {'English': 'Save target', 'Slovenian': 'Shrani tarčo', 'German': 'Scheibe speichern'},
'Edit target': {'English': 'Edit target', 'Slovenian': 'Uredi tarčo', 'German': 'Scheibe bearbeiten'},
'Save changes': {'English': 'Save changes', 'Slovenian': 'Shrani spremembe', 'German': 'Änderungen speichern'},
'Hold and drag': {'English': 'Hold and drag', 'Slovenian': 'Drži in povleci', 'German': 'Halten und ziehen'},
'Its value; then drag it to where it hit.': {'English': 'Its value; then drag it to where it hit.', 'Slovenian': 'Njegova vrednost; nato ga povleci na mesto zadetka.', 'German': 'Sein Wert; dann an die Trefferstelle ziehen.'},
'Image not available': {'English': 'Image not available', 'Slovenian': 'Slika ni na voljo', 'German': 'Bild nicht verfügbar'},
@@ -73,15 +90,15 @@ const Map<String, Map<String, String>> translationsV2 = {
'Slovenian': 'Drži in povleci po tarči, da premakneš izbrani zadetek; povečevalo pokaže, kje je.',
'German': 'Halten und auf der Scheibe ziehen, um den gewählten Treffer zu verschieben; eine Lupe zeigt, wo er liegt.',
},
'Add hit: for a shot that was not found. Remove hit: deletes the picked one.': {
'English': 'Add hit: for a shot that was not found. Remove hit: deletes the picked one.',
'Slovenian': 'Dodaj zadetek: za strel, ki ni bil najden. Odstrani zadetek: izbriše izbranega.',
'German': 'Treffer hinzufügen: für einen nicht gefundenen Schuss. Treffer entfernen: löscht den gewählten.',
'+ tile: for a shot that was not found. Bin: deletes the picked hit.': {
'English': '+ tile: for a shot that was not found. Bin: deletes the picked hit.',
'Slovenian': 'Ploščica +: za strel, ki ni bil najden. Koš: izbriše izbrani zadetek.',
'German': 'Kachel +: für einen nicht gefundenen Schuss. Papierkorb: löscht den gewählten Treffer.',
},
'Save to: training or tournament, and which folder. The last one is chosen for you.': {
'English': 'Save to: training or tournament, and which folder. The last one is chosen for you.',
'Slovenian': 'Shrani v: trening ali tekmovanje in katera mapa. Zadnja je že izbrana.',
'German': 'Speichern in: Training oder Wettkampf und welcher Ordner. Der letzte ist vorausgewählt.',
'Button bottom left: training or tournament. The folder on top: where it is saved; the last one is chosen for you.': {
'English': 'Button bottom left: training or tournament. The folder on top: where it is saved; the last one is chosen for you.',
'Slovenian': 'Gumb levo spodaj: trening ali tekmovanje. Mapa zgoraj: kam se shrani; zadnja je že izbrana.',
'German': 'Knopf unten links: Training oder Wettkampf. Der Ordner oben: wohin gespeichert wird; der letzte ist vorausgewählt.',
},
'Photo icon: see the photo with what was detected.': {
'English': 'Photo icon: see the photo with what was detected.',