63. Ghost Globe

This commit is contained in:
Edward R. Gonzalez 2024-10-19 21:33:20 -04:00
parent 014925b5c6
commit 3a3f0c0271
9 changed files with 108 additions and 12 deletions

View File

@ -9,7 +9,8 @@
"_DEBUG",
"UNICODE",
"_UNICODE",
"GASA_INTELLISENSE_DIRECTIVES=1"
"GASA_INTELLISENSE_DIRECTIVES=1",
"WITH_EDITOR=1",
],
"windowsSdkVersion": "10.0.22621.0",
"compilerPath": "cl.exe"

20
GASATHON.code-workspace Normal file
View File

@ -0,0 +1,20 @@
{
"folders": [
{
"path": "."
},
{
"path": "../Surgo/UE"
}
],
"settings": {
"autoHide.autoHideSideBar": false,
"autoHide.autoHidePanel": false,
"files.associations": {
"*.rmd": "markdown",
"*.ipp": "cpp",
"__hash_table": "cpp",
"string": "cpp"
}
}
}

Binary file not shown.

View File

@ -210,8 +210,7 @@
"SupportedTargetPlatforms": [
"Win64",
"Linux",
"Android",
"VisionOS"
"Android"
]
},
{
@ -293,8 +292,7 @@
"SupportedTargetPlatforms": [
"Win64",
"Linux",
"Android",
"VisionOS"
"Android"
]
},
{
@ -340,6 +338,10 @@
{
"Name": "LiveUpdateForSlate",
"Enabled": true
},
{
"Name": "SunPosition",
"Enabled": true
}
]
}

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "GasaEngineMinimal.h"

View File

@ -8,6 +8,7 @@
#include "Components/OverlaySlot.h"
#include "Blueprint/WidgetBlueprintGeneratedClass.h"
#include "Blueprint/WidgetTree.h"
#include "TimerManager.h"
#include "Extensions/WidgetBlueprintGeneratedClassExtension.h"
#if WITH_EDITOR
@ -61,6 +62,11 @@ void UGlobeProgressBar::GenerateDesignerWidgetTemplate()
#endif
}
void UGlobeProgressBar::GhostPercentUpdateViaTimer()
{
GhostTargetPercent = Bar->GetPercent();
}
#pragma region Bindings
void UGlobeProgressBar::SetBezelStyle(FSlateBrush brush)
{
@ -78,6 +84,11 @@ void UGlobeProgressBar::SetBarStyle(FProgressBarStyle style)
Bar->SetWidgetStyle( style );
}
void UGlobeProgressBar::SetGhostBarStyle(FProgressBarStyle style)
{
GhostBar->SetWidgetStyle( style );
}
void UGlobeProgressBar::SetGlassPadding(FMargin margin)
{
UOverlaySlot* GlassSlot = CastChecked<UOverlaySlot>(Glass->Slot);
@ -91,7 +102,26 @@ void UGlobeProgressBar::SetGlassStyle(FSlateBrush brush)
void UGlobeProgressBar::SetPercentage(float CurrentValue, float MaxValue)
{
Bar->SetPercent( MaxValue > 0.f ? CurrentValue / MaxValue : 0.f );
float PreviousValue = Bar->GetPercent();
float CurrentValueClamped = MaxValue > 0.f ? CurrentValue / MaxValue : 0.f;
Bar->SetPercent( CurrentValueClamped );
UWorld* World = GetWorld();
FTimerManager& TM = World->GetTimerManager();
if ( CurrentValueClamped < PreviousValue )
{
// Timer will auto-clear previous set delay
TM.SetTimer( GhostPercentChangeTimer, this, & UGlobeProgressBar::GhostPercentUpdateViaTimer, GhostPercentChangeDelay );
}
else
{
if ( TM.TimerExists( GhostPercentChangeTimer ))
TM.ClearTimer( GhostPercentChangeTimer );
GhostBar->SetPercent( CurrentValueClamped );
GhostTargetPercent = CurrentValueClamped;
}
}
void UGlobeProgressBar::SetSize(float width, float height)
@ -131,10 +161,31 @@ void UGlobeProgressBar::NativePreConstruct()
DesiredFocusWidget.Resolve(WidgetTree);
// Basic initialization
{
GhostTargetPercent = Bar->GetPercent();
GhostBar->SetPercent( GhostTargetPercent );
}
// Blueprint Callback
PreConstruct(bIsDesignTime);
}
void UGlobeProgressBar::NativeTick(const FGeometry& MyGeometry, float InDeltaTime)
{
Super::NativeTick(MyGeometry, InDeltaTime);
UWorld* World = GetWorld();
FTimerManager& TM = World->GetTimerManager();
// Ghost Percent Interpolation
if ( ! TM.TimerExists( GhostPercentChangeTimer ))
{
float NextPercent = FMath::FInterpTo( GhostBar->GetPercent(), GhostTargetPercent, InDeltaTime, GhostPercentInterpolationSpeed );
GhostBar->SetPercent( NextPercent );
}
}
void UGlobeProgressBar::Serialize(FArchive& Ar)
{
Super::Serialize(Ar);
@ -145,3 +196,4 @@ void UGlobeProgressBar::Serialize(FStructuredArchive::FRecord Record)
Super::Serialize(Record);
}
#pragma endregion UserWidget

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "GasaCommon.h"
#include "GasaUserWidget.h"
@ -16,6 +16,20 @@ public:
UFUNCTION(CallInEditor, Category="Generate Designer Widget Template")
void GenerateDesignerWidgetTemplate();
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Globe")
float GhostTargetPercent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Globe")
float GhostPercentInterpolationSpeed;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Globe")
float GhostPercentChangeDelay;
FTimerHandle GhostPercentChangeTimer;
UFUNCTION()
void GhostPercentUpdateViaTimer();
#pragma region Bindings
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidgetOptional), Category="Globe")
UGasaSizeBox* Root_SB;
@ -26,6 +40,9 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidgetOptional), Category="Globe")
UGasaImage* Bezel;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidgetOptional), Category="Globe")
UGasaProgressBar* GhostBar;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidgetOptional), Category="Globe")
UGasaProgressBar* Bar;
@ -41,6 +58,9 @@ public:
UFUNCTION(BlueprintCallable, Category="Globe")
void SetBarStyle(FProgressBarStyle style);
UFUNCTION(BlueprintCallable, Category="Globe")
void SetGhostBarStyle(FProgressBarStyle style);
UFUNCTION(BlueprintCallable, Category="Globe")
void SetGlassPadding( FMargin margin );
@ -64,6 +84,8 @@ public:
#pragma region UserWidget
void NativePreConstruct() override;
void NativeTick(const FGeometry& MyGeometry, float InDeltaTime);
#pragma endregion UserWidget
#pragma region Object

View File

@ -9933,7 +9933,6 @@ namespace parser
param->Name = get_cached_string( name );
param->PostNameMacro = post_name_macro;
param->ValueType = type;
if ( value )

Binary file not shown.