Space Plunder
Loading...
Searching...
No Matches
UMenuBPLib Class Reference

#include <MenuBPLib.h>

Inheritance diagram for UMenuBPLib:

Static Public Member Functions

static EDifficultyLevel GetCurrentDifficultyLevel (const UObject *WorldContextObject)
 
static FString GetCurrentDifficultyLevelString (const UObject *WorldContextObject)
 
static void QuitGame (APlayerController *PlayerController)
 
static TArray< FGameLevelGetAllGameLevels (const UObject *WorldContextObject, const bool bIncludeDebugLevels=false)
 
static TArray< FGameLevelGetAllCampaignLevels (const UObject *WorldContextObject, const bool bIncludeDebugLevels=false)
 
static TArray< FGameLevelGetAllMultiplayerLevels (const UObject *WorldContextObject, const bool bIncludeDebugLevels=false)
 
static TArray< FGameLevelGetAllHordeLevels (const UObject *WorldContextObject, const bool bIncludeDebugLevels=false)
 
static FGameLevel GetDefaultLevel (const UObject *WorldContextObject, const EGameplayMode GameplayMode=EGameplayMode::Multiplayer)
 
static bool GetGameDebuggingMode (const UObject *WorldContextObject)
 

Member Function Documentation

◆ GetAllCampaignLevels()

TArray< FGameLevel > UMenuBPLib::GetAllCampaignLevels ( const UObject * WorldContextObject,
const bool bIncludeDebugLevels = false )
static
111{
112 TArray<FGameLevel> GameLevels;
113 TArray<FGameLevel> AllGameLevels = GetAllGameLevels(WorldContextObject, bIncludeDebugLevels);
114 for(const auto GameLevel : AllGameLevels)
115 {
116 if(GameLevel.bCampaignPlayable)
117 {
118 GameLevels.Add(GameLevel);
119 }
120 }
121 return GameLevels;
122}
static TArray< FGameLevel > GetAllGameLevels(const UObject *WorldContextObject, const bool bIncludeDebugLevels=false)
Definition MenuBPLib.cpp:81

◆ GetAllGameLevels()

TArray< FGameLevel > UMenuBPLib::GetAllGameLevels ( const UObject * WorldContextObject,
const bool bIncludeDebugLevels = false )
static
82{
83 TArray<FGameLevel> GameLevels;
84 const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
85 if(World != nullptr)
86 {
87 ILevelSelectInterface* LevelSelectInterface = Cast<ILevelSelectInterface>(World->GetGameInstance());
88 if(LevelSelectInterface != nullptr)
89 {
90 //- Get Data table of all Levels //
91 const UDataTable* LevelDataTable = LevelSelectInterface->GetLevelDataTable();
92 if(LevelDataTable != nullptr)
93 {
94 TArray<FGameLevel*> AllGameLevels;
95 const FString ContextString = TEXT("Loading All Game Levels");
96 LevelDataTable->GetAllRows<FGameLevel>(ContextString, AllGameLevels);
97 for(const auto GameLevel : AllGameLevels)
98 {
99 if(!GameLevel->bDebugMap || bIncludeDebugLevels)
100 {
101 GameLevels.Add(*GameLevel);
102 }
103 }
104 }
105 }
106 }
107 return GameLevels;
108}
Definition LevelSelectInterface.h:22
virtual UDataTable * GetLevelDataTable()=0
Definition MenuData.h:115

◆ GetAllHordeLevels()

TArray< FGameLevel > UMenuBPLib::GetAllHordeLevels ( const UObject * WorldContextObject,
const bool bIncludeDebugLevels = false )
static
140{
141 TArray<FGameLevel> GameLevels;
142 TArray<FGameLevel> AllGameLevels = GetAllGameLevels(WorldContextObject, bIncludeDebugLevels);
143 for(const auto GameLevel : AllGameLevels)
144 {
145 if(GameLevel.bHordePlayable)
146 {
147 GameLevels.Add(GameLevel);
148 }
149 }
150 return GameLevels;
151}

◆ GetAllMultiplayerLevels()

TArray< FGameLevel > UMenuBPLib::GetAllMultiplayerLevels ( const UObject * WorldContextObject,
const bool bIncludeDebugLevels = false )
static
126{
127 TArray<FGameLevel> GameLevels;
128 TArray<FGameLevel> AllGameLevels = GetAllGameLevels(WorldContextObject, bIncludeDebugLevels);
129 for(const auto GameLevel : AllGameLevels)
130 {
131 if(GameLevel.bMultiplayerPlayable)
132 {
133 GameLevels.Add(GameLevel);
134 }
135 }
136 return GameLevels;
137}

◆ GetCurrentDifficultyLevel()

EDifficultyLevel UMenuBPLib::GetCurrentDifficultyLevel ( const UObject * WorldContextObject)
static
39{
40 const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
41 if(World != nullptr)
42 {
43 IDifficultyInterface* DifficultyInterface = Cast<IDifficultyInterface>(World->GetGameInstance());
44 if(DifficultyInterface != nullptr)
45 {
46 return DifficultyInterface->GetDifficultyLevel();
47 }
48 }
50}
Definition DifficultyInterface.h:19
virtual EDifficultyLevel GetDifficultyLevel() const =0

◆ GetCurrentDifficultyLevelString()

FString UMenuBPLib::GetCurrentDifficultyLevelString ( const UObject * WorldContextObject)
static
53{
54 const EDifficultyLevel DifficultyLevel = GetCurrentDifficultyLevel(WorldContextObject);
55 switch (DifficultyLevel)
56 {
58 return "Assisted";
60 return "Easy";
62 return "Normal";
64 return "Hard";
66 return "Expert";
68 return "Master";
69 default:
70 return "Normal";
71 }
72
73}
EDifficultyLevel
Definition BaseData.h:1052
static EDifficultyLevel GetCurrentDifficultyLevel(const UObject *WorldContextObject)
Definition MenuBPLib.cpp:38

◆ GetDefaultLevel()

FGameLevel UMenuBPLib::GetDefaultLevel ( const UObject * WorldContextObject,
const EGameplayMode GameplayMode = EGameplayMode::Multiplayer )
static
154{
155 TArray<FGameLevel> GameLevels;
156 switch (GameplayMode)
157 {
159 GameLevels = GetAllCampaignLevels(WorldContextObject, false);
160 break;
162 GameLevels = GetAllHordeLevels(WorldContextObject, false);
163 break;
165 GameLevels = GetAllGameLevels(WorldContextObject, false);
166 break;
168 default:
169 GameLevels = GetAllMultiplayerLevels(WorldContextObject, false);
170 break;
171 }
172 for(const auto GameLevel : GameLevels)
173 {
174 if(GameLevel.bDefaultMap)
175 {
176 return GameLevel;
177 }
178 }
179 FGameLevel DefaultGameLevel;
180 return DefaultGameLevel;
181
182}
static TArray< FGameLevel > GetAllHordeLevels(const UObject *WorldContextObject, const bool bIncludeDebugLevels=false)
Definition MenuBPLib.cpp:139
static TArray< FGameLevel > GetAllMultiplayerLevels(const UObject *WorldContextObject, const bool bIncludeDebugLevels=false)
Definition MenuBPLib.cpp:124
static TArray< FGameLevel > GetAllCampaignLevels(const UObject *WorldContextObject, const bool bIncludeDebugLevels=false)
Definition MenuBPLib.cpp:110

◆ GetGameDebuggingMode()

bool UMenuBPLib::GetGameDebuggingMode ( const UObject * WorldContextObject)
static
185{
186 const UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
187 if(World != nullptr)
188 {
189 const IMenuSystem* MenuInterface = Cast<IMenuSystem>(World->GetGameInstance());
190 if(MenuInterface != nullptr)
191 {
192 return MenuInterface->GetDebuggingMode();
193 }
194 }
195 return false;
196}
Definition MenuSystem.h:19
virtual bool GetDebuggingMode() const =0

◆ QuitGame()

void UMenuBPLib::QuitGame ( APlayerController * PlayerController)
static
76{
77 if(PlayerController == nullptr){UE_LOG(LogMenuSystem,Warning,TEXT("PlayerController NULLPTR"));}
78 UKismetSystemLibrary::QuitGame(PlayerController, PlayerController, EQuitPreference::Quit, false);
79}

The documentation for this class was generated from the following files: