本文整理匯總了TypeScript中wait-until.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: xit
xit("should tag successfully with Aelith", async function (done) {
debug = true;
var cmd = new CommandHandler(fChatLibInstance, "here");
await initiateMatchSettings2vs2TagForDb(cmd);
waitUntil().interval(10).times(50).condition(() => {
return cmd.fight.fighters.findIndex(x => x.name == "test1") != -1;
}).done(() => {
waitUntil().interval(100).times(50).condition(() => {
return (cmd.fight.hasStarted && cmd.fight.waitingForAction);
}).done((res) => {
if (res) {
cmd.fight.setCurrentPlayer("test1");
cmd.tag("test2", {character: "test1", channel: "here"});
waitUntil().interval(100).times(50).condition(() => {
return (cmd.fight.currentPlayer != undefined && cmd.fight.currentPlayer.name != "test2");
}).done(() => {
done();
});
}
else {
done.fail(res);
}
});
});
}, 80000);
示例2: waitUntil
waitUntil().interval(10).times(50).condition(condition).done((res) => {
if (res) {
cmd.fight.currentPlayer.dice.addMod(50);
cmd[action](target, {character: cmd.fight.currentPlayer.name, channel: "here"});
waitUntil().interval(INTERVAL_TO_WAIT_FOR).times(50).condition(condition).done(() => {
resolve();
});
}
else {
reject("Couldn't execute action. Is the fight started and waiting for action?");
}
});
示例3: waitUntil
}).done((res) => {
if (res) {
cmd.fight.setCurrentPlayer("test1");
cmd.tag("test2", {character: "test1", channel: "here"});
waitUntil().interval(100).times(50).condition(() => {
return (cmd.fight.currentPlayer != undefined && cmd.fight.currentPlayer.name != "test2");
}).done(() => {
done();
});
}
else {
done.fail(res);
}
});
示例4: Promise
return new Promise((resolve, reject) => {
if (!condition) {
condition = () => {
return (cmd.fight.hasStarted && !cmd.fight.hasEnded && cmd.fight.waitingForAction && cmd.fight.currentTurn > 0);
};
}
waitUntil().interval(10).times(50).condition(condition).done((res) => {
if (res) {
cmd.fight.currentPlayer.dice.addMod(50);
cmd[action](target, {character: cmd.fight.currentPlayer.name, channel: "here"});
waitUntil().interval(INTERVAL_TO_WAIT_FOR).times(50).condition(condition).done(() => {
resolve();
});
}
else {
reject("Couldn't execute action. Is the fight started and waiting for action?");
}
});
});
示例5: doMoveInLoop
async function doMoveInLoop(tier, action, nonRandom, cb){
let fight = new Fight();
fight.build(fChatLibInstance, 'here');
var first = createFighter("test"+Utils.getRandomInt(0,10000000));
var second = createFighter("test"+Utils.getRandomInt(0,10000000));
await fight.join(first.name,Team.Blue);
await fight.join(second.name,Team.Red);
await fight.setFighterReady(first.name);
await fight.setFighterReady(second.name);
let result = [];
let turnsCount = 0;
var HPdamagesDone = [];
var LPdamagesDone = [];
var FPdamagesDone = [];
waitUntil().interval(1000).times(50).condition(function(){
return (fight.hasStarted && !fight.hasEnded && fight.waitingForAction && fight.fighters[0] != undefined && fight.fighters[1] != undefined);
}).done(async (res) => {
while(res && !fight.hasEnded) {
fight.fighters[0].pendingAction = new Action("1", 1, action, tier, fight.fighters[0].name, fight.fighters[1].name);
fight.fighters[0].pendingAction.buildAction(fight, fight.fighters[0], fight.fighters[1]);
if(nonRandom)
{
fight.fighters[0].pendingAction.missed = false;
fight.fighters[0].pendingAction.diceScore = 12;
}
fight.fighters[0].pendingAction.triggerAction();
if(nonRandom)
{
fight.fighters[0].pendingAction.missed = false;
fight.fighters[0].pendingAction.diceScore = 12;
}
HPdamagesDone.push(fight.fighters[0].pendingAction.hpDamageToDef);
LPdamagesDone.push(fight.fighters[0].pendingAction.lpDamageToDef);
FPdamagesDone.push(fight.fighters[0].pendingAction.fpDamageToDef);
await fight.fighters[0].pendingAction.commit(fight);
turnsCount++;
}
result = [turnsCount, HPdamagesDone, LPdamagesDone, FPdamagesDone];
cb(null, result);
});
}