Merge pull request #1359 from IceCola97/PR-Branch
为更新后首次启动添加扩展报错提示;优化之前的代码;将安卓的更新url构造改成URL类构造
This commit is contained in:
commit
2107f6618c
|
@ -845,7 +845,6 @@ const skills = {
|
|||
return get.prompt("xinfu_zuilun") + "(可获得" + get.cnNumber(num) + "张牌)";
|
||||
},
|
||||
async content(event, trigger, player) {
|
||||
"step 0";
|
||||
let num = 0;
|
||||
const cards = get.cards(3);
|
||||
await game.cardsGotoOrdering(cards);
|
||||
|
@ -1389,7 +1388,6 @@ const skills = {
|
|||
return get.type(event.card) == "trick" && event.targets.length > 1 && player.countCards("he") > 0;
|
||||
},
|
||||
async cost(event, trigger, player) {
|
||||
"step 0";
|
||||
event.result = await player
|
||||
.chooseCardTarget({
|
||||
filterCard: true,
|
||||
|
@ -1590,7 +1588,6 @@ const skills = {
|
|||
return player.countCards("he") > 0;
|
||||
},
|
||||
async cost(event, trigger, player) {
|
||||
"step 0";
|
||||
event.result = await player
|
||||
.chooseCard(get.prompt("kongsheng"), "将任意张牌置于武将牌上", "he", [1, player.countCards("he")])
|
||||
.set("ai", function (card) {
|
||||
|
@ -1630,13 +1627,13 @@ const skills = {
|
|||
return get.type(i, false) == "equip" && player.hasUseTarget(i);
|
||||
});
|
||||
if (cards.length > 0) {
|
||||
let card = cards[0];
|
||||
let [card] = cards;
|
||||
if (cards.length > 1) {
|
||||
const { result } = await player.chooseButton(true, ["选择要使用的装备牌", cards]).set("ai", function (button) {
|
||||
return get.order(button.link);
|
||||
});
|
||||
if (!result.bool) continue;
|
||||
card = result.links[0];
|
||||
[card] = result.links;
|
||||
}
|
||||
await player.chooseUseTarget(card, true);
|
||||
} else break;
|
||||
|
@ -1961,6 +1958,7 @@ const skills = {
|
|||
combo: "nzry_huaiju",
|
||||
},
|
||||
},
|
||||
// ----- 审查分界线喵 ----- 上面的代码已经经过了审查喵
|
||||
nzry_kuizhu: {
|
||||
audio: 2,
|
||||
trigger: {
|
||||
|
|
|
@ -66,14 +66,18 @@ export function sendUpdate() {
|
|||
if (nonameInitialized && nonameInitialized.includes("com.noname.shijian") && window.noname_shijianInterfaces && typeof window.noname_shijianInterfaces.sendUpdate === 'function') {
|
||||
// 给诗笺版apk的java层传递升级完成的信息
|
||||
// @ts-ignore
|
||||
return window.noname_shijianInterfaces.sendUpdate() + "?sendUpdate=true";
|
||||
const url = new URL(window.noname_shijianInterfaces.sendUpdate());
|
||||
url.searchParams.set("sendUpdate", "true");
|
||||
return url.toString();
|
||||
}
|
||||
// 由理版判断
|
||||
// @ts-ignore
|
||||
if (window.NonameAndroidBridge && typeof window.NonameAndroidBridge.sendUpdate === 'function') {
|
||||
// 给由理版apk的java层传递升级完成的信息
|
||||
// @ts-ignore
|
||||
return window.NonameAndroidBridge.sendUpdate() + "?sendUpdate=true";
|
||||
const url = new URL(window.NonameAndroidBridge.sendUpdate());
|
||||
url.searchParams.set("sendUpdate", "true");
|
||||
return url.toString();
|
||||
}
|
||||
}
|
||||
// 电脑端
|
||||
|
@ -633,6 +637,7 @@ export async function boot() {
|
|||
for (const promise of _status.extensionLoading) {
|
||||
await promise.catch(async (error) => {
|
||||
if (extErrorList.includes(error)) return;
|
||||
extErrorList.add(error);
|
||||
if (!promiseErrorHandler || !promiseErrorHandler.onHandle) return;
|
||||
// @ts-ignore
|
||||
await promiseErrorHandler.onHandle({ promise });
|
||||
|
@ -640,6 +645,18 @@ export async function boot() {
|
|||
}
|
||||
// await Promise.allSettled(_status.extensionLoading);
|
||||
|
||||
const isFirstStartAfterUpdate = lib.version && lib.version != lib.config.version;
|
||||
|
||||
if (isFirstStartAfterUpdate && extErrorList.length) {
|
||||
const stacktraces = extErrorList.map(e => e instanceof Error ? e.stack : String(e)).join("\n\n")
|
||||
// game.saveConfig("update_first_log", stacktraces);
|
||||
if(confirm(`扩展加载出错!是否重新载入游戏?\n本次更新可能导致了扩展出现了错误:\n\n${stacktraces}`)){
|
||||
game.reload();
|
||||
clearTimeout(resetGameTimeout);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_status.extensionLoaded
|
||||
.filter((name) => game.hasExtension(name))
|
||||
.forEach((name) => {
|
||||
|
|
Loading…
Reference in New Issue