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

View File

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