werewolf.ts 588 B

12345678910111213141516171819
  1. import { cloudApi } from '@/api'
  2. import type { WerewolfGame, WerewolfPlayer } from '@/types/games/werewolf'
  3. // 狼人杀游戏相关API
  4. export const werewolfService = {
  5. // 获取游戏数据
  6. getGameData(gameId: string, role: string) {
  7. return cloudApi.call<{ game: WerewolfGame }>('getWerewolfGame', { gameId, role })
  8. },
  9. // 玩家行动
  10. playerAction(gameId: string, playerId: string, action: string, target?: string) {
  11. return cloudApi.call<{ success: boolean }>('werewolfAction', {
  12. gameId, playerId, action, target
  13. })
  14. },
  15. // ... 狼人杀特有方法
  16. }