Initial commit: Text Adventure Game

Features:
- Combat system with AP/EP hit calculation and three-layer defense
- Auto-combat/farming mode
- Item system with stacking support
- Skill system with levels, milestones, and parent skill sync
- Shop system with dynamic pricing
- Inventory management with bulk selling
- Event system
- Game loop with offline earnings
- Save/Load system

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-01-21 17:13:51 +08:00
commit cb412544e9
90 changed files with 17149 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
<template>
<view class="collapse">
<view class="collapse__header" @click="toggle">
<text class="collapse__title">{{ title }}</text>
<text class="collapse__arrow">{{ isExpanded ? '▼' : '▶' }}</text>
</view>
<view v-show="isExpanded" class="collapse__content">
<slot></slot>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
const props = defineProps({
title: { type: String, default: '' },
expanded: { type: Boolean, default: false }
})
const emit = defineEmits(['toggle'])
const isExpanded = ref(props.expanded)
function toggle() {
isExpanded.value = !isExpanded.value
emit('toggle', isExpanded.value)
}
</script>
<style lang="scss" scoped>
.collapse {
border-top: 1rpx solid $border-color;
&__header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx;
background-color: $bg-secondary;
cursor: pointer;
&:active {
background-color: $bg-tertiary;
}
}
&__title {
color: $text-primary;
font-size: 28rpx;
}
&__arrow {
color: $text-secondary;
font-size: 20rpx;
transition: transform 0.2s;
}
&__content {
padding: 16rpx;
background-color: $bg-primary;
}
}
</style>

View File

@@ -0,0 +1,49 @@
<template>
<view class="filter-tabs">
<view
v-for="tab in tabs"
:key="tab.id"
class="filter-tabs__item"
:class="{ 'filter-tabs__item--active': modelValue === tab.id }"
@click="$emit('update:modelValue', tab.id)"
>
<text>{{ tab.label }}</text>
</view>
</view>
</template>
<script setup>
defineProps({
tabs: { type: Array, default: () => [] },
modelValue: { type: String, default: '' }
})
defineEmits(['update:modelValue'])
</script>
<style lang="scss" scoped>
.filter-tabs {
display: flex;
gap: 8rpx;
padding: 8rpx;
flex-wrap: wrap;
&__item {
padding: 12rpx 20rpx;
border-radius: 8rpx;
background-color: $bg-tertiary;
color: $text-secondary;
font-size: 24rpx;
transition: all 0.2s;
&:active {
transform: scale(0.95);
}
&--active {
background-color: $accent;
color: $bg-primary;
}
}
}
</style>

View File

@@ -0,0 +1,53 @@
<template>
<view class="progress-bar" :style="{ height }">
<view class="progress-bar__fill" :style="fillStyle"></view>
<view v-if="showText" class="progress-bar__text">
{{ value }}/{{ max }}
</view>
</view>
</template>
<script setup>
import { computed } from 'vue'
const props = defineProps({
value: { type: Number, default: 0 },
max: { type: Number, default: 100 },
color: { type: String, default: '#4ecdc4' },
showText: { type: Boolean, default: true },
height: { type: String, default: '16rpx' }
})
const percentage = computed(() => {
return Math.min(100, Math.max(0, (props.value / props.max) * 100))
})
const fillStyle = computed(() => ({
width: `${percentage.value}%`,
backgroundColor: props.color
}))
</script>
<style lang="scss" scoped>
.progress-bar {
position: relative;
background-color: $bg-tertiary;
border-radius: 8rpx;
overflow: hidden;
&__fill {
height: 100%;
transition: width 0.3s ease;
}
&__text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 20rpx;
color: $text-primary;
text-shadow: 0 0 4rpx rgba(0,0,0,0.8);
}
}
</style>

View File

@@ -0,0 +1,29 @@
<template>
<view class="stat-item">
<text v-if="icon" class="stat-item__icon">{{ icon }}</text>
<text class="stat-item__label">{{ label }}</text>
<text class="stat-item__value" :style="{ color }">{{ value }}</text>
</view>
</template>
<script setup>
defineProps({
label: String,
value: [Number, String],
icon: String,
color: { type: String, default: '#e0e0e0' }
})
</script>
<style lang="scss" scoped>
.stat-item {
display: inline-flex;
align-items: center;
gap: 8rpx;
padding: 8rpx 16rpx;
&__icon { font-size: 28rpx; }
&__label { color: $text-secondary; }
&__value { font-weight: bold; }
}
</style>

View File

@@ -0,0 +1,68 @@
<template>
<view
class="text-button"
:class="[`text-button--${type}`, { 'text-button--disabled': disabled }]"
@click="handleClick"
>
<text>{{ text }}</text>
</view>
</template>
<script setup>
const props = defineProps({
text: { type: String, required: true },
type: { type: String, default: 'default' },
disabled: { type: Boolean, default: false }
})
const emit = defineEmits(['click'])
function handleClick() {
if (!props.disabled) {
emit('click')
}
}
</script>
<style lang="scss" scoped>
.text-button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 16rpx 32rpx;
border-radius: 8rpx;
transition: all 0.2s;
&--default {
background-color: $bg-tertiary;
color: $text-primary;
&:active {
background-color: $bg-secondary;
}
}
&--danger {
background-color: rgba($danger, 0.2);
color: $danger;
&:active {
background-color: rgba($danger, 0.3);
}
}
&--warning {
background-color: rgba($warning, 0.2);
color: $warning;
&:active {
background-color: rgba($warning, 0.3);
}
}
&--disabled {
opacity: 0.5;
pointer-events: none;
}
}
</style>