• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

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

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript walk-sync.default函数代码示例发布时间:2022-05-25
下一篇:
TypeScript wait-for-observables.default函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap