核心系统: - combatSystem: 战斗逻辑、伤害计算、战斗状态管理 - skillSystem: 技能系统、技能解锁、经验值、里程碑 - taskSystem: 任务系统、任务类型、任务执行和完成 - eventSystem: 事件系统、随机事件处理 - environmentSystem: 环境系统、时间流逝、区域效果 - levelingSystem: 升级系统、属性成长 - soundSystem: 音效系统 配置文件: - enemies: 敌人配置、掉落表 - events: 事件配置、事件效果 - items: 物品配置、装备属性 - locations: 地点配置、探索事件 - skills: 技能配置、技能树 UI组件: - CraftingDrawer: 制造界面 - InventoryDrawer: 背包界面 - 其他UI优化和动画 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
105 lines
1.9 KiB
JavaScript
105 lines
1.9 KiB
JavaScript
import { defineStore } from 'pinia'
|
|
import { ref } from 'vue'
|
|
|
|
export const useGameStore = defineStore('game', () => {
|
|
// 当前标签页
|
|
const currentTab = ref('status')
|
|
|
|
// 抽屉状态
|
|
const drawerState = ref({
|
|
inventory: false,
|
|
event: false,
|
|
shop: false,
|
|
crafting: false
|
|
})
|
|
|
|
// 日志
|
|
const logs = ref([])
|
|
|
|
// 游戏时间
|
|
const gameTime = ref({
|
|
day: 1,
|
|
hour: 8,
|
|
minute: 0,
|
|
totalMinutes: 480
|
|
})
|
|
|
|
// 战斗状态
|
|
const inCombat = ref(false)
|
|
const combatState = ref(null)
|
|
const autoCombat = ref(false) // 自动战斗模式
|
|
|
|
// 活动任务
|
|
const activeTasks = ref([])
|
|
|
|
// 负面状态
|
|
const negativeStatus = ref([])
|
|
|
|
// 市场价格
|
|
const marketPrices = ref({
|
|
lastRefreshDay: 1,
|
|
prices: {}
|
|
})
|
|
|
|
// 当前事件
|
|
const currentEvent = ref(null)
|
|
|
|
// 添加日志
|
|
function addLog(message, type = 'info') {
|
|
const time = `${String(gameTime.value.hour).padStart(2, '0')}:${String(gameTime.value.minute).padStart(2, '0')}`
|
|
logs.value.push({
|
|
id: Date.now(),
|
|
time,
|
|
message,
|
|
type
|
|
})
|
|
// 限制日志数量
|
|
if (logs.value.length > 200) {
|
|
logs.value.shift()
|
|
}
|
|
}
|
|
|
|
// 重置游戏状态
|
|
function resetGame() {
|
|
currentTab.value = 'status'
|
|
drawerState.value = {
|
|
inventory: false,
|
|
event: false,
|
|
shop: false
|
|
}
|
|
logs.value = []
|
|
gameTime.value = {
|
|
day: 1,
|
|
hour: 8,
|
|
minute: 0,
|
|
totalMinutes: 480
|
|
}
|
|
inCombat.value = false
|
|
combatState.value = null
|
|
autoCombat.value = false
|
|
activeTasks.value = []
|
|
negativeStatus.value = []
|
|
marketPrices.value = {
|
|
lastRefreshDay: 1,
|
|
prices: {}
|
|
}
|
|
currentEvent.value = null
|
|
}
|
|
|
|
return {
|
|
currentTab,
|
|
drawerState,
|
|
logs,
|
|
gameTime,
|
|
inCombat,
|
|
combatState,
|
|
autoCombat,
|
|
activeTasks,
|
|
negativeStatus,
|
|
marketPrices,
|
|
currentEvent,
|
|
addLog,
|
|
resetGame
|
|
}
|
|
})
|