#include <SaveLoadBPLib.h>
◆ LoadActor()
| bool USaveLoadBPLib::LoadActor |
( |
AActor * | Actor | ) |
|
|
static |
67{
69}
static bool SaveLoadActor(AActor *Actor, const bool bSave=true)
Definition SaveLoadBPLib.cpp:50
◆ LoadAllComponents()
| bool USaveLoadBPLib::LoadAllComponents |
( |
AActor * | Actor | ) |
|
|
static |
Finds All components with the ISaveLoad Interface and loads, Also loads the actor if implements interface
113{
115}
static bool SaveLoadAllComponents(AActor *Actor, const bool bSave=true)
Definition SaveLoadBPLib.cpp:21
◆ LoadGame()
| bool USaveLoadBPLib::LoadGame |
( |
const UObject * | WorldContextObject | ) |
|
|
static |
182{
183 if (WorldContextObject ==
nullptr){UE_LOG(LogSaveLoad,
Error, TEXT(
"WorldContextObject Nullptr"))return false;}
187 return true;
188}
static bool SaveGameMode(const UObject *WorldContextObject, const bool bSave=true)
Definition SaveLoadBPLib.cpp:138
static bool SaveGameInstance(const UObject *WorldContextObject, const bool bSave=true)
Definition SaveLoadBPLib.cpp:160
static bool SaveGameState(const UObject *WorldContextObject, const bool bSave=true)
Definition SaveLoadBPLib.cpp:117
◆ LoadPlayer()
| bool USaveLoadBPLib::LoadPlayer |
( |
APlayerState * | PlayerState | ) |
|
|
static |
93{
94 if (PlayerState == nullptr){return false;}
97 if (PlayerState->GetPawn() == nullptr){return false;}
100 if (PlayerState->GetOwningController() == nullptr){return false;}
102 LoadActor(PlayerState->GetOwningController());
103 return true;
104}
static bool LoadActor(AActor *Actor)
Definition SaveLoadBPLib.cpp:66
static bool LoadAllComponents(AActor *Actor)
Definition SaveLoadBPLib.cpp:112
◆ SaveActor()
| bool USaveLoadBPLib::SaveActor |
( |
AActor * | Actor | ) |
|
|
static |
◆ SaveAllComponents()
| bool USaveLoadBPLib::SaveAllComponents |
( |
AActor * | Actor | ) |
|
|
static |
Finds All components with the ISaveLoad Interface and Saves, Also saves the actor if implements interface
◆ SaveGame()
| bool USaveLoadBPLib::SaveGame |
( |
const UObject * | WorldContextObject | ) |
|
|
static |
13{
14 if (WorldContextObject ==
nullptr){UE_LOG(LogSaveLoad,
Error, TEXT(
"WorldContextObject Nullptr"))return false;}
18 return true;
19}
◆ SaveGameInstance()
| bool USaveLoadBPLib::SaveGameInstance |
( |
const UObject * | WorldContextObject, |
|
|
const bool | bSave = true ) |
|
static |
161{
162 UGameInstance* GameInstance = WorldContextObject->GetWorld()->GetGameInstance();
163 if(GameInstance != nullptr)
164 {
167 {
168 if(bSave)
169 {
171 }
173 }
174 UE_LOG(LogSaveLoad,
Error, TEXT(
"USaveLoadBPLib::SaveGameInstance GameInstance Doesn't Implement SaveLoad"));
175 return false;
176 }
177 UE_LOG(LogSaveLoad,
Warning, TEXT(
"USaveLoadBPLib::SaveGameInstance GameInstance"));
178 return false;
179}
◆ SaveGameMode()
| bool USaveLoadBPLib::SaveGameMode |
( |
const UObject * | WorldContextObject, |
|
|
const bool | bSave = true ) |
|
static |
139{
140 AGameModeBase* GameMode = UGameplayStatics::GetGameMode(WorldContextObject);
141 if(GameMode != nullptr)
142 {
145 {
146 if(bSave)
147 {
149 }
151 }
152 UE_LOG(LogSaveLoad,
Error, TEXT(
"USaveLoadBPLib::SaveGameMode Game Mode Doesn't Implement SaveLoad"));
153 return false;
154 }
155 UE_LOG(LogSaveLoad,
Warning, TEXT(
"USaveLoadBPLib::SaveGameMode GameMode"));
156 return false;
157
158}
◆ SaveGameState()
| bool USaveLoadBPLib::SaveGameState |
( |
const UObject * | WorldContextObject, |
|
|
const bool | bSave = true ) |
|
static |
118{
119 AGameStateBase* GameStateBase = UGameplayStatics::GetGameState(WorldContextObject);
120 if(GameStateBase != nullptr)
121 {
124 {
125 if(bSave)
126 {
128 }
130 }
131 UE_LOG(LogSaveLoad,
Error, TEXT(
"USaveLoadBPLib::SaveGameState Game State Doesn't Implement SaveLoad"));
132 return false;
133 }
134 UE_LOG(LogSaveLoad,
Warning, TEXT(
"USaveLoadBPLib::SaveGameState GameStateBase"));
135 return false;
136}
◆ SaveLoadActor()
| bool USaveLoadBPLib::SaveLoadActor |
( |
AActor * | Actor, |
|
|
const bool | bSave = true ) |
|
static |
51{
52 if(Actor ==
nullptr){UE_LOG(LogSaveLoad,
Error, TEXT(
"USaveLoadBPLib::SaveLoadActor Error Saving Actor"));
return false;}
55 if(bSave)
56 {
58 }
59 else
60 {
62 }
63 return true;
64}
static bool SaveActor(AActor *Actor)
Definition SaveLoadBPLib.cpp:71
◆ SaveLoadAllComponents()
| bool USaveLoadBPLib::SaveLoadAllComponents |
( |
AActor * | Actor, |
|
|
const bool | bSave = true ) |
|
static |
22{
23 if(Actor ==
nullptr){UE_LOG(LogSaveLoad,
Error, TEXT(
"USaveLoadBPLib::SaveLoadAllComponents Error Saving Actor"));
return false;}
24 TArray<UActorComponent*> Components = Actor->GetComponentsByInterface(USaveLoad::StaticClass());
25 bool bSuccess = false;
26 bool bAllPassed = true;
27 for(const auto& Component :Components)
28 {
29 ISaveLoad* SaveComponent = Cast<ISaveLoad>(Component);
30 if (SaveComponent != nullptr)
31 {
32 if (bSave)
33 {
34 bSuccess = SaveComponent->
SaveGame();
35 }
36 else
37 {
38 bSuccess = SaveComponent->
LoadGame();
39 }
40 if (bSuccess == false)
41 {
42 bAllPassed = false;
43 UE_LOG(LogSaveLoad,
Error, TEXT(
"Error Saving Component: %s"), *Component->GetReadableName());
44 }
45 }
46 }
47 return bAllPassed;
48}
virtual bool LoadGame()=0
virtual bool SaveGame()=0
◆ SavePlayer()
| bool USaveLoadBPLib::SavePlayer |
( |
APlayerState * | PlayerState | ) |
|
|
static |
79{
80 if (PlayerState == nullptr){return false;}
83 if (PlayerState->GetPawn() == nullptr){return false;}
86 if (PlayerState->GetOwningController() == nullptr){return false;}
88 SaveActor(PlayerState->GetOwningController());
89 return true;
90}
static bool SaveAllComponents(AActor *Actor)
Definition SaveLoadBPLib.cpp:107
The documentation for this class was generated from the following files:
- T:/Unreal/Unreal Projects/SpaceAdventure52/SpaceAdventure/Plugins/BaseHelpers/Source/BaseHelpers/Public/BPLib/SaveLoadBPLib.h
- T:/Unreal/Unreal Projects/SpaceAdventure52/SpaceAdventure/Plugins/BaseHelpers/Source/BaseHelpers/Private/BPLib/SaveLoadBPLib.cpp