new UI + new targets.
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Where a target design comes from (only used to order and group the picker).
|
||||
enum TargetGroup { classic, design, holiday }
|
||||
|
||||
/// One target design of the v3 set (FigCraft Designs/target-designs/v3).
|
||||
///
|
||||
/// Every design has the same geometry in a 1200 × 1200 space: centre
|
||||
/// (600, 600), ring 1 at r 510, the black at r 180; decoration and glow only
|
||||
/// outside ring 1. Hits are stored in that space, so a hit lands on the same
|
||||
/// ring whatever design is picked. The default ([id] 0) is drawn as vectors
|
||||
/// (sharp at any zoom); the others are 1600 px WebP images with transparency.
|
||||
class TargetStyle {
|
||||
final int id; // 1–35 are the old Target<id>.jpg, so saved choices carry over
|
||||
final String sl;
|
||||
final String en;
|
||||
final String de;
|
||||
final TargetGroup group;
|
||||
final Color glow; // outer glow colour, used for the picker's selection ring
|
||||
|
||||
const TargetStyle(this.id, this.sl, this.en, this.de, this.group, this.glow);
|
||||
|
||||
bool get isDefault => id == 0;
|
||||
bool get isHoliday => group == TargetGroup.holiday;
|
||||
|
||||
/// Image asset; null for the vector default.
|
||||
String? get asset => isDefault ? null : 'assets/targets/v3/t${id.toString().padLeft(2, '0')}.webp';
|
||||
|
||||
String name(String language) => switch (language) {
|
||||
'Slovenian' => sl,
|
||||
'German' => de,
|
||||
_ => en,
|
||||
};
|
||||
|
||||
static const TargetStyle fallback = TargetStyle(0, 'Privzeta', 'Default', 'Standard', TargetGroup.classic, Color(0xFF9FD8FF));
|
||||
|
||||
static TargetStyle byId(int? id) =>
|
||||
[...all, ...holidays].firstWhere((t) => t.id == id, orElse: () => fallback);
|
||||
|
||||
/// Holiday targets: never in the picker, only shown (locked) during their
|
||||
/// holiday – see HolidayTheme.
|
||||
static const List<TargetStyle> holidays = [
|
||||
TargetStyle(70, 'Božič', 'Christmas', 'Weihnachten', TargetGroup.holiday, Color(0xFFE2231A)),
|
||||
TargetStyle(71, 'Novo leto', 'New Year', 'Neujahr', TargetGroup.holiday, Color(0xFF7A2CFF)),
|
||||
TargetStyle(72, 'Velika noč', 'Easter', 'Ostern', TargetGroup.holiday, Color(0xFFB6E86E)),
|
||||
TargetStyle(73, 'Valentinovo', 'Valentine\'s Day', 'Valentinstag', TargetGroup.holiday, Color(0xFFE2112F)),
|
||||
TargetStyle(74, 'Noč čarovnic', 'Halloween', 'Halloween', TargetGroup.holiday, Color(0xFF7A2CFF)),
|
||||
TargetStyle(75, 'Pust', 'Carnival', 'Fasching', TargetGroup.holiday, Color(0xFFFF2F6D)),
|
||||
TargetStyle(76, 'Martinovo', 'St Martin\'s Day', 'Martinstag', TargetGroup.holiday, Color(0xFF7A1E4A)),
|
||||
TargetStyle(77, 'Praznik dela', 'Labour Day', 'Tag der Arbeit', TargetGroup.holiday, Color(0xFFE2231A)),
|
||||
TargetStyle(78, 'Kresna noč', 'Midsummer night', 'Johannisnacht', TargetGroup.holiday, Color(0xFFFF3D00)),
|
||||
TargetStyle(79, 'Dan državnosti', 'Statehood Day', 'Staatsfeiertag', TargetGroup.holiday, Color(0xFF1C4FA0)),
|
||||
];
|
||||
|
||||
/// The designs the app ships, in picker order. The rest of the v3 set
|
||||
/// (FigCraft Designs/target-designs/v3) is not used for now; to bring one
|
||||
/// back, add its line here and its webp to assets/targets/v3.
|
||||
static const List<TargetStyle> all = [
|
||||
fallback,
|
||||
TargetStyle(1, 'Lovorov venec', 'Laurel wreath', 'Lorbeerkranz', TargetGroup.classic, Color(0xFF3E8A1E)),
|
||||
TargetStyle(42, 'ISSF ecru', 'ISSF ecru', 'ISSF Ecru', TargetGroup.design, Color(0xFFE8D9B0)),
|
||||
TargetStyle(5, 'Plameni', 'Flames', 'Flammen', TargetGroup.classic, Color(0xFFFF3D00)),
|
||||
TargetStyle(8, 'Val', 'Wave', 'Welle', TargetGroup.classic, Color(0xFF0B8BD9)),
|
||||
TargetStyle(7, 'Sončno rumena', 'Sunny yellow', 'Sonnengelb', TargetGroup.classic, Color(0xFFFFA000)),
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user