追加更新:DPS网站 独立汉化

This commit is contained in:
xkeyC 2023-12-12 20:25:36 +08:00
parent 932bf6f894
commit bbb6e89e65
2 changed files with 19 additions and 6 deletions

View File

@ -1,9 +1,10 @@
/// rsi : "0.2.11"
/// uex : "2.2"
/// rsi : "0.2.21"
/// uex : "2.3"
/// addresses : "1.0"
/// concierge : "1.1"
/// hangar : "1.2"
/// orgs : "1.3"
/// dps : "0.1.1"
class AppWebLocalizationVersionsData {
AppWebLocalizationVersionsData({
@ -12,7 +13,8 @@ class AppWebLocalizationVersionsData {
this.addresses,
this.concierge,
this.hangar,
this.orgs,});
this.orgs,
this.dps,});
AppWebLocalizationVersionsData.fromJson(dynamic json) {
rsi = json['rsi'];
@ -21,6 +23,7 @@ class AppWebLocalizationVersionsData {
concierge = json['concierge'];
hangar = json['hangar'];
orgs = json['orgs'];
dps = json['dps'];
}
String? rsi;
String? uex;
@ -28,6 +31,7 @@ class AppWebLocalizationVersionsData {
String? concierge;
String? hangar;
String? orgs;
String? dps;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
@ -37,6 +41,7 @@ class AppWebLocalizationVersionsData {
map['concierge'] = concierge;
map['hangar'] = hangar;
map['orgs'] = orgs;
map['dps'] = dps;
return map;
}

View File

@ -128,9 +128,15 @@ class WebViewModel {
webview.evaluateJavaScript(
"getRSILauncherToken(\"$loginChannel\");");
}
} else if (uri.host.contains("www.erkul.games") ||
uri.host.contains("uexcorp.space")) {
//
} else if (uri.host.contains("www.erkul.games")) {
dPrint("load script");
await Future.delayed(const Duration(milliseconds: 100));
await webview.evaluateJavaScript(localizationScript);
dPrint("update replaceWords");
final replaceWords = _getLocalizationResource("DPS");
await webview.evaluateJavaScript(
"WebLocalizationUpdateReplaceWords(${json.encode(replaceWords)},$enableCapture)");
} else if (uri.host.contains("uexcorp.space")) {
dPrint("load script");
await Future.delayed(const Duration(milliseconds: 100));
await webview.evaluateJavaScript(localizationScript);
@ -192,6 +198,8 @@ class WebViewModel {
cacheKey: "hangar", version: v.hangar);
localizationResource["UEX"] = await _getJson("$hostUrl/zh-CN-uex.json",
cacheKey: "uex", version: v.uex);
localizationResource["DPS"] = await _getJson("$hostUrl/zh-CN-dps.json",
cacheKey: "dps", version: v.dps);
}
List<Map<String, String>> _getLocalizationResource(String key) {