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


C# IGuildMember类代码示例

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


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

示例1: EnsureValidEventSource

        /// <summary>
        /// Makes sure that the guild event invoker is valid and part of a guild.
        /// </summary>
        /// <param name="invoker">The guild member invoking the event.</param>
        /// <returns>True if the invoker is valid; otherwise false.</returns>
        bool EnsureValidEventSource(IGuildMember invoker)
        {
            if (IsDestroyed)
            {
                const string errmsg = "Tried to invoke an event on guild `{0}`, but it has been destroyed already!";
                Debug.Fail(string.Format(errmsg, this));
                if (log.IsErrorEnabled)
                    log.ErrorFormat(errmsg, this);
                return false;
            }

            if (invoker == null)
            {
                const string errmsg = "Guild event invoker is null.";
                Debug.Fail(errmsg);
                if (log.IsWarnEnabled)
                    log.Warn(errmsg);
                return false;
            }

            if (invoker.Guild != this)
            {
                const string errmsg = "Guild event invoker `{0}` is not part of this guild instance (`{1}`).";
                Debug.Fail(string.Format(errmsg, invoker, this));
                if (log.IsWarnEnabled)
                    log.WarnFormat(errmsg, invoker, this);
                return false;
            }

            return true;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:36,代码来源:GuildBase.cs

示例2: GuildMemberPerformer_GuildKick

        /// <summary>
        /// Handles kicking someone out of a guild.
        /// </summary>
        /// <param name="target">The <see cref="IGuildMember"/> being kicked out of the guild.</param>
        /// <param name="userName">The name of the <paramref name="target"/>.</param>
        void GuildMemberPerformer_GuildKick(IGuildMember target, string userName)
        {
            if (target == null)
            {
                User.Send(GameMessage.GuildKickFailedInvalidUser, ServerMessageType.GUI, userName);
                return;
            }

            if (target.Guild != User.Guild)
            {
                User.Send(GameMessage.GuildKickFailedNotInGuild, ServerMessageType.GUI, target.Name);
                return;
            }

            if (target.GuildRank > ((IGuildMember)User).GuildRank)
            {
                User.Send(GameMessage.GuildKickFailedTooHighRank, ServerMessageType.GUI, target.Name);
                return;
            }

            if (!User.Guild.TryKickMember(User, target))
            {
                User.Send(GameMessage.GuildKickFailedUnknownReason, ServerMessageType.GUI, target.Name);
                return;
            }

            User.Send(GameMessage.GuildKick, ServerMessageType.GUI, target.Name);
        }
开发者ID:wtfcolt,项目名称:game,代码行数:33,代码来源:SayHandlerCommands.HelperMethods.cs

示例3: AddNewOnlineMember

        /// <summary>
        /// Adds the reference of an online guild member to this guild that is new to the guild.
        /// This does not make the user join or leave the guild in any way, just allows the guild to keep track of the
        /// members that are online.
        /// </summary>
        /// <param name="newMember">The online guild member to add.</param>
        public void AddNewOnlineMember(IGuildMember newMember)
        {
            if (MemberAdded != null)
                MemberAdded.Raise(this, EventArgsHelper.Create(newMember));

            OnMemberAdded(newMember);

            AddOnlineMember(newMember);
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:15,代码来源:GuildBase.cs

示例4: TryGetGuildMember

 /// <summary>
 /// When overridden in the derived class, tries to acquire the guild member with the given <paramref name="name"/>
 /// who's object already exists in memory.
 /// </summary>
 /// <param name="name">The name of the <see cref="IGuildMember"/> to get.</param>
 /// <param name="guildMember">When this method returns true, contains the <see cref="IGuildMember"/>
 /// for the guild member with the given <paramref name="name"/>.</param>
 /// <returns>True if the <see cref="IGuildMember"/> with the given <paramref name="name"/> was successfully
 /// loaded; otherwise false.</returns>
 protected override bool TryGetGuildMember(string name, out IGuildMember guildMember)
 {
     guildMember = _findGuildMember(name);
     return guildMember != null;
 }
开发者ID:wtfcolt,项目名称:game,代码行数:14,代码来源:GuildMemberPerformer.cs

示例5: TryViewEventLog

        /// <summary>
        /// Makes the <paramref name="invoker"/> try to view the event log for the guild.
        /// </summary>
        /// <param name="invoker">The guild member that invoked the event.</param>
        /// <returns>True if the <paramref name="invoker"/> successfully viewed the log; otherwise false.</returns>
        public bool TryViewEventLog(IGuildMember invoker)
        {
            // Ensure the parameters are valid
            if (!EnsureValidEventSource(invoker))
                return false;

            // Ensure the user has the needed permission level for the action
            if (!EnsureValidRank(invoker, _guildSettings.MinRankViewLog))
                return false;

            return InternalTryViewEventLog(invoker);
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:17,代码来源:GuildBase.cs

示例6: LogEvent

 /// <summary>
 /// Logs an event from a guild.
 /// </summary>
 /// <param name="guildManager">The <see cref="IGuildManager"/>.</param>
 /// <param name="eventCreator">The guild member that created the event.</param>
 /// <param name="guildEvent">The type of event that took place.</param>
 /// <param name="eventTarget">Optionally contains the other guild member that the event involves. This member
 /// may or may not actually be in the guild at this point.</param>
 /// <param name="arg0">The optional first argument string.</param>
 /// <exception cref="ArgumentNullException"><paramref name="eventCreator"/> is null.</exception>
 public static void LogEvent(this IGuildManager guildManager, IGuildMember eventCreator, GuildEvents guildEvent,
                             IGuildMember eventTarget, string arg0)
 {
     guildManager.LogEvent(eventCreator, guildEvent, eventTarget, arg0, null, null);
 }
开发者ID:mateuscezar,项目名称:netgore,代码行数:15,代码来源:IGuildManagerExtensions.cs

示例7: TryChangeTag

        /// <summary>
        /// Tries to change the tag of the guild.
        /// </summary>
        /// <param name="invoker">The guild member trying to change the guild's tag.</param>
        /// <param name="newTag">The new tag of the guild.</param>
        /// <returns>True if the tag was successfully changed; otherwise false.</returns>
        public bool TryChangeTag(IGuildMember invoker, string newTag)
        {
            if (!EnsureValidEventSource(invoker))
                return false;

            if (!EnsureValidRank(invoker, _guildSettings.MinRankRename))
                return false;

            if (_tag == newTag || !GuildManager.IsTagAvailable(newTag))
                return false;

            var oldValue = Tag;

            var success = InternalTryChangeTag(newTag);

            if (success)
            {
                _tag = newTag;
                Save();

                OnTagChanged(invoker, oldValue, Tag);

                if (TagChanged != null)
                    TagChanged.Raise(this, new GuildRenameEventArgs(invoker, oldValue, Tag));
            }

            return success;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:34,代码来源:GuildBase.cs

示例8: EnsureValidRank

        /// <summary>
        /// Ensures a guild member invoking an event meets the rank requirements to invoke the event.
        /// </summary>
        /// <param name="invoker">The guild member invoking the event.</param>
        /// <param name="minRequiredRank">The minimum rank required to invoke the event.</param>
        /// <returns>True if the <paramref name="invoker"/> is a high enough rank to invoke the event;
        /// otherwise false.</returns>
        static bool EnsureValidRank(IGuildMember invoker, GuildRank minRequiredRank)
        {
            if (invoker.GuildRank < minRequiredRank)
            {
                const string errmsg =
                    "Guild member `{0}` from guild `{1}` tried to invoke an event, but their rank was not" +
                    " high enough (rank: `{2}` req: `{3}`).";
                if (log.IsInfoEnabled)
                    log.InfoFormat(errmsg, invoker, invoker.Guild, invoker.GuildRank, minRequiredRank);
                return false;
            }

            return true;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:21,代码来源:GuildBase.cs

示例9: InternalTryViewEventLog

 /// <summary>
 /// When overridden in the derived class, does the actually handling of viewing the event log for the guild.
 /// This should send the latest entries of the guild event log to the <paramref name="invoker"/>.
 /// </summary>
 /// <param name="invoker">The guild member that invoked the event.</param>
 /// <returns>True if the <paramref name="invoker"/> successfully viewed the log; otherwise false.</returns>
 protected abstract bool InternalTryViewEventLog(IGuildMember invoker);
开发者ID:mateuscezar,项目名称:netgore,代码行数:7,代码来源:GuildBase.cs

示例10: InternalTryViewOnlineMembers

 /// <summary>
 /// When overridden in the derived class, displays the online members of the guild to the <paramref name="invoker"/>.
 /// </summary>
 /// <param name="invoker">The guild member that invoked the event.</param>
 /// <returns>True if the <paramref name="invoker"/> successfully viewed the online member list; otherwise false.</returns>
 protected abstract bool InternalTryViewOnlineMembers(IGuildMember invoker);
开发者ID:mateuscezar,项目名称:netgore,代码行数:6,代码来源:GuildBase.cs

示例11: InternalTryLeaveGuild

        /// <summary>
        /// Does the actual handling of making a member leave the guild.
        /// </summary>
        /// <param name="invoker">The guild member who is leaving.</param>
        /// <returns>True if the <paramref name="invoker"/> successfully left the guild; otherwise false.</returns>
        protected virtual bool InternalTryLeaveGuild(IGuildMember invoker)
        {
            // If they were the only founder remaining, destroy the guild completely instead
            if (invoker.GuildRank == _guildSettings.HighestRank)
            {
                var founders = GetNumberOfFounders();
                if (founders == 1)
                {
                    DestroyGuild();
                    return true;
                }
            }

            // Leave the guild
            invoker.Guild = null;

            return true;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:23,代码来源:GuildBase.cs

示例12: InternalTryPromoteMember

        /// <summary>
        /// Does the actual handling of promoting a guild member.
        /// </summary>
        /// <param name="invoker">The guild member is who promoting the <paramref name="target"/>.</param>
        /// <param name="target">The guild member being promoted.</param>
        /// <returns>True if the <paramref name="invoker"/> successfully promoted the <paramref name="target"/>;
        /// otherwise false.</returns>
        protected virtual bool InternalTryPromoteMember(IGuildMember invoker, IGuildMember target)
        {
            // Promote
            target.GuildRank = new GuildRank((byte)(target.GuildRank + 1));

            if (target.GuildRank > invoker.GuildRank)
            {
                const string errmsg =
                    "Somehow, when `{0}` promoted `{1}`, their rank [{2}] ended up greater than that of" +
                    " the member who promoted them [{3}].";
                if (log.IsErrorEnabled)
                    log.ErrorFormat(errmsg, invoker, target, target.GuildRank, invoker.GuildRank);
                Debug.Fail(string.Format(errmsg, invoker, target, target.GuildRank, invoker.GuildRank));
                target.GuildRank = invoker.GuildRank;
            }

            // Log the event
            GuildManager.LogEvent(invoker, GuildEvents.Promote, target);

            if (MemberPromoted != null)
                MemberPromoted.Raise(invoker, EventArgsHelper.Create(target));

            OnMemberPromoted(invoker, target);

            return true;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:33,代码来源:GuildBase.cs

示例13: InternalTryKickMember

        /// <summary>
        /// Does the actual handling of kicking a member out of a guild.
        /// </summary>
        /// <param name="invoker">The guild member is who kicking out the <paramref name="target"/>.</param>
        /// <param name="target">The guild member being kicked out of the guild.</param>
        /// <returns>True if the <paramref name="invoker"/> successfully kicked the <paramref name="target"/>
        /// out of the guild; otherwise false.</returns>
        protected virtual bool InternalTryKickMember(IGuildMember invoker, IGuildMember target)
        {
            // Kick the target out of the guild
            target.Guild = null;

            // Log the event
            GuildManager.LogEvent(invoker, GuildEvents.Kick, target);

            if (MemberKicked != null)
                MemberKicked.Raise(invoker, EventArgsHelper.Create(target));

            OnMemberKicked(invoker, target);

            return true;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:22,代码来源:GuildBase.cs

示例14: InternalTryInviteMember

        /// <summary>
        /// Does the actual handling of inviting a member into the guild.
        /// </summary>
        /// <param name="invoker">The guild member is who inviting the <paramref name="target"/>.</param>
        /// <param name="target">The guild member being invited to the guild.</param>
        /// <returns>True if the <paramref name="invoker"/> successfully invited the <paramref name="target"/>
        /// to the guild; otherwise false.</returns>
        protected virtual bool InternalTryInviteMember(IGuildMember invoker, IGuildMember target)
        {
            // Send the invite
            target.SendGuildInvite(invoker, this);

            // Log the event
            GuildManager.LogEvent(invoker, GuildEvents.Invite, target);

            if (MemberInvited != null)
                MemberInvited.Raise(invoker, EventArgsHelper.Create(target));

            OnMemberInvited(invoker, target);

            return true;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:22,代码来源:GuildBase.cs

示例15: InternalTryDemoteMember

        /// <summary>
        /// Does the actual handling of demoting a guild member.
        /// </summary>
        /// <param name="invoker">The guild member is who demoting the <paramref name="target"/>.</param>
        /// <param name="target">The guild member being demoted.</param>
        /// <returns>True if the <paramref name="invoker"/> successfully demoted the <paramref name="target"/>;
        /// otherwise false.</returns>
        protected virtual bool InternalTryDemoteMember(IGuildMember invoker, IGuildMember target)
        {
            // Demote
            target.GuildRank = new GuildRank((byte)(target.GuildRank - 1));

            if (target.GuildRank < 0 || target.GuildRank > _guildSettings.HighestRank)
            {
                const string errmsg =
                    "Somehow, when `{0}` demoted `{1}`, their rank ended up at the invalid value of `{2}`." +
                    " Rank being reset to 0.";
                if (log.IsErrorEnabled)
                    log.ErrorFormat(errmsg, invoker, target, target.GuildRank);
                Debug.Fail(string.Format(errmsg, invoker, target, target.GuildRank));
                target.GuildRank = 0;
            }

            // Log the event
            GuildManager.LogEvent(invoker, GuildEvents.Demote, target);

            OnMemberDemoted(invoker, target);

            if (MemberDemoted != null)
                MemberDemoted.Raise(invoker, EventArgsHelper.Create(target));

            return true;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:33,代码来源:GuildBase.cs


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