本文整理汇总了C#中Party.GetMembers方法的典型用法代码示例。如果您正苦于以下问题:C# Party.GetMembers方法的具体用法?C# Party.GetMembers怎么用?C# Party.GetMembers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Party
的用法示例。
在下文中一共展示了Party.GetMembers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateGuild
/// <summary>
/// Creates new guild with the members from the party.
/// </summary>
/// <param name="party"></param>
/// <exception cref="ArgumentException">
/// Thrown if one of the party members already is in a guild.
/// </exception>
public void CreateGuild(Party party, string name, GuildType type, GuildVisibility visibility)
{
var partyMembers = party.GetMembers();
if (partyMembers.Any(a => a.GuildId != 0))
throw new ArgumentException("One of the party members is in a guild already.");
var leader = party.Leader;
lock (_syncLock)
{
// Add guild
var guild = new Guild();
guild.Name = name;
guild.LeaderName = leader.Name;
guild.Title = "";
guild.EstablishedDate = DateTime.Now;
guild.Server = ChannelServer.Instance.Conf.Channel.ChannelServer;
guild.Type = type;
guild.Visibility = visibility;
guild.IntroMessage = string.Format(Localization.Get("Guild stone for the {0} guild."), guild.Name);
guild.WelcomeMessage = string.Format(Localization.Get("Welcome to the {0} guild!"), guild.Name);
guild.LeavingMessage = string.Format(Localization.Get("You have left the {0} guild."), guild.Name);
guild.RejectionMessage = string.Format(Localization.Get("You have been denied admission to the {0} guild."), guild.Name);
ChannelServer.Instance.Database.AddGuild(guild);
this.LoadGuild(guild);
// Add members
foreach (var creature in partyMembers)
{
var guildMember = new GuildMember();
guildMember.GuildId = guild.Id;
guildMember.CharacterId = creature.EntityId;
guildMember.JoinedDate = DateTime.Now;
guildMember.Application = "";
if (creature != leader)
guildMember.Rank = GuildMemberRank.Member;
ChannelServer.Instance.Database.AddGuildMember(guildMember);
guild.AddMember(guildMember);
creature.Guild = guild;
creature.GuildMember = guildMember;
Send.GuildUpdateMember(creature, guild, guildMember);
}
}
}