makefuture / games / accept-the-cookie / game / scenes / Zone1Scene.js
126 words
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { BaseZoneScene } from './BaseZoneScene.js?v=20260427c';
import { ZONE_DEFINITIONS } from '../systems/session.js?v=20260427c';

export class Zone1Scene extends BaseZoneScene {
    constructor() {
        super('Zone1Scene', ZONE_DEFINITIONS[0]);
    }

    drawBackground() {
        super.drawBackground();
        const hour = new Date().getHours();
        const night = hour < 6 || hour >= 20;
        if (this.session.consent.personalization && (night || this.session.device.darkMode)) {
            this.cameras.main.setBackgroundColor(0x10192b);
            this.add.circle(this.scale.width - 120, 120, 34, 0xf6f2cc, 0.8).setScrollFactor(0);
        } else {
            this.add.circle(this.scale.width - 120, 120, 42, 0xffd166, 0.7).setScrollFactor(0);
        }
    }

    zonePrompts() {
        return [
            {
                at: 11,
                key: 'Allow push notifications',
                title: 'Allow push notifications?',
                copy: 'Get important updates, bonus cookies, and tiny red badges that will absolutely not distract you later.',
                accept: 'Allow',
                decline: 'Block',
                onAccept: () => {
                    this.session.flags.notificationBadges = true;
                    this.session.currencies.cookies += 50;
                    this.algorithm.say('Perfect. You will never miss anything again.');
                },
            },
        ];
    }
}

static mirror of HEAD · about · clone: git clone https://git.makefuture.ro/makefuture.git