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


C# TasSayEventArgs类代码示例

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


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


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