Compare commits
5 Commits
ac16dad1ee
...
593bba370c
Author | SHA1 | Date | |
---|---|---|---|
593bba370c | |||
6c1f21d501 | |||
3d6aa526e7 | |||
cb61032e00 | |||
90ed878b6d |
@ -3,6 +3,11 @@ bUseMotionBlur=False
|
|||||||
bShowFps=False
|
bShowFps=False
|
||||||
bMouseInverted=False
|
bMouseInverted=False
|
||||||
fMouseSensetivity=1.000000
|
fMouseSensetivity=1.000000
|
||||||
|
fMasterVolume=0.500000
|
||||||
|
fMusicVolume=1.000000
|
||||||
|
fEffectsVolume=1.000000
|
||||||
|
fVoicesVolume=1.000000
|
||||||
|
fMenuVolume=1.000000
|
||||||
bUseVSync=False
|
bUseVSync=False
|
||||||
bUseDynamicResolution=False
|
bUseDynamicResolution=False
|
||||||
ResolutionSizeX=1920
|
ResolutionSizeX=1920
|
||||||
|
BIN
UnrealProject/Lost_Edge/Content/Blueprints/BP_CustomGameInstance.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/Blueprints/BP_CustomGameInstance.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/Blueprints/Characters/BP_Player.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/Blueprints/Characters/BP_Player.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/Blueprints/FunctionLibraries/BPFL_BPCast.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/Blueprints/FunctionLibraries/BPFL_BPCast.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/Levels/Test/L_Test.umap
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/Levels/Test/L_Test.umap
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/Classes/UICC_MainMenu_Page.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/Classes/UICC_MainMenu_Page.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/Classes/UICC_MainMenu_PageButtonParticle.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/Classes/UICC_MainMenu_PageButtonParticle.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/Classes/UICC_MainMenu_SmallButton.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/Classes/UICC_MainMenu_SmallButton.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/Classes/UICC_MenuMain_PageButton.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/Classes/UICC_MenuMain_PageButton.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_OptionsButton.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_OptionsButton.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_OptionsCategory.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_OptionsCategory.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_OptionsComboBox.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_OptionsComboBox.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_OptionsComboBox_Bool.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_OptionsComboBox_Bool.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_OptionsKeySelector.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_OptionsKeySelector.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_OptionsSlider.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_OptionsSlider.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_PageButton.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_PageButton.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_Title.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Components/UIC_MainMenu_Title.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuButtonNames.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuButtonNames.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuOptionsButtonName.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuOptionsButtonName.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuOptionsButtonNames.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuOptionsButtonNames.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuPages.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuPages.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenu_Button.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenu_Button.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenu_Page.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenu_Page.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Credits.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Credits.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Home.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Home.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Audio.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Audio.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Game.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Game.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Graphics.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Graphics.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/ST_MainMenuCommonText.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/ST_MainMenuCommonText.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/ST_MainMenu_CommonText.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/ST_MainMenu_CommonText.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenu.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenu.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuCredits.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuCredits.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptions.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptions.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsAudio.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsAudio.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsControls.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsControls.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsGame.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsGame.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsVideo.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsVideo.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_MainMenu_PageButtonParticle.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_MainMenu_PageButtonParticle.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_MainMenu_SmallButton.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_MainMenu_SmallButton.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_MenuMain_PageButton.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_MenuMain_PageButton.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/ST_CommonComboxValues.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Components/ST_CommonComboxValues.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_ComboBox.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_ComboBox.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_Keyselector.uasset
(Stored with Git LFS)
Normal file
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_Keyselector.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsButton.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsButton.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsCategory.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsCategory.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsComboBox.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsComboBox.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsKeySelector.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsKeySelector.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsSlider.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsSlider.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsSwitchButton.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsSwitchButton.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_PageButton.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_PageButton.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_Title.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_Title.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_OptionKeyselector.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_OptionKeyselector.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_Slider.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_Slider.uasset
(Stored with Git LFS)
Binary file not shown.
@ -2,14 +2,16 @@
|
|||||||
|
|
||||||
using UnrealBuildTool;
|
using UnrealBuildTool;
|
||||||
|
|
||||||
public class Lost_Edge : ModuleRules {
|
public class Lost_Edge : ModuleRules
|
||||||
public Lost_Edge(ReadOnlyTargetRules Target) : base(Target) {
|
{
|
||||||
|
public Lost_Edge(ReadOnlyTargetRules Target) : base(Target)
|
||||||
|
{
|
||||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "OpenCV" });
|
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "OpenCV" });
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(new string[] { "EnhancedInput", "UMG", "RHI", "RenderCore", "Lost_EdgeShaders", "PakFile", //"TextureCompressor",
|
PrivateDependencyModuleNames.AddRange(new string[] { "EnhancedInput", "UMG", "RHI", "RenderCore", "Lost_EdgeShaders", "PakFile", //"TextureCompressor",
|
||||||
"LevelSequence", "MovieScene", "HTTP", "Json" }); // "Slate", "SlateCore"
|
"LevelSequence", "MovieScene", "HTTP", "Json", "ApplicationCore" }); // "Slate", "SlateCore"
|
||||||
|
|
||||||
// UE_LOG(LogTemp, Log, TEXT("capture: %s"), (capture ? TEXT("true") : TEXT("false")));
|
// UE_LOG(LogTemp, Log, TEXT("capture: %s"), (capture ? TEXT("true") : TEXT("false")));
|
||||||
// GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Yellow, TEXT("1"));
|
// GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Yellow, TEXT("1"));
|
||||||
|
@ -29,6 +29,16 @@ FText UCommonFunctions::GetKeyDisplayName(FKey key)
|
|||||||
return key.GetDisplayName(false);
|
return key.GetDisplayName(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32 UCommonFunctions::StringIndexInTextArray(const TArray<FText>& array, const FString& value)
|
||||||
|
{
|
||||||
|
FString v = value.ToLower();
|
||||||
|
for(int32 i = 0; i < array.Num(); ++i)
|
||||||
|
if(FTextInspector::GetSourceString(array[i])->ToLower().Equals(v))
|
||||||
|
return i;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void UCommonFunctions::DestroyActorRecursively(AActor* actor)
|
void UCommonFunctions::DestroyActorRecursively(AActor* actor)
|
||||||
{
|
{
|
||||||
TArray<AActor*> childs;
|
TArray<AActor*> childs;
|
||||||
|
@ -25,6 +25,9 @@ public:
|
|||||||
UFUNCTION(BlueprintPure)
|
UFUNCTION(BlueprintPure)
|
||||||
static FText GetKeyDisplayName(struct FKey key);
|
static FText GetKeyDisplayName(struct FKey key);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure)
|
||||||
|
static int32 StringIndexInTextArray(const TArray<FText>& array, const FString& value);
|
||||||
|
|
||||||
/** Recursively destroy actor and all its childs (the default Destroy doesn't have consistent behavior) */
|
/** Recursively destroy actor and all its childs (the default Destroy doesn't have consistent behavior) */
|
||||||
UFUNCTION(BlueprintCallable, Category = Actor)
|
UFUNCTION(BlueprintCallable, Category = Actor)
|
||||||
static void DestroyActorRecursively(class AActor* actor);
|
static void DestroyActorRecursively(class AActor* actor);
|
||||||
|
@ -6,10 +6,17 @@
|
|||||||
#include "Kismet/KismetSystemLibrary.h"
|
#include "Kismet/KismetSystemLibrary.h"
|
||||||
|
|
||||||
#include "ContentLoader.h"
|
#include "ContentLoader.h"
|
||||||
|
#include "CustomGameSettings.h"
|
||||||
#include "Levels/LevelBase.h"
|
#include "Levels/LevelBase.h"
|
||||||
#include "PlayerBase.h"
|
#include "PlayerBase.h"
|
||||||
#include "SaveData.h"
|
#include "SaveData.h"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
constexpr auto saveName = TEXT("Save");
|
||||||
|
constexpr int32 saveIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
UCustomGameInstance* UCustomGameInstance::instance = nullptr;
|
UCustomGameInstance* UCustomGameInstance::instance = nullptr;
|
||||||
|
|
||||||
void UCustomGameInstance::Init()
|
void UCustomGameInstance::Init()
|
||||||
@ -17,8 +24,28 @@ void UCustomGameInstance::Init()
|
|||||||
UGameInstance::Init();
|
UGameInstance::Init();
|
||||||
|
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
contentLoader = NewObject<UContentLoader>(this);
|
contentLoader = NewObject<UContentLoader>(this);
|
||||||
saveData = Cast<USaveData>(UGameplayStatics::CreateSaveGameObject(USaveData::StaticClass()));
|
for(auto& _class : globalInstancesClasses)
|
||||||
|
{
|
||||||
|
UObject* gi = NewObject<UObject>(_class);
|
||||||
|
gi->AddToRoot();
|
||||||
|
globalInstances.Add(_class.Get(), gi);
|
||||||
|
}
|
||||||
|
globalInstancesClasses.Empty();
|
||||||
|
|
||||||
|
if(auto save = UGameplayStatics::LoadGameFromSlot(saveName, saveIndex))
|
||||||
|
saveData = Cast<USaveData>(save);
|
||||||
|
else
|
||||||
|
saveData = Cast<USaveData>(UGameplayStatics::CreateSaveGameObject(USaveData::StaticClass()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void UCustomGameInstance::Shutdown()
|
||||||
|
{
|
||||||
|
if(auto settings = UCustomGameSettings::Get())
|
||||||
|
settings->SaveSettings();
|
||||||
|
|
||||||
|
Super::Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
UCustomGameInstance* UCustomGameInstance::Get()
|
UCustomGameInstance* UCustomGameInstance::Get()
|
||||||
@ -34,6 +61,22 @@ UContentLoader* UCustomGameInstance::GetContentLoader()
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UObject* UCustomGameInstance::GetGlobalInstance(UClass* _class)
|
||||||
|
{
|
||||||
|
if(auto GI = Get())
|
||||||
|
return *(GI->globalInstances.Find(_class));
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UCustomGameInstance::IsGameSaved()
|
||||||
|
{
|
||||||
|
if(auto GI = Get())
|
||||||
|
return GI->saveData != nullptr;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void UCustomGameInstance::SaveGame(FName checkpointName)
|
void UCustomGameInstance::SaveGame(FName checkpointName)
|
||||||
{
|
{
|
||||||
auto levelScript = ALevelBase::Get();
|
auto levelScript = ALevelBase::Get();
|
||||||
@ -56,12 +99,12 @@ void UCustomGameInstance::SaveGame(FName checkpointName)
|
|||||||
else
|
else
|
||||||
saveData->playerRightPocketItem = FName(TEXT(""));
|
saveData->playerRightPocketItem = FName(TEXT(""));
|
||||||
|
|
||||||
UGameplayStatics::SaveGameToSlot(saveData, TEXT("Save"), 0);
|
UGameplayStatics::SaveGameToSlot(saveData, saveName, saveIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UCustomGameInstance::LoadGame()
|
void UCustomGameInstance::LoadGame()
|
||||||
{
|
{
|
||||||
saveData = Cast<USaveData>(UGameplayStatics::LoadGameFromSlot(TEXT("Save"), 0));
|
saveData = Cast<USaveData>(UGameplayStatics::LoadGameFromSlot(saveName, saveIndex));
|
||||||
if(!saveData)
|
if(!saveData)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -20,17 +20,24 @@ class UCustomGameInstance : public UGameInstance
|
|||||||
public:
|
public:
|
||||||
/** Instantiates content loader, dummy save data and applies settings */
|
/** Instantiates content loader, dummy save data and applies settings */
|
||||||
virtual void Init() override;
|
virtual void Init() override;
|
||||||
|
/** Saves settings */
|
||||||
|
virtual void Shutdown() override;
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, meta = (DisplayName = "Get Custom Game Instance"))
|
UFUNCTION(BlueprintPure, meta = (DisplayName = "Get Custom Game Instance"))
|
||||||
static UCustomGameInstance* Get();
|
static UCustomGameInstance* Get();
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure)
|
UFUNCTION(BlueprintPure)
|
||||||
static class UContentLoader* GetContentLoader();
|
static class UContentLoader* GetContentLoader();
|
||||||
|
UFUNCTION(BlueprintPure)
|
||||||
|
static UObject* GetGlobalInstance(UClass* _class);
|
||||||
|
|
||||||
|
/** Return true is save data are present and valid */
|
||||||
|
UFUNCTION(BlueprintPure)
|
||||||
|
static bool IsGameSaved();
|
||||||
UFUNCTION(BlueprintCallable, Category = Save)
|
UFUNCTION(BlueprintCallable, Category = Save)
|
||||||
void SaveGame(FName checkpointName);
|
void SaveGame(FName checkpointName);
|
||||||
UFUNCTION(BlueprintCallable, Category = Save)
|
UFUNCTION(BlueprintCallable, Category = Save)
|
||||||
void LoadGame();
|
void LoadGame();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
void ExitGame();
|
void ExitGame();
|
||||||
|
|
||||||
@ -46,4 +53,7 @@ protected:
|
|||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
class UContentLoader* contentLoader;
|
class UContentLoader* contentLoader;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly)
|
||||||
|
TSet<TSubclassOf<UObject>> globalInstancesClasses;
|
||||||
|
TMap<UClass*, UObject*> globalInstances;
|
||||||
};
|
};
|
||||||
|
@ -4,12 +4,35 @@
|
|||||||
|
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
/** Game */
|
||||||
|
constexpr float fDefaultMouseSensetivity = 0.5f;
|
||||||
|
constexpr bool bDefaultMouseInverted = false;
|
||||||
|
|
||||||
|
/** Audio */
|
||||||
|
constexpr float fDefaultMasterVolume = 0.4f;
|
||||||
|
constexpr float fDefaultMusicVolume = 1.0f;
|
||||||
|
constexpr float fDefaultEffectsVolume = 1.0f;
|
||||||
|
constexpr float fDefaultVoicesVolume = 1.0f;
|
||||||
|
constexpr float fDefaultMenuVolume = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
UCustomGameSettings::UCustomGameSettings(const FObjectInitializer& ObjectInitializer) :Super(ObjectInitializer)
|
UCustomGameSettings::UCustomGameSettings(const FObjectInitializer& ObjectInitializer) :Super(ObjectInitializer)
|
||||||
{
|
{
|
||||||
bUseMotionBlur = false;
|
bUseMotionBlur = false;
|
||||||
bShowFps = false;
|
bShowFps = false;
|
||||||
bMouseInverted = false;
|
|
||||||
fMouseSensetivity = 1.0f;
|
/** Game */
|
||||||
|
fMouseSensetivity = GetDefaultMouseSensetivity();
|
||||||
|
bMouseInverted = GetDefaultMouseInverted();
|
||||||
|
|
||||||
|
/** Audio */
|
||||||
|
fMasterVolume = GetDefaultMasterVolume();
|
||||||
|
fMusicVolume = GetDefaultMusicVolume();
|
||||||
|
fEffectsVolume = GetDefaultEffectsVolume();
|
||||||
|
fVoicesVolume = GetDefaultVoicesVolume();
|
||||||
|
fMenuVolume = GetDefaultMenuVolume();
|
||||||
}
|
}
|
||||||
|
|
||||||
UCustomGameSettings* UCustomGameSettings::Get()
|
UCustomGameSettings* UCustomGameSettings::Get()
|
||||||
@ -17,12 +40,89 @@ UCustomGameSettings* UCustomGameSettings::Get()
|
|||||||
return Cast<UCustomGameSettings>(UGameUserSettings::GetGameUserSettings());
|
return Cast<UCustomGameSettings>(UGameUserSettings::GetGameUserSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Game */
|
||||||
|
float UCustomGameSettings::GetDefaultMouseSensetivity() const
|
||||||
|
{
|
||||||
|
return fDefaultMouseSensetivity;
|
||||||
|
}
|
||||||
|
float UCustomGameSettings::GetMouseSensetivity() const
|
||||||
|
{
|
||||||
|
return fMouseSensetivity;
|
||||||
|
}
|
||||||
void UCustomGameSettings::SetMouseSensetivity(float value)
|
void UCustomGameSettings::SetMouseSensetivity(float value)
|
||||||
{
|
{
|
||||||
fMouseSensetivity = FMath::Clamp(value, 0.1f, 2.0f);
|
fMouseSensetivity = FMath::Clamp(value, 0.1f, 2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
float UCustomGameSettings::GetMouseSensetivity() const
|
bool UCustomGameSettings::GetDefaultMouseInverted() const
|
||||||
{
|
{
|
||||||
return fMouseSensetivity;
|
return bDefaultMouseInverted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Audio */
|
||||||
|
float UCustomGameSettings::GetDefaultMasterVolume() const
|
||||||
|
{
|
||||||
|
return fDefaultMasterVolume;
|
||||||
|
}
|
||||||
|
float UCustomGameSettings::GetDefaultMusicVolume() const
|
||||||
|
{
|
||||||
|
return fDefaultMusicVolume;
|
||||||
|
}
|
||||||
|
float UCustomGameSettings::GetDefaultEffectsVolume() const
|
||||||
|
{
|
||||||
|
return fDefaultEffectsVolume;
|
||||||
|
}
|
||||||
|
float UCustomGameSettings::GetDefaultVoicesVolume() const
|
||||||
|
{
|
||||||
|
return fDefaultVoicesVolume;
|
||||||
|
}
|
||||||
|
float UCustomGameSettings::GetDefaultMenuVolume() const
|
||||||
|
{
|
||||||
|
return fDefaultMenuVolume;
|
||||||
|
}
|
||||||
|
|
||||||
|
float UCustomGameSettings::GetMasterVolume() const
|
||||||
|
{
|
||||||
|
return fMasterVolume;
|
||||||
|
}
|
||||||
|
float UCustomGameSettings::GetMusicVolume() const
|
||||||
|
{
|
||||||
|
return fMusicVolume;
|
||||||
|
}
|
||||||
|
float UCustomGameSettings::GetEffectsVolume() const
|
||||||
|
{
|
||||||
|
return fEffectsVolume;
|
||||||
|
}
|
||||||
|
float UCustomGameSettings::GetVoicesVolume() const
|
||||||
|
{
|
||||||
|
return fVoicesVolume;
|
||||||
|
}
|
||||||
|
float UCustomGameSettings::GetMenuVolume() const
|
||||||
|
{
|
||||||
|
return fMenuVolume;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UCustomGameSettings::SetMasterVolume(float value)
|
||||||
|
{
|
||||||
|
fMasterVolume = FMath::Clamp(value, 0.0f, 1.0f);
|
||||||
|
}
|
||||||
|
void UCustomGameSettings::SetMusicVolume(float value)
|
||||||
|
{
|
||||||
|
fMusicVolume = FMath::Clamp(value, 0.0f, 1.0f);
|
||||||
|
}
|
||||||
|
void UCustomGameSettings::SetEffectsVolume(float value)
|
||||||
|
{
|
||||||
|
fEffectsVolume = FMath::Clamp(value, 0.0f, 1.0f);
|
||||||
|
}
|
||||||
|
void UCustomGameSettings::SetVoicesVolume(float value)
|
||||||
|
{
|
||||||
|
fVoicesVolume = FMath::Clamp(value, 0.0f, 1.0f);
|
||||||
|
}
|
||||||
|
void UCustomGameSettings::SetMenuVolume(float value)
|
||||||
|
{
|
||||||
|
fMenuVolume = FMath::Clamp(value, 0.0f, 1.0f);
|
||||||
|
}
|
||||||
|
@ -10,28 +10,19 @@
|
|||||||
* Manages custom game settings.
|
* Manages custom game settings.
|
||||||
* Mouse sensetivity and inversion, motion blur usage, fps show.
|
* Mouse sensetivity and inversion, motion blur usage, fps show.
|
||||||
*/
|
*/
|
||||||
UCLASS(Config = Game, defaultconfig)
|
UCLASS(defaultconfig)
|
||||||
class UCustomGameSettings : public UGameUserSettings
|
class UCustomGameSettings : public UGameUserSettings
|
||||||
{
|
{
|
||||||
GENERATED_UCLASS_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Is auto defined by UE but implementation is in cpp
|
// Is auto defined by UE but implementation is in cpp
|
||||||
//UCustomGameSettings(const FObjectInitializer& ObjectInitializer);
|
UCustomGameSettings(const FObjectInitializer& ObjectInitializer);
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, Category = Settings, meta = (DisplayName = "Get Custom Game Settings"))
|
UFUNCTION(BlueprintPure, Category = Settings, meta = (DisplayName = "Get Custom Game Settings"))
|
||||||
static UCustomGameSettings* Get();
|
static UCustomGameSettings* Get();
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets mouse sensetivity multiplier
|
|
||||||
* @param value [0.1 - 2.0]
|
|
||||||
*/
|
|
||||||
UFUNCTION(BlueprintCallable, Category = Settings)
|
|
||||||
void SetMouseSensetivity(float value);
|
|
||||||
|
|
||||||
/** Returns mouse sensetivity multiplier in [0.1 - 2.0] */
|
|
||||||
UFUNCTION(BlueprintCallable, Category = Settings)
|
|
||||||
float GetMouseSensetivity() const;
|
|
||||||
|
|
||||||
UPROPERTY(Config, BlueprintReadWrite)
|
UPROPERTY(Config, BlueprintReadWrite)
|
||||||
bool bUseMotionBlur;
|
bool bUseMotionBlur;
|
||||||
@ -39,11 +30,79 @@ public:
|
|||||||
UPROPERTY(Config, BlueprintReadWrite)
|
UPROPERTY(Config, BlueprintReadWrite)
|
||||||
bool bShowFps;
|
bool bShowFps;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Game */
|
||||||
|
UFUNCTION(BlueprintPure, Category = Settings)
|
||||||
|
float GetDefaultMouseSensetivity() const;
|
||||||
|
/** Returns mouse sensetivity multiplier in [0.1 - 2.0] */
|
||||||
|
UFUNCTION(BlueprintPure, Category = Settings)
|
||||||
|
float GetMouseSensetivity() const;
|
||||||
|
/**
|
||||||
|
* Sets mouse sensetivity multiplier
|
||||||
|
* @param value [0.1 - 2.0]
|
||||||
|
*/
|
||||||
|
UFUNCTION(BlueprintCallable, Category = Settings)
|
||||||
|
void SetMouseSensetivity(float value);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category = Settings)
|
||||||
|
bool GetDefaultMouseInverted() const;
|
||||||
UPROPERTY(Config, BlueprintReadWrite)
|
UPROPERTY(Config, BlueprintReadWrite)
|
||||||
bool bMouseInverted;
|
bool bMouseInverted;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Audio
|
||||||
|
* All values are clamped in [0.0 - 1.0]
|
||||||
|
*/
|
||||||
|
UFUNCTION(BlueprintPure, Category = Settings)
|
||||||
|
float GetDefaultMasterVolume() const; // UFUNCTION doesn't support constexpr functions
|
||||||
|
UFUNCTION(BlueprintPure, Category = Settings)
|
||||||
|
float GetDefaultMusicVolume() const; // UFUNCTION doesn't support constexpr functions
|
||||||
|
UFUNCTION(BlueprintPure, Category = Settings)
|
||||||
|
float GetDefaultEffectsVolume() const; // UFUNCTION doesn't support constexpr functions
|
||||||
|
UFUNCTION(BlueprintPure, Category = Settings)
|
||||||
|
float GetDefaultVoicesVolume() const; // UFUNCTION doesn't support constexpr functions
|
||||||
|
UFUNCTION(BlueprintPure, Category = Settings)
|
||||||
|
float GetDefaultMenuVolume() const; // UFUNCTION doesn't support constexpr functions
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, Category = Settings)
|
||||||
|
float GetMasterVolume() const;
|
||||||
|
UFUNCTION(BlueprintPure, Category = Settings)
|
||||||
|
float GetMusicVolume() const;
|
||||||
|
UFUNCTION(BlueprintPure, Category = Settings)
|
||||||
|
float GetEffectsVolume() const;
|
||||||
|
UFUNCTION(BlueprintPure, Category = Settings)
|
||||||
|
float GetVoicesVolume() const;
|
||||||
|
UFUNCTION(BlueprintPure, Category = Settings)
|
||||||
|
float GetMenuVolume() const;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category = Settings)
|
||||||
|
void SetMasterVolume(float value);
|
||||||
|
UFUNCTION(BlueprintCallable, Category = Settings)
|
||||||
|
void SetMusicVolume(float value);
|
||||||
|
UFUNCTION(BlueprintCallable, Category = Settings)
|
||||||
|
void SetEffectsVolume(float value);
|
||||||
|
UFUNCTION(BlueprintCallable, Category = Settings)
|
||||||
|
void SetVoicesVolume(float value);
|
||||||
|
UFUNCTION(BlueprintCallable, Category = Settings)
|
||||||
|
void SetMenuVolume(float value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UPROPERTY(Config)
|
UPROPERTY(Config)
|
||||||
float fMouseSensetivity;
|
float fMouseSensetivity;
|
||||||
|
|
||||||
|
/** Audio */
|
||||||
|
UPROPERTY(Config)
|
||||||
|
float fMasterVolume;
|
||||||
|
UPROPERTY(Config)
|
||||||
|
float fMusicVolume;
|
||||||
|
UPROPERTY(Config)
|
||||||
|
float fEffectsVolume;
|
||||||
|
UPROPERTY(Config)
|
||||||
|
float fVoicesVolume;
|
||||||
|
UPROPERTY(Config)
|
||||||
|
float fMenuVolume;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -33,6 +33,13 @@ void ACustomPlayerController::AppendInputContext(TSoftObjectPtr<class UInputMapp
|
|||||||
subsystem->AddMappingContext(context.LoadSynchronous(), 0);
|
subsystem->AddMappingContext(context.LoadSynchronous(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ACustomPlayerController::ApplyMouseSettings()
|
||||||
|
{
|
||||||
|
if(auto settings = UCustomGameSettings::Get())
|
||||||
|
for(auto& context : contexts)
|
||||||
|
ApplyMouseSettings(context, settings);
|
||||||
|
}
|
||||||
|
|
||||||
void ACustomPlayerController::BeginPlay()
|
void ACustomPlayerController::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
@ -71,15 +78,19 @@ void ACustomPlayerController::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
|||||||
Super::EndPlay(EndPlayReason);
|
Super::EndPlay(EndPlayReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACustomPlayerController::ApplyMouseSettings(TSoftObjectPtr<class UInputMappingContext>& context)
|
void ACustomPlayerController::ApplyMouseSettings(TSoftObjectPtr<class UInputMappingContext>& context, UCustomGameSettings* settings)
|
||||||
{
|
{
|
||||||
auto gameSettings = UCustomGameSettings::Get();
|
if(!settings)
|
||||||
if(!gameSettings)
|
{
|
||||||
return;
|
settings = UCustomGameSettings::Get();
|
||||||
|
if(!settings)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!context.LoadSynchronous())
|
if(!context.LoadSynchronous())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
bool contextChanged = false;
|
||||||
for(auto& mapping : context.LoadSynchronous()->GetMappings())
|
for(auto& mapping : context.LoadSynchronous()->GetMappings())
|
||||||
{
|
{
|
||||||
if(mapping.Key != EKeys::Mouse2D)
|
if(mapping.Key != EKeys::Mouse2D)
|
||||||
@ -87,20 +98,27 @@ void ACustomPlayerController::ApplyMouseSettings(TSoftObjectPtr<class UInputMapp
|
|||||||
|
|
||||||
for(auto& modifier : mapping.Modifiers)
|
for(auto& modifier : mapping.Modifiers)
|
||||||
{
|
{
|
||||||
if(gameSettings->bMouseInverted)
|
if(auto negate_modifier = Cast<UInputModifierNegate>(modifier))
|
||||||
{
|
{
|
||||||
if(auto negate_modifier = Cast<UInputModifierNegate>(modifier))
|
negate_modifier->bY = !settings->bMouseInverted;
|
||||||
{
|
contextChanged = true;
|
||||||
negate_modifier->bY = !negate_modifier->bY;
|
}
|
||||||
continue;
|
else if(auto scalar_modifier = Cast<UInputModifierScalar>(modifier))
|
||||||
}
|
{
|
||||||
|
scalar_modifier->Scalar = FVector{ settings->GetMouseSensetivity() };
|
||||||
|
contextChanged = true;
|
||||||
}
|
}
|
||||||
if(auto scalar_modifier = Cast<UInputModifierScalar>(modifier))
|
|
||||||
scalar_modifier->Scalar = FVector{ gameSettings->GetMouseSensetivity() * 0.5 };
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UEnhancedInputLibrary::RequestRebuildControlMappingsUsingContext(context.LoadSynchronous());
|
if(contextChanged)
|
||||||
|
{
|
||||||
|
if(subsystem)
|
||||||
|
{
|
||||||
|
FModifyContextOptions options;
|
||||||
|
subsystem->RequestRebuildControlMappings(options, EInputMappingRebuildType::RebuildWithFlush);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACustomPlayerController::OnAnyKeyPressed(FKey key)
|
void ACustomPlayerController::OnAnyKeyPressed(FKey key)
|
||||||
|
@ -30,6 +30,10 @@ public:
|
|||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
static void AppendInputContext(TSoftObjectPtr<class UInputMappingContext> context);
|
static void AppendInputContext(TSoftObjectPtr<class UInputMappingContext> context);
|
||||||
|
|
||||||
|
/** Applies mouse settings to all loaded contexts */
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
static void ApplyMouseSettings();
|
||||||
|
|
||||||
FPlayerAnyKeyPressedDelegate onAnyKeyPressed;
|
FPlayerAnyKeyPressedDelegate onAnyKeyPressed;
|
||||||
FPlayerAnyKeyReleasedDelegate onAnyKeyReleased;
|
FPlayerAnyKeyReleasedDelegate onAnyKeyReleased;
|
||||||
|
|
||||||
@ -38,7 +42,8 @@ protected:
|
|||||||
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void ApplyMouseSettings(TSoftObjectPtr<class UInputMappingContext>& context);
|
/** Applies mouse settings to the specific context */
|
||||||
|
static void ApplyMouseSettings(TSoftObjectPtr<class UInputMappingContext>& context, class UCustomGameSettings* settings = nullptr);
|
||||||
|
|
||||||
void OnAnyKeyPressed(FKey key);
|
void OnAnyKeyPressed(FKey key);
|
||||||
void OnAnyKeyReleased(FKey key);
|
void OnAnyKeyReleased(FKey key);
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
#include "GraphicsSettingsHelper.h"
|
||||||
|
|
||||||
|
#include "GenericPlatform/GenericApplication.h"
|
||||||
|
|
||||||
|
int32 UGraphicsSettingsHelper::GetPrimaryMonitorId()
|
||||||
|
{
|
||||||
|
FDisplayMetrics FDM;
|
||||||
|
FDisplayMetrics::GetMonitorsInfo(FDM);
|
||||||
|
TArray<FMonitorInfo> buffer;
|
||||||
|
for(const FMonitorInfo& i : FDM.MonitorInfo)
|
||||||
|
{
|
||||||
|
buffer.Add(FMonitorInfo(i.Name, i.ID, i.NativeWidth, i.NativeHeight,
|
||||||
|
FPlatformRectangle(i.DisplayRect.Left, i.DisplayRect.Top, i.DisplayRect.Right, i.DisplayRect.Bottom),
|
||||||
|
FPlatformRectangle(i.WorkArea.Left, i.WorkArea.Top, i.WorkArea.Right, i.WorkArea.Bottom),
|
||||||
|
i.bIsPrimary, i.DPI));
|
||||||
|
}
|
||||||
|
monitors = buffer;
|
||||||
|
TArray<FMonitorInfo> monitors = GetAvailableMonitors();
|
||||||
|
for(int i = 0; i < monitors.Num(); i++)
|
||||||
|
if(monitors[i].bIsPrimary)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 UGraphicsSettingsHelper::GetCurrentMonitorId()
|
||||||
|
{
|
||||||
|
return int32();
|
||||||
|
}
|
||||||
|
|
||||||
|
//TArray<FMonitorInfo> UGraphicsSettingsHelper::GetAvailableMonitors()
|
||||||
|
//{
|
||||||
|
// return TArray<FMonitorInfo>();
|
||||||
|
//}
|
||||||
|
|
||||||
|
void UGraphicsSettingsHelper::SetMonitor(int32 id)
|
||||||
|
{}
|
@ -0,0 +1,23 @@
|
|||||||
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||||
|
|
||||||
|
#include "GraphicsSettingsHelper.generated.h"
|
||||||
|
|
||||||
|
UCLASS()
|
||||||
|
class UGraphicsSettingsHelper : public UBlueprintFunctionLibrary
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UFUNCTION(BlueprintPure, Category = GraphicsSettingsHelper)
|
||||||
|
static int32 GetPrimaryMonitorId();
|
||||||
|
UFUNCTION(BlueprintPure, Category = GraphicsSettingsHelper)
|
||||||
|
static int32 GetCurrentMonitorId();
|
||||||
|
//UFUNCTION(BlueprintPure, Category = GraphicsSettingsHelper)
|
||||||
|
//static TArray<FMonitorInfo> GetAvailableMonitors();
|
||||||
|
UFUNCTION(BlueprintCallable, Category = GraphicsSettingsHelper)
|
||||||
|
static void SetMonitor(int32 id);
|
||||||
|
};
|
@ -371,16 +371,22 @@ void APlayerBase::ShowMenu()
|
|||||||
if(GetWorld()->IsPaused())
|
if(GetWorld()->IsPaused())
|
||||||
{
|
{
|
||||||
WM->HideMainMenu();
|
WM->HideMainMenu();
|
||||||
playerController->SetShowMouseCursor(false);
|
if(auto PC = ACustomPlayerController::Get())
|
||||||
playerController->SetInputMode(FInputModeGameOnly{});
|
{
|
||||||
|
PC->SetShowMouseCursor(false);
|
||||||
|
PC->SetInputMode(FInputModeGameOnly{});
|
||||||
|
}
|
||||||
UnlockPlayer(FPlayerLock::All());
|
UnlockPlayer(FPlayerLock::All());
|
||||||
UGameplayStatics::SetGamePaused(GetWorld(), false);
|
UGameplayStatics::SetGamePaused(GetWorld(), false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WM->ShowMainMenu();
|
WM->ShowMainMenu();
|
||||||
playerController->SetShowMouseCursor(true);
|
if(auto PC = ACustomPlayerController::Get())
|
||||||
playerController->SetInputMode(FInputModeGameAndUI{});
|
{
|
||||||
|
PC->SetShowMouseCursor(true);
|
||||||
|
PC->SetInputMode(FInputModeGameAndUI{});
|
||||||
|
}
|
||||||
LockPlayer(FPlayerLock::All());
|
LockPlayer(FPlayerLock::All());
|
||||||
UGameplayStatics::SetGamePaused(GetWorld(), true);
|
UGameplayStatics::SetGamePaused(GetWorld(), true);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,6 @@ protected:
|
|||||||
UFUNCTION(BlueprintCallable, Category = Character)
|
UFUNCTION(BlueprintCallable, Category = Character)
|
||||||
void ShowMenu();
|
void ShowMenu();
|
||||||
|
|
||||||
class APlayerController* playerController;
|
|
||||||
UPROPERTY(EditAnywhere)
|
UPROPERTY(EditAnywhere)
|
||||||
float moveSpeed = 200;
|
float moveSpeed = 200;
|
||||||
UPROPERTY(EditAnywhere)
|
UPROPERTY(EditAnywhere)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ResolutionResponsiveUserWidget.h"
|
#include "ResolutionResponsiveWidget.h"
|
||||||
|
|
||||||
#include "AutohideWidget.generated.h"
|
#include "AutohideWidget.generated.h"
|
||||||
|
|
||||||
@ -10,7 +10,7 @@
|
|||||||
* Automatically hides itself after some period
|
* Automatically hides itself after some period
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UAutohideWidget : public UResolutionResponsiveUserWidget
|
class UAutohideWidget : public UResolutionResponsiveWidget
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
#include "ComboBoxText.h"
|
||||||
|
|
||||||
|
void UComboBoxText::PostInitProperties()
|
||||||
|
{
|
||||||
|
Super::PostInitProperties();
|
||||||
|
|
||||||
|
SetOptions(_DefaultOptions);
|
||||||
|
_DefaultOptions.Empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UComboBoxText::SetOptions(const TArray<FText>& options)
|
||||||
|
{
|
||||||
|
ClearSelection();
|
||||||
|
Options.Empty();
|
||||||
|
for(auto& o : options)
|
||||||
|
Options.Add(MakeShareable(new FString(o.ToString())));
|
||||||
|
RefreshOptions();
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Components/ComboBoxString.h"
|
||||||
|
|
||||||
|
#include "ComboBoxText.generated.h"
|
||||||
|
|
||||||
|
UCLASS(Blueprintable, meta = (DisplayName = "ComboBox (Text)"), MinimalAPI)
|
||||||
|
class UComboBoxText : public UComboBoxString
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual void PostInitProperties() override;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void SetOptions(const TArray<FText>& options);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
UPROPERTY(EditAnywhere, Category = ComboBoxTextDefault)
|
||||||
|
TArray<FText> _DefaultOptions;
|
||||||
|
};
|
@ -3,14 +3,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "InputAnimatedWidgetInterface.h"
|
#include "InputAnimatedWidgetInterface.h"
|
||||||
#include "ResolutionResponsiveUserWidget.h"
|
#include "ResolutionResponsiveWidget.h"
|
||||||
|
|
||||||
#include "CutsceneSkipWidget.generated.h"
|
#include "CutsceneSkipWidget.generated.h"
|
||||||
|
|
||||||
DECLARE_DYNAMIC_DELEGATE(FSkipCutsceneDelegate);
|
DECLARE_DYNAMIC_DELEGATE(FSkipCutsceneDelegate);
|
||||||
|
|
||||||
UCLASS(Blueprintable, Abstract)
|
UCLASS(Blueprintable, Abstract)
|
||||||
class UCutsceneSkipWidget : public UResolutionResponsiveUserWidget, public IInputAnimatedWidgetInterface
|
class UCutsceneSkipWidget : public UResolutionResponsiveWidget, public IInputAnimatedWidgetInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ResolutionResponsiveUserWidget.h"
|
#include "ResolutionResponsiveWidget.h"
|
||||||
|
|
||||||
#include "DialogueRowWidget.generated.h"
|
#include "DialogueRowWidget.generated.h"
|
||||||
|
|
||||||
enum class EDialogueWaveType : uint8;
|
enum class EDialogueWaveType : uint8;
|
||||||
|
|
||||||
UCLASS(Blueprintable, Abstract)
|
UCLASS(Blueprintable, Abstract)
|
||||||
class UDialogueRowWidget : public UResolutionResponsiveUserWidget
|
class UDialogueRowWidget : public UResolutionResponsiveWidget
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "InputAnimatedWidgetInterface.h"
|
#include "InputAnimatedWidgetInterface.h"
|
||||||
#include "ResolutionResponsiveUserWidget.h"
|
#include "ResolutionResponsiveWidget.h"
|
||||||
|
|
||||||
#include "DialogueSkipWidget.generated.h"
|
#include "DialogueSkipWidget.generated.h"
|
||||||
|
|
||||||
DECLARE_DYNAMIC_DELEGATE(FDialogueSkipDelegate);
|
DECLARE_DYNAMIC_DELEGATE(FDialogueSkipDelegate);
|
||||||
|
|
||||||
UCLASS(Blueprintable, Abstract)
|
UCLASS(Blueprintable, Abstract)
|
||||||
class UDialogueSkipWidget : public UResolutionResponsiveUserWidget, public IInputAnimatedWidgetInterface
|
class UDialogueSkipWidget : public UResolutionResponsiveWidget, public IInputAnimatedWidgetInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "InputAnimatedWidgetInterface.h"
|
#include "InputAnimatedWidgetInterface.h"
|
||||||
#include "ResolutionResponsiveUserWidget.h"
|
#include "ResolutionResponsiveWidget.h"
|
||||||
|
|
||||||
#include "InteractableHintWidget.generated.h"
|
#include "InteractableHintWidget.generated.h"
|
||||||
|
|
||||||
UCLASS(Blueprintable, Abstract)
|
UCLASS(Blueprintable, Abstract)
|
||||||
class UInteractableHintWidget : public UResolutionResponsiveUserWidget, public IInputAnimatedWidgetInterface
|
class UInteractableHintWidget : public UResolutionResponsiveWidget, public IInputAnimatedWidgetInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "AutohideWidget.h"
|
#include "AutohideWidget.h"
|
||||||
#include "ResolutionResponsiveUserWidget.h"
|
#include "ResolutionResponsiveWidget.h"
|
||||||
|
|
||||||
#include "JournalWidget.generated.h"
|
#include "JournalWidget.generated.h"
|
||||||
|
|
||||||
|
@ -11,16 +11,6 @@
|
|||||||
|
|
||||||
bool UMainMenuWidget::Initialize()
|
bool UMainMenuWidget::Initialize()
|
||||||
{
|
{
|
||||||
if(ButtonLoadLastSave)
|
|
||||||
{
|
|
||||||
auto GI = UCustomGameInstance::Get();
|
|
||||||
if(GI && GI->saveData)
|
|
||||||
{
|
|
||||||
ButtonLoadLastSave->SetIsEnabled(true);
|
|
||||||
ButtonLoadLastSave->SetRenderOpacity(1.0f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//FWidgetAnimationDynamicEvent closeFinished;
|
//FWidgetAnimationDynamicEvent closeFinished;
|
||||||
//closeFinished.BindDynamic(this, &UMainMenuWidget::Closed);
|
//closeFinished.BindDynamic(this, &UMainMenuWidget::Closed);
|
||||||
//BindToAnimationFinished(closeAnimation, closeFinished);
|
//BindToAnimationFinished(closeAnimation, closeFinished);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Widgets/ResolutionResponsiveUserWidget.h"
|
#include "Widgets/ResolutionResponsiveWidget.h"
|
||||||
|
|
||||||
#include "MainMenuWidget.generated.h"
|
#include "MainMenuWidget.generated.h"
|
||||||
|
|
||||||
@ -30,24 +30,9 @@ public:
|
|||||||
UPROPERTY(BlueprintAssignable)
|
UPROPERTY(BlueprintAssignable)
|
||||||
FMainMenuClosedDelegate OnMainMenuClosedDelegate;
|
FMainMenuClosedDelegate OnMainMenuClosedDelegate;
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(BlueprintReadOnly, Transient, meta = (BindWidgetAnim))
|
||||||
class UMainMenuButtonWidget* ButtonContinue;
|
class UWidgetAnimation* extendAnimation;
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(BlueprintReadOnly, Transient, meta = (BindWidgetAnim))
|
||||||
class UMainMenuButtonWidget* ButtonLoadLastSave;
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
|
||||||
class UMainMenuButtonWidget* ButtonNewGame;
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
|
||||||
class UMainMenuButtonWidget* ButtonOptions;
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
|
||||||
class UMainMenuButtonWidget* ButtonCredits;
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
|
||||||
class UMainMenuButtonWidget* ButtonExit;
|
|
||||||
|
|
||||||
UPROPERTY(Transient, meta = (BindWidgetAnim))
|
|
||||||
class UWidgetAnimation* showFullAnimation;
|
|
||||||
UPROPERTY(Transient, meta = (BindWidgetAnim))
|
|
||||||
class UWidgetAnimation* showFastAnimation;
|
|
||||||
UPROPERTY(Transient, meta = (BindWidgetAnim))
|
|
||||||
class UWidgetAnimation* closeAnimation;
|
class UWidgetAnimation* closeAnimation;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "QuickTimeEvent.h" // forward declaration of EQuickTimeEventResult is somehow insufficient on some machines
|
#include "QuickTimeEvent.h" // forward declaration of EQuickTimeEventResult is somehow insufficient on some machines
|
||||||
#include "Widgets/ResolutionResponsiveUserWidget.h"
|
#include "Widgets/ResolutionResponsiveWidget.h"
|
||||||
|
|
||||||
#include "QuickTimeEventWidget.generated.h"
|
#include "QuickTimeEventWidget.generated.h"
|
||||||
|
|
||||||
enum class EQuickTimeEventResult : uint8;
|
enum class EQuickTimeEventResult : uint8;
|
||||||
|
|
||||||
UCLASS(Blueprintable, Abstract)
|
UCLASS(Blueprintable, Abstract)
|
||||||
class UQuickTimeEventWidget : public UResolutionResponsiveUserWidget
|
class UQuickTimeEventWidget : public UResolutionResponsiveWidget
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Widgets/WorldDilationResponsiveUserWidget.h"
|
#include "Widgets/WorldDilationResponsiveWidget.h"
|
||||||
|
|
||||||
#include "QuickTimeEventWidgetManager.generated.h"
|
#include "QuickTimeEventWidgetManager.generated.h"
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ enum class EQuickTimeEventResult : uint8;
|
|||||||
class UQuickTimeEventWidget;
|
class UQuickTimeEventWidget;
|
||||||
|
|
||||||
UCLASS(Blueprintable, Abstract)
|
UCLASS(Blueprintable, Abstract)
|
||||||
class UQuickTimeEventWidgetManager : public UWorldDilationResponsiveUserWidget
|
class UQuickTimeEventWidgetManager : public UWorldDilationResponsiveWidget
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
#include "ResolutionResponsiveUserWidget.h"
|
#include "ResolutionResponsiveWidget.h"
|
||||||
|
|
||||||
#include "Components/PanelSlot.h"
|
#include "Components/PanelSlot.h"
|
||||||
#include "UnrealClient.h"
|
#include "UnrealClient.h"
|
||||||
|
|
||||||
bool UResolutionResponsiveUserWidget::Initialize()
|
bool UResolutionResponsiveWidget::Initialize()
|
||||||
{
|
{
|
||||||
_viewportResizedEventHandle = FViewport::ViewportResizedEvent.AddUObject(this, &UResolutionResponsiveUserWidget::Rescale);
|
_viewportResizedEventHandle = FViewport::ViewportResizedEvent.AddUObject(this, &UResolutionResponsiveWidget::Rescale);
|
||||||
|
|
||||||
return UUserWidget::Initialize();
|
return UUserWidget::Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UResolutionResponsiveUserWidget::BeginDestroy()
|
void UResolutionResponsiveWidget::BeginDestroy()
|
||||||
{
|
{
|
||||||
if(_viewportResizedEventHandle.IsValid())
|
if(_viewportResizedEventHandle.IsValid())
|
||||||
{
|
{
|
||||||
@ -22,18 +22,18 @@ void UResolutionResponsiveUserWidget::BeginDestroy()
|
|||||||
UUserWidget::BeginDestroy();
|
UUserWidget::BeginDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UResolutionResponsiveUserWidget::Rescale(FViewport* ViewPort, uint32 val)
|
void UResolutionResponsiveWidget::Rescale(FViewport* ViewPort, uint32 val)
|
||||||
{
|
{
|
||||||
_scale = (float)defaultResolution / ViewPort->GetSizeXY().GetMin();
|
_scale = (float)defaultResolution / ViewPort->GetSizeXY().GetMin();
|
||||||
Rescale();
|
Rescale();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UResolutionResponsiveUserWidget::Rescale_Implementation()
|
void UResolutionResponsiveWidget::Rescale_Implementation()
|
||||||
{
|
{
|
||||||
SetRenderScale(FVector2D{ _scale });
|
SetRenderScale(FVector2D{ _scale });
|
||||||
}
|
}
|
||||||
|
|
||||||
float UResolutionResponsiveUserWidget::GetScale() const
|
float UResolutionResponsiveWidget::GetScale() const
|
||||||
{
|
{
|
||||||
return _scale;
|
return _scale;
|
||||||
}
|
}
|
@ -4,13 +4,13 @@
|
|||||||
|
|
||||||
#include "Blueprint/UserWidget.h"
|
#include "Blueprint/UserWidget.h"
|
||||||
|
|
||||||
#include "ResolutionResponsiveUserWidget.generated.h"
|
#include "ResolutionResponsiveWidget.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatically scale itself for current resolution to keep UI sizes universal.
|
* Automatically scale itself for current resolution to keep UI sizes universal.
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UResolutionResponsiveUserWidget : public UUserWidget
|
class UResolutionResponsiveWidget : public UUserWidget
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
#include "WorldDilationResponsiveUserWidget.h"
|
#include "WorldDilationResponsiveWidget.h"
|
||||||
|
|
||||||
#include "Animation/UMGSequencePlayer.h"
|
#include "Animation/UMGSequencePlayer.h"
|
||||||
#include "Animation/WidgetAnimation.h"
|
#include "Animation/WidgetAnimation.h"
|
||||||
@ -8,21 +8,21 @@
|
|||||||
|
|
||||||
#include "CommonFunctions.h"
|
#include "CommonFunctions.h"
|
||||||
|
|
||||||
bool UWorldDilationResponsiveUserWidget::Initialize()
|
bool UWorldDilationResponsiveWidget::Initialize()
|
||||||
{
|
{
|
||||||
UCommonFunctions::GetWorldDilationChangedDelegate().AddDynamic(this, &UWorldDilationResponsiveUserWidget::UpdateAnimations);
|
UCommonFunctions::GetWorldDilationChangedDelegate().AddDynamic(this, &UWorldDilationResponsiveWidget::UpdateAnimations);
|
||||||
|
|
||||||
return UUserWidget::Initialize();
|
return UUserWidget::Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UWorldDilationResponsiveUserWidget::BeginDestroy()
|
void UWorldDilationResponsiveWidget::BeginDestroy()
|
||||||
{
|
{
|
||||||
UCommonFunctions::GetWorldDilationChangedDelegate().RemoveDynamic(this, &UWorldDilationResponsiveUserWidget::UpdateAnimations);
|
UCommonFunctions::GetWorldDilationChangedDelegate().RemoveDynamic(this, &UWorldDilationResponsiveWidget::UpdateAnimations);
|
||||||
|
|
||||||
UUserWidget::BeginDestroy();
|
UUserWidget::BeginDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UWorldDilationResponsiveUserWidget::UpdateAnimations(float newSpeed)
|
void UWorldDilationResponsiveWidget::UpdateAnimations(float newSpeed)
|
||||||
{
|
{
|
||||||
UpdateAnimation(GetRootWidget(), newSpeed);
|
UpdateAnimation(GetRootWidget(), newSpeed);
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ void UWorldDilationResponsiveUserWidget::UpdateAnimations(float newSpeed)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UWorldDilationResponsiveUserWidget::UpdateAnimation(UWidget* widget, float newSpeed)
|
void UWorldDilationResponsiveWidget::UpdateAnimation(UWidget* widget, float newSpeed)
|
||||||
{
|
{
|
||||||
if(auto userWidget = Cast<UUserWidget>(widget))
|
if(auto userWidget = Cast<UUserWidget>(widget))
|
||||||
{
|
{
|
@ -4,13 +4,13 @@
|
|||||||
|
|
||||||
#include "Blueprint/UserWidget.h"
|
#include "Blueprint/UserWidget.h"
|
||||||
|
|
||||||
#include "WorldDilationResponsiveUserWidget.generated.h"
|
#include "WorldDilationResponsiveWidget.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatically update animations speed to sync with world time dilation
|
* Automatically update animations speed to sync with world time dilation
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UWorldDilationResponsiveUserWidget : public UUserWidget
|
class UWorldDilationResponsiveWidget : public UUserWidget
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user