Compare commits
15 Commits
9253d00be4
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c55ebd21b4 | |||
| 254e0d2675 | |||
| 77226b1469 | |||
| a26e0b93b5 | |||
| 82bd496cc9 | |||
| 9732a7e453 | |||
| 2ed3ee0ea1 | |||
| 43b3edd11e | |||
| fb85915418 | |||
| 00c09ad01b | |||
| aa0725b908 | |||
| 5f6574d08c | |||
| 3fb9dce729 | |||
| 92b5ef16cb | |||
| 94c3ef0f63 |
@@ -56,3 +56,7 @@ docs/perf/*.raw
|
||||
*.jks
|
||||
*.keystore
|
||||
*.p12
|
||||
|
||||
# Python bytecode (art pipeline)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
@@ -10,14 +10,41 @@ Alle nennenswerten Änderungen an diesem Projekt. Format nach
|
||||
- (docs) Entscheidungslog eingefuehrt; 12-Tester-Closed-Test auf Wunsch entfernt (D2)
|
||||
- (sim) `MAX_HP` 100 -> 150 (laengere, taktischere Matches); `SIM_VERSION` 0.2.0
|
||||
- (app) Version 0.6.0 (6), HP-Balken gegen `kTankMaxHp`
|
||||
- (app) Zahnrad-Button mit Semantik-Label „Einstellungen“ und größerer Touch-Fläche (Barrierefreiheit)
|
||||
|
||||
### Fixed
|
||||
- (game) Querformat war unspielbar: die Kamera zoomte auf die Ansichtsbreite und schnitt die Welt
|
||||
oben/unten ab, ohne vertikales Pannen - beide Panzer lagen außerhalb des Bildes. Jetzt passt die
|
||||
Kamera immer die Welthöhe ein, zentriert bei breiter Ansicht und der Hintergrund (Himmel, Bergketten,
|
||||
Boden) läuft in die Ränder weiter. Neuer Golden-Test `landscape.png` hält das fest.
|
||||
- (game) Schusskraft war kaum zu dosieren und nicht ablesbar: Zielen läuft jetzt als Zurückziehen
|
||||
(Zuglänge = Kraft, 260 px = 100 %), mit Gummiband zum Finger, Kraftbalken unter dem Panzer und
|
||||
Prozentanzeige samt Winkel im HUD
|
||||
- (ui) Bedienelemente und Abstände im Querformat kompakter (kein Overflow, per logcat geprüft)
|
||||
- (game) Renderer wieder bei 60 fps / 0 % Jank: Vollbild-Gradient (Vignette), Gradient je
|
||||
Bergrücken, zwei geclippte Gradient-Rects und MaskFilter-Blur entfernt, Boden als
|
||||
`ui.Picture` pro Terrain-Version gecacht
|
||||
- (app) HUD blieb auf dem Initialwert (100 HP), weil `onLoad` waehrend des ersten Builds publizierte
|
||||
- (app) Top-Level-`Stopwatch` startete erst beim ersten Zugriff (Dart initialisiert Top-Level-Finals lazy) - das Bootlog zeigte 0 ms
|
||||
|
||||
### Changed
|
||||
- (build) Version 0.7.0 (7); signiertes App Bundle mit Upload-Keystore
|
||||
- (build) Version 0.8.2 (12): Datenschutz-URL + Kontaktadresse + Löschpfad in der App; signiertes App Bundle mit Upload-Keystore
|
||||
|
||||
### Added
|
||||
- (app) „Datenlöschung anfragen" im Einstellungen-Sheet: vorausgefüllte E-Mail an die Kontaktadresse mit Geräte-ID
|
||||
- (legal) Kontaktadresse `softwareapp.hb@gmail.com` in Policy (DE/EN) und Listing eingetragen
|
||||
- (app) Datenschutzerklärung im Einstellungen-Sheet (öffnet die Webseite über `url_launcher`),
|
||||
Manifest-`<queries>` für den Browser, Release-Guard gegen die Platzhalter-URL
|
||||
- (game) Ingame-Grafik neu: Himmel mit kamerarelativ platzierter Sonne, drei parallaxe
|
||||
Bergrücken, Boden mit Verlauf/Schattenlippe/Felsbrocken, Panzer mit Kette/Turm/Rohr,
|
||||
Kometenschweif, Explosion mit Funken, Zielhilfe (`lib/src/game/art.dart`)
|
||||
- (art) Generierte Marken-Grafik: `tools/art/` (SVG-Master + rsvg), Adaptive Icon inkl.
|
||||
Monochrom, Splash-Lockup, neues Feature-Graphic, Design-Tokens nach
|
||||
`app/lib/src/ui/palette.dart`; Doku in `docs/art-direction.md`
|
||||
- (app) Splash-Kette ohne weissen Bildschirm: Markenfarbe `#05070A` als Launch- und Normal-Theme,
|
||||
Android-12-Splash-API (`values-v31`), pulsierendes Logo inkl. Fortschrittslinie bis die native
|
||||
Bibliothek, die Session und das Ad-SDK bereit sind, danach Fade in die Partie
|
||||
- (app) Startlog `iron_arc: ready after N ms` (Debug + Release), nutzbar als Regressionswaechter
|
||||
- (legal) Datenschutzerklaerung DE/EN als Markdown und als hostbare HTML-Seite
|
||||
- (app) Geraete-ID im Einstellungen-Sheet sichtbar und kopierbar (fuer Loeschantraege)
|
||||
- (ads) UMP-Consent-Flow vor SDK-Init, Fail-Safe ohne Zustimmung, Einstellungen-Sheet mit „Datenschutz-Optionen“
|
||||
|
||||
@@ -44,6 +44,12 @@
|
||||
|
||||
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
|
||||
<queries>
|
||||
<!-- url_launcher: needed on Android 11+ to resolve the browser for the
|
||||
privacy policy link. -->
|
||||
<intent>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<data android:scheme="https"/>
|
||||
</intent>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
||||
<data android:mimeType="text/plain"/>
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<!-- v21 variant of the launch screen (identical content, kept in sync). -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="?android:colorBackground" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<item android:drawable="@color/launch_bg" />
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
android:src="@drawable/launch_logo" />
|
||||
</item>
|
||||
</layer-list>
|
||||
|
||||
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 55 KiB |
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<!-- Launch screen shown from process start until Flutter draws its first frame.
|
||||
Brand background + the same logo the in-app splash pulses, so the handover
|
||||
from native window to Flutter is invisible. -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@android:color/white" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<item android:drawable="@color/launch_bg" />
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
android:src="@drawable/launch_logo" />
|
||||
</item>
|
||||
</layer-list>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generated by tools/art/artgen.py - do not edit by hand. -->
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generated by tools/art/artgen.py - do not edit by hand. -->
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
@@ -2,9 +2,9 @@
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
the Flutter engine draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
<item name="android:statusBarColor">@color/launch_bg</item>
|
||||
<item name="android:navigationBarColor">@color/launch_bg</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
<item name="android:windowBackground">@color/launch_bg</item>
|
||||
<item name="android:statusBarColor">@color/launch_bg</item>
|
||||
<item name="android:navigationBarColor">@color/launch_bg</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Android 12+ draws its own splash screen; configure it to look like ours
|
||||
instead of the default (which would flash the launcher icon on white). -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowSplashScreenBackground">@color/launch_bg</item>
|
||||
<!-- Padded 512x512 canvas: Android masks everything outside the inner
|
||||
192dp of the 288dp icon area, so the mark must sit inside it. -->
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/launch_logo_splash</item>
|
||||
<item name="android:windowSplashScreenIconBackgroundColor">@color/launch_plate</item>
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
<item name="android:statusBarColor">@color/launch_bg</item>
|
||||
<item name="android:navigationBarColor">@color/launch_bg</item>
|
||||
</style>
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/launch_bg</item>
|
||||
<item name="android:statusBarColor">@color/launch_bg</item>
|
||||
<item name="android:navigationBarColor">@color/launch_bg</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Same near-black the game canvas uses, so launch -> splash -> game never flashes. -->
|
||||
<color name="launch_bg">#FF05070A</color>
|
||||
<!-- Plate behind the Android 12+ splash icon: identical to launch_bg, so the
|
||||
circular badge floats instead of sitting on a visible square. -->
|
||||
<color name="launch_plate">#FF05070A</color>
|
||||
</resources>
|
||||
@@ -1,10 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
the Flutter engine draws its first frame -->
|
||||
<!-- Theme applied to the Android Window while the process is starting.
|
||||
Dark parent + dark background: the white flash of the stock template is gone.
|
||||
The Flutter splash takes over with the same logo and the same colour. -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
<item name="android:statusBarColor">@color/launch_bg</item>
|
||||
<item name="android:navigationBarColor">@color/launch_bg</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
@@ -12,7 +14,9 @@
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/launch_bg</item>
|
||||
<item name="android:statusBarColor">@color/launch_bg</item>
|
||||
<item name="android:navigationBarColor">@color/launch_bg</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
|
After Width: | Height: | Size: 75 KiB |
@@ -1,18 +1,35 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flame/game.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import 'src/ads/ads_service.dart';
|
||||
import 'src/billing/billing_service.dart';
|
||||
import 'src/billing/entitlements.dart';
|
||||
import 'src/billing/models.dart';
|
||||
import 'src/billing/store_client.dart';
|
||||
import 'src/game/iron_arc_game.dart';
|
||||
import 'src/native/native_match.dart';
|
||||
import 'src/net/api_client.dart';
|
||||
import 'src/net/match_session.dart';
|
||||
import 'src/net/offline_queue.dart';
|
||||
import 'src/ui/links.dart';
|
||||
import 'src/ui/splash_screen.dart';
|
||||
import 'src/ui/widgets.dart';
|
||||
|
||||
void main() => runApp(const IronArcApp());
|
||||
/// Started in `main()`, so the boot log line covers the whole cold start
|
||||
/// (engine, Dart isolate and native match load). Must be initialised eagerly -
|
||||
/// a top-level `final` would only start on first access.
|
||||
final Stopwatch _bootWatch = Stopwatch();
|
||||
|
||||
void main() {
|
||||
_bootWatch.start();
|
||||
runApp(const IronArcApp());
|
||||
}
|
||||
|
||||
class IronArcApp extends StatelessWidget {
|
||||
const IronArcApp({super.key});
|
||||
@@ -39,23 +56,79 @@ class MatchScreen extends StatefulWidget {
|
||||
class _MatchScreenState extends State<MatchScreen> {
|
||||
static const _baseUrl = 'http://127.0.0.1:8080';
|
||||
|
||||
/// Minimum time the splash stays up, so even a warm start shows the brand
|
||||
/// instead of a single-frame flicker.
|
||||
static const _minSplash = Duration(milliseconds: 700);
|
||||
|
||||
int _seed = 42;
|
||||
late final ApiClient _api = ApiClient(baseUrl: _baseUrl);
|
||||
late final OfflineQueue _queue = OfflineQueue();
|
||||
late final AdsService _ads = AdsService();
|
||||
late final MatchSession _session =
|
||||
MatchSession(client: _api, queue: _queue, deviceId: 'pending');
|
||||
late IronArcGame _game = _buildGame();
|
||||
|
||||
/// Null while booting. Constructing a game loads the native match library,
|
||||
/// which must not block the first frame - that used to be the white screen.
|
||||
IronArcGame? _game;
|
||||
bool _splashGone = false;
|
||||
|
||||
Entitlements? _entitlements;
|
||||
BillingService? _billing;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_initSession();
|
||||
// Boot after the first frame so the splash is painted before any blocking
|
||||
// work (FFI library load, shared preferences, ad SDK).
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _bootstrap());
|
||||
}
|
||||
|
||||
/// Session, native match and ad SDK - all while the splash is on screen.
|
||||
Future<void> _bootstrap() async {
|
||||
// Measured from the first Flutter frame, so the pulse is always visible
|
||||
// even when the engine took seconds to start (debug builds, cold JIT).
|
||||
final splashStart = Stopwatch()..start();
|
||||
|
||||
await _initSession();
|
||||
final game = _buildGame();
|
||||
if (!mounted) return;
|
||||
|
||||
// Keep the brand moment on screen even when everything loads instantly.
|
||||
final left = _minSplash - splashStart.elapsed;
|
||||
if (left > Duration.zero) await Future<void>.delayed(left);
|
||||
if (!mounted) return;
|
||||
|
||||
setState(() => _game = game);
|
||||
// Fade out over the already-built match, then drop the splash from the tree.
|
||||
await Future<void>.delayed(const Duration(milliseconds: 320));
|
||||
if (!mounted) return;
|
||||
setState(() => _splashGone = true);
|
||||
|
||||
debugPrint('iron_arc: ready after ${_bootWatch.elapsedMilliseconds} ms');
|
||||
|
||||
// Store first: entitlements gate the interstitials that ads would load.
|
||||
final entitlements = await Entitlements.load();
|
||||
if (!mounted) return;
|
||||
_entitlements = entitlements;
|
||||
entitlements.addListener(_syncAdsGate);
|
||||
_syncAdsGate();
|
||||
final billing = BillingService(
|
||||
entitlements: entitlements,
|
||||
client: PlayStoreClient(),
|
||||
);
|
||||
_billing = billing;
|
||||
unawaited(billing.init());
|
||||
|
||||
_ads.initialize();
|
||||
}
|
||||
|
||||
/// Owners of "Remove Ads" never see an interstitial.
|
||||
void _syncAdsGate() => _ads.adsRemoved = _entitlements?.adsRemoved ?? false;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_entitlements?.removeListener(_syncAdsGate);
|
||||
_billing?.dispose();
|
||||
_ads.dispose();
|
||||
_api.close();
|
||||
_session.dispose();
|
||||
@@ -109,7 +182,9 @@ class _MatchScreenState extends State<MatchScreen> {
|
||||
}
|
||||
|
||||
void _playReplay() {
|
||||
final json = _game.replayJson();
|
||||
final game = _game;
|
||||
if (game == null) return;
|
||||
final json = game.replayJson();
|
||||
debugPrint('iron_arc: replay tapped, ${json.length} bytes');
|
||||
if (json.isEmpty) {
|
||||
_toast('Kein Replay vorhanden');
|
||||
@@ -138,6 +213,21 @@ class _MatchScreenState extends State<MatchScreen> {
|
||||
if (mounted) _toast('Consent: ${_ads.consentLabel}');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.description_outlined),
|
||||
title: const Text('Datenschutzerklärung'),
|
||||
subtitle: const Text('Öffnet die Webseite'),
|
||||
trailing: const Icon(Icons.open_in_new, size: 18),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
final ok = await launchUrl(
|
||||
Uri.parse(kPrivacyPolicyUrl),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
if (!ok && mounted) _toast('Keine App zum Öffnen gefunden');
|
||||
},
|
||||
),
|
||||
_shopSection(sheetContext),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.campaign_outlined),
|
||||
title: const Text('Werbe-Status'),
|
||||
@@ -157,6 +247,46 @@ class _MatchScreenState extends State<MatchScreen> {
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.delete_outline),
|
||||
title: const Text('Datenlöschung anfragen'),
|
||||
subtitle: const Text('E-Mail mit vorausgefüllter Geräte-ID'),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
final ok = await launchUrl(deletionRequestUri(_session.deviceId));
|
||||
if (!ok && mounted) _toast('Keine E-Mail-App gefunden');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.cleaning_services_outlined),
|
||||
title: const Text('Lokale Daten löschen'),
|
||||
subtitle: const Text('Verlauf, Warteschlange, Geräte-ID'),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('Lokale Daten löschen?'),
|
||||
content: const Text(
|
||||
'Entfernt Offline-Warteschlange, Replays und die Geräte-ID '
|
||||
'von diesem Gerät. Käufe bleiben erhalten.'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, false),
|
||||
child: const Text('Abbrechen')),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.pop(ctx, true),
|
||||
child: const Text('Löschen')),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (confirmed != true || !mounted) return;
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.clear();
|
||||
if (!mounted) return;
|
||||
_toast('Lokale Daten gelöscht – App neu starten');
|
||||
},
|
||||
),
|
||||
if (kDebugMode)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.restart_alt),
|
||||
@@ -174,6 +304,73 @@ class _MatchScreenState extends State<MatchScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
/// Store section of the settings sheet (M7c).
|
||||
Widget _shopSection(BuildContext sheetContext) {
|
||||
final billing = _billing;
|
||||
final ent = _entitlements;
|
||||
if (billing == null || ent == null) {
|
||||
return const ListTile(
|
||||
leading: Icon(Icons.shopping_bag_outlined),
|
||||
title: Text('Werbung entfernen'),
|
||||
subtitle: Text('Store wird geladen …'),
|
||||
enabled: false,
|
||||
);
|
||||
}
|
||||
return ListenableBuilder(
|
||||
listenable: Listenable.merge([billing, ent]),
|
||||
builder: (context, _) {
|
||||
final owned = ent.adsRemoved;
|
||||
final price = billing.product(ProductIds.removeAds)?.price;
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Divider(height: 1, color: Color(0xFF1B2C44)),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
owned ? Icons.verified : Icons.block,
|
||||
color: owned ? const Color(0xFFFFB347) : null,
|
||||
),
|
||||
title: const Text('Werbung entfernen'),
|
||||
subtitle: Text(owned
|
||||
? 'Gekauft - keine Interstitials mehr'
|
||||
: billing.busy
|
||||
? 'Einen Moment …'
|
||||
: price ?? billing.error ?? 'Preis wird geladen …'),
|
||||
trailing: owned
|
||||
? null
|
||||
: const Icon(Icons.shopping_bag_outlined, size: 18),
|
||||
enabled: !owned && billing.canPurchase && !billing.busy,
|
||||
onTap: owned
|
||||
? null
|
||||
: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
final started = await billing.buy(ProductIds.removeAds);
|
||||
if (!mounted) return;
|
||||
_toast(started
|
||||
? 'Kauf gestartet'
|
||||
: billing.error ?? 'Kauf nicht möglich');
|
||||
},
|
||||
),
|
||||
if (!owned)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.restore),
|
||||
title: const Text('Käufe wiederherstellen'),
|
||||
enabled: billing.available && !billing.busy,
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await billing.restore();
|
||||
if (!mounted) return;
|
||||
_toast(ent.adsRemoved
|
||||
? 'Käufe wiederhergestellt'
|
||||
: 'Keine Käufe gefunden');
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showRewardedAd() async {
|
||||
if (!_ads.isAdsAllowed) {
|
||||
_toast('Anzeigen erst nach Zustimmung');
|
||||
@@ -208,70 +405,96 @@ class _MatchScreenState extends State<MatchScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final game = _game;
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF05070A),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(12, 8, 12, 0),
|
||||
child: Column(
|
||||
children: [
|
||||
ValueListenableBuilder<HudState>(
|
||||
valueListenable: _game.hud,
|
||||
builder: (context, hud, _) => Hud(hud: hud),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
AnimatedBuilder(
|
||||
animation: _session,
|
||||
builder: (context, _) =>
|
||||
StatusBar(session: _session, onSettings: _openSettings),
|
||||
),
|
||||
],
|
||||
backgroundColor: SplashScreen.background,
|
||||
body: Stack(
|
||||
children: [
|
||||
// The match only exists once the native library and session are up;
|
||||
// until then the pulsing splash covers the whole window.
|
||||
if (game != null) _buildMatch(game),
|
||||
if (!_splashGone)
|
||||
Positioned.fill(
|
||||
child: AnimatedOpacity(
|
||||
opacity: game == null ? 1 : 0,
|
||||
duration: const Duration(milliseconds: 280),
|
||||
curve: Curves.easeOut,
|
||||
child: const SplashScreen(),
|
||||
),
|
||||
),
|
||||
// Play area: gestures only affect the game, never the controls.
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(child: GameWidget(key: ValueKey(_game), game: _game)),
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onPanStart: (d) => _game.beginAim(d.localPosition),
|
||||
onPanUpdate: (d) => _game.updateAim(d.localPosition),
|
||||
onPanEnd: (_) => _game.releaseAim(),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 16,
|
||||
right: 16,
|
||||
bottom: 8,
|
||||
child: ValueListenableBuilder<HudState>(
|
||||
valueListenable: _game.hud,
|
||||
builder: (context, hud, _) => hud.isFinished
|
||||
? GameOver(hud: hud, onRestart: _restart)
|
||||
: HintBubble(hud: hud),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(12, 8, 12, 8),
|
||||
child: AnimatedBuilder(
|
||||
animation: _session,
|
||||
builder: (context, _) => Controls(
|
||||
session: _session,
|
||||
onOnline: _startOnline,
|
||||
onReplay: _playReplay,
|
||||
onFlush: _flushQueue,
|
||||
onAd: _showRewardedAd,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// HUD, canvas and controls of a running match.
|
||||
Widget _buildMatch(IronArcGame game) {
|
||||
final window = MediaQuery.sizeOf(context);
|
||||
// Landscape: the play area is the scarce resource, so chrome gets thinner.
|
||||
final compact = window.width > window.height;
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(12, compact ? 4 : 8, 12, 0),
|
||||
child: Column(
|
||||
children: [
|
||||
ValueListenableBuilder<HudState>(
|
||||
valueListenable: game.hud,
|
||||
builder: (context, hud, _) => Hud(hud: hud),
|
||||
),
|
||||
SizedBox(height: compact ? 3 : 6),
|
||||
AnimatedBuilder(
|
||||
animation: _session,
|
||||
builder: (context, _) =>
|
||||
StatusBar(session: _session, onSettings: _openSettings),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Play area: gestures only affect the game, never the controls.
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: GameWidget(key: ValueKey(game), game: game)),
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onPanStart: (d) => game.beginAim(d.localPosition),
|
||||
onPanUpdate: (d) => game.updateAim(d.localPosition),
|
||||
onPanEnd: (_) => game.releaseAim(),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 16,
|
||||
right: 16,
|
||||
bottom: 8,
|
||||
child: ValueListenableBuilder<HudState>(
|
||||
valueListenable: game.hud,
|
||||
builder: (context, hud, _) => hud.isFinished
|
||||
? GameOver(hud: hud, onRestart: _restart)
|
||||
: HintBubble(hud: hud),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(12, compact ? 4 : 8, 12, compact ? 4 : 8),
|
||||
child: AnimatedBuilder(
|
||||
animation: _session,
|
||||
builder: (context, _) => Controls(
|
||||
session: _session,
|
||||
onOnline: _startOnline,
|
||||
onReplay: _playReplay,
|
||||
onFlush: _flushQueue,
|
||||
onAd: _showRewardedAd,
|
||||
compact: compact,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,10 @@ class AdsService {
|
||||
InterstitialAd? _interstitial;
|
||||
bool _started = false;
|
||||
bool _adsAllowed = false;
|
||||
|
||||
/// Set from the store entitlements ("Remove Ads"). Owners never see an
|
||||
/// interstitial; rewarded video stays available on purpose.
|
||||
bool adsRemoved = false;
|
||||
int _matchesFinished = 0;
|
||||
|
||||
ConsentStatus _consentStatus = ConsentStatus.unknown;
|
||||
@@ -168,6 +172,7 @@ class AdsService {
|
||||
}
|
||||
|
||||
void _loadInterstitial() {
|
||||
if (adsRemoved) return; // owner: never request an interstitial
|
||||
InterstitialAd.load(
|
||||
adUnitId: interstitialUnitId,
|
||||
request: const AdRequest(),
|
||||
@@ -215,7 +220,7 @@ class AdsService {
|
||||
|
||||
/// Called when a match ends; applies the frequency caps from the GDD.
|
||||
void onMatchFinished() {
|
||||
if (!_adsAllowed) return;
|
||||
if (!_adsAllowed || adsRemoved) return;
|
||||
_matchesFinished++;
|
||||
if (_matchesFinished <= skipFirstMatches) return;
|
||||
if (_matchesFinished % everyNthMatch != 0) return;
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'entitlements.dart';
|
||||
import 'models.dart';
|
||||
import 'store_client.dart';
|
||||
|
||||
/// Orchestrates the store: product query, purchase, restore, entitlement write.
|
||||
///
|
||||
/// Rules from docs/monetization.md:
|
||||
/// * prices come from the store, never from the app;
|
||||
/// * `queryPurchases` on start, so a reinstall restores what was bought;
|
||||
/// * pending transactions are reported but never granted;
|
||||
/// * every purchased/restored item is completed (Play refunds after 3 days).
|
||||
class BillingService extends ChangeNotifier {
|
||||
BillingService({required this.entitlements, required this.client});
|
||||
|
||||
final Entitlements entitlements;
|
||||
final StoreClient client;
|
||||
|
||||
StreamSubscription<PurchaseEvent>? _sub;
|
||||
final Map<String, StoreProduct> _products = {};
|
||||
|
||||
bool _available = false;
|
||||
bool _busy = false;
|
||||
bool _initialised = false;
|
||||
String? _error;
|
||||
|
||||
bool get available => _available;
|
||||
bool get busy => _busy;
|
||||
bool get initialised => _initialised;
|
||||
String? get error => _error;
|
||||
bool get adsRemoved => entitlements.adsRemoved;
|
||||
|
||||
StoreProduct? product(String id) => _products[id];
|
||||
Iterable<StoreProduct> get products => _products.values;
|
||||
|
||||
/// True when the store answered and offered at least one product.
|
||||
bool get canPurchase => _available && _products.isNotEmpty;
|
||||
|
||||
Future<void> init() async {
|
||||
if (_initialised) return;
|
||||
_initialised = true;
|
||||
_sub = client.events.listen(_onEvent);
|
||||
|
||||
try {
|
||||
_available = await client.isAvailable();
|
||||
} catch (e) {
|
||||
_available = false;
|
||||
_error = 'Play Store nicht erreichbar';
|
||||
}
|
||||
if (!_available) {
|
||||
notifyListeners();
|
||||
return;
|
||||
}
|
||||
await refreshProducts();
|
||||
// Owned products are re-delivered through the event stream.
|
||||
await restore(silent: true);
|
||||
}
|
||||
|
||||
Future<void> refreshProducts() async {
|
||||
if (!_available) return;
|
||||
try {
|
||||
final found = await client.queryProducts(ProductIds.offered);
|
||||
_products
|
||||
..clear()
|
||||
..addEntries(found.map((p) => MapEntry(p.id, p)));
|
||||
_error = found.isEmpty ? 'Keine Produkte im Play Store angelegt' : null;
|
||||
} catch (e) {
|
||||
_error = 'Produkte konnten nicht geladen werden';
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// Starts the purchase flow. The result arrives asynchronously via the
|
||||
/// stream - this only reports whether the flow could be started at all.
|
||||
Future<bool> buy(String productId) async {
|
||||
final item = _products[productId];
|
||||
if (item == null) {
|
||||
_error = 'Produkt nicht verfügbar';
|
||||
notifyListeners();
|
||||
return false;
|
||||
}
|
||||
_busy = true;
|
||||
_error = null;
|
||||
notifyListeners();
|
||||
try {
|
||||
final started = await client.buy(item);
|
||||
if (!started) _error = 'Kauf konnte nicht gestartet werden';
|
||||
return started;
|
||||
} catch (e) {
|
||||
_error = 'Kauf abgebrochen: $e';
|
||||
return false;
|
||||
} finally {
|
||||
_busy = false;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> restore({bool silent = false}) async {
|
||||
if (!_available) return;
|
||||
_busy = true;
|
||||
notifyListeners();
|
||||
try {
|
||||
await client.restore();
|
||||
} catch (e) {
|
||||
if (!silent) _error = 'Wiederherstellen fehlgeschlagen';
|
||||
} finally {
|
||||
_busy = false;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onEvent(PurchaseEvent event) async {
|
||||
switch (event.state) {
|
||||
case PurchaseState.purchased:
|
||||
case PurchaseState.restored:
|
||||
// Grant first, then complete: a crash in between re-delivers the
|
||||
// purchase instead of losing it.
|
||||
await entitlements.grant(event.productId);
|
||||
await client.complete(event);
|
||||
_error = null;
|
||||
break;
|
||||
case PurchaseState.pending:
|
||||
_error = 'Kauf wird geprüft (pending)';
|
||||
break;
|
||||
case PurchaseState.canceled:
|
||||
_error = null;
|
||||
break;
|
||||
case PurchaseState.error:
|
||||
_error = event.error ?? 'Kauf fehlgeschlagen';
|
||||
break;
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_sub?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'models.dart';
|
||||
|
||||
/// Non-consumable products the player owns, persisted on the device.
|
||||
///
|
||||
/// The Play Console is the source of truth for money; this is the local mirror
|
||||
/// that the UI and the ad gate read. `BillingService` only grants after the
|
||||
/// store reported `purchased` or `restored`, and every grant is written through
|
||||
/// to disk immediately.
|
||||
class Entitlements extends ChangeNotifier {
|
||||
Entitlements._(this._prefs, this._owned);
|
||||
|
||||
static const String storageKey = 'iron_arc.entitlements';
|
||||
|
||||
final SharedPreferences _prefs;
|
||||
final Set<String> _owned;
|
||||
|
||||
static Future<Entitlements> load() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final owned = prefs.getStringList(storageKey)?.toSet() ?? <String>{};
|
||||
return Entitlements._(prefs, owned);
|
||||
}
|
||||
|
||||
Set<String> get owned => Set.unmodifiable(_owned);
|
||||
|
||||
bool owns(String productId) => _owned.contains(productId);
|
||||
|
||||
/// Interstitials are hidden for owners; rewarded video stays opt-in.
|
||||
bool get adsRemoved => owns(ProductIds.removeAds);
|
||||
|
||||
Future<void> grant(String productId) async {
|
||||
if (!_owned.add(productId)) return;
|
||||
await _prefs.setStringList(storageKey, _owned.toList());
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// Used when the store reports that a product is no longer owned (refund).
|
||||
Future<void> revoke(String productId) async {
|
||||
if (!_owned.remove(productId)) return;
|
||||
await _prefs.setStringList(storageKey, _owned.toList());
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> clearAll() async {
|
||||
if (_owned.isEmpty) return;
|
||||
_owned.clear();
|
||||
await _prefs.remove(storageKey);
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/// Product catalogue. Ids must match the entries created in the Play Console -
|
||||
/// prices are **never** hardcoded in the app, the store returns them.
|
||||
///
|
||||
/// Only [removeAds] is wired into the UI so far (M7c); the rest of the table in
|
||||
/// docs/monetization.md needs the economy that does not exist yet.
|
||||
abstract final class ProductIds {
|
||||
/// Non-consumable: hides interstitials. Rewarded video stays opt-in.
|
||||
static const String removeAds = 'remove_ads';
|
||||
|
||||
/// Documents the seasonal pass that will follow in MVP-3.
|
||||
static const String seasonPass = 'season_pass';
|
||||
|
||||
/// Consumable hard currency - needs server-side bookkeeping, not wired yet.
|
||||
static const String coresSmall = 'cores_small';
|
||||
|
||||
static const Set<String> all = {removeAds, seasonPass, coresSmall};
|
||||
|
||||
/// Products the UI offers today.
|
||||
static const Set<String> offered = {removeAds};
|
||||
}
|
||||
|
||||
/// One purchasable item as the store describes it.
|
||||
class StoreProduct {
|
||||
const StoreProduct({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.price,
|
||||
this.raw,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final String title;
|
||||
final String price;
|
||||
final Object? raw;
|
||||
|
||||
@override
|
||||
String toString() => '$id ($price)';
|
||||
}
|
||||
|
||||
/// State of a purchase event, mapped from the platform.
|
||||
enum PurchaseState { pending, purchased, restored, canceled, error }
|
||||
|
||||
class PurchaseEvent {
|
||||
const PurchaseEvent({
|
||||
required this.productId,
|
||||
required this.state,
|
||||
this.error,
|
||||
this.complete = false,
|
||||
this.raw,
|
||||
});
|
||||
|
||||
final String productId;
|
||||
final PurchaseState state;
|
||||
final String? error;
|
||||
|
||||
/// True when the platform waits for `completePurchase` (Play: acknowledge
|
||||
/// within three days, otherwise the purchase is refunded automatically).
|
||||
final bool complete;
|
||||
final Object? raw;
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:in_app_purchase/in_app_purchase.dart';
|
||||
|
||||
import 'models.dart';
|
||||
|
||||
/// Thin seam over the platform billing plugin.
|
||||
///
|
||||
/// Everything above this interface (entitlements, UI) is testable with a fake
|
||||
/// implementation; only [PlayStoreClient] touches the real store.
|
||||
abstract class StoreClient {
|
||||
/// Emits every purchase state change, including restored purchases.
|
||||
Stream<PurchaseEvent> get events;
|
||||
|
||||
Future<bool> isAvailable();
|
||||
|
||||
Future<List<StoreProduct>> queryProducts(Set<String> ids);
|
||||
|
||||
/// Returns false when the platform refused to start the flow.
|
||||
Future<bool> buy(StoreProduct product);
|
||||
|
||||
/// Acknowledge/consume - must happen or Play refunds after three days.
|
||||
Future<void> complete(PurchaseEvent event);
|
||||
|
||||
/// Re-delivers owned non-consumables through [events].
|
||||
Future<void> restore();
|
||||
|
||||
Future<void> dispose();
|
||||
}
|
||||
|
||||
/// Google Play implementation.
|
||||
class PlayStoreClient implements StoreClient {
|
||||
PlayStoreClient({InAppPurchase? iap}) : _iap = iap ?? InAppPurchase.instance {
|
||||
_subscription = _iap.purchaseStream.listen(_onPurchases);
|
||||
}
|
||||
|
||||
final InAppPurchase _iap;
|
||||
late final StreamSubscription<List<PurchaseDetails>> _subscription;
|
||||
final StreamController<PurchaseEvent> _out = StreamController.broadcast();
|
||||
|
||||
@override
|
||||
Stream<PurchaseEvent> get events => _out.stream;
|
||||
|
||||
@override
|
||||
Future<bool> isAvailable() => _iap.isAvailable();
|
||||
|
||||
@override
|
||||
Future<List<StoreProduct>> queryProducts(Set<String> ids) async {
|
||||
final response = await _iap.queryProductDetails(ids);
|
||||
if (response.error != null) {
|
||||
throw StateError(response.error!.message);
|
||||
}
|
||||
return response.productDetails
|
||||
.map((d) => StoreProduct(
|
||||
id: d.id,
|
||||
title: d.title,
|
||||
price: d.price,
|
||||
raw: d,
|
||||
))
|
||||
.toList(growable: false);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> buy(StoreProduct product) async {
|
||||
final details = product.raw;
|
||||
if (details is! ProductDetails) return false;
|
||||
return _iap.buyNonConsumable(
|
||||
purchaseParam: PurchaseParam(productDetails: details),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> complete(PurchaseEvent event) async {
|
||||
final raw = event.raw;
|
||||
if (raw is PurchaseDetails && raw.pendingCompletePurchase) {
|
||||
await _iap.completePurchase(raw);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> restore() => _iap.restorePurchases();
|
||||
|
||||
void _onPurchases(List<PurchaseDetails> purchases) {
|
||||
for (final p in purchases) {
|
||||
_out.add(PurchaseEvent(
|
||||
productId: p.productID,
|
||||
state: switch (p.status) {
|
||||
PurchaseStatus.pending => PurchaseState.pending,
|
||||
PurchaseStatus.purchased => PurchaseState.purchased,
|
||||
PurchaseStatus.restored => PurchaseState.restored,
|
||||
PurchaseStatus.canceled => PurchaseState.canceled,
|
||||
PurchaseStatus.error => PurchaseState.error,
|
||||
},
|
||||
error: p.error?.message,
|
||||
complete: p.pendingCompletePurchase,
|
||||
raw: p,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> dispose() async {
|
||||
await _subscription.cancel();
|
||||
await _out.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,699 @@
|
||||
import 'dart:math' as math;
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../ui/palette.dart';
|
||||
|
||||
/// Scene art for the match: dusk sky, parallax ridges, layered terrain, tanks,
|
||||
/// projectile trail and impact effects.
|
||||
///
|
||||
/// Everything is drawn with canvas primitives on purpose - the terrain is
|
||||
/// destructible and the camera zooms, so bitmaps would have to be regenerated
|
||||
/// anyway. Geometry that never changes (ridges) is built once and cached; the
|
||||
/// per-frame work stays at a few paths and gradients.
|
||||
///
|
||||
/// Look rules: docs/art-direction.md - light from the horizon, a warm rim on
|
||||
/// every silhouette, one accent colour per side, vignette over the frame.
|
||||
|
||||
const double kArtWorldWidth = 2048;
|
||||
const double kArtWorldHeight = 1152;
|
||||
|
||||
/// Heightmap sampling step, must match the game (`kSamplePx`).
|
||||
const int kArtWorldSample = 2;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// geometry (ported from tools/art/artlib.py so both stay in sync)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Sum of two sines plus seeded jitter - reproducible ridges.
|
||||
List<Offset> ridgePoints({
|
||||
required double width,
|
||||
required double baseY,
|
||||
required double amplitude,
|
||||
required int seed,
|
||||
int steps = 7,
|
||||
double phase = 0,
|
||||
double footY = kArtWorldHeight,
|
||||
}) {
|
||||
final rnd = math.Random(seed);
|
||||
final pts = <Offset>[];
|
||||
for (var i = 0; i <= steps; i++) {
|
||||
final t = i / steps;
|
||||
var wave = math.sin((t * 2.2 + phase) * math.pi * 2) * 0.55;
|
||||
wave += math.sin((t * 5.1 + phase * 1.7) * math.pi * 2) * 0.22;
|
||||
final jitter = (i > 0 && i < steps) ? (rnd.nextDouble() - 0.5) * 0.30 : 0.0;
|
||||
pts.add(Offset(t * width, baseY - amplitude * (0.5 + 0.5 * wave + jitter)));
|
||||
}
|
||||
pts.add(Offset(width, footY));
|
||||
pts.add(Offset(0, footY));
|
||||
return pts;
|
||||
}
|
||||
|
||||
/// Catmull-Rom through the points, emitted as cubic beziers.
|
||||
Path smoothPath(List<Offset> points, {bool closed = false}) {
|
||||
final path = Path();
|
||||
if (points.length < 2) return path;
|
||||
final pts = <Offset>[
|
||||
if (closed) points.last,
|
||||
points.first,
|
||||
...points,
|
||||
points.last,
|
||||
if (closed) points.first,
|
||||
];
|
||||
path.moveTo(pts[1].dx, pts[1].dy);
|
||||
for (var i = 1; i < pts.length - 2; i++) {
|
||||
final p0 = pts[i - 1], p1 = pts[i], p2 = pts[i + 1], p3 = pts[i + 2];
|
||||
final c1 = Offset(p1.dx + (p2.dx - p0.dx) / 6, p1.dy + (p2.dy - p0.dy) / 6);
|
||||
final c2 = Offset(p2.dx - (p3.dx - p1.dx) / 6, p2.dy - (p3.dy - p1.dy) / 6);
|
||||
path.cubicTo(c1.dx, c1.dy, c2.dx, c2.dy, p2.dx, p2.dy);
|
||||
}
|
||||
if (closed) path.close();
|
||||
return path;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// sky + parallax backdrop
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class SkyArt {
|
||||
SkyArt({this.seed = 7});
|
||||
|
||||
final int seed;
|
||||
|
||||
final List<_Ridge> _ridges = [];
|
||||
final List<Offset> _stars = [];
|
||||
bool _built = false;
|
||||
|
||||
/// Long-lived paints: re-creating shaders every frame caused shader churn and
|
||||
/// dropped frames on device.
|
||||
final Paint _skyPaint = Paint();
|
||||
final Paint _starPaint = Paint();
|
||||
final Paint _coronaPaint = Paint();
|
||||
final Paint _sunPaint = Paint();
|
||||
|
||||
/// Sun radius in world units. The disc itself is camera-anchored (it is
|
||||
/// infinitely far away), so every camera position has a visible light source.
|
||||
static const double sunRadius = 74;
|
||||
|
||||
void _build() {
|
||||
final rnd = math.Random(seed);
|
||||
for (var i = 0; i < 22; i++) {
|
||||
// Wider than the world: landscape letterboxes the sides with sky.
|
||||
_stars.add(Offset(
|
||||
-700 + rnd.nextDouble() * (kArtWorldWidth + 1400), rnd.nextDouble() * 430));
|
||||
}
|
||||
_ridges.addAll([
|
||||
_Ridge(
|
||||
smoothPath(ridgePoints(
|
||||
width: kArtWorldWidth, baseY: 545, amplitude: 105, seed: seed + 1, steps: 6)),
|
||||
parallax: 0.12,
|
||||
fill: const Color(0xFF20334F),
|
||||
rim: Palette.terrainRim.withValues(alpha: 0.08),
|
||||
),
|
||||
_Ridge(
|
||||
smoothPath(ridgePoints(
|
||||
width: kArtWorldWidth,
|
||||
baseY: 625,
|
||||
amplitude: 95,
|
||||
seed: seed + 2,
|
||||
steps: 7,
|
||||
phase: 0.31)),
|
||||
parallax: 0.24,
|
||||
fill: const Color(0xFF152238),
|
||||
rim: Palette.terrainRim.withValues(alpha: 0.12),
|
||||
),
|
||||
_Ridge(
|
||||
smoothPath(ridgePoints(
|
||||
width: kArtWorldWidth,
|
||||
baseY: 700,
|
||||
amplitude: 80,
|
||||
seed: seed + 3,
|
||||
steps: 5,
|
||||
phase: 0.62)),
|
||||
parallax: 0.38,
|
||||
fill: const Color(0xFF080E19),
|
||||
rim: Palette.solarLight.withValues(alpha: 0.14),
|
||||
),
|
||||
]);
|
||||
_skyPaint.shader = ui.Gradient.linear(
|
||||
const Offset(0, 0),
|
||||
const Offset(0, kArtWorldHeight),
|
||||
const [
|
||||
Palette.ink0,
|
||||
Color(0xFF0B1424),
|
||||
Color(0xFF17243A),
|
||||
Color(0xFF3A3026),
|
||||
],
|
||||
const [0.0, 0.42, 0.62, 0.78],
|
||||
);
|
||||
_built = true;
|
||||
}
|
||||
|
||||
/// `camX` shifts each layer by (1 - parallax): the ridges crawl slower than
|
||||
/// the playfield. `viewWidth` places the sun relative to the viewport.
|
||||
void paint(Canvas canvas, {required double camX, required double viewWidth}) {
|
||||
if (!_built) _build();
|
||||
|
||||
final left = camX - 12;
|
||||
final right = camX + viewWidth + 12;
|
||||
canvas.drawRect(
|
||||
Rect.fromLTRB(left, 0, right, kArtWorldHeight),
|
||||
_skyPaint,
|
||||
);
|
||||
|
||||
_starPaint.color = const Color(0xFFDCE6F5).withValues(alpha: 0.22);
|
||||
for (final s in _stars) {
|
||||
final dx = s.dx + camX * 0.85;
|
||||
if (dx < left - 40 || dx > right + 40) continue;
|
||||
canvas.drawCircle(Offset(dx, s.dy), 2.2, _starPaint);
|
||||
}
|
||||
|
||||
_paintSun(canvas, Offset(camX + viewWidth * 0.66, 395));
|
||||
|
||||
// Tile the ridges so the horizon continues into the letterbox area.
|
||||
for (final ridge in _ridges) {
|
||||
final base = camX * (1 - ridge.parallax);
|
||||
for (final tile in const [-kArtWorldWidth, 0.0, kArtWorldWidth]) {
|
||||
final shift = base + tile;
|
||||
if (shift > right || shift + kArtWorldWidth < left) continue;
|
||||
canvas.save();
|
||||
canvas.translate(shift, 0);
|
||||
canvas.drawPath(ridge.path, ridge.fillPaint);
|
||||
if (ridge.rim.a > 0.01) {
|
||||
canvas.drawPath(ridge.path, ridge.rimPaint);
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _paintSun(Canvas canvas, Offset center) {
|
||||
_coronaPaint.shader = ui.Gradient.radial(center, sunRadius * 2.2, [
|
||||
Palette.solarDeep.withValues(alpha: 0.22),
|
||||
Palette.solarDeep.withValues(alpha: 0.0),
|
||||
]);
|
||||
canvas.drawCircle(center, sunRadius * 2.2, _coronaPaint);
|
||||
_sunPaint.shader = ui.Gradient.radial(
|
||||
center.translate(-sunRadius * 0.25, -sunRadius * 0.3),
|
||||
sunRadius * 1.35,
|
||||
[
|
||||
const Color(0xFFFFF3DC),
|
||||
Palette.solarLight,
|
||||
Palette.solarBase,
|
||||
Palette.solarDeep,
|
||||
],
|
||||
const [0.0, 0.45, 0.78, 1.0],
|
||||
);
|
||||
canvas.drawCircle(center, sunRadius, _sunPaint);
|
||||
}
|
||||
}
|
||||
|
||||
class _Ridge {
|
||||
_Ridge(this.path, {required this.parallax, required this.fill, required this.rim}) {
|
||||
// Flat fill: a gradient per ridge cost more than it added at this size.
|
||||
fillPaint.color = fill;
|
||||
rimPaint
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 2.5
|
||||
..color = rim;
|
||||
}
|
||||
|
||||
final Path path;
|
||||
final double parallax;
|
||||
final Color fill;
|
||||
final Color rim;
|
||||
final Paint fillPaint = Paint();
|
||||
final Paint rimPaint = Paint();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// terrain
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class TerrainArt {
|
||||
int _version = -1;
|
||||
ui.Picture? _picture;
|
||||
|
||||
/// The soil never changes between two craters, so the whole layer is recorded
|
||||
/// into a Picture once. Redrawing it every frame cost ~30 % of the frame
|
||||
/// budget on the test device (mask filters are not free).
|
||||
void paint(
|
||||
Canvas canvas,
|
||||
Path fill,
|
||||
Path line, {
|
||||
List<int>? heights,
|
||||
int version = -1,
|
||||
}) {
|
||||
if (_picture == null || version != _version) {
|
||||
_version = version;
|
||||
final recorder = ui.PictureRecorder();
|
||||
_draw(Canvas(recorder), fill, line, heights);
|
||||
_picture = recorder.endRecording();
|
||||
}
|
||||
canvas.drawPicture(_picture!);
|
||||
}
|
||||
|
||||
void _draw(Canvas canvas, Path fill, Path line, List<int>? heights) {
|
||||
canvas.drawPath(
|
||||
fill,
|
||||
Paint()
|
||||
..shader = ui.Gradient.linear(
|
||||
const Offset(0, 520),
|
||||
const Offset(0, kArtWorldHeight),
|
||||
[const Color(0xFF54402C), Palette.terrainSoil, Palette.terrainDeep],
|
||||
const [0.0, 0.35, 1.0],
|
||||
),
|
||||
);
|
||||
|
||||
canvas.save();
|
||||
canvas.clipPath(fill);
|
||||
// Shade under the lip without a mask filter: two soft strokes.
|
||||
canvas.drawPath(
|
||||
line,
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 26
|
||||
..strokeJoin = StrokeJoin.round
|
||||
..color = const Color(0xFF0B0805).withValues(alpha: 0.10),
|
||||
);
|
||||
canvas.drawPath(
|
||||
line,
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 12
|
||||
..strokeJoin = StrokeJoin.round
|
||||
..color = const Color(0xFF0B0805).withValues(alpha: 0.12),
|
||||
);
|
||||
canvas.restore();
|
||||
|
||||
// Surface: wide translucent edge, warm line, thin highlight.
|
||||
canvas.drawPath(
|
||||
line,
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 12
|
||||
..strokeJoin = StrokeJoin.round
|
||||
..color = Palette.solarLight.withValues(alpha: 0.07),
|
||||
);
|
||||
canvas.drawPath(
|
||||
line,
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 3.5
|
||||
..strokeCap = StrokeCap.round
|
||||
..strokeJoin = StrokeJoin.round
|
||||
..color = Palette.terrainRim.withValues(alpha: 0.55),
|
||||
);
|
||||
canvas.drawPath(
|
||||
line,
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 1.2
|
||||
..strokeCap = StrokeCap.round
|
||||
..color = Palette.solarLight.withValues(alpha: 0.35),
|
||||
);
|
||||
|
||||
if (heights != null) _paintSurfaceRocks(canvas, heights);
|
||||
}
|
||||
|
||||
/// Sparse rocks poking out of the surface. Evenly spaced ticks read as a
|
||||
/// fence, so the spacing is seeded and irregular.
|
||||
void _paintSurfaceRocks(Canvas canvas, List<int> heights) {
|
||||
if (heights.length < 8) return;
|
||||
final rnd = math.Random(91);
|
||||
var i = 3;
|
||||
while (i < heights.length - 4) {
|
||||
i += 12 + rnd.nextInt(38);
|
||||
if (i >= heights.length - 4) break;
|
||||
final x = i * kArtWorldSample.toDouble();
|
||||
final y = heights[i].toDouble();
|
||||
final w = 4.0 + rnd.nextDouble() * 9;
|
||||
final h = 3.0 + rnd.nextDouble() * 6;
|
||||
final rock = Path()
|
||||
..moveTo(x - w, y + 3)
|
||||
..lineTo(x - w * 0.5, y - h)
|
||||
..lineTo(x + w * 0.35, y - h * 0.75)
|
||||
..lineTo(x + w, y + 3)
|
||||
..close();
|
||||
canvas.drawPath(rock, Paint()..color = const Color(0xFF4A3A26));
|
||||
canvas.drawPath(
|
||||
rock,
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 1.2
|
||||
..color = Palette.terrainRim.withValues(alpha: 0.45),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// tanks
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Tanks are authored in a local space (origin = ground contact, up = -y) and
|
||||
/// scaled up, so the silhouette still reads at the camera's ~0.7 zoom.
|
||||
const double kTankScale = 1.5;
|
||||
const double _barrelLength = 42;
|
||||
const double _turretPivotY = 32;
|
||||
|
||||
/// World position of the barrel pivot.
|
||||
Offset tankPivot(Offset pos) => Offset(pos.dx, pos.dy - _turretPivotY * kTankScale);
|
||||
|
||||
/// World position of the muzzle - shared by the tank painter and the aim hint.
|
||||
Offset tankMuzzle(Offset pos, double barrelDeg, double dir) {
|
||||
final rad = barrelDeg * math.pi / 180;
|
||||
return Offset(
|
||||
pos.dx + dir * math.cos(rad) * _barrelLength * kTankScale,
|
||||
pos.dy - (_turretPivotY + math.sin(rad) * _barrelLength) * kTankScale,
|
||||
);
|
||||
}
|
||||
|
||||
void paintTank(
|
||||
Canvas canvas, {
|
||||
required Offset pos,
|
||||
required double barrelDeg,
|
||||
required bool alive,
|
||||
required bool isPlayer0,
|
||||
required double hpFrac,
|
||||
required bool isCurrent,
|
||||
}) {
|
||||
final dir = isPlayer0 ? 1.0 : -1.0;
|
||||
final base = alive
|
||||
? (isPlayer0 ? Palette.solarBase : Palette.steelBase)
|
||||
: const Color(0xFF3A4450);
|
||||
final light = isPlayer0 ? Palette.solarLight : Palette.steelLight;
|
||||
final dark = isPlayer0 ? Palette.solarDeep : Palette.steelDeep;
|
||||
final a = alive ? 1.0 : 0.45;
|
||||
|
||||
// Contact shadow stays in world space so it hugs the ground line.
|
||||
canvas.drawOval(
|
||||
Rect.fromCenter(center: Offset(pos.dx, pos.dy + 3), width: 96, height: 18),
|
||||
Paint()..color = Colors.black.withValues(alpha: 0.45 * a),
|
||||
);
|
||||
|
||||
canvas.save();
|
||||
canvas.translate(pos.dx, pos.dy);
|
||||
canvas.scale(kTankScale);
|
||||
|
||||
// Tracks.
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(
|
||||
Rect.fromCenter(center: const Offset(0, -4), width: 66, height: 15),
|
||||
const Radius.circular(7),
|
||||
),
|
||||
Paint()..color = const Color(0xFF090E15).withValues(alpha: a),
|
||||
);
|
||||
for (var i = 0; i < 4; i++) {
|
||||
canvas.drawCircle(
|
||||
Offset(-21 + i * 14, -4),
|
||||
4.2,
|
||||
Paint()..color = const Color(0xFF2B3543).withValues(alpha: a),
|
||||
);
|
||||
}
|
||||
|
||||
// Hull.
|
||||
final hull = Path()
|
||||
..moveTo(-29, -10)
|
||||
..lineTo(29, -10)
|
||||
..lineTo(24, -22)
|
||||
..lineTo(15, -26)
|
||||
..lineTo(-15, -26)
|
||||
..lineTo(-24, -22)
|
||||
..close();
|
||||
canvas.drawPath(
|
||||
hull,
|
||||
Paint()
|
||||
..shader = ui.Gradient.linear(
|
||||
const Offset(0, -27),
|
||||
const Offset(0, -9),
|
||||
[light.withValues(alpha: a), base.withValues(alpha: a), dark.withValues(alpha: a)],
|
||||
const [0.0, 0.45, 1.0],
|
||||
),
|
||||
);
|
||||
|
||||
// Turret.
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(
|
||||
Rect.fromCenter(center: const Offset(0, -31), width: 34, height: 17),
|
||||
const Radius.circular(8),
|
||||
),
|
||||
Paint()
|
||||
..shader = ui.Gradient.linear(
|
||||
const Offset(0, -40),
|
||||
const Offset(0, -23),
|
||||
[light.withValues(alpha: a), base.withValues(alpha: a), dark.withValues(alpha: a)],
|
||||
const [0.0, 0.5, 1.0],
|
||||
),
|
||||
);
|
||||
|
||||
// Barrel: dark core, light top edge, muzzle brake.
|
||||
final rad = barrelDeg * math.pi / 180;
|
||||
const pivot = Offset(0, -_turretPivotY);
|
||||
final muzzle = Offset(
|
||||
dir * math.cos(rad) * _barrelLength,
|
||||
-_turretPivotY - math.sin(rad) * _barrelLength,
|
||||
);
|
||||
canvas.drawLine(
|
||||
pivot,
|
||||
muzzle,
|
||||
Paint()
|
||||
..color = const Color(0xFF141A24).withValues(alpha: a)
|
||||
..strokeWidth = 8
|
||||
..strokeCap = StrokeCap.round,
|
||||
);
|
||||
canvas.drawLine(
|
||||
pivot.translate(0, -2),
|
||||
muzzle.translate(0, -2),
|
||||
Paint()
|
||||
..color = light.withValues(alpha: 0.55 * a)
|
||||
..strokeWidth = 2.6
|
||||
..strokeCap = StrokeCap.round,
|
||||
);
|
||||
canvas.drawCircle(muzzle, 5.2, Paint()..color = const Color(0xFF0C1118).withValues(alpha: a));
|
||||
|
||||
// Rim light on the hull top edge - the rule that keeps silhouettes readable.
|
||||
canvas.drawLine(
|
||||
const Offset(-15, -26.4),
|
||||
const Offset(15, -26.4),
|
||||
Paint()
|
||||
..color = light.withValues(alpha: 0.8 * a)
|
||||
..strokeWidth = 1.8
|
||||
..strokeCap = StrokeCap.round,
|
||||
);
|
||||
canvas.restore();
|
||||
|
||||
if (isCurrent && alive) {
|
||||
canvas.drawCircle(
|
||||
Offset(pos.dx, pos.dy - 82),
|
||||
4.5,
|
||||
Paint()..color = Palette.solarLight.withValues(alpha: 0.9),
|
||||
);
|
||||
}
|
||||
|
||||
// Health bar, world space so it keeps a constant on-screen weight.
|
||||
const barW = 64.0;
|
||||
final barTop = pos.dy - 84;
|
||||
final bar = Rect.fromLTWH(pos.dx - barW / 2, barTop, barW, 6);
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(bar, const Radius.circular(3.5)),
|
||||
Paint()..color = Colors.black.withValues(alpha: 0.55),
|
||||
);
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(
|
||||
Rect.fromLTWH(bar.left, bar.top, barW * hpFrac.clamp(0.0, 1.0), 6),
|
||||
const Radius.circular(3.5),
|
||||
),
|
||||
Paint()
|
||||
..color = hpFrac > 0.5
|
||||
? base
|
||||
: hpFrac > 0.25
|
||||
? Palette.solarBase
|
||||
: Palette.stateDanger,
|
||||
);
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(bar, const Radius.circular(3.5)),
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 1
|
||||
..color = Colors.white.withValues(alpha: 0.25),
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// effects
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void paintProjectile(Canvas canvas, Offset p, List<Offset> trail) {
|
||||
for (var i = 0; i < trail.length; i++) {
|
||||
final t = i / trail.length;
|
||||
canvas.drawCircle(
|
||||
trail[i],
|
||||
3 + 5 * t,
|
||||
Paint()..color = Palette.solarBase.withValues(alpha: 0.06 + 0.18 * t),
|
||||
);
|
||||
}
|
||||
canvas.drawCircle(
|
||||
p,
|
||||
18,
|
||||
Paint()
|
||||
..color = Palette.solarBase.withValues(alpha: 0.35)
|
||||
..maskFilter = const MaskFilter.blur(BlurStyle.normal, 8),
|
||||
);
|
||||
canvas.drawCircle(p, 6.5, Paint()..color = Palette.solarLight);
|
||||
canvas.drawCircle(p + const Offset(-1.5, -1.5), 2.6, Paint()..color = Colors.white);
|
||||
}
|
||||
|
||||
/// `t` runs from 1 (impact) down to 0.
|
||||
void paintImpact(Canvas canvas, Offset p, double t) {
|
||||
final grow = 1 - t;
|
||||
final fireRadius = 26 + 54 * grow;
|
||||
canvas.drawCircle(
|
||||
p,
|
||||
fireRadius,
|
||||
Paint()
|
||||
..shader = ui.Gradient.radial(p, fireRadius, [
|
||||
Colors.white.withValues(alpha: 0.85 * t),
|
||||
Palette.solarBase.withValues(alpha: 0.55 * t),
|
||||
Palette.solarDeep.withValues(alpha: 0.0),
|
||||
]),
|
||||
);
|
||||
canvas.drawCircle(
|
||||
p,
|
||||
18 + 78 * grow,
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 3 * t
|
||||
..color = Palette.solarLight.withValues(alpha: 0.45 * t),
|
||||
);
|
||||
// Sparks: deterministic fan, gravity bends them down as they age.
|
||||
for (var i = 0; i < 9; i++) {
|
||||
final angle = (i / 9) * math.pi * 2 + 0.4;
|
||||
final speed = 60 + (i % 3) * 34;
|
||||
final r = speed * grow * 1.5;
|
||||
canvas.drawCircle(
|
||||
Offset(
|
||||
p.dx + math.cos(angle) * r,
|
||||
p.dy + math.sin(angle) * r * 0.7 + 90 * grow * grow,
|
||||
),
|
||||
3.2 * t,
|
||||
Paint()..color = Palette.solarLight.withValues(alpha: 0.8 * t),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void paintAim(
|
||||
Canvas canvas, {
|
||||
required Offset muzzle,
|
||||
required double angleDeg,
|
||||
required double dir,
|
||||
required double power,
|
||||
}) {
|
||||
final rad = angleDeg * math.pi / 180;
|
||||
for (var i = 1; i <= 7; i++) {
|
||||
final r = 52.0 + i * 30;
|
||||
// Approximate drop so the hint curves like the real shot.
|
||||
final p = Offset(
|
||||
muzzle.dx + dir * math.cos(rad) * r,
|
||||
muzzle.dy - math.sin(rad) * r + 1.28 * i * i,
|
||||
);
|
||||
canvas.drawCircle(
|
||||
p,
|
||||
2.2 + 2.4 * power,
|
||||
Paint()..color = Colors.white.withValues(alpha: ((0.55 - i * 0.05) * (0.6 + 0.4 * power)).clamp(0.0, 1.0)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Edge darkening without a full-screen radial gradient: four cheap bands.
|
||||
/// A single radial fill over 2048x1152 tripled the jank rate on the test device.
|
||||
void paintVignette(Canvas canvas, {required double left, required double right}) {
|
||||
final w = right - left;
|
||||
const h = kArtWorldHeight;
|
||||
const band = 300.0;
|
||||
const edge = Color(0x66000000);
|
||||
const clear = Color(0x00000000);
|
||||
|
||||
canvas.drawRect(
|
||||
Rect.fromLTWH(left, 0, w, band),
|
||||
Paint()
|
||||
..shader = ui.Gradient.linear(
|
||||
const Offset(0, 0), const Offset(0, band), [edge, clear]),
|
||||
);
|
||||
canvas.drawRect(
|
||||
Rect.fromLTWH(left, h - band, w, band),
|
||||
Paint()
|
||||
..shader = ui.Gradient.linear(
|
||||
const Offset(0, h - band), const Offset(0, h), [clear, edge]),
|
||||
);
|
||||
}
|
||||
|
||||
/// Charge bar under the active tank: the value the player is setting right now.
|
||||
void paintPowerBar(Canvas canvas, Offset tankPos, double power) {
|
||||
const w = 104.0;
|
||||
const h = 9.0;
|
||||
final rect = Rect.fromLTWH(tankPos.dx - w / 2, tankPos.dy + 12, w, h);
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(rect, const Radius.circular(4)),
|
||||
Paint()..color = Colors.black.withValues(alpha: 0.55),
|
||||
);
|
||||
final fill = power.clamp(0.0, 1.0);
|
||||
final color = fill < 0.5
|
||||
? Palette.solarBase
|
||||
: fill < 0.85
|
||||
? const Color(0xFFFF8A3D)
|
||||
: Palette.stateDanger;
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(
|
||||
Rect.fromLTWH(rect.left, rect.top, w * fill, h),
|
||||
const Radius.circular(4),
|
||||
),
|
||||
Paint()..color = color,
|
||||
);
|
||||
// Quarter marks make a value readable without text on the canvas.
|
||||
for (var i = 1; i < 4; i++) {
|
||||
final x = rect.left + w * i / 4;
|
||||
canvas.drawLine(
|
||||
Offset(x, rect.top + 1),
|
||||
Offset(x, rect.bottom - 1),
|
||||
Paint()
|
||||
..color = Colors.black.withValues(alpha: 0.35)
|
||||
..strokeWidth = 1,
|
||||
);
|
||||
}
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(rect, const Radius.circular(4)),
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 1
|
||||
..color = Colors.white.withValues(alpha: 0.28),
|
||||
);
|
||||
}
|
||||
|
||||
/// Rubber band from the barrel pivot to the finger while pulling back.
|
||||
void paintPullBand(Canvas canvas, Offset pivot, Offset finger, double power) {
|
||||
final band = Paint()
|
||||
..color = Palette.solarLight.withValues(alpha: 0.45)
|
||||
..strokeWidth = 3
|
||||
..strokeCap = StrokeCap.round;
|
||||
// Dashed, so it never competes with the trajectory hint.
|
||||
final total = (finger - pivot).distance;
|
||||
if (total < 4) return;
|
||||
final dir = (finger - pivot) / total;
|
||||
var travelled = 0.0;
|
||||
while (travelled < total) {
|
||||
final from = pivot + dir * travelled;
|
||||
final to = pivot + dir * math.min(travelled + 12, total);
|
||||
canvas.drawLine(from, to, band);
|
||||
travelled += 22;
|
||||
}
|
||||
canvas.drawCircle(
|
||||
finger,
|
||||
14 + 10 * power,
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 2
|
||||
..color = Palette.solarLight.withValues(alpha: 0.5),
|
||||
);
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
import 'dart:math' as math;
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:flame/game.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../native/match_source.dart';
|
||||
import 'art.dart';
|
||||
import '../native/native_match.dart';
|
||||
|
||||
/// World dimensions in simulation pixels (must match crates/sim).
|
||||
@@ -101,12 +101,31 @@ class IronArcGame extends FlameGame {
|
||||
double aimPower = 0.6;
|
||||
bool _dragging = false;
|
||||
|
||||
/// Pull back to charge. The distance is relative to the playfield, because a
|
||||
/// fixed value is wrong on every other screen: 260 *logical* pixels meant a
|
||||
/// swipe of 715 physical pixels on a 1080x2400 device - two thirds of the
|
||||
/// screen - so full power was unreachable without hitting the edge.
|
||||
double get _maxDragPx => math.max(80, math.min(size.x, size.y) * 0.30);
|
||||
|
||||
Offset? _dragStart;
|
||||
Offset? _dragCurrent;
|
||||
|
||||
/// True once the drag left the dead zone; a stray tap must not fire a shot.
|
||||
bool _dragged = false;
|
||||
|
||||
double _zoom = 1;
|
||||
double _camX = 0;
|
||||
double _camY = 0;
|
||||
bool _cameraReady = false;
|
||||
|
||||
int _terrainVersion = -1;
|
||||
Path? _terrainFill;
|
||||
Path? _terrainLine;
|
||||
List<int>? _heightmap;
|
||||
|
||||
final SkyArt _sky = SkyArt();
|
||||
final TerrainArt _terrainArt = TerrainArt();
|
||||
final List<Offset> _trail = [];
|
||||
|
||||
bool get isReady => isLoaded;
|
||||
|
||||
@@ -139,6 +158,15 @@ class IronArcGame extends FlameGame {
|
||||
} else if (_match.isAiming) {
|
||||
_accumulator = 0;
|
||||
}
|
||||
|
||||
// Projectile trail: keep the last positions for the comet effect.
|
||||
final shot = _match.projectile();
|
||||
if (shot != null) {
|
||||
_trail.add(Offset(shot.x.toDouble(), shot.y.toDouble()));
|
||||
if (_trail.length > 16) _trail.removeAt(0);
|
||||
} else if (!_match.isFlying && _trail.isNotEmpty) {
|
||||
_trail.clear();
|
||||
}
|
||||
if (_impactFlash > 0) {
|
||||
_impactFlash = math.max(0, _impactFlash - dt * 1.8);
|
||||
}
|
||||
@@ -182,20 +210,28 @@ class IronArcGame extends FlameGame {
|
||||
void beginAim(Offset screen) {
|
||||
if (!_match.isAiming) return;
|
||||
_dragging = true;
|
||||
_aimAt(screen);
|
||||
_dragged = false;
|
||||
_dragStart = screen;
|
||||
_dragCurrent = screen;
|
||||
}
|
||||
|
||||
/// Updates the aim while dragging.
|
||||
void updateAim(Offset screen) {
|
||||
if (!_dragging) return;
|
||||
_aimAt(screen);
|
||||
_dragCurrent = screen;
|
||||
_aimFromDrag();
|
||||
}
|
||||
|
||||
/// Fires if a drag produced a valid shot.
|
||||
void releaseAim() {
|
||||
if (!_dragging) return;
|
||||
_dragging = false;
|
||||
final fired = _dragged;
|
||||
_dragged = false;
|
||||
_dragStart = null;
|
||||
_dragCurrent = null;
|
||||
if (!_match.isAiming) return;
|
||||
if (!fired) return; // tap without a pull: keep the turn
|
||||
final angleMdeg = (aimAngle * 1000).round().clamp(1000, 89000);
|
||||
final powerQ16 = (aimPower * 65536).round().clamp(3277, 65536);
|
||||
final before = _match.stateHash();
|
||||
@@ -211,17 +247,22 @@ class IronArcGame extends FlameGame {
|
||||
_pushHud();
|
||||
}
|
||||
|
||||
void _aimAt(Offset screen) {
|
||||
final world = screenToWorld(screen);
|
||||
final player = _match.current;
|
||||
final tank = Offset(_match.tankX(player).toDouble(),
|
||||
_match.tankY(player).toDouble() - 14);
|
||||
final dx = world.dx - tank.dx;
|
||||
final dy = world.dy - tank.dy;
|
||||
final distance = math.sqrt(dx * dx + dy * dy);
|
||||
aimPower = (distance / 250).clamp(0.05, 1.0);
|
||||
final radians = math.atan2(-dy, dx.abs());
|
||||
/// Slingshot semantics: pull away from the target, the shot leaves in the
|
||||
/// opposite direction. The drag *length* sets the power; aiming at the finger
|
||||
/// tip instead changed direction and power at the same time, which made the
|
||||
/// power impossible to dose.
|
||||
void _aimFromDrag() {
|
||||
final start = _dragStart;
|
||||
final now = _dragCurrent;
|
||||
if (start == null || now == null) return;
|
||||
final pull = now - start;
|
||||
// Dead zone: a twitchy finger must not move the reticle.
|
||||
if (pull.distance < 6) return;
|
||||
_dragged = true;
|
||||
|
||||
final radians = math.atan2(pull.dy, pull.dx.abs());
|
||||
aimAngle = (radians * 180 / math.pi).clamp(1.0, 89.0);
|
||||
aimPower = (pull.distance / _maxDragPx).clamp(0.05, 1.0);
|
||||
_pushHud();
|
||||
}
|
||||
|
||||
@@ -232,28 +273,41 @@ class IronArcGame extends FlameGame {
|
||||
|
||||
void _updateCamera(double dt) {
|
||||
if (size.y <= 0 || size.x <= 0) return;
|
||||
// Fit height, but never crop the world horizontally more than necessary.
|
||||
final zoomForHeight = size.y / kWorldHeight;
|
||||
final zoomForWidth = size.x / kWorldWidth;
|
||||
_zoom = math.max(zoomForHeight, zoomForWidth);
|
||||
// The playfield must never be cropped vertically: a tank or a shot that
|
||||
// leaves the screen makes the game unplayable. So the world height always
|
||||
// fits. If the view is wider than the world (landscape), the world is
|
||||
// centred and the sides are letterboxed with sky.
|
||||
_zoom = size.y / kWorldHeight;
|
||||
_camY = 0;
|
||||
|
||||
final viewW = _viewWidthWorld;
|
||||
final focus = _match.isFlying
|
||||
? (_match.projectile()?.x.toDouble() ??
|
||||
_match.tankX(_match.current).toDouble())
|
||||
: _match.tankX(_match.current).toDouble();
|
||||
final desiredLeft = (focus - viewW / 2).clamp(0.0, math.max(0, kWorldWidth - viewW));
|
||||
// Smooth follow; instant on first frame.
|
||||
final t = _camX == 0 ? 1.0 : (dt * 5).clamp(0.0, 1.0);
|
||||
_camX += (desiredLeft - _camX) * t;
|
||||
_camX = _camX.clamp(0.0, math.max(0, kWorldWidth - viewW));
|
||||
|
||||
final bool worldFitsWidth = viewW >= kWorldWidth;
|
||||
final double desiredLeft = worldFitsWidth
|
||||
? (kWorldWidth - viewW) / 2
|
||||
: (focus - viewW / 2).clamp(0.0, kWorldWidth - viewW);
|
||||
|
||||
if (!_cameraReady) {
|
||||
_camX = desiredLeft;
|
||||
_cameraReady = true;
|
||||
} else {
|
||||
final t = (dt * 5).clamp(0.0, 1.0);
|
||||
_camX += (desiredLeft - _camX) * t;
|
||||
}
|
||||
if (!worldFitsWidth) {
|
||||
_camX = _camX.clamp(0.0, kWorldWidth - viewW);
|
||||
}
|
||||
}
|
||||
|
||||
/// Screen -> world pixels.
|
||||
Offset screenToWorld(Offset p) => Offset(p.dx / _zoom + _camX, p.dy / _zoom);
|
||||
Offset screenToWorld(Offset p) => Offset(p.dx / _zoom + _camX, p.dy / _zoom + _camY);
|
||||
|
||||
/// World -> screen pixels.
|
||||
Offset worldToScreen(Offset p) => Offset((p.dx - _camX) * _zoom, p.dy * _zoom);
|
||||
Offset worldToScreen(Offset p) => Offset((p.dx - _camX) * _zoom, (p.dy - _camY) * _zoom);
|
||||
|
||||
// ------------------------------------------------------------- rendering
|
||||
|
||||
@@ -263,7 +317,7 @@ class IronArcGame extends FlameGame {
|
||||
if (!isLoaded) return;
|
||||
canvas.save();
|
||||
canvas.scale(_zoom);
|
||||
canvas.translate(-_camX, 0);
|
||||
canvas.translate(-_camX, -_camY);
|
||||
|
||||
_drawSky(canvas);
|
||||
_drawTerrain(canvas);
|
||||
@@ -272,180 +326,99 @@ class IronArcGame extends FlameGame {
|
||||
_drawProjectile(canvas);
|
||||
if (_match.isAiming) _drawAim(canvas);
|
||||
_drawImpact(canvas);
|
||||
paintVignette(canvas, left: _camX, right: _camX + _viewWidthWorld);
|
||||
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
void _drawSky(Canvas canvas) {
|
||||
final rect = Rect.fromLTWH(0, 0, kWorldWidth, kWorldHeight);
|
||||
final paint = Paint()
|
||||
..shader = ui.Gradient.linear(
|
||||
const Offset(0, 0),
|
||||
const Offset(0, kWorldHeight),
|
||||
const [Color(0xFF0B1220), Color(0xFF243B53), Color(0xFF7A5C3E)],
|
||||
const [0.0, 0.55, 1.0],
|
||||
);
|
||||
canvas.drawRect(rect, paint);
|
||||
|
||||
// Distant hills for depth. They stay well above any playable ground so they
|
||||
// can never bleed through the destructible terrain.
|
||||
final hills = Path()
|
||||
..moveTo(0, 470)
|
||||
..quadraticBezierTo(300, 360, 620, 450)
|
||||
..quadraticBezierTo(1000, 540, 1340, 400)
|
||||
..quadraticBezierTo(1700, 300, kWorldWidth, 440)
|
||||
..lineTo(kWorldWidth, 560)
|
||||
..lineTo(0, 560)
|
||||
..close();
|
||||
canvas.drawPath(
|
||||
hills,
|
||||
Paint()
|
||||
..shader = ui.Gradient.linear(
|
||||
const Offset(0, 330),
|
||||
const Offset(0, 560),
|
||||
const [Color(0x2EFFFFFF), Color(0x00FFFFFF)],
|
||||
),
|
||||
);
|
||||
}
|
||||
void _drawSky(Canvas canvas) =>
|
||||
_sky.paint(canvas, camX: _camX, viewWidth: _viewWidthWorld);
|
||||
|
||||
void _drawTerrain(Canvas canvas) {
|
||||
final version = _match.terrainVersion;
|
||||
if (version != _terrainVersion || _terrainFill == null) {
|
||||
_terrainVersion = version;
|
||||
final heights = _match.terrain();
|
||||
final fill = Path()..moveTo(0, heights[0].toDouble());
|
||||
final line = Path()..moveTo(0, heights[0].toDouble());
|
||||
_heightmap = heights;
|
||||
// Flat continuation outside the world so landscape letterboxing still
|
||||
// shows ground instead of a hard edge.
|
||||
const ext = 700.0;
|
||||
final fill = Path()..moveTo(-ext, heights[0].toDouble());
|
||||
final line = Path()..moveTo(-ext, heights[0].toDouble());
|
||||
for (var i = 1; i < heights.length; i++) {
|
||||
final x = i * kSamplePx.toDouble();
|
||||
final y = heights[i].toDouble();
|
||||
fill.lineTo(x, y);
|
||||
line.lineTo(x, y);
|
||||
}
|
||||
line.lineTo(kWorldWidth + ext, heights[heights.length - 1].toDouble());
|
||||
fill
|
||||
..lineTo(kWorldWidth, kWorldHeight)
|
||||
..lineTo(0, kWorldHeight)
|
||||
..lineTo(kWorldWidth + ext, heights[heights.length - 1].toDouble())
|
||||
..lineTo(kWorldWidth + ext, kWorldHeight)
|
||||
..lineTo(-ext, kWorldHeight)
|
||||
..close();
|
||||
_terrainFill = fill;
|
||||
_terrainLine = line;
|
||||
}
|
||||
|
||||
canvas.drawPath(
|
||||
_terrainFill!,
|
||||
Paint()
|
||||
..shader = ui.Gradient.linear(
|
||||
const Offset(0, 400),
|
||||
const Offset(0, kWorldHeight),
|
||||
const [Color(0xFF6B4A2F), Color(0xFF2E1F16)],
|
||||
),
|
||||
);
|
||||
canvas.drawPath(
|
||||
_terrainLine!,
|
||||
Paint()
|
||||
..color = const Color(0xFF8FD694)
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 6
|
||||
..strokeJoin = StrokeJoin.round,
|
||||
);
|
||||
_terrainArt.paint(canvas, _terrainFill!, _terrainLine!,
|
||||
heights: _heightmap, version: _terrainVersion);
|
||||
}
|
||||
|
||||
void _drawTank(Canvas canvas, int player) {
|
||||
if (!isLoaded) return;
|
||||
final x = _match.tankX(player).toDouble();
|
||||
final y = _match.tankY(player).toDouble();
|
||||
final alive = _match.tankHp(player) > 0;
|
||||
final color = player == 0 ? const Color(0xFFFF8A3D) : const Color(0xFF4DD0E1);
|
||||
final body = Paint()..color = alive ? color : color.withValues(alpha: 0.3);
|
||||
|
||||
final hull = RRect.fromRectAndRadius(
|
||||
Rect.fromCenter(center: Offset(x, y - 9), width: 52, height: 18),
|
||||
const Radius.circular(5),
|
||||
);
|
||||
canvas.drawRRect(hull, body);
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(
|
||||
Rect.fromCenter(center: Offset(x, y - 9), width: 26, height: 12),
|
||||
const Radius.circular(4),
|
||||
),
|
||||
Paint()..color = const Color(0x22000000),
|
||||
);
|
||||
|
||||
final dir = player == 0 ? 1.0 : -1.0;
|
||||
final angle = player == _match.current ? aimAngle : 35.0;
|
||||
final radians = angle * math.pi / 180;
|
||||
final muzzle = Offset(
|
||||
x + dir * math.cos(radians) * 34,
|
||||
y - 16 - math.sin(radians) * 34,
|
||||
);
|
||||
canvas.drawLine(
|
||||
Offset(x, y - 15),
|
||||
muzzle,
|
||||
Paint()
|
||||
..color = Colors.white
|
||||
..strokeWidth = 6
|
||||
..strokeCap = StrokeCap.round,
|
||||
);
|
||||
|
||||
// Health bar.
|
||||
final hp = _match.tankHp(player).clamp(0, kTankMaxHp) / kTankMaxHp;
|
||||
final barRect = RRect.fromRectAndRadius(
|
||||
Rect.fromLTWH(x - 30, y - 46, 60, 8),
|
||||
const Radius.circular(4),
|
||||
);
|
||||
canvas.drawRRect(barRect, Paint()..color = const Color(0xAA000000));
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(
|
||||
Rect.fromLTWH(x - 30, y - 46, 60 * hp, 8),
|
||||
const Radius.circular(4),
|
||||
),
|
||||
Paint()..color = hp > 0.5
|
||||
? const Color(0xFF66BB6A)
|
||||
: hp > 0.25
|
||||
? const Color(0xFFFFC107)
|
||||
: const Color(0xFFE53935),
|
||||
paintTank(
|
||||
canvas,
|
||||
pos: Offset(x, y),
|
||||
barrelDeg: player == _match.current ? aimAngle : 35,
|
||||
alive: alive,
|
||||
isPlayer0: player == 0,
|
||||
hpFrac: _match.tankHp(player).clamp(0, kTankMaxHp) / kTankMaxHp,
|
||||
isCurrent: player == _match.current && !_match.isPlayback,
|
||||
);
|
||||
// Charge bar sits under the tank that is about to fire.
|
||||
if (player == _match.current && _match.isAiming) {
|
||||
paintPowerBar(canvas, Offset(x, y), aimPower);
|
||||
}
|
||||
}
|
||||
|
||||
void _drawProjectile(Canvas canvas) {
|
||||
final p = _match.projectile();
|
||||
if (p == null) return;
|
||||
final center = Offset(p.x.toDouble(), p.y.toDouble());
|
||||
canvas.drawCircle(center, 16, Paint()..color = const Color(0x33FFD54F));
|
||||
canvas.drawCircle(center, 7, Paint()..color = const Color(0xFFFFD54F));
|
||||
paintProjectile(canvas, Offset(p.x.toDouble(), p.y.toDouble()), _trail);
|
||||
}
|
||||
|
||||
void _drawAim(Canvas canvas) {
|
||||
final player = _match.current;
|
||||
final dir = player == 0 ? 1.0 : -1.0;
|
||||
final x = _match.tankX(player).toDouble();
|
||||
final y = _match.tankY(player).toDouble() - 16;
|
||||
final radians = aimAngle * math.pi / 180;
|
||||
final paint = Paint()
|
||||
..color = const Color(0xCCFFFFFF)
|
||||
..strokeWidth = 3
|
||||
..strokeCap = StrokeCap.round;
|
||||
for (var i = 1; i <= 6; i++) {
|
||||
final r = 40.0 + i * 26;
|
||||
final p = Offset(
|
||||
x + dir * math.cos(radians) * r,
|
||||
y - math.sin(radians) * r + 0.12 * i * i,
|
||||
);
|
||||
canvas.drawCircle(p, 4, paint);
|
||||
}
|
||||
canvas.drawRect(
|
||||
Rect.fromLTWH(x - 40, y - 70, 80 * aimPower, 6),
|
||||
Paint()..color = const Color(0xCCFFB74D),
|
||||
final y = _match.tankY(player).toDouble();
|
||||
// Same geometry the tank painter uses, so the hint starts at the muzzle.
|
||||
final muzzle = tankMuzzle(Offset(x, y), aimAngle, dir);
|
||||
paintAim(
|
||||
canvas,
|
||||
muzzle: muzzle,
|
||||
angleDeg: aimAngle,
|
||||
dir: dir,
|
||||
power: aimPower,
|
||||
);
|
||||
final finger = _dragCurrent;
|
||||
if (_dragging && finger != null) {
|
||||
paintPullBand(
|
||||
canvas,
|
||||
tankPivot(Offset(x, y)),
|
||||
screenToWorld(finger),
|
||||
aimPower,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _drawImpact(Canvas canvas) {
|
||||
final pos = _lastImpact;
|
||||
if (pos == null || _impactFlash <= 0) return;
|
||||
final alpha = (_impactFlash * 200).clamp(0, 200).toInt();
|
||||
canvas.drawCircle(
|
||||
pos,
|
||||
30 + 60 * (1 - _impactFlash),
|
||||
Paint()..color = Color.fromARGB(alpha, 0xFF, 0xB3, 0x00),
|
||||
);
|
||||
paintImpact(canvas, pos, _impactFlash.clamp(0.0, 1.0));
|
||||
}
|
||||
|
||||
/// Replay JSON of everything played so far.
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/// External links. Single source of truth: the settings sheet, the store
|
||||
/// listing and the compliance docs all quote these strings.
|
||||
///
|
||||
/// NOTE: this is the raw file from the public Gitea repo. Gitea serves it as
|
||||
/// `text/plain`, so a browser shows the HTML source instead of rendering it.
|
||||
/// It is reachable and contains the full policy, but a real page
|
||||
/// (e.g. https://softwareapp-hb.de/iron-arc/privacy) is strongly preferred for
|
||||
/// the store listing. Moving it means: upload store/privacy-policy.html as
|
||||
/// index.html to that path, change this one line, rebuild.
|
||||
///
|
||||
/// Because the policy now lives in the repository, the repository has to stay
|
||||
/// public - see docs/status/blocked.md.
|
||||
const String kPrivacyPolicyUrl =
|
||||
'https://gitea.softwareapp-hb.de/fishfacegit/iron-arc/raw/branch/main/store/privacy-policy.html';
|
||||
|
||||
/// Contact address used by the policy and by the in-app deletion request.
|
||||
const String kContactEmail = 'softwareapp.hb@gmail.com';
|
||||
|
||||
/// Pre-filled deletion request: the device id is the only identifier we store,
|
||||
/// so it has to travel with the mail. Play asks for a reachable deletion path.
|
||||
Uri deletionRequestUri(String deviceId) => Uri(
|
||||
scheme: 'mailto',
|
||||
path: kContactEmail,
|
||||
query: 'subject=${Uri.encodeComponent('Datenlöschung Iron Arc')}'
|
||||
'&body=${Uri.encodeComponent('Geräte-ID: $deviceId\n\nBitte löscht alle zu dieser ID gespeicherten Daten.')}',
|
||||
);
|
||||
@@ -0,0 +1,43 @@
|
||||
// GENERATED FILE - do not edit by hand.
|
||||
// Source: tools/art/palette.json, generator: tools/art/artgen.py
|
||||
// Re-run `python3 tools/art/artgen.py palette` after changing a token.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Design tokens shared by the app and the generated art.
|
||||
abstract final class Palette {
|
||||
|
||||
// ink
|
||||
static const ink0 = Color(0xFF05070A);
|
||||
static const ink1 = Color(0xFF0A1220);
|
||||
static const ink2 = Color(0xFF101B2E);
|
||||
static const ink3 = Color(0xFF1B2C44);
|
||||
|
||||
// solar
|
||||
static const solarLight = Color(0xFFFFD9A0);
|
||||
static const solarBase = Color(0xFFFFB347);
|
||||
static const solarDeep = Color(0xFFFF7A2F);
|
||||
|
||||
// steel
|
||||
static const steelLight = Color(0xFF9FE3F0);
|
||||
static const steelBase = Color(0xFF4EA8C8);
|
||||
static const steelDeep = Color(0xFF2C6F8A);
|
||||
|
||||
// terrain
|
||||
static const terrainRim = Color(0xFFE8C08A);
|
||||
static const terrainTop = Color(0xFF7A6A45);
|
||||
static const terrainSoil = Color(0xFF3A2F20);
|
||||
static const terrainDeep = Color(0xFF241C12);
|
||||
|
||||
// state
|
||||
static const stateDanger = Color(0xFFFF5A5F);
|
||||
static const stateOk = Color(0xFF6BD08A);
|
||||
|
||||
// text
|
||||
static const textHi = Color(0xFFF5F7FA);
|
||||
static const textMid = Color(0xFFA9B4C4);
|
||||
static const textLow = Color(0xFF6C7A8D);
|
||||
|
||||
// type
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'palette.dart';
|
||||
|
||||
/// Brand splash shown while the native match library, the session and the
|
||||
/// ad SDK boot. The logo pulses so a cold start reads as "loading" instead of
|
||||
/// a frozen screen - the native launch theme uses the same colour and image,
|
||||
/// so the handover from the Android window to Flutter is invisible.
|
||||
class SplashScreen extends StatefulWidget {
|
||||
const SplashScreen({super.key});
|
||||
|
||||
/// Canvas colour of the game; the Android launch theme uses the same value.
|
||||
static const background = Palette.ink0;
|
||||
static const accent = Palette.solarBase;
|
||||
|
||||
@override
|
||||
State<SplashScreen> createState() => _SplashScreenState();
|
||||
}
|
||||
|
||||
class _SplashScreenState extends State<SplashScreen>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late final AnimationController _pulse = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 1100),
|
||||
)..repeat(reverse: true);
|
||||
|
||||
late final Animation<double> _scale = Tween<double>(begin: 0.96, end: 1.04)
|
||||
.animate(CurvedAnimation(parent: _pulse, curve: Curves.easeInOut));
|
||||
late final Animation<double> _opacity = Tween<double>(begin: 0.72, end: 1.0)
|
||||
.animate(CurvedAnimation(parent: _pulse, curve: Curves.easeInOut));
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_pulse.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ColoredBox(
|
||||
color: SplashScreen.background,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
FadeTransition(
|
||||
opacity: _opacity,
|
||||
child: ScaleTransition(
|
||||
scale: _scale,
|
||||
child: Image.asset(
|
||||
'assets/logo_mark.png',
|
||||
width: 220,
|
||||
filterQuality: FilterQuality.medium,
|
||||
semanticLabel: 'Iron Arc',
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 28),
|
||||
// Thin indeterminate bar: tells the player the app is working,
|
||||
// not hung. Kept subtle so the logo stays the focus.
|
||||
SizedBox(
|
||||
width: 140,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
child: LinearProgressIndicator(
|
||||
minHeight: 2,
|
||||
color: SplashScreen.accent,
|
||||
backgroundColor: const Color(0xFF16202E),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -34,8 +34,18 @@ class Hud extends StatelessWidget {
|
||||
const SizedBox(width: 4),
|
||||
Text('${hud.wind > 0 ? '+' : ''}${hud.wind}',
|
||||
style: const TextStyle(fontSize: 13)),
|
||||
const SizedBox(width: 10),
|
||||
Icon(Icons.straighten,
|
||||
size: 14, color: const Color(0xFFA9B4C4)),
|
||||
const SizedBox(width: 3),
|
||||
Text('${hud.aimAngle.round()}°',
|
||||
style: const TextStyle(fontSize: 13)),
|
||||
],
|
||||
),
|
||||
// Power is the value players fight with - show it as a number
|
||||
// *and* as a bar, not only through the size of the aim dots.
|
||||
const SizedBox(height: 3),
|
||||
_PowerMeter(power: hud.aimPower),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -85,12 +95,16 @@ class StatusBar extends StatelessWidget {
|
||||
style: const TextStyle(fontSize: 11, color: Color(0xFFFFC107))),
|
||||
],
|
||||
const SizedBox(width: 4),
|
||||
InkWell(
|
||||
onTap: onSettings,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(4),
|
||||
child: Icon(Icons.tune, size: 16, color: Color(0xFF90A4AE)),
|
||||
Semantics(
|
||||
button: true,
|
||||
label: 'Einstellungen',
|
||||
child: InkWell(
|
||||
onTap: onSettings,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Icon(Icons.tune, size: 18, color: Color(0xFF90A4AE)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -107,6 +121,7 @@ class Controls extends StatelessWidget {
|
||||
required this.onReplay,
|
||||
required this.onFlush,
|
||||
required this.onAd,
|
||||
this.compact = false,
|
||||
});
|
||||
|
||||
final MatchSession session;
|
||||
@@ -115,30 +130,52 @@ class Controls extends StatelessWidget {
|
||||
final VoidCallback onFlush;
|
||||
final VoidCallback onAd;
|
||||
|
||||
/// Landscape: the play area is short, so the controls lose their padding.
|
||||
final bool compact;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
_Action(icon: Icons.wifi_tethering, label: 'Online', onTap: onOnline),
|
||||
_Action(icon: Icons.replay, label: 'Replay', onTap: onReplay),
|
||||
_Action(
|
||||
icon: Icons.wifi_tethering,
|
||||
label: 'Online',
|
||||
onTap: onOnline,
|
||||
compact: compact),
|
||||
_Action(
|
||||
icon: Icons.replay,
|
||||
label: 'Replay',
|
||||
onTap: onReplay,
|
||||
compact: compact),
|
||||
_Action(
|
||||
icon: Icons.cloud_upload,
|
||||
label: session.queued > 0 ? 'Senden (${session.queued})' : 'Senden',
|
||||
onTap: onFlush,
|
||||
compact: compact,
|
||||
),
|
||||
_Action(icon: Icons.ondemand_video, label: 'Ad', onTap: onAd),
|
||||
_Action(
|
||||
icon: Icons.ondemand_video,
|
||||
label: 'Ad',
|
||||
onTap: onAd,
|
||||
compact: compact),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _Action extends StatelessWidget {
|
||||
const _Action({required this.icon, required this.label, required this.onTap});
|
||||
const _Action({
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.onTap,
|
||||
this.compact = false,
|
||||
});
|
||||
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final VoidCallback onTap;
|
||||
final bool compact;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -149,13 +186,14 @@ class _Action extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: compact ? 10 : 14, vertical: compact ? 6 : 12),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(icon, size: 18),
|
||||
const SizedBox(width: 6),
|
||||
Text(label, style: const TextStyle(fontSize: 13)),
|
||||
Icon(icon, size: compact ? 16 : 18),
|
||||
SizedBox(width: compact ? 4 : 6),
|
||||
Text(label, style: TextStyle(fontSize: compact ? 12 : 13)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -164,6 +202,55 @@ class _Action extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// Slim power bar with a percentage label, shared by the HUD.
|
||||
class _PowerMeter extends StatelessWidget {
|
||||
const _PowerMeter({required this.power});
|
||||
|
||||
final double power;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final pct = (power.clamp(0.0, 1.0) * 100).round();
|
||||
final color = pct < 50
|
||||
? const Color(0xFFFFB347)
|
||||
: pct < 85
|
||||
? const Color(0xFFFF8A3D)
|
||||
: const Color(0xFFFF5A5F);
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.bolt, size: 14, color: Color(0xFFA9B4C4)),
|
||||
const SizedBox(width: 3),
|
||||
SizedBox(
|
||||
width: 74,
|
||||
height: 6,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
child: LinearProgressIndicator(
|
||||
value: power.clamp(0.0, 1.0),
|
||||
minHeight: 6,
|
||||
color: color,
|
||||
backgroundColor: const Color(0xFF1B2C44),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
SizedBox(
|
||||
width: 38,
|
||||
// „MAX" is worth a word: the bar alone made it hard to tell whether
|
||||
// full power had been reached.
|
||||
child: Text(pct >= 99 ? 'MAX' : '$pct %',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: pct >= 99 ? FontWeight.w700 : FontWeight.w400,
|
||||
color: pct >= 99 ? const Color(0xFFFF5A5F) : null,
|
||||
)),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _Pill extends StatelessWidget {
|
||||
const _Pill({
|
||||
required this.label,
|
||||
@@ -212,7 +299,7 @@ class HintBubble extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final text = hud.phase == 1
|
||||
? 'Projektil im Flug…'
|
||||
: 'Ziehen zum Zielen · Loslassen zum Schießen';
|
||||
: 'Zurückziehen zum Spannen · Loslassen zum Schießen';
|
||||
return Center(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
|
||||
|
||||
@@ -136,6 +136,38 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.2"
|
||||
in_app_purchase:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: in_app_purchase
|
||||
sha256: d8317ec2ed6fe33199957d67ee67e08a4fd4871ef93b91d7611d8ee560892afc
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.3.1"
|
||||
in_app_purchase_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: in_app_purchase_android
|
||||
sha256: b76ab601573f8a848e72d015496257235066ba3479bef6300482239f417e0d72
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.5"
|
||||
in_app_purchase_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: in_app_purchase_platform_interface
|
||||
sha256: "0b0076cac8ce4fa7048f01e76af8b123aeb6a7c4e0dea2a5206d6664454f3e36"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.1"
|
||||
in_app_purchase_storekit:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: in_app_purchase_storekit
|
||||
sha256: de4f86b7bed848cd60a32c93affad868ba06a5276c007e23878855558094ff43
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.4.15"
|
||||
jni:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -152,6 +184,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
json_annotation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: json_annotation
|
||||
sha256: "2a743920d81b7910627f68ee2c9ac1fc0bfee32b9fc3403587d7c6791ca12f80"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.12.0"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -389,6 +429,70 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: url_launcher
|
||||
sha256: e8cc955c97e06df9879140a1fe301f3d493f01b7c62dec7f46834be31d7e9fda
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.3"
|
||||
url_launcher_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
sha256: "611e87fb320b70d1dd721dc46af89c98aceccea9b31fde49e084591414e0c610"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.33"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_ios
|
||||
sha256: "8faa1aab294f1ab4040b43660c887b0418d5fa4f0cffef76a484e6aa1092eb4a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.4.2"
|
||||
url_launcher_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_linux
|
||||
sha256: "10f86fef4c2c43563fa6c211ff9cf757adf4d3ab762c56bd430664a947d70cd0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.3"
|
||||
url_launcher_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_macos
|
||||
sha256: "5e835a3b869c2d70325349c81c5a45c28e20791265b67b2669da6b08c5cd5201"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.6"
|
||||
url_launcher_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_platform_interface
|
||||
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
url_launcher_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_web
|
||||
sha256: "85c81589622fbc87c1c683aaea164d3604a7777495a79d91e39ffcdec39ddb34"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.3"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_windows
|
||||
sha256: "6c5ad3f22cd4c38e089b81963b3cd7bb83b111b2df5dce008bb066162f42e429"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.6"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 0.7.0+7
|
||||
version: 0.9.2+15
|
||||
|
||||
environment:
|
||||
sdk: ^3.13.4
|
||||
@@ -39,6 +39,8 @@ dependencies:
|
||||
http: ^1.6.0
|
||||
shared_preferences: ^2.5.6
|
||||
google_mobile_ads: ^9.2.0
|
||||
url_launcher: ^6.3.0
|
||||
in_app_purchase: ^3.2.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
@@ -62,10 +64,10 @@ flutter:
|
||||
# the material Icons class.
|
||||
uses-material-design: true
|
||||
|
||||
# To add assets to your application, add an assets section, like this:
|
||||
# assets:
|
||||
# - images/a_dot_burr.jpeg
|
||||
# - images/a_dot_ham.jpeg
|
||||
# Brand mark used by the in-app splash (the Android launch theme ships the
|
||||
# same image as res/drawable-xxxhdpi/launch_logo.png).
|
||||
assets:
|
||||
- assets/logo_mark.png
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/to/resolution-aware-images
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:iron_arc/src/billing/billing_service.dart';
|
||||
import 'package:iron_arc/src/billing/entitlements.dart';
|
||||
import 'package:iron_arc/src/billing/models.dart';
|
||||
import 'package:iron_arc/src/billing/store_client.dart';
|
||||
import 'package:iron_arc/src/ui/links.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
/// Stand-in for Google Play: the module is testable before the Console has any
|
||||
/// products, which is the only way to verify the grant/complete logic here.
|
||||
class FakeStore implements StoreClient {
|
||||
FakeStore({
|
||||
this.available = true,
|
||||
List<StoreProduct>? products,
|
||||
this.purchaseStarts = true,
|
||||
this.throwOnQuery = false,
|
||||
}) : products = products ?? _defaultProducts;
|
||||
|
||||
static const List<StoreProduct> _defaultProducts = [
|
||||
StoreProduct(
|
||||
id: ProductIds.removeAds, title: 'Werbung entfernen', price: '4,99 €'),
|
||||
];
|
||||
|
||||
final bool available;
|
||||
final bool purchaseStarts;
|
||||
final bool throwOnQuery;
|
||||
final List<StoreProduct> products;
|
||||
|
||||
final StreamController<PurchaseEvent> _events =
|
||||
StreamController<PurchaseEvent>.broadcast();
|
||||
|
||||
int completedCalls = 0;
|
||||
int restoreCalls = 0;
|
||||
int buyCalls = 0;
|
||||
bool disposed = false;
|
||||
|
||||
@override
|
||||
Stream<PurchaseEvent> get events => _events.stream;
|
||||
|
||||
void emit(PurchaseEvent event) => _events.add(event);
|
||||
|
||||
@override
|
||||
Future<bool> isAvailable() async => available;
|
||||
|
||||
@override
|
||||
Future<List<StoreProduct>> queryProducts(Set<String> ids) async {
|
||||
if (throwOnQuery) throw StateError('store down');
|
||||
return products.where((p) => ids.contains(p.id)).toList();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> buy(StoreProduct product) async {
|
||||
buyCalls++;
|
||||
return purchaseStarts;
|
||||
}
|
||||
|
||||
/// Mirrors Play: acknowledging is only required (and only counted) when the
|
||||
/// platform flags `pendingCompletePurchase`.
|
||||
@override
|
||||
Future<void> complete(PurchaseEvent event) async {
|
||||
if (event.complete) completedCalls++;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> restore() async => restoreCalls++;
|
||||
|
||||
@override
|
||||
Future<void> dispose() async {
|
||||
disposed = true;
|
||||
await _events.close();
|
||||
}
|
||||
}
|
||||
|
||||
Future<BillingService> _service(FakeStore store) async {
|
||||
final entitlements = await Entitlements.load();
|
||||
final billing = BillingService(entitlements: entitlements, client: store);
|
||||
await billing.init();
|
||||
return billing;
|
||||
}
|
||||
|
||||
void main() {
|
||||
setUp(() => SharedPreferences.setMockInitialValues(<String, Object>{}));
|
||||
|
||||
test('query on start exposes the catalogue and restores silently', () async {
|
||||
final store = FakeStore();
|
||||
final billing = await _service(store);
|
||||
|
||||
expect(billing.available, isTrue);
|
||||
expect(billing.canPurchase, isTrue);
|
||||
expect(billing.product(ProductIds.removeAds)?.price, '4,99 €');
|
||||
// Restoring on start is the documented rule (monetization.md §3).
|
||||
expect(store.restoreCalls, 1);
|
||||
|
||||
billing.dispose();
|
||||
await store.dispose();
|
||||
});
|
||||
|
||||
test('purchase grants the entitlement and is completed', () async {
|
||||
final store = FakeStore();
|
||||
final billing = await _service(store);
|
||||
|
||||
expect(await billing.buy(ProductIds.removeAds), isTrue);
|
||||
expect(billing.adsRemoved, isFalse,
|
||||
reason: 'nothing is granted before the store answers');
|
||||
|
||||
store.emit(const PurchaseEvent(
|
||||
productId: ProductIds.removeAds,
|
||||
state: PurchaseState.purchased,
|
||||
complete: true,
|
||||
));
|
||||
await pumpEventQueue();
|
||||
|
||||
expect(billing.entitlements.adsRemoved, isTrue);
|
||||
expect(store.completedCalls, 1,
|
||||
reason: 'Play refunds purchases that are not acknowledged');
|
||||
|
||||
billing.dispose();
|
||||
await store.dispose();
|
||||
});
|
||||
|
||||
test('pending purchases are reported but never granted', () async {
|
||||
final store = FakeStore();
|
||||
final billing = await _service(store);
|
||||
|
||||
store.emit(const PurchaseEvent(
|
||||
productId: ProductIds.removeAds,
|
||||
state: PurchaseState.pending,
|
||||
complete: true,
|
||||
));
|
||||
await pumpEventQueue();
|
||||
|
||||
expect(billing.entitlements.adsRemoved, isFalse);
|
||||
expect(store.completedCalls, 0);
|
||||
expect(billing.error, contains('pending'));
|
||||
|
||||
billing.dispose();
|
||||
await store.dispose();
|
||||
});
|
||||
|
||||
test('cancel and error leave the entitlement untouched', () async {
|
||||
final store = FakeStore();
|
||||
final billing = await _service(store);
|
||||
|
||||
store.emit(const PurchaseEvent(
|
||||
productId: ProductIds.removeAds, state: PurchaseState.canceled));
|
||||
await pumpEventQueue();
|
||||
expect(billing.entitlements.adsRemoved, isFalse);
|
||||
expect(billing.error, isNull);
|
||||
|
||||
store.emit(const PurchaseEvent(
|
||||
productId: ProductIds.removeAds,
|
||||
state: PurchaseState.error,
|
||||
error: 'ITEM_ALREADY_OWNED'));
|
||||
await pumpEventQueue();
|
||||
expect(billing.entitlements.adsRemoved, isFalse);
|
||||
expect(billing.error, 'ITEM_ALREADY_OWNED');
|
||||
|
||||
billing.dispose();
|
||||
await store.dispose();
|
||||
});
|
||||
|
||||
test('restored purchases grant too (reinstall path)', () async {
|
||||
final store = FakeStore();
|
||||
final billing = await _service(store);
|
||||
|
||||
store.emit(const PurchaseEvent(
|
||||
productId: ProductIds.removeAds,
|
||||
state: PurchaseState.restored,
|
||||
complete: false,
|
||||
));
|
||||
await pumpEventQueue();
|
||||
|
||||
expect(billing.adsRemoved, isTrue);
|
||||
expect(store.completedCalls, 0, reason: 'restores need no acknowledgement');
|
||||
|
||||
billing.dispose();
|
||||
await store.dispose();
|
||||
});
|
||||
|
||||
test('entitlement survives a restart', () async {
|
||||
final first = await _service(FakeStore());
|
||||
await first.entitlements.grant(ProductIds.removeAds);
|
||||
expect(first.entitlements.adsRemoved, isTrue);
|
||||
first.dispose();
|
||||
|
||||
final second = await Entitlements.load();
|
||||
expect(second.adsRemoved, isTrue, reason: 'written through to disk');
|
||||
|
||||
await second.clearAll();
|
||||
expect(second.adsRemoved, isFalse);
|
||||
});
|
||||
|
||||
test('missing store: no crash, clear error, purchase disabled', () async {
|
||||
final store = FakeStore(available: false);
|
||||
final billing = await _service(store);
|
||||
|
||||
expect(billing.available, isFalse);
|
||||
expect(billing.canPurchase, isFalse);
|
||||
expect(await billing.buy(ProductIds.removeAds), isFalse);
|
||||
expect(billing.error, isNotNull);
|
||||
|
||||
billing.dispose();
|
||||
await store.dispose();
|
||||
});
|
||||
|
||||
test('store that throws while querying is handled', () async {
|
||||
final store = FakeStore(throwOnQuery: true);
|
||||
final billing = await _service(store);
|
||||
|
||||
expect(billing.canPurchase, isFalse);
|
||||
expect(billing.error, 'Produkte konnten nicht geladen werden');
|
||||
|
||||
billing.dispose();
|
||||
await store.dispose();
|
||||
});
|
||||
|
||||
test('deletion request carries the device id and the contact address', () {
|
||||
final uri = deletionRequestUri('dev-abc123');
|
||||
|
||||
expect(uri.scheme, 'mailto');
|
||||
expect(uri.path, kContactEmail);
|
||||
expect(Uri.decodeComponent(uri.query), contains('dev-abc123'));
|
||||
expect(Uri.decodeComponent(uri.query), contains('Datenlöschung'));
|
||||
});
|
||||
}
|
||||
@@ -7,8 +7,9 @@ import 'fake_match.dart';
|
||||
|
||||
/// Golden tests render the game headlessly (no device, no native library).
|
||||
/// Update with: flutter test --update-goldens
|
||||
Future<void> pumpGame(WidgetTester tester, IronArcGame game) async {
|
||||
await tester.binding.setSurfaceSize(const Size(420, 840));
|
||||
Future<void> pumpGame(WidgetTester tester, IronArcGame game,
|
||||
{Size surface = const Size(420, 840)}) async {
|
||||
await tester.binding.setSurfaceSize(surface);
|
||||
addTearDown(() => tester.binding.setSurfaceSize(null));
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
@@ -46,4 +47,17 @@ void main() {
|
||||
matchesGoldenFile('goldens/after_impact.png'),
|
||||
);
|
||||
});
|
||||
|
||||
// Landscape used to zoom to the view *width*, which cropped the world top and
|
||||
// bottom without any vertical panning - both tanks were off-screen and the
|
||||
// match was unplayable. The camera now always fits the world height, so this
|
||||
// golden is the regression guard for that bug.
|
||||
testWidgets('landscape shows the whole playfield', (tester) async {
|
||||
final game = IronArcGame(matchFactory: FakeMatch.aiming);
|
||||
await pumpGame(tester, game, surface: const Size(840, 420));
|
||||
await expectLater(
|
||||
find.byType(MaterialApp),
|
||||
matchesGoldenFile('goldens/landscape.png'),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 345 KiB |
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 315 KiB |
|
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 323 KiB |
|
After Width: | Height: | Size: 247 KiB |
|
After Width: | Height: | Size: 242 KiB |
@@ -0,0 +1,110 @@
|
||||
# Art Direction
|
||||
|
||||
Wie die Grafiken von IRON ARC entstehen: **SVG-Master → Raster**, alles aus einer
|
||||
Palette-Datei generiert. Kein Pixelgeschubse, keine Binärdateien ohne Quelle.
|
||||
|
||||
```
|
||||
tools/art/palette.json Design-Tokens (Farben, Type)
|
||||
tools/art/artlib.py Primitiven: Gradienten, Grain, Vignette, Catmull-Rom-Kurven, Ballistik, Panzer
|
||||
tools/art/gen_brand.py Icon (Legacy + Adaptive + Monochrom), Splash-Lockup, Feature-Graphic
|
||||
tools/art/artgen.py CLI: brand | palette | preview | all
|
||||
```
|
||||
|
||||
```bash
|
||||
python3 tools/art/artgen.py all # Assets + app/lib/src/ui/palette.dart neu bauen
|
||||
```
|
||||
|
||||
Voraussetzungen: `rsvg-convert` (librsvg ≥ 2.5), Roboto (Black/Bold/Medium). Prüfen mit
|
||||
`rsvg-convert --version` und `fc-match 'Roboto:weight=black'`.
|
||||
|
||||
## Prinzipien
|
||||
|
||||
Die Regeln sind der Grund, warum die Bilder nicht nach Platzhalter aussehen:
|
||||
|
||||
1. **Licht kommt vom Horizont.** Eine Sonne tief über dem Grat liefert Glow, Rim-Lights und
|
||||
Farbverläufe. Nie von oben links, nie zwei Lichtquellen.
|
||||
2. **Jede Silhouette bekommt eine warme Kante.** Ein 2-px-Rim in `solar.light` trennt Berg und
|
||||
Panzer vom Himmel – ohne ihn wirken Flächen wie Aufkleber.
|
||||
3. **Eine Akzentfarbe.** Amber (`solar.*`) ist der Spieler, Stahlblau (`steel.*`) der Gegner.
|
||||
Alles andere bleibt Ink/Text.
|
||||
4. **Grain + Vignette über das ganze Bild.** 5 % Rauschen und eine weiche Vignette (0,36–0,42)
|
||||
nehmen dem Vektor-Look die Kälte. Immer als letzte Ebene, nie pro Form.
|
||||
5. **Bewegung statt Symmetrie.** Der Schuss ist asymmetrisch und verlässt das Bild nach oben
|
||||
rechts. Ein vollständiger Parabelbogen liest sich als Kuppel oder Regenbogen.
|
||||
6. **Typografie:** Roboto Black, Tracking −0,02 em für Wortmarken; Unterzeilen in
|
||||
Versalien mit weitem Tracking (4–8). Genau **ein** farbiges Wort (`ARC`).
|
||||
|
||||
## Palette
|
||||
|
||||
| Gruppe | Tokens | Verwendung |
|
||||
|---|---|---|
|
||||
| `ink.0…3` | `#05070A` … `#1B2C44` | Canvas, Panels, Rahmen |
|
||||
| `solar.*` | `#FFD9A0`, `#FFB347`, `#FF7A2F` | Spieler, Sonne, Akzent, CTA |
|
||||
| `steel.*` | `#9FE3F0`, `#4EA8C8`, `#2C6F8A` | Gegner, Sekundärinformation |
|
||||
| `terrain.*` | `#E8C08A`, `#7A6A45`, `#3A2F20`, `#241C12` | Boden, Rim-Light, Straten |
|
||||
| `text.*` | `#F5F7FA`, `#A9B4C4`, `#6C7A8D` | Hierarchie |
|
||||
|
||||
`tools/art/artgen.py palette` schreibt daraus `app/lib/src/ui/palette.dart` – App und Assets
|
||||
können damit nicht auseinanderlaufen.
|
||||
|
||||
## Assets und ihre Quellen
|
||||
|
||||
| Datei | Quelle | Größe |
|
||||
|---|---|---|
|
||||
| `store/assets/icon_512.png` | `icon_svg()` | 512 × 512, randlos |
|
||||
| `store/assets/feature_1024x500.png` | `feature_svg()` | 1024 × 500 |
|
||||
| `store/assets/logo_mark.png`, `app/assets/logo_mark.png` | `lockup_svg()` | 640 × 780, transparent |
|
||||
| `res/drawable-xxxhdpi/launch_logo.png` | `lockup_svg()` | 512 breit (Pre-12-Launch) |
|
||||
| `res/drawable-xxxhdpi/launch_logo_splash.png` | `splash_icon_svg()` | 512, Motiv in 60 % (API 31+) |
|
||||
| `res/mipmap-*/ic_launcher.png` | `icon_svg()` | 48/72/96/144/192 |
|
||||
| `res/mipmap-*/ic_launcher_{background,foreground,monochrome}.png` | `background_svg()`, `foreground_svg()`, `monochrome_svg()` | 108 dp × Dichte |
|
||||
| `res/mipmap-anydpi-v26/ic_launcher{,_round}.xml` | `ADAPTIVE_XML` | Adaptive-Icon-Verknüpfung |
|
||||
|
||||
## Regeln für Adaptive Icons (Android 8+)
|
||||
|
||||
- Der Foreground wird in einem 108-dp-Canvas geliefert; sichtbar sind nur die inneren 72 dp.
|
||||
`foreground_svg()` skaliert das Motiv deshalb auf 58 % und hebt es leicht an, damit der
|
||||
Boden nicht in die Maske läuft.
|
||||
- **Monochrom** (Android 13 Themed Icons) ist ein eigenes Motiv: Sonne, Teilschuss, Horizontlinie.
|
||||
Keine Details, die bei 108 dp zu Matsch werden.
|
||||
- Das Android-12-Splash-Icon wird vom System auf die inneren 192 von 288 dp maskiert; deshalb
|
||||
ist `splash_icon_svg()` ein Kreis-Badge bei 60 % der Fläche.
|
||||
|
||||
## Was bei 48 dp noch lesbar sein muss
|
||||
|
||||
Der Test für jedes Icon: auf 48 × 48 px verkleinern und ansehen. Bestehen nur drei Dinge –
|
||||
**Sonne**, **Diagonale**, **Bodenkante** – ist das Icon gut. Alles andere (Panzerdetails,
|
||||
Sternen, Trail-Punkte) ist Zugabe für große Darstellungen.
|
||||
|
||||
## Ingame-Grafik (Phase 2, umgesetzt)
|
||||
|
||||
`app/lib/src/game/art.dart` zeichnet die Szene mit Canvas-Primitiven - bewusst keine Bitmaps,
|
||||
weil die Landschaft zerstörbar ist und die Kamera zoomt.
|
||||
|
||||
| Baustein | Umsetzung |
|
||||
|---|---|
|
||||
| Himmel | Verlauf Ink → warme Horizontlinie, Sterne, Sonne **kamerarelativ** platziert (jede Kameraposition hat eine Lichtquelle) |
|
||||
| Bergrücken | drei Silhouetten mit Parallaxe 0.12/0.24/0.38, atmosphärische Perspektive (fern = heller), Rim-Light |
|
||||
| Boden | Verlauf oben warm → unten fast schwarz, Schattenlippe, warme Oberkante + dünnes Highlight, Felsbrocken mit unregelmäßigem Abstand |
|
||||
| Panzer | Hull, Turret, Rohr mit Mündungsbremse, Ketten mit Rollen, Rim-Light, HP-Balken in Teamfarbe |
|
||||
| Effekte | Kometenschweif am Geschoss, Explosion mit Feuerball/Ring/Funken, Zielhilfe mit Punkten |
|
||||
|
||||
**Performance ist Teil der Gestaltung.** Erste Fassung: 31–40 % Jank. Ursachen und Lösung:
|
||||
|
||||
| Ursache | Lösung |
|
||||
|---|---|
|
||||
| Radial-Verlauf über die ganze Welt (Vignette) | vier bzw. zwei Rand-Bänder statt Vollbild |
|
||||
| Gradient-Shader pro Bergrücken und pro Frame | flache Füllungen, Paints/Shader einmal gebaut |
|
||||
| zwei geclippte Gradient-Rects unter der Oberfläche | entfernt, Basisverlauf reicht |
|
||||
| Boden jeden Frame neu gezeichnet | einmal pro Terrain-Version in ein `ui.Picture` |
|
||||
| `MaskFilter.blur` auf großen Pfaden | durch gestaffelte Striche ersetzt |
|
||||
|
||||
Ergebnis auf dem Redmi Note 10: **60,0 fps, 0,0–0,8 % Jank** (Baseline vorher: 0–6,5 %).
|
||||
Messung: `tools/device/perf.sh`.
|
||||
|
||||
## Offene Punkte
|
||||
|
||||
1. Store-Screenshots bei jeder sichtbaren Änderung neu aufnehmen (liegen in `store/screenshots/`).
|
||||
2. Tablet-Screenshots und 30-s-Video fehlen weiterhin.
|
||||
3. Die Golden-Tests werden per `flutter test --update-goldens` neu erzeugt und **angesehen** -
|
||||
sie sind der Regressionsschutz für die Optik.
|
||||
@@ -43,9 +43,9 @@ Legende: `[ ]` offen · `[x]` erledigt · `[~]` teilweise/geplant mit Owner
|
||||
| `[x]` | Enthält Werbung | **Ja** – AdMob SDK im Release-APK, App ID verifiziert |
|
||||
| `[ ]` | Zielgruppe | **13+**, **nicht** am Families-Programm teilnehmen |
|
||||
| `[ ]` | Altersfreigabe (IARC) | Erwartung: USK 12 / PEGI 12 (kompetitive Gewalt, keine realistischen Darstellungen, keine Sprache) |
|
||||
| `[~]` | Datenschutzerklärung | Text fertig: [privacy-policy.md](privacy-policy.md) + `store/privacy-policy.html`. **URL fehlt noch** (auf softwareapp-hb.de hosten, dann in der Console eintragen). Deckt: Geräte-ID, Match-/Replay-Daten, AdMob (Werbe-ID, IP, Geräteinfos), ungefährer Standort aus IP. **Keine** Analytics-, Crash- oder Firebase-SDKs im Build |
|
||||
| `[x]` | Datenschutzerklärung | URL gesetzt: `store/privacy-policy.html` im öffentlichen Gitea-Repo (Rohdatei, HTTP 200, `text/plain` – funktioniert, aber unschön; besserer Host in [status/blocked.md](status/blocked.md) §3b). In-App-Einstieg implementiert und auf Gerät verifiziert (Zahnrad → „Datenschutzerklärung“, `url_launcher`), Release-Guard gegen Platzhalter. Deckt: Geräte-ID, Match-/Replay-Daten, AdMob (Werbe-ID, IP, Geräteinformationen), ungefährer Standort aus IP. **Keine** Analytics-, Crash- oder Firebase-SDKs im Build |
|
||||
| `[~]` | Data-Safety-Formular | Angaben aus [privacy-policy.md](privacy-policy.md) übernehmen: Geräte-IDs (App-Funktion), ungefährer Standort aus IP + Werbe-ID (durch AdMob, Weitergabe an Google), **keine** Crash-Logs, **keine** Käufe (bis M7c) |
|
||||
| `[ ]` | Account-Löschung | In-App **und** Web-URL, da Accounts existieren (Firebase/Leaderboard) |
|
||||
| `[x]` | Account-Löschung | **Keine Accounts** in der App (Geräte-ID genügt). Datenlöschung: Einstellungen → „Datenlöschung anfragen“ (vorausgefüllte E-Mail, auf Gerät verifiziert) plus „Lokale Daten löschen“ (Warteschlange, Replays, Geräte-ID). Damit ist die Play-Anforderung erfüllt |
|
||||
| `[ ]` | Nachrichten-App? | Nein |
|
||||
| `[ ]` | News-App? | Nein |
|
||||
|
||||
@@ -53,8 +53,9 @@ Legende: `[ ]` offen · `[x]` erledigt · `[~]` teilweise/geplant mit Owner
|
||||
|
||||
| Status | Anforderung | Umsetzung |
|
||||
|---|---|---|
|
||||
| `[ ]` | **UMP-Consent** (EEA/UK/CH) | `google_mobile_ads` Consent-API, TCF v2.2, vor **jeder** Ad-Anfrage |
|
||||
| `[ ]` | Einstieg „Datenschutz-Optionen" | dauerhaft in Settings (Consent erneut ändern) |
|
||||
| `[x]` | **UMP-Consent** (EEA/UK/CH) | Umgesetzt und auf Gerät verifiziert: Formular vor der ersten Ad-Anfrage, `consent=obtained`, Ads erst danach |
|
||||
| `[x]` | Datenlöschung | Einstellungen → „Datenlöschung anfragen" öffnet eine vorausgefüllte E-Mail (Empfänger, Betreff, Geräte-ID) – auf Gerät verifiziert |
|
||||
| `[x]` | Einstieg „Datenschutz-Optionen" | Zahnrad → Datenschutz-Optionen öffnet das UMP-Formular erneut (verifiziert) |
|
||||
| `[ ]` | Keine personalisierte Werbung an Minderjährige | Zielgruppe 13+; kein Kindern-Tracking, keine Interest-Based Ads bei „unter 13" |
|
||||
| `[ ]` | Werbe-Frequenz-Caps | Remote Config, Interstitial max. 1:2, nie in ersten 3 Matches |
|
||||
| `[ ]` | Keine irreführenden Ad-Formate | Keine Ads, die wie Spiel-UI aussehen; klare „Anzeige"-Kennzeichnung |
|
||||
@@ -64,8 +65,8 @@ Legende: `[ ]` offen · `[x]` erledigt · `[~]` teilweise/geplant mit Owner
|
||||
|
||||
| Status | Anforderung | Umsetzung |
|
||||
|---|---|---|
|
||||
| `[ ]` | Nur **Play Billing** für digitale Güter | Keine externen Payment-Links, kein Stripe/PayPal im Spiel |
|
||||
| `[ ]` | „Käufe wiederherstellen" | `queryPurchases` beim Start + Button in Settings |
|
||||
| `[x]` | Nur **Play Billing** für digitale Güter | `in_app_purchase` (Play Billing Library), keine externen Payment-Links. `com.android.vending.BILLING` im gemergten Manifest geprüft |
|
||||
| `[x]` | „Käufe wiederherstellen" | `restorePurchases` beim Start + „Käufe wiederherstellen“ im Einstellungen-Sheet |
|
||||
| `[ ]` | Pending Transactions | Korrekt behandeln (z. B. Barzahlung), keine Doppel-Gutschrift |
|
||||
| `[ ]` | Preise & MwSt. | Über Play Console gepflegt, nicht hartkodiert |
|
||||
| `[ ]` | Keine Lootboxen mit Zufall | Kosmetik direkt kaufbar; keine Odds-Disclosure nötig |
|
||||
@@ -111,9 +112,11 @@ Ein Release ist **nicht** erlaubt, wenn einer dieser Punkte offen ist:
|
||||
2. `targetSdk` < 36 oder 16-KB-Check fehlgeschlagen.
|
||||
3. Keine `native-debug-symbols.zip` im Upload.
|
||||
4. Data-Safety-Formular unvollständig.
|
||||
5. Account-Löschung nicht implementiert.
|
||||
6. **Keystore nicht gesichert** (kein verschlüsseltes Backup außerhalb dieses Rechners).
|
||||
5. ~~Account-Löschung nicht implementiert~~ → **erledigt 2026-10-25**: keine Accounts; Daten- und
|
||||
lokale Löschung in der App (Einstellungen).
|
||||
6. ~~Keine Datenschutz-Nachricht in AdMob~~ → **erledigt 2026-10-25**: Nachricht veröffentlicht,
|
||||
Formular erscheint, `consent=obtained`, Ads laden erst danach (Nachweis in
|
||||
[monetization.md](monetization.md#7b-ump-consent-m7b-umgesetzt)).
|
||||
7. **Keystore nicht gesichert** (kein verschlüsseltes Backup außerhalb dieses Rechners).
|
||||
Ohne ihn sind keine Updates der veröffentlichten App möglich.
|
||||
7. **Keine Datenschutz-Nachricht in AdMob konfiguriert** (UMP liefert dann `unknown` und
|
||||
`canRequestAds()==true` → Werbung ohne Einwilligung in der EU). Nachweis: `ads: consent update failed (3)`
|
||||
im Logcat, solange die Nachricht fehlt. Schritt-für-Schritt in [monetization.md](monetization.md#7b-ump-consent-m7b-umgesetzt).
|
||||
|
||||
|
||||
@@ -79,3 +79,22 @@ AdMob-Konto sperren. Test-Units liefern zuverlaessig Fill und sind dafuer vorges
|
||||
**Naechster Schritt:** echte Unit-IDs (Rewarded, Interstitial, ggf. Banner) vom Auftraggeber,
|
||||
dann Ersatz der Konstanten in `app/lib/src/ads/ads_service.dart` — **erst nach** implementiertem
|
||||
UMP-Consent.
|
||||
|
||||
## D6 — Käufe: lokal freigeschaltet, serverseitig geprüft erst in MVP-2 (2026-10-25)
|
||||
|
||||
**Entscheidung:** M7c schaltet Entitlements **lokal** frei (`iron_arc.entitlements`), nachdem
|
||||
der Play Store `purchased`/`restored` gemeldet hat. Es gibt noch keine serverseitige
|
||||
Belegprüfung und keine Real-time Developer Notifications.
|
||||
|
||||
**Begründung:** Der Referee kennt keine Accounts und keine Inventare; ein gekaufter
|
||||
Skin/Pass existiert nicht. „Remove Ads“ wirkt ausschließlich auf dem Gerät, ein gefälschter
|
||||
Besitzstand schadet also niemandem außer dem Fälscher. Eine Verifikation wäre Aufwand ohne
|
||||
Gegenwert, solange keine serverseitigen Vorteile verkauft werden.
|
||||
|
||||
**Konsequenzen:**
|
||||
- Ein manipuliertes Gerät kann sich Interstitials selbst abschalten. Akzeptiert.
|
||||
- Sobald käufliche Vorteile den Server berühren (Cores, Season Pass, Loadout-Slots), ist die
|
||||
Prüfung Pflicht: `purchases.products.get` mit Service-Account plus RTDN-Webhook, und die
|
||||
Entitlements wandern in die Datenbank statt in SharedPreferences.
|
||||
- Dasselbe gilt für Erstattungen: heute bleibt ein erstatteter Kauf aktiv, bis der Nutzer die
|
||||
App-Daten löscht. Bei serverseitigen Vorteilen muss der Webhook entziehen.
|
||||
|
||||
@@ -121,26 +121,66 @@ Jeder Test: mind. 7 Tage, eine Variable, Entscheidung nach ARPDAU **und** D7 (ni
|
||||
| Debug | `ConsentDebugSettings` mit EEA-Geografie + Testgerät `8FE2A5A74DC63E67AB86EE55E600589C` |
|
||||
| Statusanzeige | „Consent: … · Ads: aktiv/inaktiv · Rewarded: geladen“ |
|
||||
|
||||
### Ergebnis des Gerätetests (2026-10-24)
|
||||
### Ergebnis der Gerätetests
|
||||
|
||||
**Vor der AdMob-Konfiguration** (2026-10-24):
|
||||
|
||||
```
|
||||
ads: consent update failed (3) Publisher misconfiguration: no form(s) configured
|
||||
for the input app ID ca-app-pub-3909261635234286~8769927442
|
||||
ads: consent=ConsentStatus.unknown privacyOptionsRequired=false
|
||||
ads: SDK initialised
|
||||
ads: consent=ConsentStatus.unknown → canRequestAds() lieferte true
|
||||
```
|
||||
|
||||
**Das ist erwartet:** Im AdMob-Konto ist noch **keine Datenschutz-Nachricht** angelegt. Ohne sie
|
||||
liefert UMP `unknown` und `canRequestAds()` gibt `true` zurück – die App würde in der EU also
|
||||
**ohne Einwilligung** werben. Deshalb ist das ein harter Release-Blocker:
|
||||
Das war der Release-Blocker: ohne Nachricht hätte die App in der EU ohne Einwilligung geworben.
|
||||
|
||||
1. AdMob → **Privacy & messaging** → **GDPR** → *Create message* (Deutsch + Englisch)
|
||||
2. Nachricht der App `Iron Arc` zuordnen, Zielregionen EEA/UK/CH
|
||||
3. **Consent Management Platform**: Google (UMP) als CMP bestätigen
|
||||
4. App neu starten → Formular erscheint auf EEA-Testgeräten, `consent=obtained`, danach erst Ads
|
||||
**Nach dem Veröffentlichen der Consent-Nachricht** (2026-10-25, Redmi Note 10):
|
||||
|
||||
**Wichtig:** Bis das erledigt ist, bleiben Test-Units aktiv (kein Invalid Traffic) und es gehen
|
||||
keine echten Anzeigen live.
|
||||
| Schritt | Nachweis |
|
||||
|---|---|
|
||||
| Formular erscheint beim Start | UI-Dump: „Iron Arc benötigt Ihre Einwilligung … 210 Partner …“, Buttons „Einwilligen“ / „Optionen verwalten“ |
|
||||
| Zustimmung wirkt | `ads: consent form handled`, `ads: consent=ConsentStatus.obtained privacyOptionsRequired=true` |
|
||||
| **Ads erst danach** | `ads: SDK initialised` → `ads: interstitial ready` → `ads: rewarded ready` (jeweils nach dem Consent-Callback) |
|
||||
| Einstiegspunkt funktioniert | Zahnrad → „Datenschutz-Optionen“ öffnet das Formular erneut; nach Bestätigung `ads: privacy options closed, consent=ConsentStatus.obtained` |
|
||||
| Statusanzeige | „Werbe-Status: Consent: Zustimmung erteilt · Ads: aktiv · Rewarded: geladen“ |
|
||||
|
||||
Damit sind die drei Play-Anforderungen erfüllt: Einwilligung **vor** der ersten Ad-Anfrage,
|
||||
keine Ads ohne Zustimmung, und ein **dauerhafter** Weg, die Einwilligung zu ändern.
|
||||
|
||||
## 7c. Play Billing (M7c, umgesetzt 2026-10-25)
|
||||
|
||||
**Katalog** aus §3, aber bewusst klein gestartet: nur **Remove Ads** (`remove_ads`,
|
||||
Non-Consumable) ist im UI. Season Pass, Starter Pack und Cores brauchen eine Ökonomie,
|
||||
die es noch nicht gibt – die IDs stehen bereits in `ProductIds`, damit die Erweiterung
|
||||
eine Datenzeile ist und kein Umbau.
|
||||
|
||||
| Baustein | Datei |
|
||||
|---|---|
|
||||
| Katalog + Ereignismodelle | `lib/src/billing/models.dart` |
|
||||
| Store-Schnittstelle + Play-Implementierung | `lib/src/billing/store_client.dart` |
|
||||
| Besitzstand (persistiert) | `lib/src/billing/entitlements.dart` |
|
||||
| Ablaufsteuerung | `lib/src/billing/billing_service.dart` |
|
||||
| UI | Einstellungen-Sheet: „Werbung entfernen“, „Käufe wiederherstellen“ |
|
||||
|
||||
**Regeln, die eingehalten werden**
|
||||
|
||||
1. Preise kommen ausschließlich aus dem Store (`queryProductDetails`), nichts ist hartkodiert.
|
||||
2. `restorePurchases` läuft **beim Start** – Neuinstallation stellt den Besitz wieder her.
|
||||
3. `purchased`/`restored` → erst Entitlement schreiben, dann `completePurchase`
|
||||
(Play erstattet nach 3 Tagen nicht bestätigte Käufe automatisch).
|
||||
4. `pending` wird gemeldet, aber **nie** freigeschaltet (z. B. Barzahlung im Laden).
|
||||
5. Besitz wird sofort persistiert (`iron_arc.entitlements`), damit ein Absturz zwischen
|
||||
Store-Ereignis und Bestätigung nichts verliert.
|
||||
6. Remove Ads schaltet nur **Interstitials** ab (`AdsService.adsRemoved`); Rewarded bleibt
|
||||
freiwillig – sonst wäre die Belohnung für Käufer weg.
|
||||
7. Ohne Play-Dienst (Seitelladen, kein Konto) gibt es keinen Crash, sondern einen klaren
|
||||
Zustand: „Play Store nicht erreichbar“ bzw. „Keine Produkte im Play Store angelegt“.
|
||||
|
||||
**Verifikation:** 9 Unit-Tests mit einem Fake-Store (`app/test/billing_test.dart`) decken
|
||||
Kauf, Restore, Pending, Abbruch, Fehler, Neustart-Persistenz und den Fall „kein Store“ ab.
|
||||
Auf dem Gerät wurde zusätzlich geprüft, dass die App den echten Billing-Dienst anspricht
|
||||
(`IInAppBillingService` im Logcat) und ohne angelegte Produkte sauber degradiert.
|
||||
|
||||
**Noch offen:** serverseitige Belegprüfung (siehe [D6](decisions.md)) und die Produkte
|
||||
im Play Console (siehe [status/blocked.md](status/blocked.md)).
|
||||
|
||||
## 8. Offene Punkte
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
| Feld | Wert |
|
||||
|---|---|
|
||||
| App | Iron Arc (`de.softwareapp_hb.ironarc`) |
|
||||
| Verantwortlicher | Hadrian Burkhardt, `<Anschrift>`, E-Mail: `privacy@softwareapp-hb.de` |
|
||||
| Verantwortlicher | Hadrian Burkhardt, `<Anschrift>`, E-Mail: `softwareapp.hb@gmail.com` |
|
||||
| Stand | 2026-10-24 (Version 1.0) |
|
||||
| Gültig für | Google-Play-Version ab 0.6.0 |
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
Hadrian Burkhardt
|
||||
`<Anschrift>`
|
||||
E-Mail: `privacy@softwareapp-hb.de`
|
||||
E-Mail: `softwareapp.hb@gmail.com`
|
||||
Website: https://softwareapp-hb.de
|
||||
|
||||
## 3. Welche Daten verarbeitet werden
|
||||
@@ -108,8 +108,10 @@ Einschränkung der Verarbeitung (Art. 18), Datenübertragbarkeit (Art. 20) und W
|
||||
(Art. 21 DSGVO). Eine erteilte Einwilligung kannst du jederzeit mit Wirkung für die Zukunft
|
||||
widerrufen (Art. 7 Abs. 3).
|
||||
|
||||
**Löschung beantragen:** E-Mail an `privacy@softwareapp-hb.de` mit der Geräte-ID
|
||||
(angezeigt unter **Zahnrad → Werbe-Status**). Wir löschen die Serverdaten innerhalb von 30 Tagen.
|
||||
**Löschung beantragen:** Einstellungen → **Datenlöschung anfragen** öffnet eine E-Mail an
|
||||
`softwareapp.hb@gmail.com` mit Adresse, Betreff und Geräte-ID bereits ausgefüllt
|
||||
(die Geräte-ID steht auch unter **Zahnrad → Geräte-ID**). Wir löschen die Serverdaten
|
||||
innerhalb von 30 Tagen.
|
||||
|
||||
**Beschwerde:** Du kannst dich bei einer Aufsichtsbehörde beschweren, z. B. der für den
|
||||
Verantwortlichen zuständigen Landesdatenschutzbeauftragten.
|
||||
@@ -133,7 +135,7 @@ https://softwareapp-hb.de/datenschutz abrufbar; das Datum oben zeigt den Stand.
|
||||
|
||||
# Privacy Policy (English)
|
||||
|
||||
**Controller:** Hadrian Burkhardt, `<address>`, `privacy@softwareapp-hb.de`
|
||||
**Controller:** Hadrian Burkhardt, `<address>`, `softwareapp.hb@gmail.com`
|
||||
|
||||
**Summary.** No account, no name, no e-mail, no contacts, no photos, no GPS. For online duels we
|
||||
store a randomly generated device id plus match data. Ads are served by Google AdMob; personalised
|
||||
@@ -159,11 +161,11 @@ requested deletion.
|
||||
|
||||
**Your rights:** access, rectification, erasure, restriction, portability, objection, withdrawal of
|
||||
consent, complaint to a supervisory authority. To request deletion, e-mail
|
||||
`privacy@softwareapp-hb.de` with your device id (shown under **gear → Ad status**).
|
||||
`softwareapp.hb@gmail.com` with your device id (shown under **gear → device id**, or use **gear → request data deletion**, which pre-fills the address, subject and device id).
|
||||
|
||||
**Children:** not directed at children under 13.
|
||||
|
||||
**Contact:** `privacy@softwareapp-hb.de`
|
||||
**Contact:** `softwareapp.hb@gmail.com`
|
||||
|
||||
---
|
||||
|
||||
@@ -173,5 +175,5 @@ consent, complaint to a supervisory authority. To request deletion, e-mail
|
||||
|---|---|
|
||||
| `<Anschrift>` / `<address>` | Postanschrift des Verantwortlichen (Empfehlung; für ein Impressum ohnehin nötig) |
|
||||
| `<Hosting-Anbieter>` | Name des Servers-Hosters (z. B. Hetzner, Cloud Run) inkl. AVV |
|
||||
| `privacy@softwareapp-hb.de` | Postfach einrichten (oder Gmail-Adresse eintragen) |
|
||||
| `softwareapp.hb@gmail.com` | Postfach einrichten (oder Gmail-Adresse eintragen) |
|
||||
| URL | Seite unter `https://softwareapp-hb.de/datenschutz` hosten und in der Play Console eintragen |
|
||||
|
||||
@@ -107,8 +107,189 @@ Startspieler hatte Spieler 0 einen 59/40-Vorteil.
|
||||
- Layer-Namen mit Klammern brechen `adb shell`-Quoting; Lösung: lokal doppelt, remote einfach quoten.
|
||||
- Fit-to-world-Transform verschenkt im Portrait 3/4 des Screens → Kamera mit Höhen-Fit ist Pflicht.
|
||||
|
||||
## Nächste Schritte (M3b/M4)
|
||||
## M4 — Referee-Server (erledigt)
|
||||
|
||||
1. M3b: Golden-Tests für den Renderer (headless, ohne native Lib via injizierbarem Heightmap-Provider).
|
||||
2. M4: axum-Server mit Replay-Validierung (nutzt `sim` + `content`).
|
||||
3. Offene Design-Entscheidungen aus [balance-m2.md](balance-m2.md) einholen.
|
||||
| Punkt | Umsetzung |
|
||||
|---|---|
|
||||
| Stack | axum + tokio, SQLite (sqlx), Tower-Middleware |
|
||||
| Auth | Signierter Geräte-Token, Ablauf, Replay-Schutz |
|
||||
| Rate-Limit | Token-Bucket pro Gerät/IP, 429 mit `Retry-After` |
|
||||
| Validierung | Replay wird serverseitig nachgerechnet; Manipulation → **409** |
|
||||
| Lasttest | 342 k Anfragen/s im synthetischen Benchmark (Axum+SQLite auf dieser Maschine) |
|
||||
|
||||
## M5 — Client↔Server-Sync (erledigt)
|
||||
|
||||
- `MatchSession` kapselt online/offline; Offline-Queue mit persistenter Warteschlange.
|
||||
- Replay-Wiedergabe im Client (gleiche Pfade wie Live-Match).
|
||||
- 6 Bugs beim Zusammenführen gefunden und behoben (u. a. `BigInt.toInt()`-Clamping,
|
||||
u64-Hashes als JSON-Zahl > 2^53).
|
||||
|
||||
## M6 — Release-Pipeline (erledigt)
|
||||
|
||||
- HP 150, R8/ProGuard, `native-debug-symbols.zip`, signiertes AAB, Store-Assets.
|
||||
- 16-KB-Page-Check ABI-bewusst (`armeabi-v7a` 4 KB, 64-bit 16 KB).
|
||||
|
||||
## M7a/M7b — AdMob + UMP-Consent (erledigt 2026-10-25)
|
||||
|
||||
| Punkt | Nachweis |
|
||||
|---|---|
|
||||
| App-ID + Test-Units | Rewarded auf Gerät angesehen (`onUserEarnedReward` gefeuert) |
|
||||
| Consent-Nachricht | In AdMob veröffentlicht; Formular erscheint auf dem Redmi |
|
||||
| Reihenfolge | `consent=ConsentStatus.obtained` **vor** `SDK initialised` → keine Ad-Anfrage ohne Einwilligung |
|
||||
| Einstiegspunkt | Zahnrad → Datenschutz-Optionen öffnet das Formular erneut |
|
||||
|
||||
## M7c — Startzeit & Splash (erledigt 2026-10-25)
|
||||
|
||||
**Problem:** 5 s weisser Bildschirm vor dem ersten Frame (Stock-`launch_background` mit
|
||||
`@android:color/white`, dazu die gesamte Bootarbeit vor dem ersten Frame).
|
||||
|
||||
| Massnahme | Datei |
|
||||
|---|---|
|
||||
| Launch- und Normal-Theme dunkel (`#05070A`), Status-/Nav-Bar gleich | `res/values/styles.xml`, `values-night`, `values/colors.xml` |
|
||||
| Androids Splash-API ab 31: Markenfarbe, beschnitt-sicheres Icon, Icon-Platte in Icon-Navy | `res/values-v31/styles.xml`, `res/drawable-xxxhdpi/launch_logo{,_splash}.png` |
|
||||
| Pulsierendes Logo + Fortschrittslinie waehrend der Bootarbeit | `lib/src/ui/splash_screen.dart` |
|
||||
| Boot (Session, native Lib, Ad-SDK) erst **nach** dem ersten Frame, Splash mit Mindeststandzeit | `lib/main.dart` (`_bootstrap`) |
|
||||
| Logo-Mark aus dem Store-Icon freigestellt (Alpha-Ramp + Un-Premultiply, kein Navy-Saum) | `store/assets/logo_mark.png` → `app/assets/logo_mark.png` |
|
||||
|
||||
**Messung** (Redmi Note 10, API 31, Consent erteilt): Debug 3053 ms, Profile/AOT **2040 ms**,
|
||||
`iron_arc: ready after` 1740 / **1037 ms**. Neues Skript `tools/device/startup.sh`.
|
||||
|
||||
**Erkenntnisse**
|
||||
- Android 12 maskiert beim Splash-Icon alles ausserhalb der inneren 192 dp eines 288-dp-Bereichs →
|
||||
ein breites Wortmarken-Logo wird oben/unten abgeschnitten; Loesung ist eine 512×512-Vorlage mit
|
||||
Motiv auf 59 % Breite.
|
||||
- Die Icon-Platte ist ueber `windowSplashScreenIconBackgroundColor` steuerbar (mit Testfarbe Rot
|
||||
verifiziert), Groesse ~153 dp.
|
||||
- `am start -W` zaehlt den UMP-Dialog mit (7863 ms statt 3076 ms) → nur nach erteiltem Consent messen.
|
||||
- Dart initialisiert Top-Level-`final`s **lazy**: `final Stopwatch _bootWatch = Stopwatch()..start();`
|
||||
startete erst beim ersten Zugriff (Bootlog 0 ms). Jetzt Start in `main()`.
|
||||
- MIUI verweigert `adb install` von release-signierten APKs (`INSTALL_FAILED_USER_RESTRICTED`) →
|
||||
fuer Messungen `--profile` (AOT, debug-signiert).
|
||||
|
||||
## M7d — Grafik-Pipeline (erledigt 2026-10-25)
|
||||
|
||||
**Ausgangslage:** Icon, Feature-Graphic und Splash bestanden aus flachen Formen – Mintgrün
|
||||
gegen Navy, keine Tiefe, keine Lichtführung, Wortmarke in Standardschrift.
|
||||
|
||||
**Lösung:** Assets werden generiert statt gemalt. `tools/art/` erzeugt SVG-Master und
|
||||
rastert sie mit librsvg; Farben kommen aus `palette.json`, das auch `app/lib/src/ui/palette.dart`
|
||||
speist. Damit können App-Theme und Grafik nicht auseinanderlaufen.
|
||||
|
||||
| Baustein | Inhalt |
|
||||
|---|---|
|
||||
| `artlib.py` | Gradienten, Blur/Grain/Vignette-Filter, Catmull-Rom-Kurven, reproduzierbare Hügelketten, Ballistik, Text mit Tracking |
|
||||
| `gen_brand.py` | Icon (Legacy-Mipmaps + Adaptive Background/Foreground + Monochrom), Splash-Badge und -Lockup, Feature-Graphic |
|
||||
| `artgen.py` | CLI `brand \| palette \| preview \| all`, schreibt 24 Dateien |
|
||||
|
||||
**Gestaltungsregeln** (dokumentiert in [../art-direction.md](../art-direction.md)): Licht vom
|
||||
Horizont, warme Rim-Lights auf jeder Silhouette, genau eine Akzentfarbe, Grain+Vignette über
|
||||
das ganze Bild, Asymmetrie statt Kuppel, Roboto Black mit negativem Tracking.
|
||||
|
||||
**Erkenntnisse**
|
||||
- Ein vollständiger Ballistikbogen liest sich als Kuppel oder Regenbogen. Erst der Bogen, der
|
||||
das Bild nach oben rechts verlässt, wirkt wie ein Schuss.
|
||||
- Androids Splash-Icon maskiert alles außerhalb der inneren 192 von 288 dp → Motiv muss in
|
||||
~60 % der Fläche liegen; eine kreisförmige Plakette mit gezoomtem Ausschnitt schlägt
|
||||
jede rechteckige Kachel.
|
||||
- Das zusätzliche `dy`-Verschieben war nötig, weil der Adaptive-Foreground sonst in die
|
||||
108-dp-Maske läuft (Motiv auf 58 %, leicht angehoben).
|
||||
- Wortmarken in SVG verlieren das Leerzeichen zwischen Tspanen → explizites `dx`.
|
||||
- rsvg/Pango braucht installierte Fonts; Roboto aus dem Flutter-Cache nach
|
||||
`~/.local/share/fonts` kopieren, sonst rendert Pango in DejaVu.
|
||||
|
||||
**Offen (Phase 2):** die Ingame-Grafik ist weiterhin Canvas-Code (flacher Boden,
|
||||
Rechteck-Panzer). `docs/art-direction.md` beschreibt das geplante `gen_ingame.py`.
|
||||
|
||||
## M7e — Ingame-Grafik (erledigt 2026-10-25)
|
||||
|
||||
**Problem:** flacher Himmel, eine Hügel-Silhouette, brauner Boden als Fläche,
|
||||
Panzer als zwei Rechtecke plus weiße Linie.
|
||||
|
||||
| Baustein | Umsetzung |
|
||||
|---|---|
|
||||
| `art.dart` | Szenen-Renderer: Himmel, Parallaxe, Boden, Panzer, Effekte, Vignette |
|
||||
| Sonne | kamerarelativ platziert, damit jede Kameraposition eine Lichtquelle hat |
|
||||
| Bergrücken | drei Ebenen (Parallaxe 0.12/0.24/0.38), fern = heller, Rim-Light |
|
||||
| Boden | Verlauf, Schattenlippe, warme Oberkante, Felsbrocken mit unregelmäßigem Abstand |
|
||||
| Panzer | Hull/Turm/Rohr/Kette, Rim-Light, HP-Balken in Teamfarbe, 1,5x skaliert |
|
||||
| Effekte | Kometenschweif, Explosion (Feuerball, Ring, 9 Funken), Zielhilfe |
|
||||
|
||||
**Performance-Arbeit** (wichtigster Teil): erste Fassung 31–40 % Jank bei 60 fps Median.
|
||||
A/B gegen den alten Renderer (0–6,5 %) bewies, dass es die neue Szene war. Ursachen einzeln
|
||||
eliminiert: Vollbild-Radialverlauf (Vignette) → Randbänder; Gradient-Shader pro Bergrücken
|
||||
und pro Frame → flache Füllungen und einmal gebaute Paints; zwei geclippte Gradient-Rects
|
||||
unter der Oberfläche → entfernt; Boden pro Frame → `ui.Picture` je Terrain-Version;
|
||||
`MaskFilter.blur` → gestaffelte Striche. Ergebnis: **60,0 fps, 0,0–0,8 % Jank**.
|
||||
|
||||
**Erkenntnisse**
|
||||
- Auf einem Mali-G52 zählt Overdraw, nicht Pfadanzahl: ein einziger Vollbild-Radialverlauf
|
||||
kostete ~15 Prozentpunkte Jank.
|
||||
- `perf.sh`-Einzelmessungen schwanken um ±5 Punkte → immer 3 Läufe, Median nehmen.
|
||||
- Golden-Tests sind der einzige Schutz gegen„ sieht anders aus“: nach jeder Änderung
|
||||
`--update-goldens` und die PNGs wirklich ansehen.
|
||||
- Terrain-Cache braucht die Terrain-Version, sonst friert der Boden nach dem ersten Krater ein
|
||||
(gleiche Klasse Fehler wie das HUD-`onLoad`-Problem aus M3a).
|
||||
|
||||
## M7c — Play Billing + Löschpfad (erledigt 2026-10-25)
|
||||
|
||||
**Umfang:** `remove_ads` (Non-Consumable) ist der erste echte Kauf; der Rest des Katalogs aus
|
||||
monetization.md §3 wartet auf eine Ökonomie, die IDs stehen aber schon in `ProductIds`.
|
||||
|
||||
| Datei | Aufgabe |
|
||||
|---|---|
|
||||
| `billing/models.dart` | Produkt-IDs, `StoreProduct`, `PurchaseEvent`/`PurchaseState` |
|
||||
| `billing/store_client.dart` | Schnittstelle + `PlayStoreClient` über `in_app_purchase` |
|
||||
| `billing/entitlements.dart` | Besitzstand, persistiert, `ChangeNotifier` |
|
||||
| `billing/billing_service.dart` | Ablauf: Query, Kauf, Restore, Grant+Complete, Fehlerzustände |
|
||||
| `main.dart` | Shop-Bereich im Einstellungen-Sheet, Ads-Gate, lokale Löschung |
|
||||
| `test/billing_test.dart` | 9 Tests mit Fake-Store |
|
||||
|
||||
**Regeln, die den Unterschied machen**
|
||||
- Erst Entitlement schreiben, **dann** `completePurchase` — Play erstattet nach drei Tagen
|
||||
nicht bestätigte Käufe automatisch.
|
||||
- `pending` wird angezeigt, aber nie freigeschaltet.
|
||||
- `restorePurchases` beim Start, sonst verliert eine Neuinstallation den Kauf.
|
||||
- Remove Ads schaltet nur Interstitials ab; Rewarded bleibt freiwillig verfügbar.
|
||||
- Kein Play-Dienst → kein Crash, sondern „Play Store nicht erreichbar“ bzw. „Keine Produkte
|
||||
im Play Store angelegt“.
|
||||
|
||||
**Verifikation:** 17 Tests grün (9 neu), `flutter analyze` sauber, `com.android.vending.BILLING`
|
||||
im gemergten Manifest. Auf dem Gerät spricht die App den echten Dienst an
|
||||
(`IInAppBillingService`-Transaktionen im Logcat) und degradiert ohne angelegte Produkte sauber —
|
||||
der Screenshot der Einstellungen zeigt genau diese Meldung.
|
||||
|
||||
**Entscheidung:** [D6](decisions.md) — lokal freigeschaltet, serverseitige Belegprüfung erst
|
||||
wenn käufliche Vorteile den Server berühren.
|
||||
|
||||
**Löschpfad:** keine Accounts → Play-Anforderung über Datenlöschung (E-Mail vorausgefüllt)
|
||||
plus „Lokale Daten löschen“ (Warteschlange, Replays, Geräte-ID) erfüllt.
|
||||
|
||||
## M7f — Spielbarkeit: Kraft dosieren + Querformat (erledigt 2026-10-25)
|
||||
|
||||
**Zwei Feldbefunde aus echtem Spielen:**
|
||||
|
||||
1. *Schusskraft schwer einzustellen und nicht ablesbar.* Die Kraft hing an der absoluten Distanz
|
||||
vom Panzer (250 Welt-px = 100 %), und angezeigt wurde sie nur über die Größe der Zielpunkte.
|
||||
2. *Querformat unspielbar.* Die Kamera rechnete `zoom = max(fitHeight, fitWidth)`. Im Querformat
|
||||
führte das FitWidth dazu, dass die Welt **vertikal abgeschnitten** wurde – ohne vertikales
|
||||
Pannen lagen beide Panzer außerhalb des Bildes.
|
||||
|
||||
| Änderung | Details |
|
||||
|---|---|
|
||||
| Zielen | Zurückziehen statt auf den Finger zeigen: Zuglänge/260 px = Kraft, Zugrichtung = Schussrichtung (Gegenseite). 6-px-Totzone gegen Zittern. |
|
||||
| Rückmeldung | Gummiband vom Turm zum Finger, Kraftbalken (104×9 Welt-px, Viertelmarken) unter dem aktiven Panzer, HUD-Zeile mit Winkel und Kraftbalken + Prozentwert |
|
||||
| Kamera | `zoom = fitHeight` immer; bei breiterer Ansicht wird die Welt zentriert und die Ränder mit Himmel/Bergen/Boden gefüllt (Bergketten gekachelt, Bodenkante fortgesetzt) |
|
||||
| Layout | Im Querformat kleinere Abstände und kompakte Bedienknöpfe |
|
||||
| Regression | Neuer Golden-Test `landscape.png` (840×420) – er zeigt beide Panzer und hätte den Fehler gefunden |
|
||||
|
||||
**Verifikation:** 18 Tests grün; auf dem Gerät Hoch- und Querformat durchgespielt (Schuss feuert,
|
||||
Kraft 47 % bzw. 54 % gemessen), keine `RenderFlex overflowed`-Meldung im Logcat,
|
||||
`perf.sh`: **60,0 fps, 0,0 % Jank** (p90 16,9 ms).
|
||||
|
||||
## Nächste Schritte (aktualisiert)
|
||||
|
||||
1. `bundletool build-apks --connected-device` aus `~/exports/iron-arc-0.7.0.aab` → Install → Smoke.
|
||||
2. AdMob: echte Unit-IDs einsetzen (Test-IDs nur für Debug).
|
||||
3. Play Console: App anlegen, Data Safety, IARC, Internal Testing.
|
||||
4. Keystore auf zwei Offline-Medien sichern.
|
||||
5. M7c: Play Billing + Kontolöschung, oder symmetrische Ranked-Maps.
|
||||
|
||||
@@ -1,36 +1,70 @@
|
||||
# Blockiert — was ich ohne dich nicht erledigen kann
|
||||
|
||||
## 1. Gerät (blockiert M3-Abnahme und M6)
|
||||
Stand: 2026-10-25. Alles andere ist erledigt und auf dem Gerät verifiziert.
|
||||
|
||||
**Was ich brauche:** ein Android-Gerät, das von dieser Umgebung per `adb` erreichbar ist.
|
||||
## 1. Keystore-Backup (kritisch, 10 Minuten)
|
||||
|
||||
**Vorgehen (Weg A, empfohlen):**
|
||||
1. Handy/Tablet per USB an deinen PC, USB-Debugging aktivieren.
|
||||
2. Am PC: `adb devices` → Gerät sichtbar, dann `adb tcpip 5555`.
|
||||
3. In `~/.ssh/config` beim bestehenden Host: `RemoteForward 5555 <handy-lan-ip>:5555`.
|
||||
4. Bei mir: `adb connect 127.0.0.1:5555` (Port 5037 ist hier bereits belegt!).
|
||||
`~/keystore/ironarc-upload.jks` existiert nur auf dieser Maschine. Geht sie verloren, sind keine
|
||||
Updates der veröffentlichten App mehr möglich — die App muss dann neu eingereicht werden.
|
||||
|
||||
**Damit möglich:** echte Screenshots, `gfxinfo`-Framestats (p50/p90/p99, Jank), Insets/Notch, Rotation, Reconnect, Soak-Tests, arm64-Determinismus-Beweis.
|
||||
1. `ironarc-upload.jks` + `ironarc-upload.pw` auf **zwei** Offline-Medien kopieren (USB-Stick, DVD,
|
||||
Papier).
|
||||
2. Passwort zusätzlich in einen Passwortmanager.
|
||||
3. Einmal testweise aus dem Backup entschlüsseln (`keytool -list -keystore ...`).
|
||||
|
||||
## 2. Konten (blockiert M6/M7)
|
||||
## 2. Privacy-Policy-URL (Pflicht für Play + AdMob)
|
||||
|
||||
| Konto | Wofür |
|
||||
Die Datei liegt fertig unter `store/privacy-policy.html` (+ `docs/privacy-policy*.md`), es fehlt nur
|
||||
der öffentliche HTTPS-Abruf. Varianten: Gitea-Pages, GitHub Pages, eigener Webspace
|
||||
(`https://softwareapp-hb.de/iron-arc/privacy`). Die URL trage ich danach in
|
||||
`app/lib/src/ui/widgets.dart`, Store-Listing und Play Console ein.
|
||||
|
||||
## 3. Play Console (Upload + Tracks)
|
||||
|
||||
| Schritt | Was ich brauche |
|
||||
|---|---|
|
||||
| Google Play Console | Upload-Key, Data Safety, IARC, Internal-Testing-Track |
|
||||
| AdMob | App-ID + Test-Unit-IDs, Mediation |
|
||||
| Firebase | Projekt, `google-services.json` (nicht im Repo!), Crashlytics/GA4 |
|
||||
| App anlegen | `de.softwareapp_hb.ironarc`, Name „Iron Arc“, Kategorie *Games/Strategy* |
|
||||
| Internal Testing | Upload von `~/exports/iron-arc-0.7.0.aab` |
|
||||
| Data Safety | Vorlage in `docs/compliance-play-store.md` §5 — nur noch eintragen |
|
||||
| IARC-Fragebogen | Antworten stehen in `docs/compliance-play-store.md` §6 |
|
||||
| Zielgruppe | 13+ (keine Kinder-Kategorie) |
|
||||
|
||||
## 3. Entscheidungen
|
||||
## 3a. Anschrift des Verantwortlichen (rechtlich, nicht Play)
|
||||
|
||||
Die Datenschutzerklärung enthält noch `<Anschrift>` als Platzhalter (HTML Zeile 41, Markdown Zeile 29).
|
||||
Name und E-Mail sind gesetzt (`softwareapp.hb@gmail.com`), für eine DSGVO-konforme Angabe des
|
||||
Verantwortlichen fehlt die Postanschrift. Play prüft das nicht, die DSGVO verlangt es aber.
|
||||
Entweder ladungsfähige Adresse eintragen oder eine c/o-Adresse / ein Impressum-Postfach nutzen.
|
||||
|
||||
## 3b. Datenschutz-URL richtig hosten (empfohlen)
|
||||
|
||||
Aktuell zeigt `app/lib/src/ui/links.dart` auf die Rohdatei im Gitea-Repo. Die liefert
|
||||
`content-type: text/plain`, der Browser zeigt also HTML-Quelltext statt einer Seite. Für Play
|
||||
und AdMob funktioniert das, wirkt im Review aber unsauber.
|
||||
|
||||
1. `store/privacy-policy.html` als `index.html` unter `https://softwareapp-hb.de/iron-arc/privacy/` ablegen.
|
||||
2. Prüfen: `curl -sI <url> | grep -i content-type` → muss `text/html` sein.
|
||||
3. Die eine Zeile in `app/lib/src/ui/links.dart` ändern, neu bauen, fertig.
|
||||
|
||||
## 3c. Produkt im Play Console anlegen (blockiert den ersten Kauf)
|
||||
|
||||
Die App fragt `remove_ads` ab; ohne Eintrag im Console steht dort
|
||||
„Keine Produkte im Play Store angelegt“ (verifiziert, kein Crash).
|
||||
|
||||
1. Console → Monetarisieren → Produkte → In-App-Produkt anlegen: ID **`remove_ads`**
|
||||
(muss exakt so heißen), Typ *Einmalig*, Preis 4,99 €.
|
||||
2. Aktivieren; Produkte sind erst mit einem veröffentlichten Track (Internal Testing genügt)
|
||||
abrufbar.
|
||||
3. Lizenz-Testkonto im Console eintragen, dann erscheint der Preis in der App.
|
||||
|
||||
## 4. Echte AdMob-Unit-IDs
|
||||
|
||||
Aktuell Test-IDs (liefern immer Testanzeigen). Sobald die echten IDs da sind, trage ich sie in
|
||||
`app/lib/src/ads/ads_service.dart` ein und baue 0.7.1.
|
||||
|
||||
## 5. Offene Entscheidungen
|
||||
|
||||
| Thema | Auswirkung | Aktueller Default |
|
||||
|---|---|---|
|
||||
| Finaler Markenname | `applicationId`, Store-Listing, Icon | IRON ARC / `de.softwareapp_hb.ironarc` |
|
||||
| Lizenz | `LICENSE`, OSS-Fähigkeit | proprietär (keine Datei) |
|
||||
| Art-Pipeline | M3-Renderer, Asset-Format | Vektor → PNG-Atlas (Vorschlag) |
|
||||
| Ads ab MVP-1? | UMP-Consent-Skeleton in M3 | nein (erst M7) |
|
||||
|
||||
## 4. Balancing-Freigaben (kein Blocker, aber Review nötig)
|
||||
|
||||
- Schadensfalloff linear vs. quadratisch.
|
||||
- MIRV-Aufteilung (3 Sprengkörper) — Designfrage, keine Technik.
|
||||
- Panzer-Passivwerte (Vanguard +10 % Schild etc.) sind noch nicht implementiert.
|
||||
| Repo-Sichtbarkeit | **muss öffentlich bleiben**: die Datenschutzerklärung wird von dort ausgeliefert | öffentlich auf Gitea |
|
||||
|
||||
@@ -73,11 +73,47 @@ flutter test --update-goldens # nur nach bewusster UI-Änderung, im PR begr
|
||||
| `install.sh` | Deinstallieren, installieren, starten, PID prüfen |
|
||||
| `smoke.sh` | Start → Menü → Match → 3 Schüsse → Ergebnis; 20 Screenshots nach `/tmp/shots` |
|
||||
| `perf.sh` | **SurfaceFlinger-Frame-Timestamps** (Flutter rendert nicht über HWUI, `gfxinfo` liefert 0 Frames): p50/p90/p99 + Jank gegen 1,2 × Vsync |
|
||||
| `startup.sh` | Kaltstart: `am start -W` (`TotalTime`) plus `iron_arc: ready after N ms` aus dem Log – läuft nur sinnvoll, **nachdem** der Consent einmal erteilt wurde (sonst zählt der UMP-Dialog mit) |
|
||||
| `logs.sh` | Filter: Rust-Panic, `wgpu`/`Vulkan`, JNI, Billing, Consent |
|
||||
|
||||
**Wichtig:** Screenshots werden als PNG abgelegt und im Review **angesehen**; `perf.sh`-Report
|
||||
landet in `docs/perf/<datum>-<gerät>.md` und ist Release-Voraussetzung.
|
||||
|
||||
### Startzeit & Splash-Kette
|
||||
|
||||
Gemessen auf dem Redmi Note 10 (Android 12, API 31), Consent bereits erteilt:
|
||||
|
||||
| Build | `TotalTime` (erster Frame) | `iron_arc: ready after` |
|
||||
|---|---|---|
|
||||
| Debug (JIT) | 3053 ms | ~1740 ms |
|
||||
| Profile/AOT, erster Start nach Installation | 2040 ms | ~1040 ms |
|
||||
| Profile/AOT, weitere Kaltstarts (Caches warm) | **850–960 ms** | ~1030 ms |
|
||||
|
||||
`TotalTime` ist der Zeitpunkt, ab dem der Splash steht – die Partie erscheint gut 1 s später
|
||||
(700 ms Mindeststandzeit + 280 ms Fade).
|
||||
|
||||
Die Startstrecke ist bewusst dreiteilig, damit zu keinem Zeitpunkt ein weißer Screen zu sehen ist:
|
||||
|
||||
1. **Nativer Splash** (ab Prozessstart): `LaunchTheme` mit `windowBackground` = `@color/launch_bg`
|
||||
(`#05070A`), darunter zentriert das Logo. Ab API 31 übernimmt die System-Splash-API
|
||||
(`values-v31`): Markenfarbe + `launch_logo_splash` auf einer Icon-Platte in Icon-Navy.
|
||||
Die 512×512-Vorlage hat das Motiv nur auf 59 % Breite, weil Android alles außerhalb der
|
||||
inneren 192 dp des 288-dp-Icon-Bereichs **wegmaskiert** (sonst wird „IRON“ abgeschnitten).
|
||||
2. **Flutter-Splash** (`lib/src/ui/splash_screen.dart`): pulsierendes Logo (Scale 0,96→1,04,
|
||||
Deckkraft 0,72→1,0, 1100 ms) plus dünne Fortschrittslinie. Mindeststandzeit 700 ms,
|
||||
gemessen ab dem ersten Flutter-Frame – nicht ab Prozessstart, sonst überspringt ein langsamer
|
||||
Enginestart die Animation komplett.
|
||||
3. **Fade** (280 ms) über die bereits gebaute Partie, danach wird der Splash aus dem Baum entfernt.
|
||||
|
||||
Erst danach startet das Ad-SDK (`_ads.initialize()`), damit UMP-Dialog und SDK-Init niemals
|
||||
vor dem ersten Frame liegen. Video-Nachweis: 6-fps-Aufnahme des Kaltstarts, Frames bei
|
||||
0,4 s (nativer Splash), 1,5–1,8 s (pulsierendes Logo), ab 2,1 s Partie.
|
||||
|
||||
**MIUI-Falle:** `adb install` eines **release**-signierten APKs scheitert mit
|
||||
`INSTALL_FAILED_USER_RESTRICTED`. Für Messungen auf dem Gerät daher `flutter build apk --profile`
|
||||
(AOT wie Release, aber debug-signiert); die echte Release-Prüfung läuft über die Split-APKs aus
|
||||
dem AAB.
|
||||
|
||||
## 6. CI-Gates (Definition of Done für jeden PR)
|
||||
|
||||
1. `cargo fmt --check`
|
||||
|
||||
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 200 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 75 KiB |
@@ -1,12 +1,19 @@
|
||||
# Store-Listing (Entwurf)
|
||||
|
||||
> **Copy-Paste-Blatt: [play-console.md](play-console.md).** Dort stehen alle Texte in
|
||||
> DE/EN mit geprueften Zeichenlaengen sowie die Antworten fuer Data Safety, IARC und
|
||||
> die App-Inhalte. Diese Datei ist die Arbeitsfassung, play-console.md ist die Vorlage
|
||||
> zum Abtippen.
|
||||
|
||||
| Feld | Wert |
|
||||
|---|---|
|
||||
| Paket | `de.softwareapp_hb.ironarc` |
|
||||
| Version | 0.7.0 (versionCode 7) |
|
||||
| Version | 0.9.1 (versionCode 14) |
|
||||
| Zielgruppe | 13+, **nicht** im Families-Programm |
|
||||
| Enthält Werbung | Ja – AdMob SDK ist eingebaut (App ID `ca-app-pub-3909261635234286~8769927442`) |
|
||||
| In-App-Käufe | Ja (geplant ab M7) |
|
||||
| Kontakt-E-Mail (Play-Feld) | softwareapp.hb@gmail.com |
|
||||
| Datenschutz-URL (Play-Feld) | https://gitea.softwareapp-hb.de/fishfacegit/iron-arc/raw/branch/main/store/privacy-policy.html |
|
||||
|
||||
## Titel (max. 30 Zeichen)
|
||||
|
||||
@@ -64,9 +71,10 @@ from Baby Shell to Digger. Drag, aim, release - and watch the hill under your op
|
||||
|
||||
| Asset | Status | Datei |
|
||||
|---|---|---|
|
||||
| Icon 512×512 | ✅ Platzhalter | `store/assets/icon_512.png` |
|
||||
| Feature-Graphic 1024×500 | ✅ Platzhalter | `store/assets/feature_1024x500.png` |
|
||||
| Screenshots (min. 4) | ✅ echte Geräteaufnahmen | `store/screenshots/01..04` (1080×2400) |
|
||||
| Icon 512×512 | ✅ generiert (`tools/art/artgen.py`) | `store/assets/icon_512.png` |
|
||||
| Feature-Graphic 1024×500 | ✅ generiert (`tools/art/artgen.py`) | `store/assets/feature_1024x500.png` |
|
||||
| Screenshots (min. 4) | ✅ echte Geräteaufnahmen, 16:9 gerahmt | `store/screenshots/01..04` (1080×1920), Rohbilder in `raw/` |
|
||||
| Datenschutz-URL (Play-Feld) | ✅ gesetzt | https://gitea.softwareapp-hb.de/fishfacegit/iron-arc/raw/branch/main/store/privacy-policy.html |
|
||||
| Promo-Video 30 s | ❌ offen (Aufnahme auf Gerät nötig) | – |
|
||||
| Tablet-Screenshots (7", 10") | ❌ offen | – |
|
||||
|
||||
|
||||
@@ -0,0 +1,314 @@
|
||||
# Play Console — Copy-Paste-Blatt
|
||||
|
||||
Stand: 2026-10-25, Build **0.9.1 (14)**. Alle Angaben sind gegen den Release-Build geprüft
|
||||
(Berechtigungen per `aapt2 dump permissions`, Netzwerkziele per Code-Grep, Asset-Größen per
|
||||
`PIL`). Wenn sich der Build ändert, muss dieses Blatt mitwandern.
|
||||
|
||||
---
|
||||
|
||||
## 1. App anlegen
|
||||
|
||||
| Feld | Wert |
|
||||
|---|---|
|
||||
| App-Name (Play) | `Iron Arc` |
|
||||
| Paketname | `de.softwareapp_hb.ironarc` (nicht änderbar) |
|
||||
| Standardsprache | Deutsch (de-DE) |
|
||||
| App oder Spiel | **Spiel** |
|
||||
| Kostenlos oder kostenpflichtig | **Kostenlos** |
|
||||
| Kategorie | Spiele → **Strategie** |
|
||||
| Tags | Rundenbasiert, Artillerie, Lokaler Mehrspieler, Offline |
|
||||
| Kontakt-E-Mail | `softwareapp.hb@gmail.com` |
|
||||
| Website | `https://softwareapp-hb.de` |
|
||||
| Datenschutz-URL | `https://gitea.softwareapp-hb.de/fishfacegit/iron-arc/raw/branch/main/store/privacy-policy.html` |
|
||||
|
||||
---
|
||||
|
||||
## 2. Store-Eintrag — Deutsch
|
||||
|
||||
### App-Name (max. 30 Zeichen)
|
||||
|
||||
```
|
||||
Iron Arc: Panzerduell
|
||||
```
|
||||
|
||||
### Kurzbeschreibung (max. 80 Zeichen)
|
||||
|
||||
```
|
||||
Rundenbasiertes Panzerduell mit zerstörbarer Landschaft. Sieg in 3 Minuten.
|
||||
```
|
||||
|
||||
### Vollständige Beschreibung (max. 4000 Zeichen)
|
||||
|
||||
```
|
||||
Ein Schuss. Ein Krater. Kein Zufall.
|
||||
|
||||
IRON ARC ist ein rundenbasiertes Artillerie-Duell für zwei Spieler an einem Gerät.
|
||||
Du zielst mit einer Wischgeste, dosierst die Kraft und überlässt den Rest der Physik –
|
||||
Steigung, Wind und deiner Einschätzung, wo der Boden nachgibt.
|
||||
|
||||
WAS DAS SPIEL ANDERS MACHT
|
||||
• Determinismus statt Glück: Jeder Schuss ist reproduzierbar. Dieselben Eingaben
|
||||
ergeben immer dasselbe Ergebnis – auf jedem Gerät.
|
||||
• Zerstörbare Landschaft: Jeder Treffer reißt einen Krater. Nach drei Runden sieht
|
||||
keine Karte mehr aus wie am Anfang.
|
||||
• Wind, Steigung, Munition: Drei Variablen, die du lesen musst, statt auf einen
|
||||
Glückswurf zu warten.
|
||||
• Kein Grind, kein Timer: Du startest und spielst. Keine Energie, keine Wartezeiten.
|
||||
|
||||
SO SPIELST DU
|
||||
1. Ziehen: Richtung und Kraft einstellen – die Punktlinie zeigt den erwarteten Bogen.
|
||||
2. Loslassen: Der Schuss fliegt, gräbt sich ein, verändert das Gelände.
|
||||
3. Antworten: Der Gegner ist dran. Wechselt euch ab, bis einer keine Panzerung mehr hat.
|
||||
Eine Partie dauert selten länger als drei Minuten – ideal für die Mittagspause.
|
||||
|
||||
FAIR BLEIBT FAIR
|
||||
• Keine Pay-to-win-Käufe. Wer kauft, kauft Bequemlichkeit oder Kosmetik, keinen Vorteil.
|
||||
• „Werbung entfernen“ ist ein einmaliger Kauf; Belohnungswerbung bleibt immer freiwillig.
|
||||
• Offline spielbar. Online-Sync ist optional.
|
||||
|
||||
DATENSPARSAM GEBAUT
|
||||
• Kein Konto, keine Anmeldung, kein Profil.
|
||||
• Keine Analyse- oder Crash-SDKs im Build.
|
||||
• Werbung nur mit Einwilligung (EU/UK/CH: Abfrage beim ersten Start), jederzeit
|
||||
widerrufbar über Einstellungen → Datenschutz-Optionen.
|
||||
• Löschanfrage direkt in der App, mit vorausgefüllter E-Mail.
|
||||
|
||||
TECHNISCH
|
||||
• Simulation in Rust, festkomma-basiert und plattformübergreifend identisch.
|
||||
• Kompakte Installation, keine zusätzlichen Downloads nach dem ersten Start.
|
||||
• Für Android 7.0 und neuer.
|
||||
|
||||
IRON ARC ist bewusst klein: ein Duell, ein Bildschirm, keine Ablenkung.
|
||||
```
|
||||
|
||||
### Was ist neu (max. 500 Zeichen)
|
||||
|
||||
```
|
||||
0.9.1
|
||||
• Schusskraft jetzt präzise: Zurückziehen zum Spannen, Kraftbalken und Prozentwert sichtbar
|
||||
• Querformat spielbar: die Kamera zeigt das ganze Spielfeld
|
||||
• Kompaktere Bedienelemente im Querformat
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Store-Eintrag — English
|
||||
|
||||
### App name (max. 30)
|
||||
|
||||
```
|
||||
Iron Arc: Artillery Duel
|
||||
```
|
||||
|
||||
### Short description (max. 80)
|
||||
|
||||
```
|
||||
Turn-based tank artillery duels with destructible terrain. Win in 3 minutes.
|
||||
```
|
||||
|
||||
### Full description (max. 4000)
|
||||
|
||||
```
|
||||
One shot. One crater. No luck.
|
||||
|
||||
IRON ARC is a turn-based artillery duel for two players on one device.
|
||||
You aim with a swipe, dial in the power and leave the rest to physics: slope, wind
|
||||
and your read of where the ground will give way.
|
||||
|
||||
WHAT MAKES IT DIFFERENT
|
||||
• Determinism instead of dice: every shot is reproducible. Same input, same result -
|
||||
on every device.
|
||||
• Destructible terrain: every hit carves a crater. After three rounds no map looks
|
||||
like it did at the start.
|
||||
• Wind, slope, ammo: three variables to read instead of waiting for a lucky roll.
|
||||
• No grind, no timers: open it and play. No energy, no waiting.
|
||||
|
||||
HOW TO PLAY
|
||||
1. Pull back: the drag length sets the power, the drag direction the shot.
|
||||
2. Release: the shell flies, digs in, reshapes the ground.
|
||||
3. Answer: your opponent takes the turn. Alternate until one tank is out of armour.
|
||||
A match rarely takes longer than three minutes - perfect for a lunch break.
|
||||
|
||||
FAIR STAYS FAIR
|
||||
• No pay-to-win. Buying gets you convenience or cosmetics, never an advantage.
|
||||
• "Remove ads" is a one-time purchase; rewarded ads always stay optional.
|
||||
• Playable offline. Online sync is optional.
|
||||
|
||||
BUILT TO COLLECT LITTLE
|
||||
• No account, no sign-up, no profile.
|
||||
• No analytics or crash SDKs in the build.
|
||||
• Ads only with consent (asked on first start in the EU/UK/CH), revocable any time
|
||||
under Settings → Privacy options.
|
||||
• Deletion request right in the app, with a pre-filled email.
|
||||
|
||||
TECHNICAL
|
||||
• Simulation written in Rust, fixed-point and identical across platforms.
|
||||
• Compact install, no extra downloads after first launch.
|
||||
• Runs on Android 7.0 and newer.
|
||||
|
||||
IRON ARC is deliberately small: one duel, one screen, no distractions.
|
||||
```
|
||||
|
||||
### What's new (max. 500)
|
||||
|
||||
```
|
||||
0.9.1
|
||||
• Precise shot power: pull back to charge, with a visible power bar and percentage
|
||||
• Playable in landscape: the camera now shows the whole playfield
|
||||
• More compact controls in landscape
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. Grafik (gegen den Build geprüft)
|
||||
|
||||
| Asset | Datei | Größe | Play-Anforderung | Status |
|
||||
|---|---|---|---|---|
|
||||
| App-Icon | `store/assets/icon_512.png` | 512 × 512 | 512 × 512, 32-bit PNG | ✅ |
|
||||
| Feature-Graphic | `store/assets/feature_1024x500.png` | 1024 × 500 | 1024 × 500 | ✅ |
|
||||
| Screenshots Telefon | `store/screenshots/01..04*.png` | 1080 × 1920 (16:9) | 2–8 Stück, 320–3840 px, max. 2:1 | ✅ 4 Stück |
|
||||
| Roboterfassungen | `store/screenshots/raw/*.png` | 1080 × 2400 | nur Arbeitsmaterial | – |
|
||||
| Tablet-Screenshots | – | – | optional (7"/10") | ⬜ |
|
||||
| Promo-Video | – | – | optional (30 s, YouTube) | ⬜ |
|
||||
|
||||
**Wichtig:** Die Rohaufnahmen sind 1080 × 2400 (9:20 = 2,22:1) und werden von Play
|
||||
**abgelehnt**. `tools/art/gen_screens.py` rahmt sie auf 1080 × 1920 (16:9) mit Markenhintergrund.
|
||||
Nach jeder sichtbaren Änderung: neu aufnehmen, Skript laufen lassen.
|
||||
|
||||
**Screenshot 04 (`04_settings`) zeigt aktuell „Keine Produkte im Play Store angelegt“.**
|
||||
Das ist der korrekte Zustand vor dem Console-Setup, wirkt im Store aber wie ein Fehler.
|
||||
Sobald `remove_ads` angelegt und ein Track veröffentlicht ist: App öffnen, Einstellungen,
|
||||
neu aufnehmen (`adb exec-out screencap -p > store/screenshots/raw/04_settings.png`),
|
||||
`python3 tools/art/gen_screens.py`.
|
||||
|
||||
---
|
||||
|
||||
## 5. App-Inhalte — Fragebogen
|
||||
|
||||
### Werbung
|
||||
| Frage | Antwort |
|
||||
|---|---|
|
||||
| Enthält die App Werbung? | **Ja** |
|
||||
| Werbe-SDK | Google AdMob (`google_mobile_ads`) |
|
||||
| Einwilligung vor Werbung | Ja, UMP-Formular vor der ersten Anfrage (EU/UK/CH) |
|
||||
|
||||
### In-App-Käufe
|
||||
| Frage | Antwort |
|
||||
|---|---|
|
||||
| Digitale Güter über Play Billing? | **Ja** – `in_app_purchase`, Produkt `remove_ads` (4,99 €) |
|
||||
| Abo? | Nein |
|
||||
| Lootboxen / Zufallskäufe? | Nein |
|
||||
|
||||
### Zielgruppe und Inhalt
|
||||
| Frage | Antwort |
|
||||
|---|---|
|
||||
| Zielgruppe | **13+** |
|
||||
| Für Kinder gestaltet? | **Nein** (kein Families-Programm) |
|
||||
| Spricht Kinder an? | Nein |
|
||||
| Nutzer-Interaktion (Chat, UGC, Profile)? | **Nein** – 2 Spieler an einem Gerät |
|
||||
| Standortfreigabe? | Nein |
|
||||
| News-App / COVID / Regierung / Finanzen / Gesundheit? | Nein, alles |
|
||||
|
||||
### Inhaltsbewertung (IARC)
|
||||
| Kategorie | Antwort |
|
||||
|---|---|
|
||||
| Art | **Spiel** |
|
||||
| Gewalt | **Ja** – Cartoon-/Fantasy-Gewalt: Panzer beschießen sich, Explosionen, kein Blut, keine Menschendarstellung |
|
||||
| Häufigkeit/Intensität | Gelegentlich / mild |
|
||||
| Angst/Horror | Nein |
|
||||
| Sexuelle Inhalte | Nein |
|
||||
| Sprache | Nein |
|
||||
| Drogen/Alkohol/Tabak | Nein |
|
||||
| Glücksspiel (echt oder simuliert) | Nein |
|
||||
| Datenaustausch mit Dritten | Nein |
|
||||
| Digitale Käufe | **Ja** |
|
||||
| Werbung | **Ja** |
|
||||
|
||||
Erwartete Einstufung (Erfahrungswert, nicht garantiert): **USK 6 / PEGI 7 / ESRC „Everyone 10+“**.
|
||||
|
||||
---
|
||||
|
||||
## 6. Datensicherheit (Data Safety)
|
||||
|
||||
Grundlage: `aapt2 dump permissions` auf dem Release-APK und ein Grep über alle
|
||||
Netzwerkziele im Dart-Code. Ergebnis: Die App sendet **keine** Daten an eigene Server
|
||||
(einziger Ziel-Host im Code ist `http://127.0.0.1:8080`, der lokale Entwicklungs-Referee).
|
||||
Alles, was das Gerät verlässt, geht an Google (AdMob, Play Billing).
|
||||
|
||||
### Schritt 1 — Übersicht
|
||||
|
||||
| Frage | Antwort |
|
||||
|---|---|
|
||||
| Erhebt oder teilt die App Nutzerdaten? | **Ja** |
|
||||
| Alle Daten verschlüsselt übertragen? | **Ja** (TLS zu Google) |
|
||||
| Möglichkeit, Löschung zu verlangen? | **Ja** |
|
||||
| Unabhängige Sicherheitsprüfung? | Nein |
|
||||
|
||||
### Schritt 2 — Datenarten
|
||||
|
||||
| Datenart | Erhoben | Geteilt | Zweck | Optional? | Flüchtig? |
|
||||
|---|---|---|---|---|---|
|
||||
| **Geräte- oder andere IDs** (Werbe-ID, App-Set-ID) | Ja | **Ja** (Google) | Werbung/Marketing, Analyse | Nein (Werbung ist Standard) | Nein |
|
||||
| **Ungefährer Standort** (aus IP, durch AdMob) | Nein | **Ja** (Google) | Werbung/Marketing | Nein | Nein |
|
||||
| Absturzprotokolle, Diagnose | Nein | – | – | – | – |
|
||||
| App-Aktivität, Suchverlauf, Käufe, Kontakte, Fotos, Dateien | Nein | – | – | – | – |
|
||||
|
||||
**Advertising ID:** „Verwendet die App die Werbe-ID?“ → **Ja** (`com.google.android.gms.permission.AD_ID`
|
||||
ist im Manifest, gesetzt vom AdMob-SDK).
|
||||
|
||||
**Begründung der Standort-Zeile:** Die App selbst liest keinen Standort (keine
|
||||
`ACCESS_FINE/COARSE_LOCATION`-Berechtigung), aber AdMob leitet aus der IP-Adresse eine
|
||||
grobe Region ab und teilt sie mit Google. Das muss deklariert werden.
|
||||
|
||||
### Schritt 3 — Löschung
|
||||
|
||||
| Feld | Antwort |
|
||||
|---|---|
|
||||
| Löschung möglich? | Ja |
|
||||
| Weg | Einstellungen → **Datenlöschung anfragen** (vorausgefüllte E-Mail mit Geräte-ID) und Einstellungen → **Lokale Daten löschen** |
|
||||
| Kontakt | `softwareapp.hb@gmail.com` |
|
||||
| Werbe-Daten | über Google-Konto → Werbeeinstellungen (Link in der Datenschutzerklärung) |
|
||||
|
||||
### Pflege-Hinweis
|
||||
|
||||
Sobald der Referee-Server produktiv ist und die Geräte-ID dorthin übertragen wird, muss
|
||||
zusätzlich deklariert werden: **Geräte- oder andere IDs → Erhoben, Zweck App-Funktionalität,
|
||||
nicht geteilt.** Die Datenschutzerklärung deckt das bereits ab.
|
||||
|
||||
---
|
||||
|
||||
## 7. Berechtigungen im Release (geprüft)
|
||||
|
||||
| Berechtigung | Herkunft | Deklaration nötig? |
|
||||
|---|---|---|
|
||||
| `INTERNET`, `ACCESS_NETWORK_STATE` | App (Referee-Sync) | nein |
|
||||
| `com.android.vending.BILLING` | Play Billing | nein |
|
||||
| `com.google.android.gms.permission.AD_ID` | AdMob | **ja** (Data Safety, Werbe-ID) |
|
||||
| `ACCESS_ADSERVICES_AD_ID/ATTRIBUTION/TOPICS` | AdMob (Privacy Sandbox) | nein |
|
||||
| `WAKE_LOCK`, `FOREGROUND_SERVICE` | AdMob SDK | nein |
|
||||
|
||||
Keine Kamera, kein Mikrofon, kein Standort, kein Speicherzugriff, kein `QUERY_ALL_PACKAGES`.
|
||||
|
||||
---
|
||||
|
||||
## 8. Reihenfolge beim ersten Upload
|
||||
|
||||
1. **App anlegen** (Abschnitt 1), dann Store-Eintrag (Abschnitte 2/3) ausfüllen.
|
||||
2. **Grafik** hochladen (Abschnitt 4) — Icons, Feature-Graphic, 4 Screenshots.
|
||||
3. **App-Inhalte** beantworten (Abschnitt 5): Werbung, IAP, Zielgruppe, IARC.
|
||||
4. **Data Safety** ausfüllen (Abschnitt 6) — Werbe-ID nicht vergessen.
|
||||
5. **Produkt anlegen**: `remove_ads`, Einmalig, 4,99 €, aktivieren.
|
||||
6. **Internal Testing** anlegen, `~/exports/iron-arc-0.9.0.aab` hochladen,
|
||||
Lizenz-Testkonto eintragen, Release-Notes aus Abschnitt 2 einsetzen.
|
||||
7. Nach dem Rollout: `bundletool`-Split-APKs auf dem Gerät testen (MIUI blockt
|
||||
`adb install` von Release-APKs, siehe `docs/testing.md`).
|
||||
|
||||
---
|
||||
|
||||
## 9. Was Play ablehnen würde (aus dem Code geprüft)
|
||||
|
||||
- Screenshots mit Seitenverhältnis > 2:1 → behoben durch `tools/art/gen_screens.py`.
|
||||
- Fehlende Werbe-ID-Deklaration → in Abschnitt 6 vorbereitet.
|
||||
- Datenschutz-URL, die nicht erreichbar ist → HTTP 200 geprüft, aber `text/plain`
|
||||
(siehe `docs/status/blocked.md` §3b für den besseren Host).
|
||||
- Fehlende Anschrift in der Datenschutzerklärung → offen (§3a), rechtlich relevant.
|
||||
@@ -34,12 +34,12 @@
|
||||
<strong>Kurzfassung:</strong> Kein Nutzerkonto, kein Name, keine E-Mail, keine Kontakte, keine Fotos,
|
||||
kein GPS-Standort. Für Online-Duelle speichern wir eine zufällig erzeugte Geräte-ID und Match-Daten.
|
||||
Werbung läuft über Google AdMob; personalisierte Werbung nur mit deiner Einwilligung.
|
||||
Löschung jederzeit per E-Mail möglich.
|
||||
Löschung jederzeit per E-Mail möglich (Einstellungen → Datenlöschung anfragen füllt Adresse, Betreff und Geräte-ID vor).
|
||||
</div>
|
||||
|
||||
<h2>1. Verantwortlicher</h2>
|
||||
<p>Hadrian Burkhardt<br><mark><Anschrift></mark><br>
|
||||
E-Mail: <a href="mailto:privacy@softwareapp-hb.de">privacy@softwareapp-hb.de</a><br>
|
||||
E-Mail: <a href="mailto:softwareapp.hb@gmail.com">softwareapp.hb@gmail.com</a><br>
|
||||
Website: <a href="https://softwareapp-hb.de">softwareapp-hb.de</a></p>
|
||||
|
||||
<h2>2. Welche Daten verarbeitet werden</h2>
|
||||
@@ -104,7 +104,7 @@ Auftragsverarbeitungsvertrag (Art. 28 DSGVO).</p>
|
||||
Datenübertragbarkeit (Art. 20), Widerspruch (Art. 21) sowie jederzeitiger Widerruf der
|
||||
Einwilligung (Art. 7 Abs. 3 DSGVO).</p>
|
||||
<p><strong>Löschung beantragen:</strong>
|
||||
<a href="mailto:privacy@softwareapp-hb.de">privacy@softwareapp-hb.de</a> mit deiner Geräte-ID
|
||||
<a href="mailto:softwareapp.hb@gmail.com">softwareapp.hb@gmail.com</a> mit deiner Geräte-ID (Einstellungen → Datenlöschung anfragen)
|
||||
(angezeigt unter <strong>Zahnrad → Werbe-Status</strong>). Wir löschen innerhalb von 30 Tagen.</p>
|
||||
<p><strong>Beschwerde:</strong> bei der für den Verantwortlichen zuständigen Aufsichtsbehörde.</p>
|
||||
|
||||
@@ -127,7 +127,7 @@ Version; das Datum oben zeigt den Stand.</p>
|
||||
<p class="meta">App: <code>de.softwareapp_hb.ironarc</code> · Last updated: 2026-10-24 · v1.0</p>
|
||||
|
||||
<p><strong>Controller:</strong> Hadrian Burkhardt, <mark><address></mark>,
|
||||
<a href="mailto:privacy@softwareapp-hb.de">privacy@softwareapp-hb.de</a></p>
|
||||
<a href="mailto:softwareapp.hb@gmail.com">softwareapp.hb@gmail.com</a></p>
|
||||
|
||||
<p><strong>Summary.</strong> No account, no name, no e-mail, no contacts, no photos, no GPS.
|
||||
For online duels we store a randomly generated device id plus match data. Ads are served by
|
||||
@@ -153,7 +153,7 @@ device id until requested deletion.</p>
|
||||
|
||||
<p><strong>Your rights:</strong> access, rectification, erasure, restriction, portability, objection,
|
||||
withdrawal of consent, complaint to a supervisory authority. To request deletion, e-mail
|
||||
<a href="mailto:privacy@softwareapp-hb.de">privacy@softwareapp-hb.de</a> with your device id
|
||||
<a href="mailto:softwareapp.hb@gmail.com">softwareapp.hb@gmail.com</a> with your device id
|
||||
(shown under <strong>gear → Ad status</strong>).</p>
|
||||
|
||||
<p><strong>Children:</strong> not directed at children under 13.</p>
|
||||
|
||||
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 193 KiB |
|
Before Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 182 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
Before Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 248 KiB |
|
After Width: | Height: | Size: 157 KiB |
|
After Width: | Height: | Size: 157 KiB |
|
After Width: | Height: | Size: 158 KiB |
|
After Width: | Height: | Size: 198 KiB |
@@ -0,0 +1,10 @@
|
||||
# Art-Pipeline
|
||||
|
||||
Erzeugt Icon, Splash-Lockup und Feature-Graphic als SVG-Master und rastert sie.
|
||||
|
||||
```bash
|
||||
python3 tools/art/artgen.py all # Assets + app/lib/src/ui/palette.dart
|
||||
python3 tools/art/artgen.py preview # Kontaktbogen in build/art-preview/brand.png
|
||||
```
|
||||
|
||||
Braucht `rsvg-convert` und Roboto. Details, Regeln und die Palette: [../../docs/art-direction.md](../../docs/art-direction.md).
|
||||
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env python3
|
||||
"""IRON ARC art pipeline.
|
||||
|
||||
python3 tools/art/artgen.py all # brand assets + Flutter tokens
|
||||
python3 tools/art/artgen.py brand # icons, splash, feature graphic
|
||||
python3 tools/art/artgen.py palette # app/lib/src/ui/palette.dart
|
||||
python3 tools/art/artgen.py preview # contact sheet in build/art-preview
|
||||
|
||||
Everything is SVG-authored and rasterised with librsvg, so the sources stay
|
||||
editable and every size is crisp. Colours come from palette.json - change a
|
||||
token there, re-run, and icons, splash, feature graphic and app theme follow.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
import artlib as A
|
||||
import gen_brand as brand
|
||||
|
||||
DART_OUT = A.ROOT / "app" / "lib" / "src" / "ui" / "palette.dart"
|
||||
|
||||
DART_HEADER = """// GENERATED FILE - do not edit by hand.
|
||||
// Source: tools/art/palette.json, generator: tools/art/artgen.py
|
||||
// Re-run `python3 tools/art/artgen.py palette` after changing a token.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Design tokens shared by the app and the generated art.
|
||||
abstract final class Palette {
|
||||
"""
|
||||
|
||||
|
||||
def _dart_color(value: str) -> str:
|
||||
h = value.lstrip("#").upper()
|
||||
if len(h) == 6:
|
||||
h = "FF" + h
|
||||
return f"Color(0x{h})"
|
||||
|
||||
|
||||
def write_palette() -> Path:
|
||||
data = json.loads((A.ART_DIR / "palette.json").read_text(encoding="utf-8"))
|
||||
lines = [DART_HEADER]
|
||||
for group, values in data.items():
|
||||
if group.startswith("$") or not isinstance(values, dict):
|
||||
continue
|
||||
lines.append(f" // {group}")
|
||||
for key, value in values.items():
|
||||
if isinstance(value, str) and value.startswith("#"):
|
||||
name = f"{group}{key[0].upper()}{key[1:]}"
|
||||
lines.append(f" static const {name} = {_dart_color(value)};")
|
||||
lines.append("")
|
||||
lines.append("}")
|
||||
text = "\n".join(lines) + "\n"
|
||||
DART_OUT.parent.mkdir(parents=True, exist_ok=True)
|
||||
DART_OUT.write_text(text, encoding="utf-8")
|
||||
return DART_OUT
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
cmd = argv[1] if len(argv) > 1 else "all"
|
||||
if cmd in ("brand", "all"):
|
||||
for path in brand.write_all():
|
||||
print(f" {path.relative_to(A.ROOT)} {path.stat().st_size} B")
|
||||
if cmd in ("palette", "all"):
|
||||
print(f" {write_palette().relative_to(A.ROOT)}")
|
||||
if cmd in ("preview", "all"):
|
||||
print("preview:", brand.preview().relative_to(A.ROOT))
|
||||
if cmd not in ("brand", "palette", "preview", "all"):
|
||||
print(__doc__)
|
||||
return 2
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main(sys.argv))
|
||||
@@ -0,0 +1,271 @@
|
||||
"""Drawing primitives for IRON ARC art.
|
||||
|
||||
Everything is authored as SVG (real gradients, blur, grain) and rasterised with
|
||||
`rsvg-convert`, so the same source yields a crisp 48 dp launcher icon and a
|
||||
1024 px store graphic. No pixel pushing, no hand-tuned anti-aliasing.
|
||||
|
||||
Style rules that make the output look deliberate (see docs/art-direction.md):
|
||||
* light comes from the horizon, never from the top corners;
|
||||
* every silhouette gets a warm rim on its upper edge;
|
||||
* grain + vignette are applied to the *whole* composition, not per shape;
|
||||
* type is Roboto Black with negative tracking, one accent word only.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import math
|
||||
import random
|
||||
import subprocess
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from typing import Iterable, Sequence
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
ART_DIR = Path(__file__).resolve().parent
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# palette
|
||||
# --------------------------------------------------------------------------- #
|
||||
class Palette:
|
||||
def __init__(self, data: dict):
|
||||
self._d = data
|
||||
|
||||
@classmethod
|
||||
def load(cls, path: Path | None = None) -> "Palette":
|
||||
path = path or (ART_DIR / "palette.json")
|
||||
return cls(json.loads(path.read_text(encoding="utf-8")))
|
||||
|
||||
def color(self, path: str) -> str:
|
||||
"""`P.color('solar.base')` -> '#FFB347'."""
|
||||
node: object = self._d
|
||||
for part in path.split("."):
|
||||
node = node[part] # type: ignore[index]
|
||||
return str(node)
|
||||
|
||||
def value(self, path: str):
|
||||
node: object = self._d
|
||||
for part in path.split("."):
|
||||
node = node[part] # type: ignore[index]
|
||||
return node
|
||||
|
||||
|
||||
def rgba(hex_color: str, alpha: float) -> str:
|
||||
"""`#FFB347` + 0.4 -> `rgba(255,179,71,0.4)` for SVG fills/strokes."""
|
||||
h = hex_color.lstrip("#")
|
||||
r, g, b = (int(h[i : i + 2], 16) for i in (0, 2, 4))
|
||||
return f"rgba({r},{g},{b},{alpha:.3f})"
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# document
|
||||
# --------------------------------------------------------------------------- #
|
||||
def svg_doc(width: float, height: float, body: str, defs: str = "") -> str:
|
||||
return (
|
||||
f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" '
|
||||
f'viewBox="0 0 {width} {height}">'
|
||||
f"<defs>{defs}</defs>{body}</svg>"
|
||||
)
|
||||
|
||||
|
||||
def linear_gradient(
|
||||
gid: str,
|
||||
stops: Sequence[tuple[float, str, float]],
|
||||
x1: float = 0,
|
||||
y1: float = 0,
|
||||
x2: float = 0,
|
||||
y2: float = 1,
|
||||
) -> str:
|
||||
parts = "".join(
|
||||
f'<stop offset="{o:.3f}" stop-color="{c}" stop-opacity="{a:.3f}"/>'
|
||||
for o, c, a in stops
|
||||
)
|
||||
return (
|
||||
f'<linearGradient id="{gid}" x1="{x1}" y1="{y1}" x2="{x2}" y2="{y2}">'
|
||||
f"{parts}</linearGradient>"
|
||||
)
|
||||
|
||||
|
||||
def radial_gradient(
|
||||
gid: str,
|
||||
stops: Sequence[tuple[float, str, float]],
|
||||
cx: float = 0.5,
|
||||
cy: float = 0.5,
|
||||
r: float = 0.5,
|
||||
) -> str:
|
||||
parts = "".join(
|
||||
f'<stop offset="{o:.3f}" stop-color="{c}" stop-opacity="{a:.3f}"/>'
|
||||
for o, c, a in stops
|
||||
)
|
||||
return (
|
||||
f'<radialGradient id="{gid}" cx="{cx}" cy="{cy}" r="{r}">'
|
||||
f"{parts}</radialGradient>"
|
||||
)
|
||||
|
||||
|
||||
def blur_filter(fid: str, std: float) -> str:
|
||||
return (
|
||||
f'<filter id="{fid}" x="-50%" y="-50%" width="200%" height="200%">'
|
||||
f'<feGaussianBlur stdDeviation="{std}"/></filter>'
|
||||
)
|
||||
|
||||
|
||||
def grain_filter(fid: str = "grain", freq: float = 0.9, octaves: int = 3) -> str:
|
||||
"""Monochrome fractal noise; overlay it at 3-8 % for a filmic finish."""
|
||||
return (
|
||||
f'<filter id="{fid}" x="0" y="0" width="100%" height="100%">'
|
||||
f'<feTurbulence type="fractalNoise" baseFrequency="{freq}" '
|
||||
f'numOctaves="{octaves}" stitchTiles="stitch"/>'
|
||||
f'<feColorMatrix type="saturate" values="0"/></filter>'
|
||||
)
|
||||
|
||||
|
||||
def vignette_def(gid: str = "vignette", strength: float = 0.55) -> str:
|
||||
return radial_gradient(
|
||||
gid,
|
||||
[(0.45, "#000000", 0.0), (1.0, "#000000", strength)],
|
||||
r=0.78,
|
||||
)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# geometry
|
||||
# --------------------------------------------------------------------------- #
|
||||
def smooth_path(points: Sequence[tuple[float, float]], closed: bool = False) -> str:
|
||||
"""Catmull-Rom through the points, emitted as cubic beziers."""
|
||||
if len(points) < 2:
|
||||
raise ValueError("need at least two points")
|
||||
pts = list(points)
|
||||
if closed:
|
||||
pts = [pts[-1]] + pts + [pts[0], pts[1]]
|
||||
else:
|
||||
pts = [pts[0]] + pts + [pts[-1]]
|
||||
|
||||
d = f"M {pts[1][0]:.2f} {pts[1][1]:.2f}"
|
||||
for i in range(1, len(pts) - 2):
|
||||
p0, p1, p2, p3 = pts[i - 1], pts[i], pts[i + 1], pts[i + 2]
|
||||
c1 = (p1[0] + (p2[0] - p0[0]) / 6.0, p1[1] + (p2[1] - p0[1]) / 6.0)
|
||||
c2 = (p2[0] - (p3[0] - p1[0]) / 6.0, p2[1] - (p3[1] - p1[1]) / 6.0)
|
||||
d += (
|
||||
f" C {c1[0]:.2f} {c1[1]:.2f} {c2[0]:.2f} {c2[1]:.2f} "
|
||||
f"{p2[0]:.2f} {p2[1]:.2f}"
|
||||
)
|
||||
if closed:
|
||||
d += " Z"
|
||||
return d
|
||||
|
||||
|
||||
def hill_ridge(
|
||||
width: float,
|
||||
base_y: float,
|
||||
amplitude: float,
|
||||
seed: int,
|
||||
*,
|
||||
steps: int = 7,
|
||||
phase: float = 0.0,
|
||||
foot: float | None = None,
|
||||
) -> list[tuple[float, float]]:
|
||||
"""Reproducible skyline: two sines + seeded jitter, optionally closed to the foot."""
|
||||
rnd = random.Random(seed)
|
||||
pts: list[tuple[float, float]] = []
|
||||
for i in range(steps + 1):
|
||||
t = i / steps
|
||||
x = t * width
|
||||
wave = math.sin((t * 2.2 + phase) * math.tau) * 0.55
|
||||
wave += math.sin((t * 5.1 + phase * 1.7) * math.tau) * 0.22
|
||||
jitter = (rnd.random() - 0.5) * 0.30 if 0 < i < steps else 0.0
|
||||
y = base_y - amplitude * (0.5 + 0.5 * wave + jitter)
|
||||
pts.append((x, y))
|
||||
if foot is not None:
|
||||
pts.append((width, foot))
|
||||
pts.append((0, foot))
|
||||
return pts
|
||||
|
||||
|
||||
def ballistic_arc(
|
||||
x0: float, y0: float, x1: float, y1: float, apex_y: float, steps: int = 26
|
||||
) -> list[tuple[float, float]]:
|
||||
"""Parabola through the apex height - the game's signature shape."""
|
||||
pts = []
|
||||
for i in range(steps + 1):
|
||||
t = i / steps
|
||||
x = x0 + (x1 - x0) * t
|
||||
base = y0 + (y1 - y0) * t
|
||||
bump = 4 * t * (1 - t) # vanishes at both ends
|
||||
y = base + (apex_y - (y0 + y1) / 2) * bump
|
||||
pts.append((x, y))
|
||||
return pts
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# type
|
||||
# --------------------------------------------------------------------------- #
|
||||
def text(
|
||||
x: float,
|
||||
y: float,
|
||||
content: str,
|
||||
*,
|
||||
size: float,
|
||||
fill: str,
|
||||
weight: int = 400,
|
||||
family: str = "Roboto",
|
||||
anchor: str = "start",
|
||||
tracking: float = 0.0,
|
||||
opacity: float = 1.0,
|
||||
extra: str = "",
|
||||
) -> str:
|
||||
return (
|
||||
f'<text x="{x}" y="{y}" font-family="{family}" font-size="{size}" '
|
||||
f'font-weight="{weight}" letter-spacing="{tracking}" fill="{fill}" '
|
||||
f'text-anchor="{anchor}" opacity="{opacity}" {extra}>{content}</text>'
|
||||
)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# raster
|
||||
# --------------------------------------------------------------------------- #
|
||||
def render(svg: str, out: Path, width: int | None = None) -> Path:
|
||||
"""Rasterise SVG with librsvg (crisp text, real filters)."""
|
||||
out.parent.mkdir(parents=True, exist_ok=True)
|
||||
cmd = ["rsvg-convert", "-o", str(out)]
|
||||
if width:
|
||||
cmd += ["-w", str(width)]
|
||||
with tempfile.NamedTemporaryFile("w", suffix=".svg", delete=False) as fh:
|
||||
fh.write(svg)
|
||||
tmp = fh.name
|
||||
try:
|
||||
subprocess.run(cmd + [tmp], check=True, capture_output=True)
|
||||
finally:
|
||||
Path(tmp).unlink(missing_ok=True)
|
||||
return out
|
||||
|
||||
|
||||
def contact_sheet(
|
||||
paths: Iterable[Path], out: Path, cols: int = 3, cell: int = 320
|
||||
) -> Path:
|
||||
"""Preview grid so generated art can be reviewed at a glance."""
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
files = [p for p in paths if p.exists()]
|
||||
if not files:
|
||||
raise SystemExit("nothing to preview")
|
||||
rows = (len(files) + cols - 1) // cols
|
||||
sheet = Image.new("RGB", (cols * cell, rows * (cell + 22)), (18, 20, 24))
|
||||
draw = ImageDraw.Draw(sheet)
|
||||
for i, path in enumerate(files):
|
||||
img = Image.open(path).convert("RGBA")
|
||||
size = img.size
|
||||
img.thumbnail((cell - 16, cell - 16), Image.LANCZOS)
|
||||
x = (i % cols) * cell + 8
|
||||
y = (i // cols) * (cell + 22) + 8
|
||||
# checkerboard so transparency is obvious
|
||||
for cy in range(y, y + cell - 16, 16):
|
||||
for cx in range(x, x + cell - 16, 16):
|
||||
shade = 40 if ((cx // 16 + cy // 16) % 2) else 30
|
||||
draw.rectangle([cx, cy, cx + 15, cy + 15], fill=(shade, shade, shade))
|
||||
sheet.paste(img, (x, y), img)
|
||||
draw.text((x, y + cell - 14), f"{path.name} {size}", fill=(180, 190, 205))
|
||||
out.parent.mkdir(parents=True, exist_ok=True)
|
||||
sheet.save(out)
|
||||
return out
|
||||
@@ -0,0 +1,558 @@
|
||||
"""Generates the IRON ARC brand art: launcher icon (legacy + adaptive +
|
||||
monochrome), splash lockup and the Play feature graphic.
|
||||
|
||||
python3 tools/art/artgen.py brand
|
||||
|
||||
All output is derived from ../palette.json, so a colour change propagates
|
||||
everywhere. Art is authored as SVG and rasterised, never painted pixel by pixel.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
import artlib as A
|
||||
|
||||
P = A.Palette.load()
|
||||
INK0 = P.color("ink.0")
|
||||
INK1 = P.color("ink.1")
|
||||
INK2 = P.color("ink.2")
|
||||
INK3 = P.color("ink.3")
|
||||
SOLAR_L = P.color("solar.light")
|
||||
SOLAR = P.color("solar.base")
|
||||
SOLAR_D = P.color("solar.deep")
|
||||
STEEL_L = P.color("steel.light")
|
||||
STEEL = P.color("steel.base")
|
||||
RIM = P.color("terrain.rim")
|
||||
SOIL = P.color("terrain.soil")
|
||||
DEEP = P.color("terrain.deep")
|
||||
TEXT_HI = P.color("text.hi")
|
||||
TEXT_MID = P.color("text.mid")
|
||||
WEIGHT = int(P.value("type.displayWeight"))
|
||||
TRACK = float(P.value("type.trackingEm"))
|
||||
|
||||
ANDROID = A.ROOT / "app" / "android" / "app" / "src" / "main" / "res"
|
||||
APP_ASSETS = A.ROOT / "app" / "assets"
|
||||
STORE = A.ROOT / "store" / "assets"
|
||||
PREVIEW = A.ROOT / "build" / "art-preview"
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# shared scene pieces
|
||||
# --------------------------------------------------------------------------- #
|
||||
def sky_defs(tag: str, w: float, h: float, horizon: float) -> str:
|
||||
"""Dusk gradient plus a warm glow sitting on the horizon."""
|
||||
return (
|
||||
A.linear_gradient(
|
||||
f"sky{tag}",
|
||||
[
|
||||
(0.00, INK0, 1),
|
||||
(0.45, INK1, 1),
|
||||
(0.78, "#132135", 1),
|
||||
(1.00, "#1B2C44", 1),
|
||||
],
|
||||
)
|
||||
+ A.radial_gradient(
|
||||
f"glow{tag}",
|
||||
[(0.00, SOLAR_D, 0.55), (0.45, SOLAR_D, 0.20), (1.00, SOLAR_D, 0.0)],
|
||||
cx=0.5,
|
||||
cy=horizon / h,
|
||||
r=0.62,
|
||||
)
|
||||
+ A.blur_filter(f"soft{tag}", 6)
|
||||
)
|
||||
|
||||
|
||||
def sky(w: float, h: float, horizon: float, tag: str = "") -> str:
|
||||
return (
|
||||
f'<rect width="{w}" height="{h}" fill="url(#sky{tag})"/>'
|
||||
f'<rect width="{w}" height="{h}" fill="url(#glow{tag})"/>'
|
||||
)
|
||||
|
||||
|
||||
def sun(cx: float, cy: float, r: float, tag: str = "") -> str:
|
||||
"""Sun disc with a soft corona - the light source of every composition."""
|
||||
return (
|
||||
f'<circle cx="{cx}" cy="{cy}" r="{r * 1.85}" fill="{SOLAR}" '
|
||||
f'opacity="0.15" filter="url(#soft{tag})"/>'
|
||||
f'<circle cx="{cx}" cy="{cy}" r="{r}" fill="url(#sun{tag})"/>'
|
||||
)
|
||||
|
||||
|
||||
def sun_defs(tag: str) -> str:
|
||||
return A.radial_gradient(
|
||||
f"sun{tag}",
|
||||
[
|
||||
(0.00, "#FFF3DC", 1),
|
||||
(0.42, SOLAR_L, 1),
|
||||
(0.78, SOLAR, 1),
|
||||
(1.00, SOLAR_D, 1),
|
||||
],
|
||||
cx=0.42,
|
||||
cy=0.38,
|
||||
r=0.62,
|
||||
)
|
||||
|
||||
|
||||
def ridge(
|
||||
points: list[tuple[float, float]],
|
||||
fill: str,
|
||||
rim: str,
|
||||
rim_width: float,
|
||||
tag: str = "",
|
||||
) -> str:
|
||||
fill = fill.replace("{tag}", tag)
|
||||
"""Silhouette plus the warm rim light that separates it from the sky."""
|
||||
d = A.smooth_path(points, closed=True)
|
||||
open_d = A.smooth_path(points[:-2]) if len(points) > 2 else d
|
||||
return (
|
||||
f'<path d="{d}" fill="{fill}"/>'
|
||||
f'<path d="{open_d}" fill="none" stroke="{rim}" stroke-width="{rim_width}" '
|
||||
f'stroke-linecap="round" opacity="0.85"/>'
|
||||
)
|
||||
|
||||
|
||||
def shot_trail(pts: list[tuple[float, float]], width: float, *, dots: int = 10) -> str:
|
||||
"""Directional trail: fading dots behind, one crisp stroke in front.
|
||||
|
||||
A full parabola reads as a dome (and as a rainbow); letting the shot leave
|
||||
the frame keeps the icon dynamic."""
|
||||
cut = int(len(pts) * 0.30)
|
||||
trail = ""
|
||||
for i in range(dots):
|
||||
t = i / max(dots - 1, 1)
|
||||
x, y = pts[int(t * cut)]
|
||||
r = width * (0.18 + 0.26 * t)
|
||||
trail += (
|
||||
f'<circle cx="{x:.2f}" cy="{y:.2f}" r="{r:.2f}" fill="{SOLAR_L}" '
|
||||
f'opacity="{0.14 + 0.20 * t:.2f}"/>'
|
||||
)
|
||||
head = A.smooth_path(pts[cut:])
|
||||
head_full = A.smooth_path(pts)
|
||||
return (
|
||||
trail
|
||||
+ f'<path d="{head_full}" fill="none" stroke="{SOLAR}" '
|
||||
f'stroke-width="{width * 1.8:.2f}" stroke-linecap="round" '
|
||||
f'opacity="0.18" filter="url(#softx)"/>'
|
||||
+ f'<path d="{head}" fill="none" stroke="url(#arc)" '
|
||||
f'stroke-width="{width:.2f}" stroke-linecap="round"/>'
|
||||
)
|
||||
|
||||
|
||||
def arc_defs() -> str:
|
||||
return A.linear_gradient(
|
||||
"arc", [(0.0, SOLAR_L, 1), (0.55, SOLAR, 1), (1.0, SOLAR_D, 1)]
|
||||
) + A.blur_filter("softx", 5)
|
||||
|
||||
|
||||
def finish(w: float, h: float, grain: float = 0.06, vig: float = 0.5) -> str:
|
||||
"""Grain + vignette over the whole frame - the cheap trick that sells depth."""
|
||||
return (
|
||||
f'<rect width="{w}" height="{h}" fill="url(#vig)" />'
|
||||
f'<rect width="{w}" height="{h}" filter="url(#grain)" opacity="{grain}" '
|
||||
f'style="mix-blend-mode:overlay"/>'
|
||||
)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# the glyph: sun, two ridges, one ballistic arc
|
||||
# --------------------------------------------------------------------------- #
|
||||
def tank(
|
||||
cx: float,
|
||||
base_y: float,
|
||||
size: float,
|
||||
*,
|
||||
fill: str,
|
||||
rim: str,
|
||||
angle: float = -32.0,
|
||||
flip: bool = False,
|
||||
) -> str:
|
||||
"""A silhouette tank: hull, turret, barrel. Only reads below ~64 px as a
|
||||
bump with a stick, which is exactly what a launcher icon needs."""
|
||||
w = size * (1 if not flip else -1)
|
||||
hull_h = size * 0.30
|
||||
turret_w = size * 0.44
|
||||
turret_h = size * 0.20
|
||||
barrel_w = size * 0.11
|
||||
barrel_l = size * 0.62
|
||||
body = (
|
||||
# hull: slightly tapered block
|
||||
f'<path d="M {cx - w * 0.5:.2f} {base_y:.2f} '
|
||||
f'L {cx + w * 0.5:.2f} {base_y:.2f} '
|
||||
f'L {cx + w * 0.44:.2f} {base_y - hull_h:.2f} '
|
||||
f'L {cx - w * 0.44:.2f} {base_y - hull_h:.2f} Z" fill="{fill}"/>'
|
||||
# turret
|
||||
f'<rect x="{cx - turret_w / 2:.2f}" y="{base_y - hull_h - turret_h:.2f}" '
|
||||
f'width="{turret_w:.2f}" height="{turret_h * 1.15:.2f}" '
|
||||
f'rx="{turret_h * 0.55:.2f}" fill="{fill}"/>'
|
||||
# barrel, pivoting at the turret centre
|
||||
f'<g transform="rotate({angle} {cx:.2f} {base_y - hull_h - turret_h * 0.4:.2f})">'
|
||||
f'<rect x="{cx - barrel_w / 2:.2f}" '
|
||||
f'y="{base_y - hull_h - turret_h * 0.4 - barrel_l:.2f}" '
|
||||
f'width="{barrel_w:.2f}" height="{barrel_l:.2f}" '
|
||||
f'rx="{barrel_w * 0.45:.2f}" fill="{fill}"/>'
|
||||
f'</g>'
|
||||
# rim light on the hull top edge
|
||||
f'<path d="M {cx - w * 0.44:.2f} {base_y - hull_h:.2f} '
|
||||
f'L {cx + w * 0.44:.2f} {base_y - hull_h:.2f}" stroke="{rim}" '
|
||||
f'stroke-width="{size * 0.035:.2f}" stroke-linecap="round" opacity="0.9"/>'
|
||||
)
|
||||
return (
|
||||
f'<ellipse cx="{cx:.2f}" cy="{base_y + size * 0.03:.2f}" '
|
||||
f'rx="{size * 0.52:.2f}" ry="{size * 0.05:.2f}" fill="#000000" '
|
||||
f'opacity="0.45"/>' + body
|
||||
)
|
||||
|
||||
|
||||
def muzzle_glow(x: float, y: float, r: float) -> str:
|
||||
"""Warm bloom right at the barrel mouth - the shot just left."""
|
||||
return (
|
||||
f'<circle cx="{x:.2f}" cy="{y:.2f}" r="{r:#.2f}" fill="{SOLAR_L}" '
|
||||
f'opacity="0.35" filter="url(#softx)"/>'
|
||||
)
|
||||
|
||||
|
||||
def stars(S: float, count: int = 7, seed: int = 3, size: float | None = None, x0: float = 0.05) -> str:
|
||||
"""A few dim points of light: fills the empty sky without becoming noise."""
|
||||
import random
|
||||
|
||||
rnd = random.Random(seed)
|
||||
unit = size if size is not None else S
|
||||
out = ""
|
||||
for _ in range(count):
|
||||
x = rnd.uniform(x0, 0.95) * S
|
||||
y = rnd.uniform(0.04, 0.42) * S
|
||||
r = rnd.uniform(0.0025, 0.0055) * unit
|
||||
a = rnd.uniform(0.20, 0.55)
|
||||
out += f'<circle cx="{x:.2f}" cy="{y:.2f}" r="{r:.2f}" fill="#DCE6F5" opacity="{a:.2f}"/>'
|
||||
return out
|
||||
|
||||
|
||||
def glyph(
|
||||
S: float,
|
||||
tag: str,
|
||||
*,
|
||||
with_sky: bool = True,
|
||||
k: float = 1.0,
|
||||
dy: float = 0.0,
|
||||
rim_alpha: float = 1.0,
|
||||
) -> str:
|
||||
"""Drawable in a 0..S box; `k` shrinks it for the adaptive safe zone."""
|
||||
horizon = 0.715 * S
|
||||
body = ""
|
||||
if with_sky:
|
||||
body += sky(S, S, horizon, tag)
|
||||
# The shot leaves the frame at the top right: no dome, no rainbow.
|
||||
# muzzle sits at the barrel tip (see tank(): pivot + L at 38 deg)
|
||||
shot = A.ballistic_arc(
|
||||
0.340 * S, 0.623 * S, 1.080 * S, -0.180 * S, apex_y=0.155 * S, steps=48
|
||||
)
|
||||
inner = (
|
||||
stars(S)
|
||||
+ sun(0.690 * S, 0.640 * S, 0.135 * S, tag)
|
||||
+ ridge(
|
||||
A.hill_ridge(S, 0.775 * S, 0.046 * S, seed=7, steps=6, foot=S),
|
||||
"#0F1B2E",
|
||||
A.rgba(RIM, 0.20),
|
||||
0.007 * S,
|
||||
tag,
|
||||
)
|
||||
+ shot_trail(shot, 0.024 * S)
|
||||
+ muzzle_glow(0.340 * S, 0.623 * S, 0.024 * S)
|
||||
+ ridge(
|
||||
A.hill_ridge(S, 0.862 * S, 0.030 * S, seed=11, steps=4, phase=0.42, foot=S),
|
||||
"url(#ground{tag})",
|
||||
A.rgba(SOLAR_L, 0.38 * rim_alpha),
|
||||
0.009 * S,
|
||||
tag,
|
||||
)
|
||||
+ tank(
|
||||
0.225 * S,
|
||||
0.884 * S,
|
||||
0.30 * S,
|
||||
fill="#0B1420",
|
||||
rim=A.rgba(SOLAR_L, 0.60),
|
||||
angle=38,
|
||||
)
|
||||
)
|
||||
if k >= 1.0:
|
||||
return body + inner
|
||||
t = S * (1 - k) / 2
|
||||
return body + f'<g transform="translate({t:.2f},{t:.2f}) scale({k})">{inner}</g>'
|
||||
|
||||
|
||||
def glyph_defs(tag: str) -> str:
|
||||
return (
|
||||
A.linear_gradient(
|
||||
f"ground{tag}",
|
||||
[(0.0, "#241D13", 1), (0.40, "#120F0A", 1), (1.0, "#07080A", 1)],
|
||||
)
|
||||
+ sky_defs(tag, 1, 1, 0.705)
|
||||
+ sun_defs(tag)
|
||||
+ arc_defs()
|
||||
+ A.grain_filter()
|
||||
+ A.vignette_def()
|
||||
)
|
||||
|
||||
|
||||
def icon_svg(S: int = 1024) -> str:
|
||||
return A.svg_doc(
|
||||
S,
|
||||
S,
|
||||
glyph(S, "") + finish(S, S, grain=0.05, vig=0.42),
|
||||
glyph_defs(""),
|
||||
)
|
||||
|
||||
|
||||
def foreground_svg(S: int = 432) -> str:
|
||||
"""Adaptive icon foreground: transparent, content inside the 72/108 safe zone."""
|
||||
return A.svg_doc(S, S, glyph(S, "f", with_sky=False, k=0.58, dy=-0.02), glyph_defs("f"))
|
||||
|
||||
|
||||
def background_svg(S: int = 432) -> str:
|
||||
return A.svg_doc(
|
||||
S,
|
||||
S,
|
||||
sky(S, S, 0.705 * S, "b") + finish(S, S, grain=0.05, vig=0.45),
|
||||
sky_defs("b", S, S, 0.705 * S) + A.grain_filter() + A.vignette_def(),
|
||||
)
|
||||
|
||||
|
||||
def monochrome_svg(S: int = 432) -> str:
|
||||
"""Android 13 themed icons: one ink, tinted by the launcher."""
|
||||
shot = A.ballistic_arc(
|
||||
0.340 * S, 0.623 * S, 1.080 * S, -0.180 * S, apex_y=0.155 * S, steps=40
|
||||
)
|
||||
body = (
|
||||
f'<circle cx="{0.690 * S:.2f}" cy="{0.640 * S:.2f}" r="{0.115 * S:.2f}" '
|
||||
f'fill="#FFFFFF"/>'
|
||||
f'<path d="{A.smooth_path(shot)}" fill="none" stroke="#FFFFFF" '
|
||||
f'stroke-width="{0.030 * S:.2f}" stroke-linecap="round"/>'
|
||||
f'<path d="M {0.060 * S:.2f} {0.868 * S:.2f} L {0.940 * S:.2f} {0.868 * S:.2f}" '
|
||||
f'stroke="#FFFFFF" stroke-width="{0.030 * S:.2f}" stroke-linecap="round"/>'
|
||||
)
|
||||
t = S * 0.13
|
||||
return A.svg_doc(S, S, f'<g transform="translate({t:.2f},{t:.2f}) scale(0.74)">{body}</g>')
|
||||
|
||||
|
||||
def splash_icon_svg(S: int = 512) -> str:
|
||||
"""Android 12+ splash icon: badge only, inside the mask-safe 60 % of the canvas."""
|
||||
r = S * 0.32
|
||||
cx = cy = S / 2
|
||||
body = clip_def("s", cx, cy, r) + badge(cx, cy, r, "s", zoom=1.28, focus=(0.56, 0.615))
|
||||
return A.svg_doc(S, S, body, glyph_defs("s"))
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# circular badge + wordmark lockup
|
||||
# --------------------------------------------------------------------------- #
|
||||
def clip_def(tag: str, cx: float, cy: float, r: float) -> str:
|
||||
return (
|
||||
f'<clipPath id="clip{tag}">'
|
||||
f'<circle cx="{cx:.2f}" cy="{cy:.2f}" r="{r:.2f}"/></clipPath>'
|
||||
)
|
||||
|
||||
|
||||
def badge(
|
||||
cx: float,
|
||||
cy: float,
|
||||
r: float,
|
||||
tag: str,
|
||||
*,
|
||||
zoom: float = 1.30,
|
||||
focus: tuple[float, float] = (0.55, 0.60),
|
||||
) -> str:
|
||||
"""The glyph art zoomed onto its subject and clipped to a circle.
|
||||
|
||||
A circular badge cannot show the square scene - the corners are masked away -
|
||||
so the art is scaled up and centred on sun, arc and tank."""
|
||||
inner = 2048
|
||||
s = (2 * r * zoom) / inner
|
||||
tx = cx - focus[0] * inner * s
|
||||
ty = cy - focus[1] * inner * s
|
||||
return (
|
||||
f'<g clip-path="url(#clip{tag})">'
|
||||
f'<g transform="translate({tx:.2f},{ty:.2f}) scale({s:.5f})">'
|
||||
f"{glyph(inner, tag, rim_alpha=0.18)}</g></g>"
|
||||
f'<circle cx="{cx:.2f}" cy="{cy:.2f}" r="{r:.2f}" fill="none" '
|
||||
f'stroke="{A.rgba(SOLAR, 0.55)}" stroke-width="{max(1.5, r * 0.012):.2f}"/>'
|
||||
)
|
||||
|
||||
|
||||
def lockup_svg(w: int = 640, h: int = 780, *, badge_only: bool = False) -> str:
|
||||
"""Circular badge above the wordmark - used for splash and store listing."""
|
||||
r = 138.0
|
||||
cx, cy = w / 2, 176.0
|
||||
body = (
|
||||
clip_def("k", cx, cy, r)
|
||||
+ badge(cx, cy, r, "k")
|
||||
+ f'<circle cx="{cx}" cy="{cy}" r="{r * 1.16:.1f}" fill="{SOLAR}" '
|
||||
f'opacity="0.09" filter="url(#softk)"/>'
|
||||
)
|
||||
if badge_only:
|
||||
return A.svg_doc(w, h, body, glyph_defs("k") + A.blur_filter("softk", 12))
|
||||
|
||||
title_y = cy + r + 126
|
||||
body += (
|
||||
f'<text x="{cx}" y="{title_y}" font-family="Roboto" font-weight="900" '
|
||||
f'font-size="104" letter-spacing="-2" text-anchor="middle">'
|
||||
f'<tspan fill="{TEXT_HI}">IRON</tspan>'
|
||||
f'<tspan fill="{SOLAR}" dx="22">ARC</tspan></text>'
|
||||
f'<text x="{cx}" y="{title_y + 54}" font-family="Roboto" font-weight="500" '
|
||||
f'font-size="25" letter-spacing="7" text-anchor="middle" '
|
||||
f'fill="{TEXT_MID}">TAKTISCHES PANZERDUELL</text>'
|
||||
)
|
||||
return A.svg_doc(w, h, body, glyph_defs("k") + A.blur_filter("softk", 12))
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Play feature graphic 1024x500
|
||||
# --------------------------------------------------------------------------- #
|
||||
def feature_svg(w: int = 1024, h: int = 500) -> str:
|
||||
"""Title block left, self-contained dusk scene in the right half.
|
||||
|
||||
The shot stays inside its half of the canvas - a line crossing the wordmark
|
||||
is exactly the kind of detail that makes store art look amateurish.
|
||||
"""
|
||||
horizon = 0.66 * h
|
||||
shot = A.ballistic_arc(
|
||||
0.585 * w, 0.615 * h, 1.045 * w, -0.070 * h, apex_y=0.165 * h, steps=56
|
||||
)
|
||||
body = (
|
||||
sky(w, h, horizon, "f")
|
||||
+ stars(w, 6, seed=5, size=min(w, h), x0=0.62)
|
||||
+ sun(0.755 * w, 0.440 * h, 0.105 * w, "f")
|
||||
+ ridge(
|
||||
A.hill_ridge(w, 0.660 * h, 0.038 * h, seed=7, steps=7, foot=h),
|
||||
"#0F1B2E",
|
||||
A.rgba(RIM, 0.22),
|
||||
2.0,
|
||||
"f",
|
||||
)
|
||||
+ shot_trail(shot, 3.2)
|
||||
+ ridge(
|
||||
A.hill_ridge(w, 0.870 * h, 0.048 * h, seed=11, steps=5, phase=0.42, foot=h),
|
||||
"url(#groundf)",
|
||||
A.rgba(SOLAR_L, 0.34),
|
||||
2.4,
|
||||
"f",
|
||||
)
|
||||
+ f'<rect x="0" y="0" width="{w * 0.54:.0f}" height="{h}" fill="url(#scrim)"/>'
|
||||
+ text_block(w)
|
||||
+ finish(w, h, grain=0.05, vig=0.36)
|
||||
)
|
||||
defs = (
|
||||
glyph_defs("f")
|
||||
+ A.linear_gradient(
|
||||
"groundf",
|
||||
[(0.0, "#2A2318", 1), (0.40, "#14110C", 1), (1.0, "#07080A", 1)],
|
||||
)
|
||||
+ A.linear_gradient(
|
||||
"scrim",
|
||||
[(0.0, INK0, 0.97), (0.62, INK0, 0.88), (1.0, INK0, 0.0)],
|
||||
x1=0,
|
||||
y1=0,
|
||||
x2=1,
|
||||
y2=0,
|
||||
)
|
||||
)
|
||||
return A.svg_doc(w, h, body, defs)
|
||||
|
||||
|
||||
def text_block(w: float) -> str:
|
||||
"""Type lockup: one accent word, wide-tracked caps for the rest."""
|
||||
return (
|
||||
f'<text x="64" y="202" font-family="Roboto" font-weight="900" '
|
||||
f'font-size="100" letter-spacing="-3">'
|
||||
f'<tspan fill="{TEXT_HI}">IRON</tspan>'
|
||||
f'<tspan fill="{SOLAR}" dx="22">ARC</tspan></text>'
|
||||
f'<text x="66" y="250" font-family="Roboto" font-weight="500" '
|
||||
f'font-size="21" letter-spacing="4" fill="{TEXT_MID}">'
|
||||
f'TAKTISCHES PANZERDUELL</text>'
|
||||
f'<rect x="66" y="274" width="112" height="3" rx="1.5" '
|
||||
f'fill="{SOLAR}" opacity="0.85"/>'
|
||||
f'<text x="66" y="314" font-family="Roboto" font-weight="400" '
|
||||
f'font-size="20" letter-spacing="2" fill="{TEXT_MID}">'
|
||||
f'1 GEGEN 1 · OFFLINE UND ONLINE</text>'
|
||||
)
|
||||
|
||||
|
||||
ADAPTIVE_XML = """<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generated by tools/art/artgen.py - do not edit by hand. -->
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
|
||||
</adaptive-icon>
|
||||
"""
|
||||
|
||||
DENSITIES = {
|
||||
"mdpi": 1.0,
|
||||
"hdpi": 1.5,
|
||||
"xhdpi": 2.0,
|
||||
"xxhdpi": 3.0,
|
||||
"xxxhdpi": 4.0,
|
||||
}
|
||||
|
||||
|
||||
def write_all() -> list[Path]:
|
||||
"""Render every brand asset into the app and the store folder."""
|
||||
written: list[Path] = []
|
||||
|
||||
written.append(A.render(icon_svg(1024), STORE / "icon_512.png", width=512))
|
||||
written.append(A.render(feature_svg(), STORE / "feature_1024x500.png"))
|
||||
|
||||
lockup = A.render(lockup_svg(), STORE / "logo_mark.png", width=640)
|
||||
written.append(lockup)
|
||||
written.append(A.render(lockup_svg(), APP_ASSETS / "logo_mark.png", width=640))
|
||||
|
||||
written.append(A.render(lockup_svg(), ANDROID / "drawable-xxxhdpi" / "launch_logo.png", width=512))
|
||||
written.append(
|
||||
A.render(splash_icon_svg(512), ANDROID / "drawable-xxxhdpi" / "launch_logo_splash.png")
|
||||
)
|
||||
|
||||
for density, factor in DENSITIES.items():
|
||||
folder = ANDROID / f"mipmap-{density}"
|
||||
legacy = int(48 * factor)
|
||||
adaptive = int(108 * factor)
|
||||
written.append(A.render(icon_svg(1024), folder / "ic_launcher.png", width=legacy))
|
||||
written.append(
|
||||
A.render(foreground_svg(adaptive), folder / "ic_launcher_foreground.png")
|
||||
)
|
||||
written.append(
|
||||
A.render(background_svg(adaptive), folder / "ic_launcher_background.png")
|
||||
)
|
||||
written.append(
|
||||
A.render(monochrome_svg(adaptive), folder / "ic_launcher_monochrome.png")
|
||||
)
|
||||
|
||||
anydpi = ANDROID / "mipmap-anydpi-v26"
|
||||
anydpi.mkdir(parents=True, exist_ok=True)
|
||||
for name in ("ic_launcher.xml", "ic_launcher_round.xml"):
|
||||
path = anydpi / name
|
||||
path.write_text(ADAPTIVE_XML, encoding="utf-8")
|
||||
written.append(path)
|
||||
return written
|
||||
|
||||
|
||||
def preview() -> Path:
|
||||
items = [
|
||||
STORE / "icon_512.png",
|
||||
STORE / "feature_1024x500.png",
|
||||
STORE / "logo_mark.png",
|
||||
ANDROID / "drawable-xxxhdpi" / "launch_logo_splash.png",
|
||||
ANDROID / "mipmap-xxxhdpi" / "ic_launcher.png",
|
||||
ANDROID / "mipmap-mdpi" / "ic_launcher.png",
|
||||
ANDROID / "mipmap-xxxhdpi" / "ic_launcher_foreground.png",
|
||||
ANDROID / "mipmap-xxxhdpi" / "ic_launcher_monochrome.png",
|
||||
]
|
||||
return A.contact_sheet(items, PREVIEW / "brand.png", cols=3, cell=340)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
for f in write_all():
|
||||
print(f.relative_to(A.ROOT), f.stat().st_size, "bytes")
|
||||
print("preview:", preview())
|
||||
@@ -0,0 +1,114 @@
|
||||
"""Frames raw device captures into Play-ready store screenshots.
|
||||
|
||||
Play accepts phone screenshots with an aspect ratio up to 2:1. The Redmi Note
|
||||
10 captures are 1080x2400 (9:20 = 2.22:1) and would be rejected, so each shot is
|
||||
scaled down and composited onto a 1080x1920 brand canvas: 16:9, no cropping of
|
||||
the UI, and the frame gives the store page a consistent look.
|
||||
|
||||
python3 tools/art/gen_screens.py
|
||||
|
||||
Raw captures live in store/screenshots/raw/, the framed results replace
|
||||
store/screenshots/01..04. Re-capture the raw shots after any visible change:
|
||||
|
||||
adb exec-out screencap -p > store/screenshots/raw/01_aiming.png
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFilter
|
||||
|
||||
import artlib as A
|
||||
|
||||
P = A.Palette.load()
|
||||
SCREENS = A.ROOT / "store" / "screenshots"
|
||||
RAW = SCREENS / "raw"
|
||||
|
||||
CANVAS = (1080, 1920)
|
||||
SHOT_HEIGHT = 1660 # leaves 130 px breathing room top and bottom
|
||||
CORNER = 34
|
||||
|
||||
|
||||
def _background() -> Image.Image:
|
||||
"""Vertical ink gradient with a warm glow behind the phone, plus vignette."""
|
||||
w, h = CANVAS
|
||||
img = Image.new("RGB", CANVAS, P.color("ink.0"))
|
||||
draw = ImageDraw.Draw(img)
|
||||
|
||||
top = (5, 7, 10)
|
||||
mid = (16, 27, 41)
|
||||
bottom = (8, 10, 14)
|
||||
for y in range(h):
|
||||
t = y / (h - 1)
|
||||
if t < 0.55:
|
||||
k = t / 0.55
|
||||
color = tuple(int(top[i] + (mid[i] - top[i]) * k) for i in range(3))
|
||||
else:
|
||||
k = (t - 0.55) / 0.45
|
||||
color = tuple(int(mid[i] + (bottom[i] - mid[i]) * k) for i in range(3))
|
||||
draw.line([(0, y), (w, y)], fill=color)
|
||||
|
||||
glow = Image.new("RGB", CANVAS, (0, 0, 0))
|
||||
gd = ImageDraw.Draw(glow)
|
||||
gd.ellipse([w * 0.05, h * 0.18, w * 0.95, h * 0.82], fill=(90, 52, 20))
|
||||
glow = glow.filter(ImageFilter.GaussianBlur(180))
|
||||
return Image.blend(img, Image.blend(img, glow, 0.35), 0.55)
|
||||
|
||||
|
||||
def _rounded(img: Image.Image, radius: int) -> Image.Image:
|
||||
mask = Image.new("L", img.size, 0)
|
||||
ImageDraw.Draw(mask).rounded_rectangle([0, 0, img.size[0] - 1, img.size[1] - 1],
|
||||
radius=radius, fill=255)
|
||||
out = img.convert("RGBA")
|
||||
out.putalpha(mask)
|
||||
return out
|
||||
|
||||
|
||||
def frame(raw: Path, out: Path) -> Path:
|
||||
shot = Image.open(raw).convert("RGB")
|
||||
scale = SHOT_HEIGHT / shot.height
|
||||
shot = shot.resize((int(shot.width * scale), SHOT_HEIGHT), Image.LANCZOS)
|
||||
shot = _rounded(shot, CORNER)
|
||||
|
||||
canvas = _background().convert("RGBA")
|
||||
x = (CANVAS[0] - shot.width) // 2
|
||||
y = (CANVAS[1] - SHOT_HEIGHT) // 2
|
||||
|
||||
shadow = Image.new("RGBA", CANVAS, (0, 0, 0, 0))
|
||||
ImageDraw.Draw(shadow).rounded_rectangle(
|
||||
[x + 10, y + 26, x + shot.width + 10, y + SHOT_HEIGHT + 26],
|
||||
radius=CORNER, fill=(0, 0, 0, 150))
|
||||
shadow = shadow.filter(ImageFilter.GaussianBlur(28))
|
||||
canvas = Image.alpha_composite(canvas, shadow)
|
||||
|
||||
# Hairline edge so the frame reads as a device, not a pasted image.
|
||||
edge = Image.new("RGBA", CANVAS, (0, 0, 0, 0))
|
||||
ImageDraw.Draw(edge).rounded_rectangle(
|
||||
[x - 1, y - 1, x + shot.width, y + SHOT_HEIGHT],
|
||||
radius=CORNER + 1, outline=(255, 255, 255, 40), width=2)
|
||||
canvas = Image.alpha_composite(canvas, edge)
|
||||
canvas.paste(shot, (x, y), shot)
|
||||
|
||||
out.parent.mkdir(parents=True, exist_ok=True)
|
||||
canvas.convert("RGB").save(out, optimize=True)
|
||||
return out
|
||||
|
||||
|
||||
def main() -> int:
|
||||
raws = sorted(RAW.glob("*.png"))
|
||||
if not raws:
|
||||
print(f"no raw captures in {RAW} - run the adb captures first", file=sys.stderr)
|
||||
return 1
|
||||
for raw in raws:
|
||||
target = SCREENS / raw.name
|
||||
frame(raw, target)
|
||||
print(f" {target.relative_to(A.ROOT)} {Image.open(target).size}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"$comment": "Single source of truth for the IRON ARC look. Used by tools/art/artgen.py and mirrored into app/lib/src/ui/palette.dart.",
|
||||
"ink": {
|
||||
"0": "#05070A",
|
||||
"1": "#0A1220",
|
||||
"2": "#101B2E",
|
||||
"3": "#1B2C44"
|
||||
},
|
||||
"solar": {
|
||||
"light": "#FFD9A0",
|
||||
"base": "#FFB347",
|
||||
"deep": "#FF7A2F"
|
||||
},
|
||||
"steel": {
|
||||
"light": "#9FE3F0",
|
||||
"base": "#4EA8C8",
|
||||
"deep": "#2C6F8A"
|
||||
},
|
||||
"terrain": {
|
||||
"rim": "#E8C08A",
|
||||
"top": "#7A6A45",
|
||||
"soil": "#3A2F20",
|
||||
"deep": "#241C12"
|
||||
},
|
||||
"state": {
|
||||
"danger": "#FF5A5F",
|
||||
"ok": "#6BD08A"
|
||||
},
|
||||
"text": {
|
||||
"hi": "#F5F7FA",
|
||||
"mid": "#A9B4C4",
|
||||
"low": "#6C7A8D"
|
||||
},
|
||||
"type": {
|
||||
"display": "Roboto",
|
||||
"displayWeight": 900,
|
||||
"trackingEm": -0.02
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,16 @@ done
|
||||
(cd build/native-symbols && zip -qr ../native-debug-symbols.zip .)
|
||||
echo "symbols: $(stat -c%s build/native-debug-symbols.zip) bytes"
|
||||
|
||||
echo '==> Release guards'
|
||||
policy_url=$(grep -A1 'const String kPrivacyPolicyUrl' app/lib/src/ui/links.dart \
|
||||
| grep -oE "https://[^']+" | head -1)
|
||||
if [ -z "$policy_url" ] || printf '%s' "$policy_url" | grep -q 'example.invalid'; then
|
||||
echo 'ERROR: privacy policy URL is missing or still the placeholder (app/lib/src/ui/links.dart).' >&2
|
||||
echo ' Play rejects a listing whose privacy policy is not reachable.' >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "OK: privacy policy -> $policy_url"
|
||||
|
||||
echo '==> Flutter bundle (AAB)'
|
||||
(cd app && flutter build appbundle --release)
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
# Cold-start measurement: time to first frame plus the in-app boot log.
|
||||
#
|
||||
# `am start -W` measures until the activity is idle. That number is polluted by
|
||||
# the Google UMP consent form (a second window), so run this only *after*
|
||||
# consent has been given once - otherwise TotalTime includes the dialog.
|
||||
#
|
||||
# Usage: tools/device/startup.sh [runs] (default 3)
|
||||
set -euo pipefail
|
||||
ADB=${ADB:-adb}
|
||||
PKG=${PKG:-de.softwareapp_hb.ironarc}
|
||||
ACT=${ACT:-.MainActivity}
|
||||
RUNS=${1:-3}
|
||||
|
||||
echo "## Kaltstart ($RUNS Laeufe, $PKG)"
|
||||
for i in $(seq 1 "$RUNS"); do
|
||||
$ADB shell am force-stop "$PKG"
|
||||
sleep 2
|
||||
$ADB logcat -c
|
||||
total=$($ADB shell am start -W -n "$PKG/$ACT" 2>/dev/null \
|
||||
| tr -d '\r' | awk '/TotalTime/ {print $2}')
|
||||
sleep 2
|
||||
ready=$($ADB logcat -d 2>/dev/null | tr -d '\r' \
|
||||
| grep -oE 'iron_arc: ready after [0-9]+ ms' | tail -1)
|
||||
echo " Lauf $i: TotalTime ${total:-?} ms | ${ready:-kein Bootlog (Release ohne Log?)}"
|
||||
done
|
||||
|
||||
echo
|
||||
echo "Richtwerte (Redmi Note 10, Android 12): Debug ~3050 ms, Profile/AOT ~2040 ms."
|
||||
echo "Splash-Kette: nativer Splash -> Flutter-Splash (Puls, min. 700 ms) -> Fade in die Partie."
|
||||