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


C# TasClient.GetBattle方法代码示例

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


在下文中一共展示了TasClient.GetBattle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: KickUnsynced

 protected void KickUnsynced(TasClient tas) {
   for (int i = 0; i < users.Count; ++i) {
     TasClient.UserBattleStatus u;
     if (tas.IsConnected && tas.GetBattle().ContainsUser(users[i], out u)) {
       if (u.SyncStatus == TasClient.SyncStatuses.Unknown && (DateTime.Now - times[i]) > TimeSpan.FromSeconds(timeout)) {
         tas.Kick(users[i]);
       }
     }
   }
 }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:10,代码来源:UnSyncKicker.cs

示例2: FilterUsers

 internal static int FilterUsers(string[] words, TasClient tas, Spring spring, out string[] vals, out int[] indexes)
 {
   TasClient.Battle b = tas.GetBattle();
   string[] temp = new string[b.Users.Count];
   int i = 0;
   foreach (TasClient.UserBattleStatus u in b.Users) {
     temp[i++] = u.name;
   }
   return Filter(temp, words, out vals, out indexes);
 }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:10,代码来源:AutoHost_commands.cs

示例3: AbstractPoll

		public AbstractPoll(TasClient tas, Spring spring, AutoHost ah)
		{
			this.tas = tas;
			this.spring = spring;
			this.ah = ah;

			initialUserCount = 0;
			var b = tas.GetBattle();
			if (b != null) {
				foreach (var us in b.Users) {
					if (us.name != tas.UserName) {
						users.Add(us.name);
						votes.Add(0);
						if (!us.IsSpectator) initialUserCount++;
					}
				}
			}
		}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:18,代码来源:Polls.cs

示例4: 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

示例5: Apply

    public void Apply(TasClient tas, Ladder ladder)
    {
      Battle b = tas.GetBattle();
      if (b == null) return;
      BattleDetails d = b.Details;

      if (startingMetal.HasValue) d.StartingMetal = startingMetal.Value;
      if (startingEnergy.HasValue) d.StartingEnergy = startingEnergy.Value;
      if (maxUnits.HasValue) d.MaxUnits = maxUnits.Value;
      if (startPos.HasValue) d.StartPos = startPos.Value;
      if (endCondition.HasValue) d.EndCondition = endCondition.Value;
      if (limitDgun.HasValue) d.LimitDgun = limitDgun.Value;
      if (diminishingMM.HasValue) d.DiminishingMM = diminishingMM.Value;
      if (ghostedBuildings.HasValue) d.GhostedBuildings = ghostedBuildings.Value;

      d.Validate();
      int mint, maxt;
      if (ladder != null) d = ladder.CheckBattleDetails(d, out mint, out maxt);
      tas.UpdateBattleDetails(d);

      if (enableAllUnits) tas.EnableAllUnits();
      if (disabledUnits.Length > 0) tas.DisableUnits(UnitInfo.ToStringList(disabledUnits));

      foreach (string s in perform) tas.Say(TasClient.SayPlace.Battle, "", s, false);
    }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:25,代码来源:Preset.cs

示例6: FilterUsers

		internal static int FilterUsers(string[] words, TasClient tas, Spring spring, out string[] vals, out int[] indexes)
		{
			var b = tas.GetBattle();
			var temp = new string[b.Users.Count];
			int i = 0;
			foreach (var u in b.Users) temp[i++] = u.name;
			return Filter(temp, words, out vals, out indexes);
		}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:8,代码来源:AutoHost_commands.cs

示例7: VotePlanet

		public VotePlanet(TasClient tas, Spring spring, AutoHost ah) : base(tas, spring, ah)
		{
			this.tas = tas;
			this.spring = spring;
			this.ah = ah;

			var pw = Program.main.PlanetWars;
			var fact = pw.GetOffensiveFaction();
			faction = fact.Name;

			users.Clear();
			votes.Clear();

			initialUserCount = 0;
			var b = tas.GetBattle();
			if (b != null) {
				foreach (var us in b.Users) {
					if (us.name != tas.UserName && !us.IsSpectator && pw.GetPlayerInfo(us.name).FactionName == faction) {
						users.Add(us.name);
						votes.Add(0);
						initialUserCount++;
					}
				}
			}
		}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:25,代码来源:Polls.cs

示例8: Apply

		public void Apply(TasClient tas, Ladder ladder)
		{
			var b = tas.GetBattle();
			if (b == null) return;
			var d = b.Details;

			int mint, maxt;
			if (ladder != null) d = ladder.CheckBattleDetails(d, out mint, out maxt);
			tas.UpdateBattleDetails(d);

			if (enableAllUnits) tas.EnableAllUnits();
			if (disabledUnits.Length > 0) tas.DisableUnits(UnitInfo.ToStringList(disabledUnits));

			foreach (var s in perform) tas.Say(TasClient.SayPlace.Battle, "", s, false);
		}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:15,代码来源:Preset.cs

示例9: Apply

    public void Apply(TasClient tas)
    {
      Battle b = tas.GetBattle();
      if (b == null) return;
      BattleDetails d = b.Details;

      if (startingMetal.HasValue) d.StartingMetal = startingMetal.Value;
      if (startingEnergy.HasValue) d.StartingEnergy = startingEnergy.Value;
      if (maxUnits.HasValue) d.MaxUnits = maxUnits.Value;
      if (startPos.HasValue) d.StartPos = startPos.Value;
      if (endCondition.HasValue) d.EndCondition = endCondition.Value;
      if (limitDgun.HasValue) d.LimitDgun = limitDgun.Value;
      if (diminishingMM.HasValue) d.DiminishingMM = diminishingMM.Value;
      if (ghostedBuildings.HasValue) d.GhostedBuildings = ghostedBuildings.Value;

      d.Validate();
      tas.UpdateBattleDetails(d);

      if (enableAllUnits) tas.EnableAllUnits();
      if (disabledUnits.Length > 0) {
        tas.DisableUnits(UnitInfo.ToStringList(disabledUnits));
      }
    }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:23,代码来源:Preset.cs


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