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


C# Guild.GetMembers方法代码示例

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


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

示例1: ForOnlineMembers

		/// <summary>
		/// Executes the given action for all members of guild that are online.
		/// </summary>
		/// <param name="guild"></param>
		/// <param name="action"></param>
		public static void ForOnlineMembers(Guild guild, Action<User> action)
		{
			var members = guild.GetMembers();
			foreach (var member in members)
			{
				// Applicants aren't full members and shouldn't receive
				// "broadcasts" yet.
				if (member.Rank > GuildMemberRank.Member)
					continue;

				var user = MsgrServer.Instance.UserManager.GetUserByCharacterId(member.CharacterId);
				if (user == null)
					continue;

				action(user);
			}
		}
开发者ID:aura-project,项目名称:aura,代码行数:22,代码来源:GuildManager.cs

示例2: ChangeLeader

	private void ChangeLeader(HttpRequest req, Guild guild, ref string success, ref string error)
	{
		var leaderName = req.Parameter("leader", "");

		// Do nothing if no change
		if (leaderName == guild.LeaderName)
			return;

		// Check characters
		var members = guild.GetMembers();
		var currentLeader = members.FirstOrDefault(a => a.Rank == GuildMemberRank.Leader && a.Name == guild.LeaderName);
		var member = members.FirstOrDefault(a => a.Rank < GuildMemberRank.Applied && a.Name == leaderName);
		if (member == null || currentLeader == null)
		{
			error = "Character not found.";
			return;
		}

		// Remove current leader
		currentLeader.Rank = GuildMemberRank.Member;

		// Set new leader
		member.Rank = GuildMemberRank.Leader;
		guild.LeaderName = leaderName;

		WebServer.Instance.Database.UpdateGuildLeader(guild);

		success = "The guild leader was changed.";
	}
开发者ID:aura-project,项目名称:aura,代码行数:29,代码来源:guild_home.cs

示例3: GuildMemberListR

		/// <summary>
		/// Sends GuildMemberListR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="guild"></param>
		public static void GuildMemberListR(MsgrClient client, Guild guild)
		{
			var packet = new Packet(Op.Msgr.GuildMemberListR, 0);
			packet.PutByte(guild != null);
			if (guild == null)
			{
				packet.PutLong(0);
				packet.PutInt(0);
			}
			else
			{
				var members = guild.GetMembers();

				packet.PutLong(guild.Id);
				packet.PutInt(members.Count);
				foreach (var member in members)
				{
					// TODO: Don't do this for every member.
					var contact = (Contact)MsgrServer.Instance.Database.GetUserByCharacterId(member.CharacterId);
					if (contact == null)
						throw new Exception(string.Format("Contact not found for character id '0x{0:X16}'.", member.CharacterId));

					var user = MsgrServer.Instance.UserManager.GetUserByCharacterId(member.CharacterId);
					var status = (user == null ? ContactStatus.Offline : user.Status);
					var channelName = (user == null ? "" : user.ChannelName);

					packet.PutInt(contact.Id);
					packet.PutByte((byte)status);
					packet.PutInt((int)member.Rank);
					packet.PutString(contact.FullName);
					packet.PutString(channelName);
					packet.PutLong(contact.LastLogin.Ticks);
				}
			}

			client.Send(packet);
		}
开发者ID:aura-project,项目名称:aura,代码行数:42,代码来源:MsgrSenders.cs

示例4: OnSyncGuildRemoved

		/// <summary>
		/// Called when a guild is removed during synchronization.
		/// </summary>
		/// <remarks>
		/// This will happen if a guild is disbanded from this or
		/// another channel.
		/// </remarks>
		/// <param name="guild"></param>
		protected override void OnSyncGuildRemoved(Guild guild)
		{
			var members = guild.GetMembers();
			foreach (var member in members)
				this.OnSyncGuildMemberRemoved(guild, member);

			this.DestroyStone(guild);
			ChannelServer.Instance.Database.RemoveGuild(guild);
		}
开发者ID:aura-project,项目名称:aura,代码行数:17,代码来源:GuildManager.cs

示例5: OnSyncGuildAdded

		/// <summary>
		/// Called when a guild is added during synchronization.
		/// </summary>
		/// <remarks>
		/// As long as guilds are only created by players at run-time this
		/// should generally never do anything, because all members that
		/// need to be updated will be on the channel where the guild
		/// was created.
		/// </remarks>
		/// <param name="guild"></param>
		protected override void OnSyncGuildAdded(Guild guild)
		{
			var members = guild.GetMembers();
			foreach (var member in members)
				this.OnSyncGuildMemberAdded(guild, member);
		}
开发者ID:aura-project,项目名称:aura,代码行数:16,代码来源:GuildManager.cs

示例6: ForOnlineMembers

		/// <summary>
		/// Executes the given action for all members of guild that are online.
		/// </summary>
		/// <param name="guild"></param>
		/// <param name="action"></param>
		private static void ForOnlineMembers(Guild guild, Action<Creature> action)
		{
			var members = guild.GetMembers();
			foreach (var member in members)
			{
				var creature = ChannelServer.Instance.World.GetCreature(member.CharacterId);
				if (creature == null)
					continue;

				action(creature);
			}
		}
开发者ID:aura-project,项目名称:aura,代码行数:17,代码来源:GuildManager.cs


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