fix: maybe not a bug.
This commit is contained in:
parent
550e026688
commit
3b4cb81799
|
@ -5836,21 +5836,18 @@ export class Game extends Uninstantable {
|
||||||
let { step, source, player, target, targets, card, cards, skill, forced, num, _trigger: trigger, _result: result, _storeEvent } = event;
|
let { step, source, player, target, targets, card, cards, skill, forced, num, _trigger: trigger, _result: result, _storeEvent } = event;
|
||||||
// 数组形式
|
// 数组形式
|
||||||
if ("contents" in event && Array.isArray(event.contents)) {
|
if ("contents" in event && Array.isArray(event.contents)) {
|
||||||
event.contents[step](event, trigger, player, _storeEvent)
|
event.contents[step](event, trigger, player, _storeEvent).then((evt) => {
|
||||||
.then((evt) => Promise.resolve(evt))
|
if (evt) event._storeEvent = evt;
|
||||||
.then((evt) => {
|
if (game.executingAsyncEventMap.has(event.toEvent())) {
|
||||||
event._storeEvent = evt;
|
game.executingAsyncEventMap.set(_status.event.toEvent(), game.executingAsyncEventMap.get(_status.event.toEvent()).then(() => {
|
||||||
if (step < event.contents.length - 1 && !event.finished) return resolve();
|
if (event.step >= event.contents.length - 1) event.finish();
|
||||||
if (game.executingAsyncEventMap.has(event.toEvent())) {
|
|
||||||
game.executingAsyncEventMap.set(_status.event.toEvent(), game.executingAsyncEventMap.get(_status.event.toEvent()).then(() => {
|
|
||||||
event.finish();
|
|
||||||
resolve();
|
|
||||||
}));
|
|
||||||
} else {
|
|
||||||
event.finish();
|
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}));
|
||||||
})
|
} else {
|
||||||
|
if (event.step >= event.contents.length - 1) event.finish();
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
else if (event.content instanceof GeneratorFunction) {
|
else if (event.content instanceof GeneratorFunction) {
|
||||||
if (!event.debugging) {
|
if (!event.debugging) {
|
||||||
|
|
|
@ -2409,7 +2409,7 @@ export default {
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
phase_old2: function () {
|
phase: function () {
|
||||||
'step 0';
|
'step 0';
|
||||||
//初始化阶段列表
|
//初始化阶段列表
|
||||||
if (!event.phaseList) {
|
if (!event.phaseList) {
|
||||||
|
@ -8249,6 +8249,9 @@ export default {
|
||||||
}, player, player.isLinked());
|
}, player, player.isLinked());
|
||||||
game.addVideo('link', player, player.isLinked());
|
game.addVideo('link', player, player.isLinked());
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
chooseToGuanxing: function () {
|
chooseToGuanxing: function () {
|
||||||
"step 0";
|
"step 0";
|
||||||
var cards = get.cards(num);
|
var cards = get.cards(num);
|
||||||
|
|
|
@ -244,5 +244,5 @@ export default {
|
||||||
delete _status.currentPhase;
|
delete _status.currentPhase;
|
||||||
}, player);
|
}, player);
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -20496,7 +20496,7 @@ export class Library extends Uninstantable {
|
||||||
let eventPromise = _status.event.next.find(e => e.toEvent() == event);
|
let eventPromise = _status.event.next.find(e => e.toEvent() == event);
|
||||||
// 如果父级事件也是一个异步的话,那应该立即执行这个事件的
|
// 如果父级事件也是一个异步的话,那应该立即执行这个事件的
|
||||||
// 如果在AsyncFunction执行过程中在别的位置新建了一个异步事件,那也直接(等会set配置完)执行
|
// 如果在AsyncFunction执行过程中在别的位置新建了一个异步事件,那也直接(等会set配置完)执行
|
||||||
if (eventPromise && _status.event.content instanceof AsyncFunction) {
|
if (eventPromise && (_status.event.content instanceof AsyncFunction || Array.isArray(_status.event.contents))) {
|
||||||
// 异步执行game.loop
|
// 异步执行game.loop
|
||||||
// 不直接game.loop(event)是因为需要让别人可以手动set()和setContent()
|
// 不直接game.loop(event)是因为需要让别人可以手动set()和setContent()
|
||||||
// 再执行game.loop是因为原有的game.loop被await卡住了,
|
// 再执行game.loop是因为原有的game.loop被await卡住了,
|
||||||
|
|
Loading…
Reference in New Issue