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

C# TasSayEventArgs类代码示例

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

本文整理汇总了C#中TasSayEventArgs的典型用法代码示例。如果您正苦于以下问题:C# TasSayEventArgs类的具体用法?C# TasSayEventArgs怎么用?C# TasSayEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TasSayEventArgs类属于命名空间,在下文中一共展示了TasSayEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FindLinks

        public void FindLinks(string[] words, FileType type, TasClient tas, TasSayEventArgs e)
        {
            if (words.Length == 0)
            {
                Battle b = tas.MyBattle;
                if (b == null) return;
                ah.Respond(e, string.Format("Getting Zero-K mirrors for currently hosted {0}", type));
                if (type == FileType.Map) GetLinksAsync(b.MapName, e);
                else GetLinksAsync(b.ModName, e);
            }
            else
            {
                int[] resultIndexes;
                string[] resultVals;
                int cnt;
                if (type == FileType.Map) cnt = ah.FilterMaps(words, out resultVals, out resultIndexes);
                else cnt = ah.FilterMods(words, out resultVals, out resultIndexes);

                if (cnt == 0) ah.Respond(e, string.Format("No such {0} found", type));
                else
                {
                    ah.Respond(e, string.Format("Getting Zero-K mirrors for {0}, please wait", resultVals[0]));
                    GetLinksAsync(resultVals[0], e);
                }
            }
        }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:26,代码来源:ResourceLinkSpringieClient.cs


示例2: PerformInit

 protected override bool PerformInit(TasSayEventArgs e, string[] words, out string question, out int winCount) {
     winCount = 0;
     question = null;
     if (ah.config.Mode == PlasmaShared.AutohostMode.Serious)
     {
         AutoHost.Respond(tas, spring, e, "Serious host, no custom options");
         return false;
     }
     if (spring.IsRunning)
     {
         AutoHost.Respond(tas, spring, e, "Cannot set options while the game is running");
         return false;
     }
     else
     {
         var wordFormat = Utils.Glue(words);
         scriptTagsFormat = ah.GetOptionsDictionary(e, words);
         if (scriptTagsFormat.Count==0) return false;
         else
         {
             question  = "Set option " + wordFormat + "?";
             return true;
         }
     }
 }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:25,代码来源:VoteSetOptions.cs


示例3: AllowVote

        protected virtual bool AllowVote(TasSayEventArgs e) {
            if (tas.MyBattle == null) return false;

            if (spring.IsRunning)
            {
                var entry = spring.StartContext.Players.FirstOrDefault(x => x.Name == e.UserName);
                if (entry == null || entry.IsSpectator)
                {
                    ah.Respond(e, string.Format("You must be a player in the game"));
                    return false;
                }
                else return true;
            }
            else
            {
                UserBattleStatus entry;
                tas.MyBattle.Users.TryGetValue(e.UserName, out entry);
                if (entry == null || entry.IsSpectator)
                {
                    ah.Respond(e, string.Format("Only players can vote"));
                    return false;
                }
                else return true;
            }
        }
开发者ID:ParzivalX,项目名称:Zero-K-Infrastructure,代码行数:25,代码来源:AbstractPoll.cs


示例4: PerformInit

        protected override bool PerformInit(TasSayEventArgs e, string[] words, out string question, out int winCount) {
            winCount = 0;
            question = null;
            if (spring.IsRunning)
            {
                question = "Exit this game?";
                int cnt = 0;
                context = spring.StartContext;
                foreach (var p in context.Players.Where(x => !x.IsSpectator))
                {
                    if (p.IsIngame || tas.MyBattle.Users.ContainsKey(p.Name))
                    {
                        //Note: "ExistingUsers" is empty if users disconnected from lobby but still ingame.

                        bool afk = tas.ExistingUsers.ContainsKey(p.Name) && tas.ExistingUsers[p.Name].IsAway;
                        if (!afk) cnt++;
                    }
                }
                winCount = cnt / 2 + 1;
                return true;
            }
            else
            {
                AutoHost.Respond(tas, spring, e, "game not running");
                return false;
            }
        }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:27,代码来源:VoteExit.cs


示例5: PerformInit

        protected override bool PerformInit(TasSayEventArgs e, string[] words, out string question, out int winCount)
        {
            winCount = (tas.MyBattle != null) ? (tas.MyBattle.Users.Count - 1) : 1;
            question = null;
            if (words.Length < 1)
            {
                ah.Respond(e, "<target hostname>");
                return false;
            }
            host = words[0];

            var target_battle = tas.ExistingBattles.Values.FirstOrDefault(x => x.Founder.Name == host);
            if (target_battle == null)
            {
                ah.Respond(e, string.Format("Host {0} not found", words[0]));
                return false;
            }

            if (target_battle.IsPassworded)
            {
                ah.Respond(e, string.Format("Move forbidden: host {0} is passworded.", words[0]));
                return false;
            }

            question = string.Format("Do you want to join {0}?", host);
            return true;

        }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:28,代码来源:VoteMove.cs


示例6: PerformInit

        protected override bool PerformInit(TasSayEventArgs e, string[] words, out string question, out int winCount) {
            if (spring.IsRunning)
            {
                context = spring.StartContext;
                voteStarter = context.Players.FirstOrDefault(x => x.Name == e.UserName && !x.IsSpectator);
                if (voteStarter != null)
                {
                    question = string.Format("Resign team {0}?", voteStarter.AllyID + 1);
                    int cnt = 0, total = 0;
                    foreach (var p in context.Players.Where(x => x.AllyID == voteStarter.AllyID && !x.IsSpectator))
                    {
                        total++;
                        if (p.IsIngame || tas.MyBattle.Users.ContainsKey(p.Name))
                        {
                            //Note: "ExistingUsers" is empty if users disconnected from lobby but still ingame.

                            bool afk = tas.ExistingUsers.ContainsKey(p.Name) && tas.ExistingUsers[p.Name].IsAway;
                            if (!afk) cnt++;
                        }
                    }
                    winCount = (cnt * 3 / 5) + 1;
                    if (total > 1 && winCount == 1) winCount = 2; // prevents most pathological cases (like a falsely AFK partner in 2v2)
                    return true;
                }
            }
            AutoHost.Respond(tas, spring, e, "You cannot resign now");
            question = null;
            winCount = 0;
            return false;
        }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:30,代码来源:VoteResign.cs


示例7: PerformInit

        protected override bool PerformInit(TasSayEventArgs e, string[] words, out string question, out int winCount)
        {
            question = null;
            winCount = 0;
            if (words.Length == 0)
            {
                ah.Respond(e, "You must specify player name");
                return false;
            }

            string[] players;
            int[] indexes;
            if (AutoHost.FilterUsers(new[] {words[0]}, tas, spring, out players, out indexes) > 0)
            {
                player = players[0];
                if (player == tas.UserName)
                {
                    ah.Respond(e, "won't kick myself, not in suicidal mood today");
                    return false;
                }
                else
                {
                    string reason = (words.Length > 1 && words[1] != "for") ? " for" : "";
                    for (var i = 1; i < words.Length; i++) reason += " " + words[i];
                    question = "Kick " + player + reason + "?";
                    return true;
                }
            }
            else
            {
                AutoHost.Respond(tas, spring, e, "Cannot find such player");
                return false;
            }
        }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:34,代码来源:VoteKick.cs


示例8: OnSaid

 void OnSaid(object sender, TasSayEventArgs args)
 {
     var tas = (TasClient)sender;
     if (args.Place == SayPlace.Channel && channels.Contains(args.Channel) && args.UserName != tas.UserName) {
         var otherTas = springTas;
         otherTas.Say(LobbyClient.Legacy.TasClient.SayPlace.Channel, args.Channel, string.Format("<{0}> {1}", args.UserName, args.Text), args.IsEmote);
     }
 }
开发者ID:ParzivalX,项目名称:Zero-K-Infrastructure,代码行数:8,代码来源:ChatRelay.cs


示例9: AllowVote

 protected override bool AllowVote(TasSayEventArgs e)
 {
     if (tas.MyBattle == null) return false;
     var entry = tas.MyBattle.Users.Values.FirstOrDefault(x => x.Name == e.UserName);
     if (entry == null || entry.IsSpectator)
     {
         ah.Respond(e, string.Format("Only players can vote"));
         return false;
     }
     else return true;
 }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:11,代码来源:VoteSplitPlayers.cs


示例10: AllowVote

 protected override bool AllowVote(TasSayEventArgs e)
 {
     if (tas.MyBattle == null) return false;
     UserBattleStatus entry;
     tas.MyBattle.Users.TryGetValue(e.UserName, out entry);
     if (entry == null || entry.IsSpectator)
     {
         ah.Respond(e, string.Format("Only players can vote"));
         return false;
     }
     else return true;
 }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:12,代码来源:VoteStart.cs


示例11: tas_Said

        void tas_Said(object sender, TasSayEventArgs e)
        {
            if (e.UserName.Contains("Nightwatch")) return;

            if (e.Place == SayPlace.User)
            {
                if (e.Text.StartsWith("!move"))
                {
                    var db = new ZkDataContext();
                    var acc = db.Accounts.Find(tas.ExistingUsers[e.UserName].AccountID);
                    if (acc.IsZeroKAdmin)
                    {
                        var parts = e.Text.Split(' ');
                        if (parts.Length != 3) tas.Say(SayPlace.User, e.UserName, "!move [from] [to]", false);
                        else
                        {
                            var from = tas.ExistingBattles.Values.FirstOrDefault(x => x.Founder.Name == parts[1]);
                            var to = tas.ExistingBattles.Values.FirstOrDefault(x => x.Founder.Name == parts[2]);
                            if (from != null && to != null)
                            {
                                foreach (var b in from.Users.Values) if (!b.LobbyUser.IsInGame && b.Name != from.Founder.Name) tas.ForceJoinBattle(b.Name, to.BattleID);
                            }
                            else tas.Say(SayPlace.User, e.UserName, "Not a valid battle host name", false);
                        }
                    }
                }
                // split players evenly into two games by median elo -> expand to specify proportion to shunt?
                // TODO: split players and specs separately
                else if (e.Text.StartsWith("!splitplayers"))
                {
                    var db = new ZkDataContext();
                    var acc = db.Accounts.Find(tas.ExistingUsers[e.UserName].AccountID);
                    if (acc.IsZeroKAdmin)
                    {
                        var parts = e.Text.Split(' ');
                        if (parts.Length != 3) tas.Say(SayPlace.User, e.UserName, "!splitplayers [from] [to]", false);
                        else
                        {
                            var from = tas.ExistingBattles.Values.FirstOrDefault(x => x.Founder.Name == parts[1]);
                            var to = tas.ExistingBattles.Values.FirstOrDefault(x => x.Founder.Name == parts[2]);
                            if (from != null && to != null)
                            {
                                var list = from.Users.Values.Where(x=>!x.LobbyUser.IsInGame && x.Name != from.Founder.Name && !x.IsSpectator).OrderBy(x => x.LobbyUser.EffectiveElo);
                                var toMove = list.Take(list.Count() / 2);
                                foreach (var b in toMove) tas.ForceJoinBattle(b.Name, to.BattleID);
                            }
                            else tas.Say(SayPlace.User, e.UserName, "Not a valid battle host name", false);
                        }
                    }
                }
            }
        }
开发者ID:ParzivalX,项目名称:Zero-K-Infrastructure,代码行数:52,代码来源:PlayerMover.cs


示例12: AllowVote

 protected override bool AllowVote(TasSayEventArgs e)
 {
     if (spring.IsRunning)
     {
         var entry = context.Players.FirstOrDefault(x => x.Name == e.UserName);
         if (entry == null || entry.IsSpectator)
         {
             ah.Respond(e, string.Format("You must be a player in the game"));
             return false;
         }
         else return true;
     }
     return false;
 }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:14,代码来源:VoteExit.cs


示例13: AllowVote

 protected override bool AllowVote(TasSayEventArgs e)
 {
     if (spring.IsRunning)
     {
         var entry = spring.StartContext.Players.FirstOrDefault(x => x.Name == e.UserName);
         if (entry == null || entry.IsSpectator || entry.AllyID != voteStarter.AllyID)
         {
             ah.Respond(e, string.Format("Only team {0} can vote", voteStarter.AllyID + 1));
             return false;
         }
         else return true;
     }
     return false;
 }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:14,代码来源:VoteResign.cs


示例14: PerformInit

 protected override bool PerformInit(TasSayEventArgs e, string[] words, out string question, out int winCount) {
     winCount = 0;
     question = null;
     if (!spring.IsRunning)
     {
         question = "Force start game?";
         winCount = tas.MyBattle.Users.Values.Count(x => !x.IsSpectator) / 2 + 1;
         return true;
     }
     else
     {
         AutoHost.Respond(tas, spring, e, "battle already started");
         return false;
     }
 }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:15,代码来源:VoteForceStart.cs


示例15: PerformInit

 override protected bool PerformInit(TasSayEventArgs e, string[] words, out string question, out int winCount)
 {
     winCount = 0;
     question = null;
     if (spring.IsRunning)
     {
         question = "Force game?";
         return true;
     }
     else
     {
         AutoHost.Respond(tas, spring, e, "battle not started yet");
         return false;
     }
 }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:15,代码来源:VoteForce.cs


示例16: GetLinksAsync

 private void GetLinksAsync(string name, TasSayEventArgs e)
 {
     Task.Factory.StartNew(() => {
         DownloadFileResult ret;
         try {
             ret = plasmaService.DownloadFile(name);
         } catch (Exception ex) {
             Trace.TraceError(ex.ToString());
             return;
         }
     
         if (ret.links != null && ret.links.Count > 0) {
             foreach (string s in ret.links) ah.Respond(e, s.Replace(" ", "%20"));
         } else {
             ah.Respond(e,"No links found");
         }
     });
 }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:18,代码来源:ResourceLinkSpringieClient.cs


示例17: PerformInit

 protected override bool PerformInit(TasSayEventArgs e, string[] words, out string question, out int winCount)
 {
     winCount = 0;
     question = null;
     if (spring.IsRunning)
     {
         AutoHost.Respond(tas, spring, e, "Cannot attack a different planet while the game is running");
         return false;
     }
     else
     {
         if (words.Length > 0)
         {
             // FIXME get list of valid planets
             //string[] vals;
             //int[] indexes;
             //ah.FilterMaps(words, out vals, out indexes);
             if (true)   //(vals.Length > 0)
             {
                 try
                 {
                     planetID = System.Convert.ToInt32(words[0]);
                     question = string.Format("Attack planet {0} {2}/Planetwars/Planet/{1} ?", planetID, planetID, GlobalConst.BaseSiteUrl);   // FIXME get planet name
                     return true;
                 }
                 catch (System.FormatException ex)
                 {
                     AutoHost.Respond(tas, spring, e, "Invalid planet ID");
                     return false;
                 }
             }
             else
             {
                 AutoHost.Respond(tas, spring, e, "Invalid planet for attack");
                 return false;
             }
         }
         else
         {
             AutoHost.Respond(tas, spring, e, "Please specify a planet");    // FIXME list possible planets
             return false;
         }
     }
 }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:44,代码来源:VotePlanet.cs


示例18: PerformInit

        protected override bool PerformInit(TasSayEventArgs e, string[] words, out string question, out int winCount)
        {
            winCount = 0;
            question = null;
            CountNoIntoWinCount = false;

            if (!spring.IsRunning) {

                var invalid = tas.MyBattle.Users.Values.Where(x => !x.IsSpectator && (x.SyncStatus != SyncStatuses.Synced || x.LobbyUser.IsAway)).ToList();
                if (invalid.Count > 0) foreach (var inv in invalid) ah.ComRing(e, new[] { inv.Name }); // ring invalids ot notify them

                // people wihtout map and spring map changed in last 2 minutes, dont allow start yet
                if (tas.MyBattle.Users.Values.Any(x=>!x.IsSpectator && x.SyncStatus != SyncStatuses.Synced) && DateTime.Now.Subtract(ah.lastMapChange).TotalSeconds < MainConfig.MapChangeDownloadWait) {
                    var waitTime = (int)(MainConfig.MapChangeDownloadWait - DateTime.Now.Subtract(ah.lastMapChange).TotalSeconds);
                    AutoHost.Respond(tas, spring, e, string.Format("Map was changed and some players don't have it yet, please wait {0} more seconds", waitTime));
                    return false;
                }

                question = "Start game? ";

                if (invalid.Count > 0) {
                    var invalids = string.Join(",", invalid);
                    ah.SayBattle(invalids + " will be forced spectators if they don't download their maps and stop being afk when vote ends");
                    question += string.Format("WARNING, SPECTATES: {0}", invalids);
                }
                if (tas.MyBattle.Users.Values.Count(x => !x.IsSpectator) >= 2)
                {
                  winCount = (tas.MyBattle.Users.Values.Count(x => !x.IsSpectator) + 1) / 2 + 1;
                }
                else
                {
                  winCount = 1;
                }
                return true;
            }
            else
            {
                AutoHost.Respond(tas, spring, e, "battle already started");
                return false;
            }
        }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:41,代码来源:VoteStart.cs


示例19: Vote

 public virtual bool Vote(TasSayEventArgs e, bool vote) {
     if (AllowVote(e)) {
         userVotes[e.UserName] = vote;
         var yes = userVotes.Count(x => x.Value == true);
         var no = userVotes.Count(x => x.Value == false);
         ah.SayBattle(string.Format("Poll: {0} [!y={1}/{3}, !n={2}/{3}]", Question, yes, no, CountNoIntoWinCount ? WinCount + no : WinCount));
         if ((!CountNoIntoWinCount && yes >= WinCount) || (CountNoIntoWinCount && yes >= WinCount + no)) {
             ah.SayBattle(string.Format("Poll: {0} [END:SUCCESS]", Question));
             ended = true;
             SuccessAction();
             return true;
         }
         else if (no >= WinCount) {
             End();
             return true;
         }
     }
     else {
         ah.Respond(e, "You are not allowed to vote");
         return false;
     }
     return false;
 }
开发者ID:TurBoss,项目名称:Zero-K-Infrastructure,代码行数:23,代码来源:AbstractPoll.cs


示例20: Setup

        public bool Setup(TasSayEventArgs e, string[] words) {
            string question;
            int winCount;
            if (PerformInit(e, words, out question, out winCount)) {
                WinCount = winCount;
                Question = question;
                if (WinCount <= 0) WinCount = tas.MyBattle != null ? (tas.MyBattle.NonSpectatorCount/2 + 1) : 1;
                if (WinCount <= 0) WinCount = 1;
                // If vote is started by a spec while there are players present don't let the number go below 2.
                if (WinCount <= 1 && tas.MyBattle.NonSpectatorCount != 0 &&
                        tas.MyBattle.Users.Values.All(u => u.Name != e.UserName || u.IsSpectator))
                    WinCount = 2;

                if (WinCount == 1) {
                    SuccessAction();
                    return false;
                } else if (!Vote(e, true)) {
                    ah.SayBattle(string.Format("Poll: {0} [!y=0/{1}, !n=0/{1}]", Question, WinCount));
                }
                return true;
            }
            else return false;
        }
开发者ID:ParzivalX,项目名称:Zero-K-Infrastructure,代码行数:23,代码来源:AbstractPoll.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Task类代码示例发布时间:2022-05-24
下一篇:
C# TargetType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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