diff --git a/style.css b/style.css index a767944..d1970c8 100644 --- a/style.css +++ b/style.css @@ -1,7 +1,9 @@ :root { + --primary-text: #00d000; + --primary-bg: black; font-family: 'Consolas', 'Cascadia Code', monospace; - color: #00d000; - background: black; + color: var(--primary-text); + background-color: var(--primary-bg); } .tooltip { @@ -42,4 +44,4 @@ a:hover{ font-size: x-large; color:#1F4F82; text-decoration:underline; -} \ No newline at end of file +} diff --git a/user-pages/chauncey-den/backend/game_manager.js b/user-pages/chauncey-den/backend/game_manager.js new file mode 100644 index 0000000..8946338 --- /dev/null +++ b/user-pages/chauncey-den/backend/game_manager.js @@ -0,0 +1,65 @@ +import { GameValue, GameUnlockable } from "../game_engine/types.js"; + +export class GameManager { + constructor() { + // Values + this.clickCount = new GameValue(0); + this.clickModifier = new GameValue(1); + this.chaunceyCount = new GameValue(0); + this.handlerCount = new GameValue(0); + + // Unlocks + this.unlocks = {}; + this.unlocks.firstClick = new GameUnlockable(); + this.unlocks.tenthClick = new GameUnlockable(); + + // Resource unlocks + this.unlocks.resources = new GameUnlockable(); + this.unlocks.chaunceys = new GameUnlockable(); + + // Upgrade unlocks + this.unlocks.upgrades = new GameUnlockable(); + this.unlocks.handlers = new GameUnlockable(); + + this._connectResourceMilestones(); + this._connectUpgradeMilestones(); + this._connectClickMilestones(); + } + + _connectResourceMilestones() { + // Unlock resources and chaunceys on first click + this.unlocks.firstClick.onUnlocked.onNextEventFired(() => { + this.unlocks.resources.onUnlocked.fireEvent(); + this.unlocks.chaunceys.onUnlocked.fireEvent(); + }); + } + + _connectUpgradeMilestones() { + // Unlock upgrades and handlers on tenth click + this.unlocks.tenthClick.onUnlocked.onNextEventFired(() => { + this.unlocks.upgrades.onUnlocked.fireEvent(); + this.unlocks.handlers.onUnlocked.fireEvent(); + }); + } + + _connectClickMilestones() { + // Increment chaunceys each click + this.clickCount.onChanged.onEachEventFired(() => { + this.chaunceyCount.value += this.clickModifier.value; + }); + + // Unlock first click + this.clickCount.onChanged.onNextEventFired(() => { + this.unlocks.firstClick.unlock(); + }); + + // Unlock tenth click + let unlockTenthClick = (clicks) => { + if (clicks >= 10) { + this.unlocks.tenthClick.unlock(); + this.clickCount.onChanged.removeRecurringCallback(self); + } + } + this.clickCount.onChanged.onEachEventFired(unlockTenthClick); + } +} diff --git a/user-pages/chauncey-den/chauncey-den.css b/user-pages/chauncey-den/chauncey-den.css index 0757cf6..6a82312 100644 --- a/user-pages/chauncey-den/chauncey-den.css +++ b/user-pages/chauncey-den/chauncey-den.css @@ -2,6 +2,10 @@ /* First media query is for phone. */ /* A second one is planned for desktops. */ +:root { + color: var(--primary-text) +} + #page-container { margin-block: 0; margin-inline: auto; @@ -51,11 +55,30 @@ h2 { p { margin: 0; - padding-inline: 3dvh; - padding-bottom: 0.75dvh; + margin-bottom: 0.75dvh; + font-size: 2.2dvh; +} + +span { font-size: 2.2dvh; } +button { + margin: 0; + margin-bottom: 0.75dvh; + font-size: 2.1dvh; + color: var(--primary-text); + background-color: var(--primary-bg); +} + +.indent-1 { + margin-left: 3dvh; +} + +.indent-2 { + margin-left: 6dvh; +} + /* Phone */ @media (max-width: 600px) { #page-container { @@ -80,8 +103,24 @@ p { } p { - padding-inline: 4dvw; - padding-bottom: 1dvw; + margin-bottom: 1dvw; font-size: 4dvw; } + + span { + font-size: 4dvw; + } + + button { + margin-bottom: 1dvw; + font-size: 3.8dvw; + } + + .indent-1 { + margin-left: 4dvw; + } + + .indent-2 { + margin-left: 8dvw; + } } diff --git a/user-pages/chauncey-den/chauncey-den.html b/user-pages/chauncey-den/chauncey-den.html index dbf67cb..3663d3c 100644 --- a/user-pages/chauncey-den/chauncey-den.html +++ b/user-pages/chauncey-den/chauncey-den.html @@ -5,7 +5,7 @@ - +
Chaunceys: 0
+Chaunceys: 0
+Chauncey Handlers: 0
++1 ChPS
+ +