Require an earned rewarded ad for every puzzle hint
This commit is contained in:
+9
-19
@@ -69,10 +69,12 @@ class Notebook extends StatefulWidget {
|
||||
required this.game,
|
||||
required this.adsEnabled,
|
||||
this.narrator,
|
||||
this.ads,
|
||||
});
|
||||
final Game game;
|
||||
final bool adsEnabled;
|
||||
final Narrator? narrator;
|
||||
final Ads? ads;
|
||||
@override
|
||||
State<Notebook> createState() => _NotebookState();
|
||||
}
|
||||
@@ -93,7 +95,7 @@ class _NotebookState extends State<Notebook> with WidgetsBindingObserver {
|
||||
narrator = widget.narrator ?? Narrator(g.book.tracks);
|
||||
ambience = Ambience();
|
||||
narrator.addListener(_syncAtmosphere);
|
||||
ads = Ads(enabled: widget.adsEnabled);
|
||||
ads = widget.ads ?? Ads(enabled: widget.adsEnabled);
|
||||
g.addListener(_changed);
|
||||
_route = route;
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
@@ -1033,17 +1035,7 @@ class _NotebookState extends State<Notebook> with WidgetsBindingObserver {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: InkButton(
|
||||
g.mode == Mode.campaign
|
||||
? 'Hint · free'
|
||||
: prefs.flag('hint_${g.key}')
|
||||
? 'Hint · rewarded ad'
|
||||
: 'Hint · free',
|
||||
hint,
|
||||
size: 22,
|
||||
),
|
||||
),
|
||||
Expanded(child: InkButton('Hint · rewarded ad', hint, size: 22)),
|
||||
],
|
||||
),
|
||||
];
|
||||
@@ -1183,8 +1175,10 @@ class _NotebookState extends State<Notebook> with WidgetsBindingObserver {
|
||||
|
||||
Future<void> hint() async {
|
||||
final requested = g.key;
|
||||
var granted = false;
|
||||
void give() async {
|
||||
if (!mounted ||
|
||||
if (granted ||
|
||||
!mounted ||
|
||||
g.key != requested ||
|
||||
g.won ||
|
||||
!(g.screen == Screen.game ||
|
||||
@@ -1192,6 +1186,7 @@ class _NotebookState extends State<Notebook> with WidgetsBindingObserver {
|
||||
g.storyPage.type == StoryPageType.puzzle)) {
|
||||
return;
|
||||
}
|
||||
granted = true;
|
||||
final h = g.applyHint();
|
||||
if (h == null) return;
|
||||
await message(
|
||||
@@ -1207,11 +1202,6 @@ class _NotebookState extends State<Notebook> with WidgetsBindingObserver {
|
||||
}
|
||||
}
|
||||
|
||||
if (g.mode == Mode.campaign || !prefs.flag('hint_$requested')) {
|
||||
await prefs.set('hint_$requested', true);
|
||||
give();
|
||||
return;
|
||||
}
|
||||
if (!await confirm(
|
||||
'A little nudge?',
|
||||
'Watch a rewarded ad for one explained hint.',
|
||||
@@ -1341,7 +1331,7 @@ class _NotebookState extends State<Notebook> with WidgetsBindingObserver {
|
||||
|
||||
void rules() => message(
|
||||
'Find the light',
|
||||
'Light exactly as many cells as the number beside each row and above each column.\n\nTap to cycle: empty → light → crossed out → empty. Mark every cell to finish. Small dots mark fixed clues.\n\nA, B and C are overlapping areas with their own totals. Shared cells count in both areas. Compare clues and subtract their shared parts to find new deductions.\n\nEvery story grid reveals an object. Later pages require area comparisons; all are solvable without guessing. Classic practice grades the length of simpler row and column chains.\n\nStory hints are always free and explained. Daily and classic puzzles offer one free hint, then optional rewarded hints. Streaks count consecutive daily completions on this device.',
|
||||
'Light exactly as many cells as the number beside each row and above each column.\n\nTap to cycle: empty → light → crossed out → empty. Mark every cell to finish. Small dots mark fixed clues.\n\nA, B and C are overlapping areas with their own totals. Shared cells count in both areas. Compare clues and subtract their shared parts to find new deductions.\n\nEvery story grid reveals an object. Later pages require area comparisons; all are solvable without guessing. Classic practice grades the length of simpler row and column chains.\n\nWatch a rewarded ad for each explained hint. Hints are optional, and your puzzle remains available if no ad can be shown. Streaks count consecutive daily completions on this device.',
|
||||
close: 'Got it',
|
||||
);
|
||||
Future<void> privacy() async {
|
||||
|
||||
Reference in New Issue
Block a user