63. Ghost Globe
This commit is contained in:
parent
014925b5c6
commit
3a3f0c0271
3
.vscode/c_cpp_properties.json
vendored
3
.vscode/c_cpp_properties.json
vendored
@ -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
20
GASATHON.code-workspace
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
BIN
Project/Binaries/Win64/UnrealEditor-GasaEditor.dll
(Stored with Git LFS)
BIN
Project/Binaries/Win64/UnrealEditor-GasaEditor.dll
(Stored with Git LFS)
Binary file not shown.
@ -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
|
||||
}
|
||||
]
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "GasaEngineMinimal.h"
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "GasaCommon.h"
|
||||
#include "GasaUserWidget.h"
|
||||
@ -15,6 +15,20 @@ public:
|
||||
// Just learning: https://benui.ca/unreal/build-widgets-in-editor/?utm_medium=social&utm_source=Discord
|
||||
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")
|
||||
@ -26,12 +40,15 @@ 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;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidgetOptional), Category="Globe")
|
||||
UGasaImage* Glass;
|
||||
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category="Globe")
|
||||
void SetBezelStyle(FSlateBrush brush);
|
||||
|
||||
@ -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
|
||||
|
@ -9933,8 +9933,7 @@ namespace parser
|
||||
param->Name = get_cached_string( name );
|
||||
|
||||
param->PostNameMacro = post_name_macro;
|
||||
|
||||
param->ValueType = type;
|
||||
param->ValueType = type;
|
||||
|
||||
if ( value )
|
||||
param->Value = value;
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user