From b1e9aef9d2698cf27eccde2f131eae3c4e6a65d0 Mon Sep 17 00:00:00 2001
From: 905086 <k2049@qq.com>
Date: Sun, 08 Nov 2026 16:10:17 +0800
Subject: [PATCH] docs: 添加项目信息和游戏功能需求文档
---
fluttergamebox/lib/api/api_service.dart | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/fluttergamebox/lib/api/api_service.dart b/fluttergamebox/lib/api/api_service.dart
index a0c78b5..79cfcf6 100644
--- a/fluttergamebox/lib/api/api_service.dart
+++ b/fluttergamebox/lib/api/api_service.dart
@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:fluttergamebox/api/api_client.dart';
+import 'package:fluttergamebox/utils/util.dart' show parseGb;
class Game {
final int id;
@@ -15,6 +16,7 @@
final String gpuReq;
final String ramReq;
final String versionNote;
+ final String launchExe; // 启动程序相对路径(相对游戏安装目录)
final String cover;
final String video;
final List<String> screenshots;
@@ -37,6 +39,7 @@
required this.gpuReq,
required this.ramReq,
required this.versionNote,
+ required this.launchExe,
required this.cover,
required this.video,
required this.screenshots,
@@ -75,6 +78,7 @@
gpuReq: j['gpu_req'] ?? '',
ramReq: j['ram_req'] ?? '',
versionNote: j['version_note'] ?? '',
+ launchExe: j['launch_exe'] ?? '',
cover: j['cover'] ?? '',
video: j['video'] ?? '',
screenshots: shots,
@@ -86,6 +90,13 @@
}
String get platformLabel => platform == 'switch' ? 'Switch资源' : 'PC资源';
+
+ /// 下载所需磁盘空间(GB):优先"磁盘占用",未设置时回退"游戏大小"
+ double get requiredDiskGb {
+ final install = parseGb(installSize);
+ if (install > 0) return install;
+ return parseGb(size);
+ }
}
class GameFile {
@@ -115,6 +126,7 @@
final String cover;
final String description;
final String fileUrl;
+ final String launchExe;
Tool({
required this.id,
required this.name,
@@ -122,6 +134,7 @@
required this.cover,
required this.description,
required this.fileUrl,
+ this.launchExe = '',
});
factory Tool.fromJson(Map<String, dynamic> j) => Tool(
id: j['id'],
@@ -130,6 +143,7 @@
cover: j['cover'] ?? '',
description: j['description'] ?? '',
fileUrl: j['file_url'] ?? '',
+ launchExe: j['launch_exe'] ?? '',
);
}
@@ -187,6 +201,9 @@
return (res['data'] as List).map((e) => Tool.fromJson(e)).toList();
}
+ static Future<Map<String, dynamic>> toolDownloadInfo(int toolId) async =>
+ await ApiClient.get('/api/tools/$toolId/download');
+
static Future<String> announcements() async {
final res = await ApiClient.get('/api/announcements');
if (res['code'] != 0) return '';
--
Gitblit v1.10.0