예제 #1
0
        /// <summary>
        /// Handles when a key is being pressed while the <see cref="Control"/> has focus.
        /// This is called immediately before <see cref="Control.KeyPressed"/>.
        /// Override this method instead of using an event hook on <see cref="Control.KeyPressed"/> when possible.
        /// </summary>
        /// <param name="e">The event args.</param>
        protected override void OnKeyPressed(KeyEventArgs e)
        {
            base.OnKeyPressed(e);

            if (e.Code == KeyCode.Escape)
            {
                if (RequestEndDialog != null)
                {
                    RequestEndDialog.Raise(this, EventArgs.Empty);
                }
            }
            else
            {
                var asNumeric = e.Code.GetNumericKeyAsValue();
                if (!asNumeric.HasValue)
                {
                    return;
                }

                var value = asNumeric.Value - 1;
                if (value < 0)
                {
                    value = 10;
                }

                if (value < _responses.Length)
                {
                    if (SelectResponse != null)
                    {
                        SelectResponse.Raise(this, EventArgsHelper.Create(_responses[value]));
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Creates a new <see cref="IGroup"/>.
        /// </summary>
        /// <param name="founder">The <see cref="IGroupable"/> that will be the founder of the group.</param>
        /// <returns>If the group was successfully created, returns the new <see cref="IGroup"/> with the
        /// <paramref name="founder"/> set as the group's founder. Otherwise, returns null.
        /// A group may not be created by someone who is already in a group.</returns>
        public IGroup TryCreateGroup(IGroupable founder)
        {
            // Make sure not already in a group
            if (founder.Group != null)
            {
                return(null);
            }

            // Create the group
            var newGroup = _tryCreateGroup(this, founder);

            if (newGroup == null)
            {
                return(null);
            }

            // Make sure the founder had their group property updated
            founder.Group = newGroup;

            // Add the new group to the list
            _groups.Add(newGroup);

            // Listen for when the group is disbanded so we can remove it
            newGroup.Disbanded += _groupDisbandHandler;

            // Raise events
            OnCreateGroup(newGroup);

            if (GroupCreated != null)
            {
                GroupCreated.Raise(this, EventArgsHelper.Create(newGroup));
            }

            return(newGroup);
        }
        /// <summary>
        /// Removes a <see cref="IToolTargetContainer"/> from this collection.
        /// </summary>
        /// <param name="c">The <see cref="IToolTargetContainer"/> to add.</param>
        /// <returns>True if <paramref name="c"/> was removed; false if <paramref name="c"/> was null or not in the collection.</returns>
        public bool Remove(IToolTargetContainer c)
        {
            // Check for a valid value
            if (c == null)
            {
                const string errmsg = "Tried to remove null IToolTargetContainer from ToolTargetContainerCollection `{0}`.";
                if (log.IsWarnEnabled)
                {
                    log.WarnFormat(errmsg, this);
                }
                Debug.Fail(string.Format(errmsg, this));
                return(false);
            }

            // Remove from the collection
            var ret = _buffer.Remove(c);

            // Check if removed successfully
            if (ret)
            {
                // Raise the event
                if (Removed != null)
                {
                    Removed.Raise(this, EventArgsHelper.Create(c));
                }
            }

            return(ret);
        }
예제 #4
0
 /// <summary>
 /// Invokes the corresponding virtual method and event for the given event. Use this instead of invoking
 /// the virtual method and event directly to ensure that the event is invoked correctly.
 /// </summary>
 /// <param name="questDescription">The quest description.</param>
 void InvokeQuestAccepted(IQuestDescription questDescription)
 {
     OnQuestAccepted(questDescription);
     var handler = Events[_eventQuestAccepted] as TypedEventHandler<Control, EventArgs<IQuestDescription>>;
     if (handler != null)
         handler(this, EventArgsHelper.Create(questDescription));
 }
예제 #5
0
        /// <summary>
        /// Removes the reference of an online guild member from this 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="member">The online guild member to remove.</param>
        public void RemoveOnlineMember(IGuildMember member)
        {
            if (member.Guild != this)
            {
                const string errmsg = "The guild member `{0}` does not belong to this guild [{1}]!";
                if (log.IsWarnEnabled)
                {
                    log.WarnFormat(errmsg, member, this);
                }
                Debug.Fail(string.Format(errmsg, member, this));
                return;
            }

            if (!_onlineMembers.Remove(member))
            {
                const string errmsg =
                    "Member `{0}` was not in the online list for guild `{1}`." +
                    " Not really a problem that can't be easily fixed, but should be avoided since it is needless overhead.";
                Debug.Fail(string.Format(errmsg, member, this));
                return;
            }

            if (OnlineUserRemoved != null)
            {
                OnlineUserRemoved.Raise(this, EventArgsHelper.Create(member));
            }

            OnOnlineUserRemoved(member);
        }
예제 #6
0
        void Input_KeyPressed(object sender, KeyEventArgs e)
        {
            const int bufferScrollRate = 3;

            switch (e.Code)
            {
            case Keyboard.Key.Return:
                if (Say != null)
                {
                    var text = _input.Text;
                    if (!string.IsNullOrEmpty(text))
                    {
                        _input.Text = string.Empty;

                        Say.Raise(this, EventArgsHelper.Create(text));
                    }
                }
                break;

            case Keyboard.Key.PageUp:
                _bufferOffset += bufferScrollRate;
                break;

            case Keyboard.Key.PageDown:
                _bufferOffset -= bufferScrollRate;
                break;
            }
        }
예제 #7
0
 /// <summary>
 /// Invokes the <see cref="RequestUseItem"/> event.
 /// </summary>
 /// <param name="slot">The <see cref="InventorySlot"/> to use.</param>
 public void InvokeRequestUseItem(InventorySlot slot)
 {
     if (RequestUseItem != null)
     {
         RequestUseItem.Raise(this, EventArgsHelper.Create(slot));
     }
 }
예제 #8
0
        /// <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;

            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);
        }
예제 #9
0
        /// <summary>
        /// Handles the <see cref="Button.Click"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> that contains the event data.</param>
        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            if (DesignMode)
            {
                return;
            }

            var currSelected = GetCurrentlySelectedGrhData();

            using (var frm = new GrhUITypeEditorForm(currSelected))
            {
                var result = frm.ShowDialog(this);
                if (result == DialogResult.Abort || result == DialogResult.Cancel || result == DialogResult.Ignore)
                {
                    return;
                }

                var newSelectedIndex = frm.SelectedValue;
                var newSelected      = GrhInfo.GetData(newSelectedIndex);

                if (GrhDataSelected != null)
                {
                    GrhDataSelected.Raise(this, EventArgsHelper.Create(newSelected));
                }
            }
        }
예제 #10
0
        /// <summary>
        /// Makes the object draw itself.
        /// </summary>
        /// <param name="sb"><see cref="ISpriteBatch"/> the object can use to draw itself with.</param>
        public void Draw(ISpriteBatch sb)
        {
            // Ensure the sprite is set
            if (!IsSpriteSet())
            {
                return;
            }

            // Pre-drawing
            if (BeforeDraw != null)
            {
                BeforeDraw.Raise(this, EventArgsHelper.Create(sb));
            }

            // Draw
            if (IsVisible)
            {
                HandleDraw(sb);
            }

            // Post-drawing
            if (AfterDraw != null)
            {
                AfterDraw.Raise(this, EventArgsHelper.Create(sb));
            }
        }
        /// <summary>
        /// Adds a <see cref="IToolTargetContainer"/> to this collection.
        /// </summary>
        /// <param name="c">The <see cref="IToolTargetContainer"/> to add.</param>
        /// <returns>True if <paramref name="c"/> was added; false if <paramref name="c"/> was invalid or already added.</returns>
        public bool Add(IToolTargetContainer c)
        {
            // Check for a valid value
            if (c == null)
            {
                const string errmsg = "Tried to add null IToolTargetContainer to ToolTargetContainerCollection `{0}`.";
                if (log.IsWarnEnabled)
                {
                    log.WarnFormat(errmsg, this);
                }
                Debug.Fail(string.Format(errmsg, this));
                return(false);
            }

            // Do not add if already in the collection
            if (_buffer.Contains(c))
            {
                return(false);
            }

            // Add
            _buffer.Add(c);

            // Raise the event
            if (Added != null)
            {
                Added.Raise(this, EventArgsHelper.Create(c));
            }

            return(true);
        }
        /// <summary>
        /// Gets the currently selected object.
        /// </summary>
        /// <param name="selected">The currently selected object.</param>
        public void SetSelected(T selected)
        {
            // Check if to clear instead
            if (selected == null)
            {
                Clear();
                return;
            }

            // Ignore if we already have this exact set as the current selection
            if (_selectedObjs.Count == 1 && _selectedObjs[0] == selected)
            {
                return;
            }

            // Set the new selected objects and update
            Clear();

            _selectedObjs.Add(selected);

            OnObjectAdded(selected);
            if (ObjectAdded != null)
            {
                ObjectAdded.Raise(this, EventArgsHelper.Create(selected));
            }

            UpdateSelection();
        }
예제 #13
0
        /// <summary>
        /// Handles <see cref="GroupInfoMessages.AddMember"/>.
        /// </summary>
        /// <param name="bs">The <see cref="BitStream"/> to read from.</param>
        void ReadAddMember(BitStream bs)
        {
            var name = bs.ReadString();

            if (!_members.Contains(name, _membersListComparer))
            {
                _members.Add(name);
            }
            else
            {
                const string errmsg = "Tried to add `{0}` to the group member list, but they were already in the list!";
                if (log.IsWarnEnabled)
                {
                    log.WarnFormat(errmsg, name);
                }
                Debug.Fail(string.Format(errmsg, name));
            }

            // Raise events
            OnMemberAdded(name);

            if (MemberAdded != null)
            {
                MemberAdded.Raise(this, EventArgsHelper.Create(name));
            }
        }
        /// <summary>
        /// Sets the focused object.
        /// </summary>
        /// <param name="obj">The object to set as focused.</param>
        /// <param name="addIfMissing">If true, <paramref name="obj"/> will be added to the collection
        /// if it is not already in it.</param>
        /// <returns>True if the <paramref name="obj"/> was successfully set as the focused object; otherwise
        /// false.</returns>
        public bool SetFocused(T obj, bool addIfMissing = false)
        {
            if (obj == null)
            {
                return(false);
            }

            if (!_selectedObjs.Contains(obj))
            {
                if (!addIfMissing)
                {
                    return(false);
                }

                _selectedObjs.Add(obj);

                OnObjectAdded(obj);
                if (ObjectAdded != null)
                {
                    ObjectAdded.Raise(this, EventArgsHelper.Create(obj));
                }
            }

            Focused = obj;
            return(true);
        }
        /// <summary>
        /// Gets the currently selected objects.
        /// </summary>
        /// <param name="selectedObjs">The currently selected objects.</param>
        public void SetManySelected(IEnumerable <T> selectedObjs)
        {
            // Check if to clear instead
            if (selectedObjs == null || selectedObjs.IsEmpty())
            {
                Clear();
                return;
            }

            selectedObjs = selectedObjs.Distinct().ToImmutable();

            // Ignore if we already have this exact set as the current selection
            if (selectedObjs.ContainSameElements(_selectedObjs))
            {
                return;
            }

            // Set the new selected objects and update
            Clear();

            foreach (var obj in selectedObjs)
            {
                _selectedObjs.Add(obj);
                OnObjectAdded(obj);
                if (ObjectAdded != null)
                {
                    ObjectAdded.Raise(this, EventArgsHelper.Create(obj));
                }
            }

            UpdateSelection();
        }
예제 #16
0
        /// <summary>
        /// Draws the ItemEntity.
        /// </summary>
        /// <param name="sb"><see cref="ISpriteBatch"/> to draw to.</param>
        /// <param name="pos">Position to draw at.</param>
        /// <param name="color">The color to draw the item.</param>
        /// <exception cref="ArgumentNullException"><paramref name="sb" /> is <c>null</c>.</exception>
        public void Draw(ISpriteBatch sb, Vector2 pos, Color color)
        {
            if (sb == null)
            {
                throw new ArgumentNullException("sb");
            }

            if (BeforeDraw != null)
            {
                BeforeDraw.Raise(this, EventArgsHelper.Create(sb));
            }

            if (IsVisible)
            {
                if (_grh != null)
                {
                    _grh.Draw(sb, pos, color);
                }
            }

            if (AfterDraw != null)
            {
                AfterDraw.Raise(this, EventArgsHelper.Create(sb));
            }
        }
예제 #17
0
        /// <summary>
        /// Handles <see cref="QuestInfoMessages.RemoveActiveQuest"/>.
        /// </summary>
        /// <param name="bs">The <see cref="BitStream"/> to read from.</param>
        void ReadRemoveActiveQuest(BitStream bs)
        {
            var questID = bs.ReadQuestID();

            // Ensure the quest is in the active list
            int index;

            if ((index = _activeQuests.BinarySearch(questID)) < 0)
            {
                return;
            }

            Debug.Assert(_activeQuests[index] == questID);

            // Remove
            _activeQuests.RemoveAt(index);

            // Raise events
            OnActiveQuestRemoved(questID);

            if (ActiveQuestRemoved != null)
            {
                ActiveQuestRemoved.Raise(this, EventArgsHelper.Create(questID));
            }
        }
예제 #18
0
        /// <summary>
        /// Adds a <see cref="IParticleEmitter"/> to this <see cref="IParticleEffect"/>. Should only be called from the
        /// <see cref="IParticleEmitter"/>'s constructor.
        /// </summary>
        /// <param name="emitter">The <see cref="IParticleEmitter"/> to add.</param>
        internal void AddParticleEmitter(ParticleEmitter emitter)
        {
            if (IsDisposed)
            {
                const string errmsg =
                    "Tried to add ParticleEmitter `{0}` to ParticleEffect `{1}`, but the ParticleEffect was disposed.";
                if (log.IsErrorEnabled)
                {
                    log.ErrorFormat(errmsg, emitter, this);
                }
                Debug.Fail(string.Format(errmsg, emitter, this));
                emitter.Dispose();
                return;
            }

            Debug.Assert(!_emitters.Contains(emitter));
            Debug.Assert(emitter.Owner == this);

            // Make sure the emitter's name is unique
            var newName = GenerateUniqueEmitterName(emitter.Name ?? ParticleEmitter.DefaultName);

            emitter.ChangeName(newName);

            // Add
            _emitters.Add(emitter);

            emitter.Disposed -= emitter_Disposed;
            emitter.Disposed += emitter_Disposed;

            if (EmitterAdded != null)
            {
                EmitterAdded.Raise(this, EventArgsHelper.Create((IParticleEmitter)emitter));
            }
        }
예제 #19
0
        /// <summary>
        /// Makes the object draw itself.
        /// </summary>
        /// <param name="sb"><see cref="ISpriteBatch"/> the object can use to draw itself with.</param>
        public void Draw(ISpriteBatch sb)
        {
            if (BeforeDraw != null)
            {
                BeforeDraw.Raise(this, EventArgsHelper.Create(sb));
            }

            var drawPos = DrawPosition;

            _lastScreenPosition = drawPos - Parent.Camera.Min;

            if (IsVisible)
            {
                // Draw the character body
                _characterSprite.Draw(sb, drawPos, Heading, Color);

                // Draw the HP/MP
                DrawSPBar(sb, HPPercent, 0, new Color(255, 0, 0, 175));
                DrawSPBar(sb, MPPercent, 1, new Color(0, 0, 255, 175));

                // Draw the name
                DrawName(sb, NameFont);
            }

            if (AfterDraw != null)
            {
                AfterDraw.Raise(this, EventArgsHelper.Create(sb));
            }
        }
예제 #20
0
        /// <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;

            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);
        }
예제 #21
0
 void SkillLabel_Clicked(object sender, MouseButtonEventArgs e)
 {
     if (RequestUseSkill != null)
     {
         var source = (SkillLabel)sender;
         RequestUseSkill.Raise(this, EventArgsHelper.Create(source.SkillInfo.Value));
     }
 }
예제 #22
0
        /// <summary>
        /// Client:
        ///     Handles any additional usage stuff. When this is called, it is to be assumed that the Server has recognized
        ///     the IUsableEntity as having been successfully used.
        /// Server:
        ///     Attempts to use this IUsableEntity on the <paramref name="charEntity"/>.
        /// </summary>
        /// <param name="charEntity">CharacterEntity that is trying to use this IUsableEntity. Can be null.</param>
        /// <returns>True if this IUsableEntity was successfully used, else false. On the Client, this is generally
        /// unused.</returns>
        public override bool Use(DynamicEntity charEntity)
        {
            if (Used != null)
            {
                Used.Raise(this, EventArgsHelper.Create(charEntity));
            }

            return(true);
        }
예제 #23
0
파일: MessageBox.cs 프로젝트: wtfcolt/game
        /// <summary>
        /// Invokes the corresponding virtual method and event for the given event. Use this instead of invoking
        /// the virtual method and event directly to ensure that the event is invoked correctly.
        /// </summary>
        /// <param name="button">The button that was used to close the <see cref="MessageBox"/>.</param>
        void InvokeOptionSelected(MessageBoxButton button)
        {
            OnOptionSelected(button);
            var handler = Events[_eventOptionSelected] as TypedEventHandler <Control, EventArgs <MessageBoxButton> >;

            if (handler != null)
            {
                handler(this, EventArgsHelper.Create(button));
            }
        }
예제 #24
0
        /// <summary>
        /// Occurs when the <see cref="CharacterStatusEffects.Added"/> event is raised.
        /// </summary>
        /// <param name="statusEffect">The <see cref="ActiveStatusEffect"/> that was added.</param>
        protected virtual void OnAdded(ActiveStatusEffect statusEffect)
        {
            statusEffect.AddBonusesTo(_modStats);

            if (Added != null)
            {
                Added.Raise(this, EventArgsHelper.Create(statusEffect));
            }

            AssertModStatsAreCorrect();
        }
예제 #25
0
        /// <summary>
        /// Occurs when the <see cref="CharacterStatusEffects.Removed"/> event is raised.
        /// </summary>
        /// <param name="statusEffect">The <see cref="ActiveStatusEffect"/> that was removed.</param>
        protected virtual void OnRemoved(ActiveStatusEffect statusEffect)
        {
            statusEffect.SubtractBonusesFrom(_modStats);

            if (Removed != null)
            {
                Removed.Raise(this, EventArgsHelper.Create(statusEffect));
            }

            AssertModStatsAreCorrect();
        }
예제 #26
0
        /// <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);
        }
예제 #27
0
            /// <summary>
            /// Handles when the <see cref="MessageBox"/> has been closed from an option button being clicked.
            /// This is called immediately before <see cref="CheckBox.TickedOverSpriteChanged"/>.
            /// Override this method instead of using an event hook on <see cref="CheckBox.TickedOverSpriteChanged"/> when possible.
            /// </summary>
            /// <param name="button">The button that was used to close the <see cref="MessageBox"/>.</param>
            protected override void OnOptionSelected(MessageBoxButton button)
            {
                if (button == MessageBoxButton.Ok)
                {
                    if (DeleteRequested != null)
                    {
                        DeleteRequested.Raise(this, EventArgsHelper.Create(CharacterSlot));
                    }
                }

                base.OnOptionSelected(button);
            }
예제 #28
0
        /// <summary>
        /// Handles the <see cref="Control.MouseUp"/> event from the <see cref="ShopItemPB"/>s on this form.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="MouseButtonEventArgs"/> instance containing the event data.</param>
        void ShopItemPB_OnMouseUp(object sender, MouseButtonEventArgs e)
        {
            var src = (ShopItemPB)sender;

            if (src.ItemInfo != null)
            {
                if (RequestPurchase != null)
                {
                    RequestPurchase.Raise(this, EventArgsHelper.Create(src.Slot));
                }
            }
        }
예제 #29
0
        /// <summary>
        /// Tries to add an <see cref="IGroupable"/> to this group.
        /// </summary>
        /// <param name="groupable">The <see cref="IGroupable"/> to try to add to the group.</param>
        /// <returns>
        /// True if the <paramref name="groupable"/> was successfully added to the group;
        /// otherwise false.
        /// This method will always return false is the <paramref name="groupable"/> is already in a group.
        /// </returns>
        public virtual bool TryAddMember(IGroupable groupable)
        {
            // Check the max members value
            if (_members.Count >= _groupSettings.MaxMembersPerGroup)
            {
                if (log.IsInfoEnabled)
                {
                    log.InfoFormat("Failed to add `{0}` to group `{1}` - the group is full.", groupable, this);
                }
                return(false);
            }

            // Ensure not already in a group
            if (groupable.Group != null)
            {
                if (log.IsInfoEnabled)
                {
                    log.InfoFormat("Failed to add `{0}` to group `{1}` - they were already in a group (`{2}`).", groupable, this,
                                   groupable.Group);
                }
                return(false);
            }

            // Check that they can be added
            if (_groupSettings.CanJoinGroupHandler != null && !_groupSettings.CanJoinGroupHandler(groupable, this))
            {
                if (log.IsInfoEnabled)
                {
                    log.InfoFormat("Failed to add `{0}` to group `{1}` - GroupSettings.CanJoinGroupHandler returned false.",
                                   groupable, this);
                }
                return(false);
            }

            // Add the member
            _members.Add(groupable);
            groupable.Group = this;

            if (log.IsInfoEnabled)
            {
                log.InfoFormat("Added `{0}` to group `{1}`.", groupable, this);
            }

            // Raise events
            OnMemberJoin(groupable);

            if (MemberJoin != null)
            {
                MemberJoin.Raise(this, EventArgsHelper.Create(groupable));
            }

            return(true);
        }
예제 #30
0
        /// <summary>
        /// Reads the <see cref="GuildInfoMessages.RemoveOnlineMember"/> message.
        /// </summary>
        /// <param name="r">The stream to read the message from.</param>
        void ReadRemoveOnlineMember(BitStream r)
        {
            var name = r.ReadString();

            SetOnlineValue(name, false);

            OnOnlineMemberRemoved(name);

            if (OnlineMemberRemoved != null)
            {
                OnlineMemberRemoved.Raise(this, EventArgsHelper.Create(name));
            }
        }