当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript wait-until.default函数代码示例

本文整理汇总了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);
开发者ID:AelithBlanchett,项目名称:nsfwbot,代码行数:25,代码来源:DBTests.ts

示例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?");
     }
 });
开发者ID:AelithBlanchett,项目名称:nsfwbot,代码行数:12,代码来源:stats.ts

示例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);
     }
 });
开发者ID:AelithBlanchett,项目名称:nsfwbot,代码行数:14,代码来源:DBTests.ts

示例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?");
         }
     });
 });
开发者ID:AelithBlanchett,项目名称:nsfwbot,代码行数:19,代码来源:stats.ts

示例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);
        });
    }
开发者ID:AelithBlanchett,项目名称:nsfwbot,代码行数:42,代码来源:stats.ts


注:本文中的wait-until.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。