diff --git a/src/components/ActionMenu.vue b/src/components/ActionMenu.vue index 2d323db..3cac302 100644 --- a/src/components/ActionMenu.vue +++ b/src/components/ActionMenu.vue @@ -3,7 +3,7 @@ - + @@ -27,7 +27,7 @@ const props = defineProps({ } }); -defineEmits(['clean', 'medicine', 'training', 'info']); +defineEmits(['clean', 'medicine', 'training', 'inventory']); diff --git a/src/components/InventoryScreen.vue b/src/components/InventoryScreen.vue new file mode 100644 index 0000000..e7079e2 --- /dev/null +++ b/src/components/InventoryScreen.vue @@ -0,0 +1,385 @@ + + + + 背包 + + + + + + x{{ item.count }} + + + + + + + + + + {{ hoveredItem.name }} + {{ hoveredItem.description }} + + + + + + + + diff --git a/src/components/PetGame.vue b/src/components/PetGame.vue index 59376bb..42ed27f 100644 --- a/src/components/PetGame.vue +++ b/src/components/PetGame.vue @@ -179,6 +179,15 @@ @close="showPetInfo = false" /> + + + @@ -206,6 +215,7 @@ import JiaobeiAnimation from './JiaobeiAnimation.vue'; import FortuneStickAnimation from './FortuneStickAnimation.vue'; import FortuneResult from './FortuneResult.vue'; import PetInfoScreen from './PetInfoScreen.vue'; +import InventoryScreen from './InventoryScreen.vue'; import guanyinLots from '../assets/guanyin_100_lots.json'; const props = defineProps({ @@ -240,19 +250,24 @@ const showJiaobeiAnimation = ref(false); const showFortuneStick = ref(false); const showFortuneResult = ref(false); const currentLotData = ref(null); +const currentLotNumber = ref(null); const consecutiveSaintCount = ref(0); const showPetInfo = ref(false); +const showInventory = ref(false); +const inventory = ref(new Array(16).fill(null)); +// Initialize some items +inventory.value[0] = { id: 'cookie', name: '幸運餅乾', description: '增加一點快樂值', count: 5, iconClass: 'icon-cookie' }; +inventory.value[1] = { id: 'water', name: '神水', description: '恢復健康', count: 2, iconClass: 'icon-water' }; +inventory.value[2] = { id: 'amulet', name: '平安符', description: '保佑寵物平安', count: 1, iconClass: 'icon-amulet' }; const infoPage = ref(0); const handlePrayerSelect = (mode) => { - fortuneMode.value = mode; showPrayerMenu.value = false; if (mode === 'jiaobei') { + fortuneMode.value = 'normal'; showJiaobeiAnimation.value = true; - } else if (mode === 'lots') { - showFortuneStick.value = true; - } else if (type === 'fortune') { + } else if (mode === 'fortune') { // 開始求籤流程 fortuneMode.value = 'fortune'; showFortuneStick.value = true; @@ -322,6 +337,27 @@ function handleCloseResult() { fortuneMode.value = 'normal'; } +function handleUseItem(item) { + console.log('Used item:', item.name); + // TODO: Implement item effects + + // Decrease count or remove item + const index = inventory.value.findIndex(i => i === item); + if (index !== -1) { + if (inventory.value[index].count > 1) { + inventory.value[index].count--; + } else { + inventory.value[index] = null; + } + } + + showInventory.value = false; +} + +function handleInventoryUpdate(newInventory) { + inventory.value = newInventory; +} + // Stats visibility toggle (removed local ref, using prop instead) // Poop position calculator (all on left side, strictly in game area)