GRASS
Browse files
public/assets/grass.PNG
ADDED
|
|
Git LFS Details
|
src/App.svelte
CHANGED
|
@@ -34,10 +34,12 @@
|
|
| 34 |
|
| 35 |
// UI state
|
| 36 |
let isDetailPageOpen = $state(false);
|
|
|
|
| 37 |
|
| 38 |
$effect(() => {
|
| 39 |
const unsubscribe = uiStore.subscribe(state => {
|
| 40 |
isDetailPageOpen = state.isDetailPageOpen;
|
|
|
|
| 41 |
});
|
| 42 |
return unsubscribe;
|
| 43 |
});
|
|
@@ -122,7 +124,7 @@
|
|
| 122 |
</script>
|
| 123 |
|
| 124 |
<div class="app">
|
| 125 |
-
{#if !isDetailPageOpen}
|
| 126 |
<ProgressBar />
|
| 127 |
<AppHeader {hfAuth} currentTab={tabNames[activeTab]} />
|
| 128 |
{/if}
|
|
@@ -141,7 +143,7 @@
|
|
| 141 |
{/if}
|
| 142 |
</main>
|
| 143 |
|
| 144 |
-
{#if !isDetailPageOpen}
|
| 145 |
<TabBar {activeTab} onTabChange={handleTabChange} />
|
| 146 |
{/if}
|
| 147 |
</div>
|
|
|
|
| 34 |
|
| 35 |
// UI state
|
| 36 |
let isDetailPageOpen = $state(false);
|
| 37 |
+
let isInBattle = $state(false);
|
| 38 |
|
| 39 |
$effect(() => {
|
| 40 |
const unsubscribe = uiStore.subscribe(state => {
|
| 41 |
isDetailPageOpen = state.isDetailPageOpen;
|
| 42 |
+
isInBattle = state.isInBattle;
|
| 43 |
});
|
| 44 |
return unsubscribe;
|
| 45 |
});
|
|
|
|
| 124 |
</script>
|
| 125 |
|
| 126 |
<div class="app">
|
| 127 |
+
{#if !isDetailPageOpen && !isInBattle}
|
| 128 |
<ProgressBar />
|
| 129 |
<AppHeader {hfAuth} currentTab={tabNames[activeTab]} />
|
| 130 |
{/if}
|
|
|
|
| 143 |
{/if}
|
| 144 |
</main>
|
| 145 |
|
| 146 |
+
{#if !isDetailPageOpen && !isInBattle}
|
| 147 |
<TabBar {activeTab} onTabChange={handleTabChange} />
|
| 148 |
{/if}
|
| 149 |
</div>
|
src/lib/components/Battle/BattleField.svelte
CHANGED
|
@@ -183,7 +183,7 @@
|
|
| 183 |
position: absolute;
|
| 184 |
bottom: -20px;
|
| 185 |
left: -20px;
|
| 186 |
-
z-index:
|
| 187 |
}
|
| 188 |
|
| 189 |
/* Player Row */
|
|
@@ -217,7 +217,7 @@
|
|
| 217 |
position: absolute;
|
| 218 |
bottom: -40px;
|
| 219 |
left: -20px;
|
| 220 |
-
z-index:
|
| 221 |
}
|
| 222 |
|
| 223 |
/* Platform fallbacks */
|
|
@@ -245,6 +245,8 @@
|
|
| 245 |
.piclet-image {
|
| 246 |
image-rendering: auto;
|
| 247 |
filter: drop-shadow(-2px 0 4px rgba(0, 0, 0, 0.1));
|
|
|
|
|
|
|
| 248 |
}
|
| 249 |
|
| 250 |
.spacer {
|
|
|
|
| 183 |
position: absolute;
|
| 184 |
bottom: -20px;
|
| 185 |
left: -20px;
|
| 186 |
+
z-index: 0;
|
| 187 |
}
|
| 188 |
|
| 189 |
/* Player Row */
|
|
|
|
| 217 |
position: absolute;
|
| 218 |
bottom: -40px;
|
| 219 |
left: -20px;
|
| 220 |
+
z-index: 0;
|
| 221 |
}
|
| 222 |
|
| 223 |
/* Platform fallbacks */
|
|
|
|
| 245 |
.piclet-image {
|
| 246 |
image-rendering: auto;
|
| 247 |
filter: drop-shadow(-2px 0 4px rgba(0, 0, 0, 0.1));
|
| 248 |
+
position: relative;
|
| 249 |
+
z-index: 1;
|
| 250 |
}
|
| 251 |
|
| 252 |
.spacer {
|
src/lib/components/Pages/Encounters.svelte
CHANGED
|
@@ -6,6 +6,7 @@
|
|
| 6 |
import { EncounterService } from '$lib/db/encounterService';
|
| 7 |
import { getOrCreateGameState, incrementCounter, addProgressPoints } from '$lib/db/gameState';
|
| 8 |
import { db } from '$lib/db';
|
|
|
|
| 9 |
import Battle from './Battle.svelte';
|
| 10 |
|
| 11 |
let encounters: Encounter[] = [];
|
|
@@ -178,6 +179,7 @@
|
|
| 178 |
battleEnemyPiclet = enemyPiclet;
|
| 179 |
battleIsWild = true;
|
| 180 |
showBattle = true;
|
|
|
|
| 181 |
} catch (error) {
|
| 182 |
console.error('Error starting battle:', error);
|
| 183 |
}
|
|
@@ -298,6 +300,7 @@
|
|
| 298 |
|
| 299 |
function handleBattleEnd(result: any) {
|
| 300 |
showBattle = false;
|
|
|
|
| 301 |
|
| 302 |
if (result === true) {
|
| 303 |
// Victory
|
|
|
|
| 6 |
import { EncounterService } from '$lib/db/encounterService';
|
| 7 |
import { getOrCreateGameState, incrementCounter, addProgressPoints } from '$lib/db/gameState';
|
| 8 |
import { db } from '$lib/db';
|
| 9 |
+
import { uiStore } from '$lib/stores/ui';
|
| 10 |
import Battle from './Battle.svelte';
|
| 11 |
|
| 12 |
let encounters: Encounter[] = [];
|
|
|
|
| 179 |
battleEnemyPiclet = enemyPiclet;
|
| 180 |
battleIsWild = true;
|
| 181 |
showBattle = true;
|
| 182 |
+
uiStore.enterBattle();
|
| 183 |
} catch (error) {
|
| 184 |
console.error('Error starting battle:', error);
|
| 185 |
}
|
|
|
|
| 300 |
|
| 301 |
function handleBattleEnd(result: any) {
|
| 302 |
showBattle = false;
|
| 303 |
+
uiStore.exitBattle();
|
| 304 |
|
| 305 |
if (result === true) {
|
| 306 |
// Victory
|
src/lib/stores/ui.ts
CHANGED
|
@@ -2,17 +2,21 @@ import { writable } from 'svelte/store';
|
|
| 2 |
|
| 3 |
interface UIState {
|
| 4 |
isDetailPageOpen: boolean;
|
|
|
|
| 5 |
}
|
| 6 |
|
| 7 |
function createUIStore() {
|
| 8 |
const { subscribe, set, update } = writable<UIState>({
|
| 9 |
-
isDetailPageOpen: false
|
|
|
|
| 10 |
});
|
| 11 |
|
| 12 |
return {
|
| 13 |
subscribe,
|
| 14 |
openDetailPage: () => update(state => ({ ...state, isDetailPageOpen: true })),
|
| 15 |
-
closeDetailPage: () => update(state => ({ ...state, isDetailPageOpen: false }))
|
|
|
|
|
|
|
| 16 |
};
|
| 17 |
}
|
| 18 |
|
|
|
|
| 2 |
|
| 3 |
interface UIState {
|
| 4 |
isDetailPageOpen: boolean;
|
| 5 |
+
isInBattle: boolean;
|
| 6 |
}
|
| 7 |
|
| 8 |
function createUIStore() {
|
| 9 |
const { subscribe, set, update } = writable<UIState>({
|
| 10 |
+
isDetailPageOpen: false,
|
| 11 |
+
isInBattle: false
|
| 12 |
});
|
| 13 |
|
| 14 |
return {
|
| 15 |
subscribe,
|
| 16 |
openDetailPage: () => update(state => ({ ...state, isDetailPageOpen: true })),
|
| 17 |
+
closeDetailPage: () => update(state => ({ ...state, isDetailPageOpen: false })),
|
| 18 |
+
enterBattle: () => update(state => ({ ...state, isInBattle: true })),
|
| 19 |
+
exitBattle: () => update(state => ({ ...state, isInBattle: false }))
|
| 20 |
};
|
| 21 |
}
|
| 22 |
|