76 lines
1.9 KiB
C++
76 lines
1.9 KiB
C++
// Project Lab - NHTV Igad
|
|
|
|
#pragma once
|
|
|
|
#include "MenuScreen.h"
|
|
#include "OnlineSessionInterface.h"
|
|
#include "GameList.generated.h"
|
|
using namespace std;
|
|
|
|
struct SessionItemData
|
|
{
|
|
FString name;
|
|
int32 index;
|
|
FOnlineSessionSearchResult* result;
|
|
};
|
|
|
|
UCLASS()
|
|
class UNREALPROJECT_API UGameList : public UPersistentSideView
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UGameList(const FObjectInitializer& init);
|
|
|
|
virtual void NativeConstruct() override;
|
|
virtual void NativeDestruct() override;
|
|
virtual void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override;
|
|
|
|
UFUNCTION(BlueprintNativeEvent, Category = "UI")
|
|
void OnStartSearching();
|
|
UFUNCTION(BlueprintNativeEvent, Category = "UI")
|
|
void OnEndSearching(int32 gamesFound);
|
|
UFUNCTION(BlueprintNativeEvent, Category = "UI")
|
|
void SetInitialSearchMode(bool useLan);
|
|
UFUNCTION(BlueprintCallable, Category = "UI")
|
|
void OnQuickJoin();
|
|
|
|
void JoinSession(const class FOnlineSessionSearchResult& result);
|
|
UFUNCTION(BlueprintCallable, Category = "UI")
|
|
void SetSearchMode(bool useLan);
|
|
UFUNCTION(BlueprintCallable, Category = "UI")
|
|
void OnSearchButton();
|
|
|
|
UFUNCTION()
|
|
void OnListItemPressed(UMenuItemBase* item);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "UI")
|
|
int32 GetNumGames() const { return m_gameItems.Num(); }
|
|
UFUNCTION(BlueprintCallable, Category = "UI")
|
|
TArray<class UGameListItem*> GetGames() const { return m_gameItems; }
|
|
|
|
private:
|
|
UFUNCTION()
|
|
void m_OnFindSessionsComplete(bool success);
|
|
UFUNCTION()
|
|
void m_OnJoinSessionComplete(int32 result);
|
|
|
|
void m_PingGames();
|
|
void m_StartPingingGames();
|
|
void m_StopPingingGames();
|
|
FTimerHandle m_pinger;
|
|
|
|
TArray<class UGameListItem*> m_gameItems;
|
|
|
|
bool m_searchingSessions;
|
|
bool m_quickJoining;
|
|
bool m_joining;
|
|
|
|
UPROPERTY()
|
|
class UOverlayInfo* m_searchingOverlay;
|
|
UPROPERTY()
|
|
class UOverlayInfo* m_joiningOverlay;
|
|
UPROPERTY()
|
|
class UDefaultGameInstance* m_gameInstance;
|
|
};
|