mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 06:33:43 +08:00
增加官方服务器状态展示
取消盒子内置的 CCUGames 汉化 增加外部浏览器拓展下载图标 性能优化选项下线HDR调整(官方已经在 3.20 正式服试装设置 UI)
This commit is contained in:
parent
54d15444d9
commit
9a68167062
@ -229,26 +229,6 @@
|
|||||||
"value": 1,
|
"value": 1,
|
||||||
"group": "图形(修改后建议清理着色器)"
|
"group": "图形(修改后建议清理着色器)"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"key": "r_HDRDisplayMaxNits",
|
|
||||||
"name": "HDR 最高亮度",
|
|
||||||
"info": "推荐设置为您显示器的最高亮度",
|
|
||||||
"type": "int",
|
|
||||||
"max": 2000,
|
|
||||||
"min": 300,
|
|
||||||
"value": 1000,
|
|
||||||
"group": "HDR设置 (在游戏设置启用HDR )"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "r_HDRDisplayRefWhite",
|
|
||||||
"name": "HDR 白点亮度",
|
|
||||||
"info": "调整画面明暗细节对比度",
|
|
||||||
"type": "int",
|
|
||||||
"max": 2000,
|
|
||||||
"min": 1,
|
|
||||||
"value": 150,
|
|
||||||
"group": "HDR设置 (在游戏设置启用HDR )"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"key": "r_displayinfo",
|
"key": "r_displayinfo",
|
||||||
"name": "屏幕信息(展示帧率)",
|
"name": "屏幕信息(展示帧率)",
|
||||||
|
@ -39,6 +39,12 @@ class Api {
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<List> getScServerStatus() async {
|
||||||
|
final r =
|
||||||
|
await dio.get("https://status.robertsspaceindustries.com/index.json");
|
||||||
|
return r.data["systems"];
|
||||||
|
}
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> getRepoJson(
|
static Future<Map<String, dynamic>> getRepoJson(
|
||||||
String dir, String name) async {
|
String dir, String name) async {
|
||||||
final data = await getRepoData(dir, name);
|
final data = await getRepoData(dir, name);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:extended_image/extended_image.dart';
|
import 'package:extended_image/extended_image.dart';
|
||||||
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:starcitizen_doctor/base/ui.dart';
|
import 'package:starcitizen_doctor/base/ui.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
@ -82,8 +83,15 @@ class HomeUI extends BaseUI<HomeUIModel> {
|
|||||||
Positioned(
|
Positioned(
|
||||||
top: 0,
|
top: 0,
|
||||||
right: 24,
|
right: 24,
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: FluentTheme.of(context).cardColor.withOpacity(.03),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
makeWebViewButton(model,
|
makeWebViewButton(model,
|
||||||
icon: SvgPicture.asset(
|
icon: SvgPicture.asset(
|
||||||
@ -132,23 +140,50 @@ class HomeUI extends BaseUI<HomeUIModel> {
|
|||||||
useLocalization: true,
|
useLocalization: true,
|
||||||
width: width),
|
width: width),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
makeWebViewButton(model,
|
const Text("外部浏览器拓展:"),
|
||||||
icon: Row(
|
const SizedBox(height: 8),
|
||||||
|
Row(
|
||||||
children: [
|
children: [
|
||||||
ExtendedImage.network(
|
Button(
|
||||||
"https://ccugame.app/assets/images/logo/logo.png",
|
child:
|
||||||
height: 20,
|
const FaIcon(FontAwesomeIcons.chrome, size: 18),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString(
|
||||||
|
"https://chrome.google.com/webstore/detail/gocnjckojmledijgmadmacoikibcggja?authuser=0&hl=zh-CN");
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
|
Button(
|
||||||
|
child: const FaIcon(FontAwesomeIcons.edge, size: 18),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString(
|
||||||
|
"https://microsoftedge.microsoft.com/addons/detail/lipbbcckldklpdcpfagicipecaacikgi");
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Button(
|
||||||
|
child: const FaIcon(FontAwesomeIcons.firefoxBrowser,
|
||||||
|
size: 18),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString(
|
||||||
|
"https://addons.mozilla.org/zh-CN/firefox/"
|
||||||
|
"addon/%E6%98%9F%E9%99%85%E5%85%AC%E6%B0%91%E7%9B%92%E5%AD%90%E6%B5%8F%E8%A7%88%E5%99%A8%E6%8B%93%E5%B1%95/");
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Button(
|
||||||
|
child:
|
||||||
|
const FaIcon(FontAwesomeIcons.github, size: 18),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString(
|
||||||
|
"https://github.com/xkeyC/StarCitizenBoxBrowserEx");
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
name: "CCUGame 网站汉化",
|
),
|
||||||
webTitle: "CCUGame 网站汉化",
|
|
||||||
webURL: "https://ccugame.app",
|
|
||||||
info: "资产管理和舰队规划,一定要理性消费.jpg",
|
|
||||||
useLocalization: true,
|
|
||||||
width: width),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
@ -156,6 +191,7 @@ class HomeUI extends BaseUI<HomeUIModel> {
|
|||||||
bottom: 0,
|
bottom: 0,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
const SizedBox(height: 12),
|
||||||
makeADCard(context, model,
|
makeADCard(context, model,
|
||||||
bgURl:
|
bgURl:
|
||||||
"https://i2.hdslb.com/bfs/face/7582c8d46fc03004f4f8032c667c0ea4dbbb1088.jpg",
|
"https://i2.hdslb.com/bfs/face/7582c8d46fc03004f4f8032c667c0ea4dbbb1088.jpg",
|
||||||
@ -169,6 +205,60 @@ class HomeUI extends BaseUI<HomeUIModel> {
|
|||||||
title: "星际公民中文百科",
|
title: "星际公民中文百科",
|
||||||
subtitle: "探索宇宙的好伙伴",
|
subtitle: "探索宇宙的好伙伴",
|
||||||
jumpUrl: "https://citizenwiki.cn"),
|
jumpUrl: "https://citizenwiki.cn"),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Container(
|
||||||
|
width: width,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: FluentTheme.of(context).cardColor,
|
||||||
|
),
|
||||||
|
child: IconButton(
|
||||||
|
icon: Padding(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
child: Column(children: [
|
||||||
|
const Row(
|
||||||
|
children: [
|
||||||
|
Text("星际公民服务器状态:"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
if (model.scServerStatus == null)
|
||||||
|
makeLoading(context, width: 20)
|
||||||
|
else
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
for (final item in model.scServerStatus ?? [])
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Center(
|
||||||
|
child: Icon(
|
||||||
|
item["status"] == "ok"
|
||||||
|
? FontAwesomeIcons.circleCheck
|
||||||
|
: FluentIcons.error,
|
||||||
|
color: item["status"] == "ok"
|
||||||
|
? Colors.green
|
||||||
|
: Colors.red,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Text(
|
||||||
|
"${model.statusCnName[item["name"]] ?? item["name"]}",
|
||||||
|
style: const TextStyle(fontSize: 13),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString(
|
||||||
|
"https://status.robertsspaceindustries.com/");
|
||||||
|
},
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
@ -202,6 +292,18 @@ class HomeUI extends BaseUI<HomeUIModel> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
|
AnimatedSize(
|
||||||
|
duration: const Duration(milliseconds: 130),
|
||||||
|
child: model.isRsiLauncherStarting
|
||||||
|
? makeLoading(context, width: 28)
|
||||||
|
: Button(
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.all(8.0),
|
||||||
|
child: Icon(FluentIcons.play),
|
||||||
|
),
|
||||||
|
onPressed: () => model.launchRSI()),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
Button(
|
Button(
|
||||||
child: const Padding(
|
child: const Padding(
|
||||||
padding: EdgeInsets.all(8.0),
|
padding: EdgeInsets.all(8.0),
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
@ -46,6 +47,18 @@ class HomeUIModel extends BaseUIModel {
|
|||||||
|
|
||||||
AppPlacardData? appPlacardData;
|
AppPlacardData? appPlacardData;
|
||||||
|
|
||||||
|
List? scServerStatus;
|
||||||
|
|
||||||
|
Timer? serverUpdateTimer;
|
||||||
|
|
||||||
|
final statusCnName = const {
|
||||||
|
"Platform": "平台",
|
||||||
|
"Persistent Universe": "持续宇宙",
|
||||||
|
"Electronic Access": "电子访问",
|
||||||
|
};
|
||||||
|
|
||||||
|
bool isRsiLauncherStarting = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future loadData() async {
|
Future loadData() async {
|
||||||
if (AppConf.networkVersionData == null) return;
|
if (AppConf.networkVersionData == null) return;
|
||||||
@ -53,21 +66,38 @@ class HomeUIModel extends BaseUIModel {
|
|||||||
final r = await Api.getAppPlacard();
|
final r = await Api.getAppPlacard();
|
||||||
final box = await Hive.openBox("app_conf");
|
final box = await Hive.openBox("app_conf");
|
||||||
final version = box.get("close_placard", defaultValue: "");
|
final version = box.get("close_placard", defaultValue: "");
|
||||||
if (r.enable != true) return;
|
if (r.enable == true) {
|
||||||
if (r.alwaysShow != true && version == r.version) return;
|
if (r.alwaysShow != true && version == r.version) {
|
||||||
|
} else {
|
||||||
appPlacardData = r;
|
appPlacardData = r;
|
||||||
notifyListeners();
|
}
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
dPrint(e);
|
dPrint(e);
|
||||||
}
|
}
|
||||||
|
notifyListeners();
|
||||||
|
updateSCServerStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initModel() {
|
void initModel() {
|
||||||
reScanPath();
|
reScanPath();
|
||||||
|
serverUpdateTimer = Timer.periodic(
|
||||||
|
const Duration(minutes: 1),
|
||||||
|
(timer) {
|
||||||
|
updateSCServerStatus();
|
||||||
|
},
|
||||||
|
);
|
||||||
super.initModel();
|
super.initModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
serverUpdateTimer?.cancel();
|
||||||
|
serverUpdateTimer = null;
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> reScanPath() async {
|
Future<void> reScanPath() async {
|
||||||
scInstallPaths.clear();
|
scInstallPaths.clear();
|
||||||
scInstalledPath = "not_install";
|
scInstalledPath = "not_install";
|
||||||
@ -91,6 +121,17 @@ class HomeUIModel extends BaseUIModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateSCServerStatus() async {
|
||||||
|
try {
|
||||||
|
final s = await Api.getScServerStatus();
|
||||||
|
dPrint("updateSCServerStatus===$s");
|
||||||
|
scServerStatus = s;
|
||||||
|
notifyListeners();
|
||||||
|
} catch (e) {
|
||||||
|
dPrint(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VoidCallback? doCheck() {
|
VoidCallback? doCheck() {
|
||||||
if (isChecking) return null;
|
if (isChecking) return null;
|
||||||
return () async {
|
return () async {
|
||||||
@ -407,4 +448,20 @@ class HomeUIModel extends BaseUIModel {
|
|||||||
await webViewModel.launch(url);
|
await webViewModel.launch(url);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
launchRSI() async {
|
||||||
|
isRsiLauncherStarting = true;
|
||||||
|
notifyListeners();
|
||||||
|
final rsiLauncherInstalledPath = await SystemHelper.getRSILauncherPath();
|
||||||
|
if (rsiLauncherInstalledPath.isEmpty) {
|
||||||
|
isRsiLauncherStarting = false;
|
||||||
|
notifyListeners();
|
||||||
|
showToast(context!, "未找到 RSI 启动器目录");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SystemHelper.checkAndLaunchRSILauncher(rsiLauncherInstalledPath);
|
||||||
|
await Future.delayed(const Duration(seconds: 3));
|
||||||
|
isRsiLauncherStarting = false;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user