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


C# Client.TasSayEventArgs类代码示例

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


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

示例1: OnSaid

    public void OnSaid(object sender, TasSayEventArgs args)
    {
      if (InvokeRequired) Invoke(new SayEvent(OnSaid), sender, args);
      else {
        switch (args.Place) {
          case TasSayEventArgs.Places.Broadcast:
          case TasSayEventArgs.Places.MessageBox:
          case TasSayEventArgs.Places.Motd:
            tServer.AppendText("[" + DateTime.Now.ToString("T") + "] " + args.Text + "\r\n");
            break;

          case TasSayEventArgs.Places.Channel:
            RichTextBox t = GetTab("#" + args.Channel);
            t.AppendText(String.Format("[{0}] <{1}> {2}\r\n", DateTime.Now.ToString("T"), args.UserName, args.Text));
            break;

          case TasSayEventArgs.Places.Normal:
            t = GetTab(args.Channel);
            t.AppendText(String.Format("[{0}] <{1}> {2}\r\n", DateTime.Now.ToString("T"), args.UserName, args.Text));
            break;

          case TasSayEventArgs.Places.Battle:
            tBattle.AppendText(String.Format("[{0}] <{1}> {2}\r\n", DateTime.Now.ToString("T"), args.UserName, args.Text));
            break;
        }
      }
    }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:27,代码来源:FormMain.cs

示例2: Parse

 public override bool Parse(TasSayEventArgs eventArgs, object[] parameters)
 {
   if (parameters.Length > 0) {
     if (!int.TryParse(parameters[0].ToString(), out allyCount)) allyCount = 2;
   } else allyCount = 2;
   if (allyCount < 2) allyCount = 2;
   operationText = string.Format("balance to {0} teams", allyCount);
   return true;
 }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:9,代码来源:ComBalance.cs

示例3: Parse

 public override bool Parse(TasSayEventArgs eventArgs, object[] parameters)
 {
   if (base.Parse(eventArgs, parameters)) {
     if (parameters.Length == 0) operationText = "ring all unready";
     else {
       string rang = "";
       foreach (string s in playerNames) {
         rang += s + ", ";
       }
       operationText = "ring " + rang;
     }
     return true;
   } else return false;
 }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:14,代码来源:ComRing.cs

示例4: RegisterVote

    protected bool RegisterVote(TasSayEventArgs e, string[] words, out int vote)
    {
      vote = 0;
      if (words.Length != 1) return false;
      int.TryParse(words[0], out vote);
      if (vote > 0 && vote <= options) { // vote within parameters, lets register it

        int ind = users.IndexOf(e.UserName);
        if (ind == -1) {
          votes.Add(vote);
          users.Add(e.UserName);
        } else {
          votes[ind] = vote;
        }
        return true;
      }
      return false;
    }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:18,代码来源:Polls.cs

示例5: Execute

 public virtual bool Execute(TasSayEventArgs eventArgs, params object[] parameters)
 {
   if (Enabled) {
     if (Parse(eventArgs, parameters)) {
       int diff = (int)(DateTime.Now.Subtract(lastExecution).TotalSeconds - Config.Throttling);
       if (diff >= 0) {
         lastExecution = DateTime.Now;
         SayBattle("does {0}", operationText);
         DoCommand();
         return true;
       } else {
         Respond(eventArgs, "wait {0} seconds", -diff);
         return false;
       }
     } else {
       Respond(eventArgs, "usage: !{0} {1}", id, paramDescription);
       return false;
     }
   } else return false;
 }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:20,代码来源:Command.cs

示例6: RegisterVote

    protected bool RegisterVote(TasSayEventArgs e, string[] words, out int vote)
    {
      vote = 0;
      if (words.Length != 1) return false;
      int.TryParse(words[0], out vote);
      if (vote > 0 && vote <= options) {
        // vote within parameters, lets register it
        lastVote = vote;

        int ind = users.IndexOf(e.UserName);
        Battle b = tas.GetBattle();
        if (b != null) {
          int bidx = b.GetUserIndex(e.UserName);
          if (bidx > -1) if (b.Users[bidx].IsSpectator) return false;
          if (ind == -1) {
            votes.Add(vote);
            users.Add(e.UserName);
          } else votes[ind] = vote;
          return true;
        }
      }
      return false;
    }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:23,代码来源:Polls.cs

示例7: ComBan

		public void ComBan(TasSayEventArgs e, string[] words)
		{
			if (words.Length == 0) {
				ah.Respond(e, "this command needs at least 1 argument - exact user name");
				return;
			}

			int duration = 0;
			if (words.Length > 1) {
				if (!int.TryParse(words[1], out duration)) {
					ah.Respond(e, "second argument must be a number - ban time in minutes or 0 - forever");
					return;
				}
			}

			if (IsBanned(words[0])) {
				ah.Respond(e, "this user is already banned");
				return;
			}

			if (duration < 0) duration = 0;
			TimeSpan dur;
			if (duration == 0) dur = TimeSpan.FromDays(365*1000);
			else dur = TimeSpan.FromMinutes(duration);

			var b = new BannedUser(words[0]);
			b.Duration = dur;
			b.Reason = Utils.Glue(words, 2);

			var battle = tas.GetBattle();
			UserBattleStatus ubs;
			if (battle.ContainsUser(b.Name, out ubs)) if (ubs.ip != IPAddress.None) b.ipAddresses.Add(ubs.ip.ToString());
			Items.Add(b);
			tas.Say(TasClient.SayPlace.Battle, "", b.Name + " banned - " + b.Reason, true);
			tas.Kick(b.Name);
			Save();
		}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:37,代码来源:BanList.cs

示例8: FindLinks

		public void FindLinks(string[] words, FileType type, TasClient tas, TasSayEventArgs e)
		{
			if (words.Length == 0) {
				var b = tas.GetBattle();
				if (b == null) return;
				Program.main.AutoHost.Respond(e, string.Format("Getting SpringDownloader mirrors for currently hosted {0}", type));
				if (type == FileType.Map) RequestLink(new LinkRequest(b.Map.Checksum, e));
				else RequestLink(new LinkRequest(b.Mod.Checksum, e));
			} else {
				List<string> items;
				if (type == FileType.Map) items = new List<string>(Program.main.Spring.UnitSyncWrapper.MapList.Keys);
				else items = new List<string>(Program.main.Spring.UnitSyncWrapper.ModList.Keys);

				int[] resultIndexes;
				string[] resultVals;
				int cnt = AutoHost.Filter(items.ToArray(), words, out resultVals, out resultIndexes);
				if (cnt == 0) Program.main.AutoHost.Respond(e, string.Format("No such {0} found", type));
				Program.main.AutoHost.Respond(e, string.Format("Getting SpringDownloader mirrors for {0}, please wait", resultVals[0]));

				int hash = type == FileType.Map ? Program.main.Spring.UnitSyncWrapper.MapList[resultVals[0]].Checksum : Program.main.Spring.UnitSyncWrapper.ModList[resultVals[0]].Checksum;

				RequestLink(new LinkRequest(hash, e));
			}
		}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:24,代码来源:ResourceLinkProvider.cs

示例9: Parse

    public override bool Parse(TasSayEventArgs eventArgs, object[] parameters)
    {
      if (parameters.Length <= playernameStartIndex) {
        if (allowEmptyArgs) {
          playerNames = new string[0];
          return true;
        }
        Respond(eventArgs, "You must specify player name");
        return false;
      }

      string[] filterWords = new string[parameters.Length - playernameStartIndex];
      for (int i = 0; i < parameters.Length; i++) filterWords[i] = parameters[i + playernameStartIndex].ToString();
      int[] indexes;
      handler.AutoHost.FilterUsers(filterWords, out playerNames, out indexes);

      if (playerNames.Length == 0) {
        Respond(eventArgs, "Cannot find such player");
        return false;
      }

      foreach (string s in playerNames) {
        if (s == handler.TasClient.UserName) {
          Respond(eventArgs, "Cannot target myself");
          return false;
        }
      }


      if (playerNames.Length > 1 && !canTargetMultiple) {
        Respond(eventArgs, "This matches more than one player");
        return false;
      }
      
      return true;
    }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:36,代码来源:ComAbstractTargetsPlayer.cs

示例10: StartVote

 public void StartVote(IVotable vote, TasSayEventArgs e, string[] words)
 {
   if (vote != null) {
     if (activePoll != null) {
       Respond(e, "Another poll already in progress, please wait");
       return;
     }
     if (vote.Init(e, words)) {
       activePoll = vote;
       pollTimer.Interval = PollTimeout*1000;
       pollTimer.Enabled = true;
     }
   }
 }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:14,代码来源:AutoHost.cs

示例11: Respond

 public static void Respond(TasClient tas, Spring spring, TasSayEventArgs e, string text)
 {
   TasClient.SayPlace p = TasClient.SayPlace.User;
   bool emote = false;
   if (e.Place == TasSayEventArgs.Places.Battle) {
     p = TasClient.SayPlace.Battle;
     emote = true;
   }
   if (e.Place == TasSayEventArgs.Places.Game && spring.IsRunning) spring.SayGame(text);
   else tas.Say(p, e.UserName, text, emote);
 }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:11,代码来源:AutoHost.cs

示例12: HasRights

    public bool HasRights(string command, TasSayEventArgs e)
    {
      if (banList.IsBanned(e.UserName)) {
        Respond(e, "tough luck, you are banned");
        return false;
      }
      foreach (CommandConfig c in config.Commands) {
        if (c.Name == command) {
          if (c.Throttling > 0) {
            int diff = (int)DateTime.Now.Subtract(c.lastCall).TotalSeconds;
            if (diff < c.Throttling) {
              Respond(e, "AntiSpam - please wait " + (c.Throttling - diff).ToString() + " more seconds");
              return false;
            }
          }

          for (int i = 0; i < c.ListenTo.Length; i++) {
            if (c.ListenTo[i] == e.Place) {
              int reqLevel = c.Level;
              int ulevel = GetUserLevel(e);

              if (ulevel >= reqLevel) {
                // boss stuff
                if (bossName != "" && ulevel <= config.DefaulRightsLevel && e.UserName != bossName && config.DefaultRightsLevelWithBoss < reqLevel) {
                  Respond(e, "Sorry, you cannot do this right now, ask boss admin " + bossName);
                  return false;
                } else {
                  c.lastCall = DateTime.Now;
                  return true; // ALL OK
                }
              } else {
                Respond(e, "Sorry, you do not have rights to execute " + command);
                return false;
              }
            }
          }
          return false; // place not allowed for this command = ignore command
        }
      }
      if (e.Place != TasSayEventArgs.Places.Channel) Respond(e, "Sorry, I don't know command '" + command + "'");
      return false;
    }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:42,代码来源:AutoHost.cs

示例13: ComListBans

 public void ComListBans(TasSayEventArgs e, string[] words)
 {
   Items.RemoveAll(delegate(BannedUser b) { return b.Expired; });
   tas.Say(TasClient.SayPlace.User, e.UserName, "---", false);
   foreach (BannedUser b in Items) {
     string text = String.Format("{0} --> {1} (banned from:{2} to:{3} (GMT))", b.Name, b.Reason, b.Started.ToUniversalTime(), b.Started.Add(b.Duration).ToUniversalTime());
     tas.Say(TasClient.SayPlace.User, e.UserName, text, false);
   }
   tas.Say(TasClient.SayPlace.User, e.UserName, "---", false);
 }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:10,代码来源:BanList.cs

示例14: SayResults

 /// <summary>
 /// Performs map search and says result
 /// </summary>
 /// <param name="name">map to search for</param>
 /// <param name="tas">tasclient to recieve response</param>
 /// <param name="e">say parameters (for forming response)</param>
 public void SayResults(string name, FileType type, TasClient tas, TasSayEventArgs e)
 {
   SayLines(GetResults(name, type), tas, e);
 }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:10,代码来源:UnknownFilesLinker.cs

示例15: ComExit

 public void ComExit(TasSayEventArgs e, string[] words)
 {
   if (spring.IsRunning) SayBattle("exiting game");
   else Respond(e, "cannot exit, not in game");
   spring.ExitGame();
 }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:6,代码来源:AutoHost_commands.cs


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