Skip to content

Commit

Permalink
Implement party member display for online list panel
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed Jun 14, 2022
1 parent f72a870 commit a953922
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion EndlessClient/HUD/Panels/HudPanelFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public StatsPanel CreateStatsPanel()
public OnlineListPanel CreateOnlineListPanel()
{
var chatFont = _contentProvider.Fonts[Constants.FontSize08];
return new OnlineListPanel(_nativeGraphicsManager, _hudControlProvider, _onlinePlayerProvider, _friendIgnoreListService, _sfxPlayer, chatFont) { DrawOrder = HUD_CONTROL_LAYER };
return new OnlineListPanel(_nativeGraphicsManager, _hudControlProvider, _onlinePlayerProvider, _partyDataProvider, _friendIgnoreListService, _sfxPlayer, chatFont) { DrawOrder = HUD_CONTROL_LAYER };
}

public PartyPanel CreatePartyPanel()
Expand Down
11 changes: 5 additions & 6 deletions EndlessClient/HUD/Panels/OnlineListPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using EndlessClient.UIControls;
using EOLib;
using EOLib.Domain.Online;
using EOLib.Domain.Party;
using EOLib.Extensions;
using EOLib.Graphics;
using Microsoft.Xna.Framework;
Expand Down Expand Up @@ -35,6 +36,7 @@ private enum Filter
private readonly INativeGraphicsManager _nativeGraphicsManager;
private readonly IHudControlProvider _hudControlProvider;
private readonly IOnlinePlayerProvider _onlinePlayerProvider;
private readonly IPartyDataProvider _partyDataProvider;
private readonly IFriendIgnoreListService _friendIgnoreListService;
private readonly ISfxPlayer _sfxPlayer;

Expand All @@ -57,13 +59,15 @@ private enum Filter
public OnlineListPanel(INativeGraphicsManager nativeGraphicsManager,
IHudControlProvider hudControlProvider,
IOnlinePlayerProvider onlinePlayerProvider,
IPartyDataProvider partyDataProvider,
IFriendIgnoreListService friendIgnoreListService,
ISfxPlayer sfxPlayer,
SpriteFont chatFont)
{
_nativeGraphicsManager = nativeGraphicsManager;
_hudControlProvider = hudControlProvider;
_onlinePlayerProvider = onlinePlayerProvider;
_partyDataProvider = partyDataProvider;
_friendIgnoreListService = friendIgnoreListService;
_sfxPlayer = sfxPlayer;
_chatFont = chatFont;
Expand Down Expand Up @@ -146,11 +150,7 @@ protected override void OnUpdateControl(GameTime gameTime)
PreviousMouseState.LeftButton == ButtonState.Pressed)
{
_sfxPlayer.PlaySfx(SoundEffectID.DialogButtonClick);

_filter = (Filter)(((int)_filter + 1) % (int)Filter.Max);
if (_filter == Filter.Party) // todo: show this when guild/party is supported
_filter = (Filter)(((int)_filter + 1) % (int)Filter.Max);

_scrollBar.ScrollToTop();

ApplyFilter();
Expand Down Expand Up @@ -208,8 +208,7 @@ private void ApplyFilter()
{
case Filter.Friends: _filteredList = _onlineList.Where(x => _friendList.Contains(x.Name, StringComparer.InvariantCultureIgnoreCase)).ToList(); break;
case Filter.Admins: _filteredList = _onlineList.Where(IsAdminIcon).ToList(); break;
// todo: implement for party/guild
case Filter.Party: _filteredList.Clear(); break;
case Filter.Party: _filteredList = _onlineList.Where(x => _partyDataProvider.Members.Any(y => string.Equals(y.Name, x.Name, StringComparison.InvariantCultureIgnoreCase))).ToList(); break;
case Filter.All:
default: _filteredList = new List<OnlinePlayerInfo>(_onlineList); break;
}
Expand Down

0 comments on commit a953922

Please sign in to comment.