You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||
|
|
|
||
|
|
#include "FriendsAndChatPrivatePCH.h"
|
||
|
|
#include "RecentPlayerList.h"
|
||
|
|
#include "IFriendItem.h"
|
||
|
|
#include "FriendViewModel.h"
|
||
|
|
|
||
|
|
class FRecentPlayerListImpl
|
||
|
|
: public FRecentPlayerList
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
|
||
|
|
virtual int32 GetFriendList(TArray< TSharedPtr<FFriendViewModel> >& OutFriendsList) override
|
||
|
|
{
|
||
|
|
TArray< TSharedPtr< IFriendItem > > FriendItemList = FFriendsAndChatManager::Get()->GetRecentPlayerList();
|
||
|
|
FriendItemList.Sort(FCompareGroupByName());
|
||
|
|
for(const auto& FriendItem : FriendItemList)
|
||
|
|
{
|
||
|
|
OutFriendsList.Add(FFriendViewModelFactory::Create(FriendItem.ToSharedRef()));
|
||
|
|
}
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
DECLARE_DERIVED_EVENT(FRecentPlayerList, IFriendList::FFriendsListUpdated, FFriendsListUpdated);
|
||
|
|
virtual FFriendsListUpdated& OnFriendsListUpdated() override
|
||
|
|
{
|
||
|
|
return FriendsListUpdatedEvent;
|
||
|
|
}
|
||
|
|
|
||
|
|
public:
|
||
|
|
FFriendsListUpdated FriendsListUpdatedEvent;
|
||
|
|
|
||
|
|
private:
|
||
|
|
void Initialize()
|
||
|
|
{
|
||
|
|
FFriendsAndChatManager::Get()->OnFriendsListUpdated().AddSP(this, &FRecentPlayerListImpl::HandleChatListUpdated);
|
||
|
|
}
|
||
|
|
|
||
|
|
void HandleChatListUpdated()
|
||
|
|
{
|
||
|
|
OnFriendsListUpdated().Broadcast();
|
||
|
|
}
|
||
|
|
|
||
|
|
private:
|
||
|
|
friend FRecentPlayerListFactory;
|
||
|
|
};
|
||
|
|
|
||
|
|
TSharedRef< FRecentPlayerList > FRecentPlayerListFactory::Create()
|
||
|
|
{
|
||
|
|
TSharedRef< FRecentPlayerListImpl > ChatList(new FRecentPlayerListImpl());
|
||
|
|
ChatList->Initialize();
|
||
|
|
return ChatList;
|
||
|
|
}
|