levels.ts - 儿童模式关卡数据

levels.ts - 儿童模式关卡数据

概述

定义儿童学习模式的关卡和世界数据结构,包含5个世界、20个关卡的学习路径。

数据模型

Level 接口

interface Level {
  slug: string;           // 唯一标识符
  title: string;          // 英文标题
  titleKey: string;       // i18n 翻译键
  description: string;    // 英文描述
  descriptionKey: string; // i18n 翻译键
  world: number;          // 所属世界编号
  levelNumber: number;    // 关卡内编号
  concepts: string[];     // 涉及的概念标签
}

World 接口

interface World {
  number: number;         // 世界编号
  title: string;          // 英文标题
  titleKey: string;       // i18n 翻译键
  slug: string;           // URL 标识
  emoji: string;          // 表情符号
  color: string;          // Tailwind 颜色类
  levels: Level[];        // 关卡列表
}

世界结构

世界标题表情颜色关卡数主题
1Starter Village🏠emerald3AI 基础与提示词入门
2Clarity Castle🏰blue4清晰度与细节
3Context Caves🕳️purple4上下文与示例
4Creation Canyon🎨orange4角色扮演与创作
5Master Mountain⛰️amber4高级技巧与精通

关卡列表

世界 1: Starter Village

  1. 1-1-meet-promi - 认识 Promi,了解什么是 AI
  2. 1-2-first-words - 写下第一个提示词
  3. 1-3-being-clear - 学习清晰的指令

世界 2: Clarity Castle

  1. 2-1-missing-details - 为什么细节很重要
  2. 2-2-who-and-what - 添加角色和物品
  3. 2-3-when-and-where - 添加时间和地点
  4. 2-4-detail-detective - 细节侦探大师

世界 3: Context Caves

  1. 3-1-setting-the-scene - 设置场景背景
  2. 3-2-show-dont-tell - 用示例说明
  3. 3-3-format-finder - 请求不同格式
  4. 3-4-context-champion - 上下文冠军

世界 4: Creation Canyon

  1. 4-1-pretend-time - 角色扮演提示词
  2. 4-2-story-starters - 故事创作
  3. 4-3-character-creator - 角色创建器
  4. 4-4-world-builder - 世界构建

世界 5: Master Mountain

  1. 5-1-perfect-prompt - 完美提示词
  2. 5-2-fix-it-up - 修复弱提示词
  3. 5-3-prompt-remix - 提示词改写
  4. 5-4-graduation-day - 毕业挑战

工具函数

getAllLevels

export function getAllLevels(): Level[]

获取所有关卡(平铺数组)。

getLevelBySlug

export function getLevelBySlug(slug: string): Level | undefined

根据 slug 获取指定关卡。

getWorldByNumber

export function getWorldByNumber(worldNumber: number): World | undefined

根据编号获取世界信息。

getAdjacentLevels

export function getAdjacentLevels(slug: string): { prev?: Level; next?: Level }

获取指定关卡的上一关和下一关。

getLevelIndex

export function getLevelIndex(slug: string): number

获取关卡在所有关卡中的索引位置(从0开始)。

getTotalLevels

export function getTotalLevels(): number

获取总关卡数量。

使用示例

import { 
  worlds, 
  getLevelBySlug, 
  getAdjacentLevels,
  getTotalLevels 
} from '@/lib/kids/levels';

// 获取特定关卡
const level = getLevelBySlug('1-1-meet-promi');

// 获取上一关和下一关
const { prev, next } = getAdjacentLevels('2-1-missing-details');

// 获取总关卡数
const total = getTotalLevels(); // 20

i18n 支持

所有标题和描述都使用翻译键,实际显示文本从 messages/{locale}.json 获取:

  • 世界标题: kids.worlds.{number}.title
  • 关卡标题: kids.levels.{slug}.title
  • 关卡描述: kids.levels.{slug}.description
← 返回目录