暂存一波 (#1)

Reviewed-on: http://www.tengenverse.com:3000/osticko/TG_ARPG/pulls/1
This commit is contained in:
2023-08-25 18:05:38 +00:00
parent d8ab28268e
commit 1fdff56070
95 changed files with 2826 additions and 1 deletions

View File

@@ -1,4 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" /> <component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise">
<file url="file://$PROJECT_DIR$/Source/TG_ARPG/Private/TG_ControllerBase.cpp" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/Source/TG_ARPG/Public/TG_ControllerBase.h" charset="UTF-8" />
</component>
</project> </project>

View File

@@ -155,3 +155,4 @@ bInitServerOnClient=true
[/Script/OnlineSubsystemSteam.SteamNetDriver] [/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection" NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"

View File

@@ -9,4 +9,5 @@ bRequiresPushToTalk=true
[/Script/CommonInput.CommonInputSettings] [/Script/CommonInput.CommonInputSettings]
InputData=/CommonUI/GenericInputData.GenericInputData_C InputData=/CommonUI/GenericInputData.GenericInputData_C
bEnableEnhancedInputSupport=True

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,29 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "3.3",
"FriendlyName": "DBTween",
"Description": "This is a Plugin for Tweeen Animation",
"Category": "Other",
"CreatedBy": "DearBing",
"CreatedByURL": "",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"EngineVersion": "5.2.0",
"CanContainContent": false,
"Installed": true,
"SupportedTargetPlatforms": [
"Win64"
],
"Modules": [
{
"Name": "DBTween",
"Type": "Runtime",
"LoadingPhase": "Default",
"PlatformAllowList": [
"Win64"
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,55 @@
// Copyright 2020-2021, DearBing. All Rights Reserved.
using UnrealBuildTool;
using System.IO;
public class DBTween : ModuleRules
{
public DBTween(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
bEnableUndefinedIdentifierWarnings = false;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"UMG",
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}

View File

@@ -0,0 +1,20 @@
// Copyright 2020-2021, DearBing. All Rights Reserved.
#include "DBTween.h"
#define LOCTEXT_NAMESPACE "FDBTweenModule"
void FDBTweenModule::StartupModule()
{
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
}
void FDBTweenModule::ShutdownModule()
{
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
// we call this function before unloading the module.
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FDBTweenModule, DBTween)

View File

@@ -0,0 +1,309 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#include "DBTweenActor.h"
#include "GameFramework/Actor.h"
UDBTweenActor* UDBTweenActor::DOLocalMove(FString TweenName, float DurTime, AActor* Actor, FVector End, EaseType easeType, bool IsLoop)
{
if(!Actor) return nullptr;
UDBTweenActor* result = NewObject<UDBTweenActor>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartLocValue = Actor->GetRootComponent()->GetRelativeLocation();
result->EndLocValue = End;
result->SetLooping(IsLoop);
result->Actor = Actor;
result->DBTweenActorType = EDBTweenActorType::E_ActorRelativeLocation;
result->CurEasyType = easeType;
return result;
}
UDBTweenActor* UDBTweenActor::DOLocalMoveByCurve(FString TweenName, float DurTime, AActor* Actor, FVector End,UCurveFloat* Curve, bool IsLoop)
{
if(!Actor) return nullptr;
UDBTweenActor* result = NewObject<UDBTweenActor>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartLocValue = Actor->GetRootComponent()->GetRelativeLocation();
result->EndLocValue = End;
result->SetLooping(IsLoop);
result->Actor = Actor;
result->DBTweenActorType = EDBTweenActorType::E_ActorRelativeLocation;
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
UDBTweenActor* UDBTweenActor::DOLocalRotation(FString TweenName,float DurTime, AActor* Actor, FRotator End, EaseType easeType, bool IsLoop)
{
if(!Actor) return nullptr;
UDBTweenActor* result = NewObject<UDBTweenActor>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartRotValue = Actor->GetRootComponent()->GetRelativeRotation();
result->EndRotValue = End;
result->SetLooping(IsLoop);
result->Actor = Actor;
result->DBTweenActorType = EDBTweenActorType::E_ActorRelativeRotation;
result->CurEasyType = easeType;
return result;
}
UDBTweenActor* UDBTweenActor::DOLocalRotationByCurve(FString TweenName, float DurTime, AActor* Actor, FRotator End,UCurveFloat* Curve, bool IsLoop)
{
if(!Actor) return nullptr;
UDBTweenActor* result = NewObject<UDBTweenActor>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartRotValue = Actor->GetRootComponent()->GetRelativeRotation();
result->EndRotValue = End;
result->SetLooping(IsLoop);
result->Actor = Actor;
result->DBTweenActorType = EDBTweenActorType::E_ActorRelativeRotation;
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
UDBTweenActor* UDBTweenActor::DOLocalScale(FString TweenName,float DurTime, AActor* Actor, FVector End, EaseType easeType, bool IsLoop)
{
if(!Actor) return nullptr;
UDBTweenActor* result = NewObject<UDBTweenActor>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartScaleValue = Actor->GetActorRelativeScale3D();
result->EndScaleValue = End;
result->SetLooping(IsLoop);
result->Actor = Actor;
result->DBTweenActorType = EDBTweenActorType::E_ActorRelativeScale;
result->CurEasyType = easeType;
return result;
}
UDBTweenActor* UDBTweenActor::DOLocalScaleByCurve(FString TweenName, float DurTime, AActor* Actor, FVector End,UCurveFloat* Curve, bool IsLoop)
{
if(!Actor) return nullptr;
UDBTweenActor* result = NewObject<UDBTweenActor>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartScaleValue = Actor->GetActorRelativeScale3D();
result->EndScaleValue = End;
result->SetLooping(IsLoop);
result->Actor = Actor;
result->DBTweenActorType = EDBTweenActorType::E_ActorRelativeScale;
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
UDBTweenActor* UDBTweenActor::DOMove(FString TweenName,float DurTime, AActor* Actor, FVector End, EaseType easeType, bool IsLoop)
{
if(!Actor) return nullptr;
UDBTweenActor* result = NewObject<UDBTweenActor>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartLocValue = Actor->GetActorLocation();
result->EndLocValue = End;
result->SetLooping(IsLoop);
result->Actor = Actor;
result->DBTweenActorType = EDBTweenActorType::E_ActorLocation;
result->CurEasyType = easeType;
return result;
}
UDBTweenActor* UDBTweenActor::DOMoveByCurve(FString TweenName, float DurTime, AActor* Actor, FVector End,UCurveFloat* Curve, bool IsLoop)
{
if(!Actor) return nullptr;
UDBTweenActor* result = NewObject<UDBTweenActor>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartLocValue = Actor->GetActorLocation();
result->EndLocValue = End;
result->SetLooping(IsLoop);
result->Actor = Actor;
result->DBTweenActorType = EDBTweenActorType::E_ActorLocation;
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
UDBTweenActor* UDBTweenActor::DORotation(FString TweenName,float DurTime, AActor* Actor, FRotator End, EaseType easeType, bool IsLoop)
{
if(!Actor) return nullptr;
UDBTweenActor* result = NewObject<UDBTweenActor>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartRotValue = Actor->GetActorRotation();
result->EndRotValue = End;
result->SetLooping(IsLoop);
result->Actor = Actor;
result->DBTweenActorType = EDBTweenActorType::E_ActorRotation;
result->CurEasyType = easeType;
return result;
}
UDBTweenActor* UDBTweenActor::DORotationByCurve(FString TweenName, float DurTime, AActor* Actor, FRotator End,UCurveFloat* Curve, bool IsLoop)
{
if(!Actor) return nullptr;
UDBTweenActor* result = NewObject<UDBTweenActor>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartRotValue = Actor->GetActorRotation();
result->EndRotValue = End;
result->SetLooping(IsLoop);
result->Actor = Actor;
result->DBTweenActorType = EDBTweenActorType::E_ActorRotation;
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
UDBTweenActor* UDBTweenActor::DOScale(FString TweenName,float DurTime, AActor* Actor, FVector End, EaseType easeType, bool IsLoop)
{
if(!Actor) return nullptr;
UDBTweenActor* result = NewObject<UDBTweenActor>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartScaleValue = Actor->GetActorScale();
result->EndScaleValue = End;
result->SetLooping(IsLoop);
result->Actor = Actor;
result->DBTweenActorType = EDBTweenActorType::E_ActorScale;
result->CurEasyType = easeType;
return result;
}
UDBTweenActor* UDBTweenActor::DOScaleByCurve(FString TweenName, float DurTime, AActor* Actor, FVector End,UCurveFloat* Curve, bool IsLoop)
{
if(!Actor) return nullptr;
UDBTweenActor* result = NewObject<UDBTweenActor>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartScaleValue = Actor->GetActorScale();
result->EndScaleValue = End;
result->SetLooping(IsLoop);
result->Actor = Actor;
result->DBTweenActorType = EDBTweenActorType::E_ActorScale;
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
void UDBTweenActor::UpdateFunc(float deltaTime)
{
if (Paused)return;//
Super::UpdateFunc(deltaTime);
if (!Actor || !IsValid(Actor)) {
SetReadyToDestroy();
return;
}
if (!isInit)
{
isInit = true;
OnFirst.Broadcast();
}
switch (DBTweenActorType)
{
case E_ActorRelativeLocation:
{
FVector CurValue = StartLocValue + Evaluate() * (EndLocValue - StartLocValue);
if (Actor)
{
Actor->SetActorRelativeLocation(CurValue);
}
}
break;
case E_ActorLocation:
{
FVector CurValue = StartLocValue + Evaluate() * (EndLocValue - StartLocValue);
if (Actor)
{
Actor->SetActorLocation(CurValue);
}
}
break;
case E_ActorRelativeRotation:
{
FRotator CurValue = StartRotValue + Evaluate() * (EndRotValue - StartRotValue);
if (Actor)
{
Actor->SetActorRelativeRotation(CurValue);
}
}
break;
case E_ActorRotation:
{
FRotator CurValue = StartRotValue + Evaluate() * (EndRotValue - StartRotValue);
if (Actor)
{
Actor->SetActorRotation(CurValue);
}
}
break;
case E_ActorRelativeScale:
{
FVector CurValue = StartScaleValue + Evaluate() * (EndScaleValue - StartScaleValue);
if (Actor)
{
Actor->SetActorRelativeScale3D(CurValue);
}
}
break;
case E_ActorScale:
{
FVector CurValue = StartScaleValue + Evaluate() * (EndScaleValue - StartScaleValue);
if (Actor)
{
Actor->SetActorScale3D(CurValue);
}
}
break;
}
OnUpdate.Broadcast();
if (Finished)
{
OnComplete.Broadcast();
return;
}
}

View File

@@ -0,0 +1,502 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#include "DBTweenBase.h"
#include "DBTweenUpdateManager.h"
#include "Runtime/Engine/Classes/Kismet/KismetMathLibrary.h"
UDBTweenBase::~UDBTweenBase()
{
if (Finished)return;
Finished = true;
ADBTweenUpdateManager::RemoveUpdateCall(UpdateKey);
if(ADBTweenUpdateManager::Instance != nullptr)
ADBTweenUpdateManager::Instance->DBTweenDic.Remove(MyDBTweenKey);
}
bool UDBTweenBase::DBTweenStop(FString TweenName)
{
if (ADBTweenUpdateManager::Instance == nullptr)return false;
if(!ADBTweenUpdateManager::Instance->DBTweenDic.Contains(TweenName))
{
return false;
}
else
{
ADBTweenUpdateManager::Instance->DBTweenDic[TweenName]->SetReadyToDestroy();
return true;
}
}
void UDBTweenBase::SetOvershootOrAmplitudeAndPeriod(float OvershootOrAmplitudeParam, float PeriodParam)
{
easePeriod = PeriodParam;
easeOvershootOrAmplitude = OvershootOrAmplitudeParam;
}
bool UDBTweenBase::DBTweenReset(FString TweenName)
{
if (ADBTweenUpdateManager::Instance == nullptr)return false;
if(!ADBTweenUpdateManager::Instance->DBTweenDic.Contains(TweenName))
{
return false;
}
else
{
UDBTweenBase* Target = ADBTweenUpdateManager::Instance->DBTweenDic[TweenName];
Target->CurTime = 0;
Target->bReverse = false;
bool bIsPaused = Target->Paused;
Target->Paused = false;
Target->isInit = true;
if(Target->Finished)
{
Target->Finished = false;
Target->UpdateFunc(0.f);
Target->Finished = true;
}
else
{
Target->UpdateFunc(0.f);
}
Target->Paused = bIsPaused;
Target->isInit = false;
return true;
}
}
bool UDBTweenBase::DBTweenPlay(FString TweenName)
{
if (ADBTweenUpdateManager::Instance == nullptr)return false;
if(!ADBTweenUpdateManager::Instance->DBTweenDic.Contains(TweenName))
{
return false;
}
else
{
UDBTweenBase* Target = ADBTweenUpdateManager::Instance->DBTweenDic[TweenName];
if (Target->Paused)
{
Target->Paused = false;
}
else
{
Target->Finished = false;
}
return true;
}
}
bool UDBTweenBase::DBTweenPause(FString TweenName)
{
if (ADBTweenUpdateManager::Instance == nullptr)return false;
if (!ADBTweenUpdateManager::Instance->DBTweenDic.Contains(TweenName))
{
return false;
}
else
{
UDBTweenBase* Target = ADBTweenUpdateManager::Instance->DBTweenDic[TweenName];
Target->Paused = true;
return true;
}
}
bool UDBTweenBase::ExistDBTween(FString DBTweenKey)
{
if (ADBTweenUpdateManager::Instance == nullptr)return false;
if (!ADBTweenUpdateManager::Instance->DBTweenDic.Contains(DBTweenKey) || DBTweenKey.IsEmpty())
{
return false;
}
return true;
}
TArray<FString> UDBTweenBase::GetAllDBTween()
{
TArray<FString> AllKey;
if (ADBTweenUpdateManager::Instance)
{
ADBTweenUpdateManager::Instance->DBTweenDic.GetKeys(AllKey);
}
return AllKey;
}
void UDBTweenBase::Init(float durTime)
{
FTickHandle updateCall = FTickHandle();
updateCall.BindUObject(this, &UDBTweenBase::UpdateFunc);
TotalTime = durTime;
UpdateKey = ADBTweenUpdateManager::RegisterUpdateCall(updateCall);
if (MyDBTweenKey.IsEmpty())
{
MyDBTweenKey = FString::FromInt(this->GetUniqueID());
}
ADBTweenUpdateManager::Instance->DBTweenDic.Add(MyDBTweenKey, this);
}
void UDBTweenBase::SetReadyToDestroy()
{
if (Finished)return;
Finished = true;
ADBTweenUpdateManager::RemoveUpdateCall(UpdateKey);
ADBTweenUpdateManager::Instance->DBTweenDic.Remove(MyDBTweenKey);
Super::SetReadyToDestroy();
}
void UDBTweenBase::UpdateFunc(float deltaTime)
{
if (Paused)return;//
if (Finished)return;
if(!bLoop)
{
CurTime = FMath::Min(CurTime+deltaTime,TotalTime);
if (CurTime >= TotalTime)//Finish
{
SetReadyToDestroy();
}
}
else
{
if (CurTime < TotalTime && !bReverse)
{
CurTime = FMath::Min(CurTime+deltaTime,TotalTime);
}
else
{
CurTime = FMath::Max(CurTime-deltaTime,0.f);
bReverse = CurTime == 0.f ? false : true;
}
}
}
void UDBTweenBase::SetLooping(bool bIsLoop)
{
bLoop = bIsLoop;
}
void UDBTweenBase::AllocaKey(FString TweenName)
{
if (ADBTweenUpdateManager::Instance == nullptr || ADBTweenUpdateManager::Instance->DBTweenDic.Contains(TweenName) || TweenName.IsEmpty())
{
MyDBTweenKey = FString::FromInt(this->GetUniqueID());
}
else
{
MyDBTweenKey = TweenName;
}
}
float UDBTweenBase::Evaluate()
{
float time = CurTime;
float duration = TotalTime;
if (FloatCurve != nullptr)
{
float MinTime;
float MaxTime;
FloatCurve->GetTimeRange(MinTime,MaxTime);
float CurveDurTime = MaxTime - MinTime;
if (CurveDurTime == 0)
{
return 0;
}
float BiliCurTime = MinTime + (time / duration * CurveDurTime);
return FloatCurve->GetFloatValue(BiliCurTime);
}
EaseType easeType = CurEasyType;
float period = easePeriod;
float overshootOrAmplitude = easeOvershootOrAmplitude;
switch (easeType)
{
case EaseType::Linear:
return (time / duration);
case EaseType::InSine:
return (-((float)FMath::Cos((double)((time / duration) * 1.570796f))) + 1.0);
case EaseType::OutSine:
return (float)FMath::Sin((double)((time / duration) * 1.570796f));
case EaseType::InOutSine:
return (-0.5f * (((float)FMath::Cos((double)((3.141593f * time) / duration))) - 1.0));
case EaseType::InQuad:
{
time = time / duration;
return (time * time);
}
case EaseType::OutQuad:
{
time = time / duration;
return (-time * (time - 2.0));
}
case EaseType::InOutQuad:
{
time = time / (duration * 0.5f);
if (time < 1.0)
{
return ((0.5f * time) * time);
}
time = time - 1.0;
return (-0.5f * ((time * (time - 2.0)) - 1.0));
}
case EaseType::InCubic:
{
time = time / duration;
return ((time * time) * time);
}
case EaseType::OutCubic:
{
time = (time / duration) - 1.0;
return (((time * time) * time) + 1.0);
}
case EaseType::InOutCubic:
{
time = time / (duration * 0.5f);
if (time < 1.0)
{
return (((0.5f * time) * time) * time);
}
time = time - 2.0;
return (0.5f * (((time * time) * time) + 2.0));
}
case EaseType::InQuart:
{
time = time / duration;
return (((time * time) * time) * time);
}
case EaseType::OutQuart:
{
time = (time / duration) - 1.0;
return -((((time * time) * time) * time) - 1.0);
}
case EaseType::InOutQuart:
{
time = time / (duration * 0.5f);
if (time < 1.0)
{
return ((((0.5f * time) * time) * time) * time);
}
time = time - 2.0;
return (-0.5f * ((((time * time) * time) * time) - 2.0));
}
case EaseType::InQuint:
{
time = time / duration;
return ((((time * time) * time) * time) * time);
}
case EaseType::OutQuint:
{
time = (time / duration) - 1.0;
return (((((time * time) * time) * time) * time) + 1.0);
}
case EaseType::InOutQuint:
{
time = time / (duration * 0.5f);
if (time < 1.0)
{
return (((((0.5f * time) * time) * time) * time) * time);
}
time = time - 2.0;
return (0.5f * (((((time * time) * time) * time) * time) + 2.0));
}
case EaseType::InExpo:
return ((time == 0.0) ? 0.0 : ((float)FMath::Pow(2.0, (double)(10.0 * ((time / duration) - 1.0)))));
case EaseType::OutExpo:
return ((time != duration) ? (-((float)FMath::Pow(2.0, (double)((-10.0 * time) / duration))) + 1.0) : 1.0);
case EaseType::InOutExpo:
{
if (time == 0.0)
{
return 0.0;
}
if (time == duration)
{
return 1.0;
}
time = time / (duration * 0.5f);
if (time < 1.0)
{
return (0.5f * ((float)FMath::Pow(2.0, (double)(10.0 * (time - 1.0)))));
}
time = time - 1.0;
return (0.5f * (-((float)FMath::Pow(2.0, (double)(-10.0 * time))) + 2.0));
}
case EaseType::InCirc:
{
time = time / duration;
return -(((float)FMath::Sqrt((double)(1.0 - (time * time)))) - 1.0);
}
case EaseType::OutCirc:
{
time = (time / duration) - 1.0;
return (float)FMath::Sqrt((double)(1.0 - (time * time)));
}
case EaseType::InOutCirc:
{
time = time / (duration * 0.5f);
if (time < 1.0)
{
return (-0.5f * (((float)FMath::Sqrt((double)(1.0 - (time * time)))) - 1.0));
}
time = time - 2.0;
return (0.5f * (((float)FMath::Sqrt((double)(1.0 - (time * time)))) + 1.0));
}
case EaseType::InElastic:
{
float num;
if (time == 0.0)
{
return 0.0;
}
time = time / duration;
if (time == 1.0)
{
return 1.0;
}
if (period == 0.0)
{
period = duration * 0.3f;
}
if (overshootOrAmplitude >= 1.0)
{
num = (period / 6.283185f) * ((float)FMath::Asin((double)(1.0 / overshootOrAmplitude)));
}
else
{
overshootOrAmplitude = 1.0;
num = period / 4.0;
}
time = time - 1.0;
return -((overshootOrAmplitude * ((float)FMath::Pow(2.0, (double)(10.0 * time )))) * ((float)FMath::Sin((double)((((time * duration) - num) * 6.283185f) / period))));
}
case EaseType::OutElastic:
{
float num2;
if (time == 0.0)
{
return 0.0;
}
time = time / duration;
if (time == 1.0)
{
return 1.0;
}
if (period == 0.0)
{
period = duration * 0.3f;
}
if (overshootOrAmplitude >= 1.0)
{
num2 = (period / 6.283185f) * ((float)FMath::Asin((double)(1.0 / overshootOrAmplitude)));
}
else
{
overshootOrAmplitude = 1.0;
num2 = period / 4.0;
}
return (((overshootOrAmplitude * ((float)FMath::Pow(2.0, (double)(-10.0 * time)))) * ((float)FMath::Sin((double)((((time * duration) - num2) * 6.283185f) / period)))) + 1.0);
}
case EaseType::InOutElastic:
{
float num3;
if (time == 0.0)
{
return 0.0;
}
time = time / (duration * 0.5f);
if (time == 2.0)
{
return 1.0;
}
if (period == 0.0)
{
period = duration * 0.45f;
}
if (overshootOrAmplitude >= 1.0)
{
num3 = (period / 6.283185f) * ((float)FMath::Asin((double)(1.0 / overshootOrAmplitude)));
}
else
{
overshootOrAmplitude = 1.0;
num3 = period / 4.0;
}
if (time < 1.0)
{
time = time - 1.0;
return (-0.5f * ((overshootOrAmplitude * ((float)FMath::Pow(2.0, (double)(10.0 * time)))) * ((float)FMath::Sin((double)((((time * duration) - num3) * 6.283185f) / period)))));
}
time = time - 1.0;
return ((((overshootOrAmplitude * ((float)FMath::Pow(2.0, (double)(-10.0 * time)))) * ((float)FMath::Sin((double)((((time * duration) - num3) * 6.283185f) / period)))) * 0.5f) + 1.0);
}
case EaseType::InBack:
{
time = time / duration;
return ((time * time) * (((overshootOrAmplitude + 1.0) * time) - overshootOrAmplitude));
}
case EaseType::OutBack:
{
time = (time / duration) - 1.0;
return (((time * time) * (((overshootOrAmplitude + 1.0) * time) + overshootOrAmplitude)) + 1.0);
}
case EaseType::InOutBack:
{
time = time / (duration * 0.5f);
if (time < 1.0)
{
overshootOrAmplitude = overshootOrAmplitude * 1.525f;
return (0.5f * ((time * time) * (((overshootOrAmplitude + 1.0) * time) - overshootOrAmplitude)));
}
time = time - 2.0;
overshootOrAmplitude = overshootOrAmplitude * 1.525f;
return (0.5f * (((time * time) * (((overshootOrAmplitude + 1.0) * time) + overshootOrAmplitude)) + 2.0));
}
case EaseType::InBounce:
return BounceEaseIn(time, duration, overshootOrAmplitude, period);
case EaseType::OutBounce:
return BounceEaseOut(time, duration, overshootOrAmplitude, period);
case EaseType::InOutBounce:
return BounceEaseInOut(time, duration, overshootOrAmplitude, period);
}
time = time / duration;
return (-time * (time - 2.0));
}
float UDBTweenBase::BounceEaseIn(float time, float duration, float unusedOvershootOrAmplitude, float unusedPeriod)
{
return 1.0 - BounceEaseOut(duration - time, duration, -1.0, -1.0);
}
float UDBTweenBase::BounceEaseInOut(float time, float duration, float unusedOvershootOrAmplitude, float unusedPeriod)
{
return (time >= (duration * 0.5f)) ? ((BounceEaseOut((time * 2.0) - duration, duration, -1.0, -1.0) * 0.5f) + 0.5f) : (BounceEaseIn(time * 2.0, duration, -1.0, -1.0) * 0.5f);
}
float UDBTweenBase::BounceEaseOut(float time, float duration, float unusedOvershootOrAmplitude, float unusedPeriod)
{
time = time / duration;
if (time < 0.3636364f)
{
return ((7.5625f * time) * time);
}
if (time < 0.7272727f)
{
time = time - 0.5454546f;
return (((7.5625f * time) * time) + 0.75f);
}
if (time < 0.9090909f)
{
time = time - 0.8181818f;
return (((7.5625f * time) * time) + 0.9375f);
}
time = time - 0.9545454f;
return (((7.5625f * time) * time) + 0.984375f);
}

View File

@@ -0,0 +1,114 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#include "DBTweenCanvasPanelSlot.h"
UDBTweenCanvasPanelSlot* UDBTweenCanvasPanelSlot::DOMove(FString TweenName,float DurTime, UCanvasPanelSlot* CanvasPanelSlot, FVector2D End,EaseType easeType, bool IsLoop)
{
if(!CanvasPanelSlot) return nullptr;
UDBTweenCanvasPanelSlot* result = NewObject<UDBTweenCanvasPanelSlot>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = CanvasPanelSlot->GetPosition();
result->EndValue = End;
result->SetLooping(IsLoop);
result->Slot = CanvasPanelSlot;
result->DBTweenCanvasSlotType = EDBTweenCanvasSlotType::E_CanvasSlotPos;
result->CurEasyType = easeType;
return result;
}
UDBTweenCanvasPanelSlot* UDBTweenCanvasPanelSlot::DOMoveByCurve(FString TweenName, float DurTime,UCanvasPanelSlot* CanvasPanelSlot, FVector2D End, UCurveFloat* Curve, bool IsLoop)
{
if(!CanvasPanelSlot) return nullptr;
UDBTweenCanvasPanelSlot* result = NewObject<UDBTweenCanvasPanelSlot>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = CanvasPanelSlot->GetPosition();
result->EndValue = End;
result->SetLooping(IsLoop);
result->Slot = CanvasPanelSlot;
result->DBTweenCanvasSlotType = EDBTweenCanvasSlotType::E_CanvasSlotPos;
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
UDBTweenCanvasPanelSlot* UDBTweenCanvasPanelSlot::DOSize(FString TweenName,float DurTime, UCanvasPanelSlot* CanvasPanelSlot, FVector2D End,EaseType easeType, bool IsLoop)
{
if(!CanvasPanelSlot) return nullptr;
UDBTweenCanvasPanelSlot* result = NewObject<UDBTweenCanvasPanelSlot>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = CanvasPanelSlot->GetSize();
result->EndValue = End;
result->SetLooping(IsLoop);
result->Slot = CanvasPanelSlot;
result->DBTweenCanvasSlotType = EDBTweenCanvasSlotType::E_CanvasSlotSize;
result->CurEasyType = easeType;
return result;
}
UDBTweenCanvasPanelSlot* UDBTweenCanvasPanelSlot::DOSizeByCurve(FString TweenName, float DurTime,UCanvasPanelSlot* CanvasPanelSlot, FVector2D End, UCurveFloat* Curve, bool IsLoop)
{
if(!CanvasPanelSlot) return nullptr;
UDBTweenCanvasPanelSlot* result = NewObject<UDBTweenCanvasPanelSlot>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = CanvasPanelSlot->GetSize();
result->EndValue = End;
result->SetLooping(IsLoop);
result->Slot = CanvasPanelSlot;
result->DBTweenCanvasSlotType = EDBTweenCanvasSlotType::E_CanvasSlotSize;
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
void UDBTweenCanvasPanelSlot::UpdateFunc(float deltaTime)
{
if (Paused)return;//
Super::UpdateFunc(deltaTime);
if (!Slot || Slot->Parent == nullptr) {
SetReadyToDestroy();
return;
}
switch (DBTweenCanvasSlotType)
{
case E_CanvasSlotPos:
{
FVector2D CurValue = StartValue + Evaluate() * (EndValue - StartValue);
Slot->SetPosition(CurValue);
}
break;
case E_CanvasSlotSize:
{
FVector2D CurValue = StartValue + Evaluate() * (EndValue - StartValue);
Slot->SetSize(CurValue);
}
break;
}
if (!isInit)
{
isInit = true;
OnFirst.Broadcast();
}
OnUpdate.Broadcast();
if (Finished)
{
OnComplete.Broadcast();
}
}

View File

@@ -0,0 +1,55 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#include "DBTweenColor.h"
UDBTweenColor* UDBTweenColor::DOColor(FString TweenName,float DurTime, FLinearColor Start, FLinearColor End, EaseType easeType, bool IsLoop)
{
UDBTweenColor* result = NewObject<UDBTweenColor>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = Start;
result->EndValue = End;
result->SetLooping(IsLoop);
result->CurEasyType = easeType;
return result;
}
UDBTweenColor* UDBTweenColor::DOColorByCurve(FString TweenName, float DurTime, FLinearColor Start, FLinearColor End,UCurveFloat* Curve, bool IsLoop)
{
UDBTweenColor* result = NewObject<UDBTweenColor>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = Start;
result->EndValue = End;
result->SetLooping(IsLoop);
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
void UDBTweenColor::UpdateFunc(float deltaTime)
{
if (Paused)return;
Super::UpdateFunc(deltaTime);
if (Finished)
{
OnUpdate.Broadcast(EndValue);
OnComplete.Broadcast(EndValue);
return;
}
if (!isInit)
{
isInit = true;
OnFirst.Broadcast(StartValue);
}
FLinearColor CurValue = StartValue + Evaluate() * (EndValue - StartValue);
OnUpdate.Broadcast(CurValue);
}

View File

@@ -0,0 +1,54 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#include "DBTweenFloat.h"
UDBTweenFloat* UDBTweenFloat::DOFloat(FString TweenName,float DurTime, float Start, float End, EaseType easeType, bool IsLoop)
{
UDBTweenFloat* result = NewObject<UDBTweenFloat>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = Start;
result->EndValue = End;
result->SetLooping(IsLoop);
result->CurEasyType = easeType;
return result;
}
UDBTweenFloat* UDBTweenFloat::DOFloatByCurve(FString TweenName,float DurTime /*= 1*/, float Start /*= 0*/, float End /*= 1*/, UCurveFloat* Curve, bool IsLoop /*= false*/)
{
UDBTweenFloat* result = NewObject<UDBTweenFloat>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = Start;
result->EndValue = End;
result->SetLooping(IsLoop);
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
void UDBTweenFloat::UpdateFunc(float deltaTime)
{
if (Paused)return;
Super::UpdateFunc(deltaTime);
if (Finished)
{
OnUpdate.Broadcast(EndValue);
OnComplete.Broadcast(EndValue);
return;
}
if (!isInit)
{
isInit = true;
OnFirst.Broadcast(StartValue);
}
float CurValue = StartValue + Evaluate() * (EndValue - StartValue);
OnUpdate.Broadcast(CurValue);
}

View File

@@ -0,0 +1,105 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#include "DBTweenPath.h"
#include "Runtime/Engine/Classes/Kismet/KismetMathLibrary.h"
UDBTweenPath* UDBTweenPath::DOPath(FString TweenName,TArray<FVector> Path, float DurTime,EaseType easeType, bool IsLoop)
{
if (Path.Num() == 0) return nullptr;
UDBTweenPath* result = NewObject<UDBTweenPath>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->PathValue = Path;
result->SetLooping(IsLoop);
result->CalcLength();
result->EndValue = Path[Path.Num() - 1];
result->StartValue = Path[0];
result->CurEasyType = easeType;
return result;
}
UDBTweenPath* UDBTweenPath::DOPathByCurve(FString TweenName, TArray<FVector> Path, float DurTime, UCurveFloat* Curve,bool IsLoop)
{
if (Path.Num() == 0) return nullptr;
UDBTweenPath* result = NewObject<UDBTweenPath>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->PathValue = Path;
result->SetLooping(IsLoop);
result->CalcLength();
result->EndValue = Path[Path.Num() - 1];
result->StartValue = Path[0];
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
void UDBTweenPath::GetCurrentTimePos(FVector& Current, FRotator& Rotator)
{
if (PathValue.Num() == 1)
{
Current = PathValue[0];
Rotator = FRotator(0,0,0);
return;
}
if (CurTime >= TotalTime)
{
Current = PathValue[PathValue.Num() - 1];
Rotator = UKismetMathLibrary::FindLookAtRotation(Current, Current + (Current - PathValue[PathValue.Num() - 2]));
return;
}
float CurLength = FMath::Clamp(Evaluate(), 0.f, 1.f) * TotalLength;
float PreSegmentLength = 0;
for (int i = 0; i < EachSegmentLength.Num(); i++)
{
if (CurLength < EachSegmentLength[i])
{
Current = PathValue[i] + (CurLength - PreSegmentLength) / (EachSegmentLength[i] - PreSegmentLength) * (PathValue[i + 1] - PathValue[i]);
Rotator = UKismetMathLibrary::FindLookAtRotation(Current, PathValue[i + 1]);
return;
}
PreSegmentLength = EachSegmentLength[i];
}
}
void UDBTweenPath::UpdateFunc(float deltaTime)
{
if (Paused)return;
Super::UpdateFunc(deltaTime);
if (Finished)
{
GetCurrentTimePos(CurValue, CurRotator);
OnUpdate.Broadcast(CurValue, CurRotator);
OnComplete.Broadcast(CurValue, CurRotator);
return;
}
if (!isInit)
{
isInit = true;
GetCurrentTimePos(CurValue, CurRotator);
OnFirst.Broadcast(CurValue, CurRotator);
}
GetCurrentTimePos(CurValue, CurRotator);
OnUpdate.Broadcast(CurValue, CurRotator);
}
void UDBTweenPath::CalcLength()
{
for (int32 i=1;i<PathValue.Num();i++)
{
TotalLength += FVector::Distance(PathValue[i], PathValue[i - 1]);
EachSegmentLength.Add(TotalLength);
}
}

View File

@@ -0,0 +1,54 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#include "DBTweenRotator.h"
UDBTweenFRotator* UDBTweenFRotator::DORotator(FString TweenName, FRotator Start, FRotator End, float DurTime, EaseType easeType, bool IsLoop)
{
UDBTweenFRotator* result = NewObject<UDBTweenFRotator>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = Start;
result->EndValue = End;
result->SetLooping(IsLoop);
result->CurEasyType = easeType;
return result;
}
UDBTweenFRotator* UDBTweenFRotator::DORotatorByCurve(FString TweenName, FRotator Start, FRotator End, float DurTime, UCurveFloat* Curve, bool IsLoop)
{
UDBTweenFRotator* result = NewObject<UDBTweenFRotator>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = Start;
result->EndValue = End;
result->SetLooping(IsLoop);
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
void UDBTweenFRotator::UpdateFunc(float deltaTime)
{
if (Paused)return;
Super::UpdateFunc(deltaTime);
if (Finished)
{
OnUpdate.Broadcast(EndValue);
OnComplete.Broadcast(EndValue);
return;
}
if (!isInit)
{
isInit = true;
OnFirst.Broadcast(StartValue);
}
FRotator CurValue = StartValue + Evaluate() * (EndValue - StartValue);
OnUpdate.Broadcast(CurValue);
}

View File

@@ -0,0 +1,86 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#include "DBTweenUpdateManager.h"
#include "Runtime/Engine/Classes/Engine/World.h"
#include "DBTweenBase.h"
ADBTweenUpdateManager* ADBTweenUpdateManager::Instance = nullptr;
TMap<int, FTickHandle> ADBTweenUpdateManager::CallMap;
TMap<int, FTickHandle> ADBTweenUpdateManager::EnterMap;
TArray<int> ADBTweenUpdateManager::QuitKeys;
int ADBTweenUpdateManager::KeyCount = 0;
// Sets default values
ADBTweenUpdateManager::ADBTweenUpdateManager()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
SetTickableWhenPaused(true);
}
int ADBTweenUpdateManager::RegisterUpdateCall(FTickHandle call)
{
UWorld* w = GWorld->GetWorld();
if (w == nullptr)return 0;
if (w->WorldType == EWorldType::Game || w->WorldType == EWorldType::PIE)
{
if (Instance == nullptr)
{
//DBTweenDic.Empty();//Clear All TweenBase
Instance = GWorld->GetWorld()->SpawnActor<ADBTweenUpdateManager>(FVector::ZeroVector, FRotator(0, 0, 0));
}
}
if (Instance != nullptr)
{
KeyCount++;
EnterMap.Add(KeyCount, call);
return KeyCount;
}
return 0;
}
void ADBTweenUpdateManager::RemoveUpdateCall(int key)
{
Instance->QuitKeys.Add(key);
}
// Called when the game starts or when spawned
void ADBTweenUpdateManager::BeginPlay()
{
Super::BeginPlay();
Instance = this;//±ÜÃâ¶à¸ö²úÉúµÄ ³åÍ»
CallMap.Empty();
QuitKeys.Empty();
EnterMap.Empty();
KeyCount = 0;
}
void ADBTweenUpdateManager::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
Instance = nullptr;
}
// Called every frame
void ADBTweenUpdateManager::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
for (TPair<int32, FTickHandle>& element : EnterMap)
{
CallMap.Add(element.Key, element.Value);
}
EnterMap.Empty();
for (int i = 0; i < QuitKeys.Num(); i++)
{
CallMap.Remove(QuitKeys[i]);
}
QuitKeys.Empty();
for (TPair<int32, FTickHandle>& element : CallMap)
{
element.Value.ExecuteIfBound(DeltaTime);
}
}

View File

@@ -0,0 +1,124 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#include "DBTweenUtil.h"
UDBTweenActor* UDBTweenUtil::DOLocalMoveSync(FString TweenName,float DurTime /*= 1.f*/, AActor* Actor /*= nullptr*/, FVector End /*= FVector(100, 100, 100)*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenActor::DOLocalMove(TweenName, DurTime, Actor, End, easeType,IsLoop);
}
UDBTweenActor* UDBTweenUtil::DOLocalMoveByCurveSync(FString TweenName, float DurTime, AActor* Actor, FVector End,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenActor::DOLocalMoveByCurve(TweenName, DurTime, Actor, End, Curve,IsLoop);
}
UDBTweenActor* UDBTweenUtil::DOLocalRotationSync(FString TweenName,float DurTime /*= 1.f*/, AActor* Actor /*= nullptr*/, FRotator End /*= FRotator(0, 90, 0)*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenActor::DOLocalRotation(TweenName,DurTime, Actor, End, easeType, IsLoop);
}
UDBTweenActor* UDBTweenUtil::DOLocalRotationByCurveSync(FString TweenName, float DurTime, AActor* Actor, FRotator End,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenActor::DOLocalRotationByCurve(TweenName,DurTime, Actor, End, Curve, IsLoop);
}
UDBTweenActor* UDBTweenUtil::DOLocalScaleSync(FString TweenName,float DurTime /*= 1.f*/, AActor* Actor /*= nullptr*/, FVector End /*= FVector(2, 2, 2)*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenActor::DOLocalScale(TweenName,DurTime, Actor, End, easeType, IsLoop);
}
UDBTweenActor* UDBTweenUtil::DOLocalScaleByCurveSync(FString TweenName, float DurTime, AActor* Actor, FVector End,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenActor::DOLocalScaleByCurve(TweenName,DurTime, Actor, End, Curve, IsLoop);
}
UDBTweenActor* UDBTweenUtil::DOMoveSync(FString TweenName,float DurTime /*= 1.f*/, AActor* Actor /*= nullptr*/, FVector End /*= FVector(100, 100, 100)*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenActor::DOMove(TweenName,DurTime, Actor, End, easeType, IsLoop);
}
UDBTweenActor* UDBTweenUtil::DOMoveByCurveSync(FString TweenName, float DurTime, AActor* Actor, FVector End,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenActor::DOMoveByCurve(TweenName,DurTime, Actor, End, Curve, IsLoop);
}
UDBTweenActor* UDBTweenUtil::DORotationSync(FString TweenName,float DurTime /*= 1.f*/, AActor* Actor /*= nullptr*/, FRotator End /*= FRotator(0, 90, 0)*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenActor::DORotation(TweenName,DurTime, Actor, End, easeType, IsLoop);
}
UDBTweenActor* UDBTweenUtil::DORotationByCurveSync(FString TweenName, float DurTime, AActor* Actor, FRotator End,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenActor::DORotationByCurve(TweenName,DurTime, Actor, End, Curve, IsLoop);
}
UDBTweenActor* UDBTweenUtil::DOScaleSync(FString TweenName,float DurTime /*= 1.f*/, AActor* Actor /*= nullptr*/, FVector End /*= FVector(2, 2, 2)*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenActor::DOScale(TweenName,DurTime, Actor, End, easeType, IsLoop);
}
UDBTweenActor* UDBTweenUtil::DOScaleByCurveSync(FString TweenName, float DurTime, AActor* Actor, FVector End,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenActor::DOScaleByCurve(TweenName,DurTime, Actor, End, Curve, IsLoop);
}
UDBTweenColor* UDBTweenUtil::DOColorSync(FString TweenName,float DurTime /*= 1*/, FLinearColor Start /*= FLinearColor(0, 0, 0, 1)*/, FLinearColor End /*= FLinearColor(1, 1, 1, 1)*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenColor::DOColor(TweenName,DurTime, Start, End, easeType, IsLoop);
}
UDBTweenColor* UDBTweenUtil::DOColorByCurveSync(FString TweenName, float DurTime, FLinearColor Start, FLinearColor End,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenColor::DOColorByCurve(TweenName,DurTime, Start, End, Curve, IsLoop);
}
UDBTweenFloat* UDBTweenUtil::DOFloatSync(FString TweenName,float DurTime /*= 1*/, float Start /*= 0*/, float End /*= 1*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenFloat::DOFloat(TweenName,DurTime, Start, End, easeType, IsLoop);
}
UDBTweenFloat* UDBTweenUtil::DOFloatByCurveSync(FString TweenName, float DurTime, float Start, float End,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenFloat::DOFloatByCurve(TweenName,DurTime, Start, End, Curve, IsLoop);
}
UDBTweenPath* UDBTweenUtil::DOPathSync(FString TweenName,TArray<FVector> Path, float DurTime /*= 1*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenPath::DOPath(TweenName,Path, DurTime, easeType, IsLoop);
}
UDBTweenPath* UDBTweenUtil::DOPathByCurveSync(FString TweenName, TArray<FVector> Path, float DurTime, UCurveFloat* Curve,bool IsLoop)
{
return UDBTweenPath::DOPathByCurve(TweenName,Path, DurTime, Curve, IsLoop);
}
UDBTweenVector2D* UDBTweenUtil::DOVector2DSync(FString TweenName,float DurTime /*= 1*/, FVector2D Start /*= FVector2D(0, 0)*/, FVector2D End /*= FVector2D(100, 100)*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenVector2D::DOVector2D(TweenName,DurTime, Start, End, easeType, IsLoop);
}
UDBTweenVector2D* UDBTweenUtil::DOVector2DByCurveSync(FString TweenName, float DurTime, FVector2D Start, FVector2D End,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenVector2D::DOVector2DByCurve(TweenName,DurTime, Start, End, Curve, IsLoop);
}
UDBTweenVector3D* UDBTweenUtil::DOVector3DSync(FString TweenName,float DurTime /*= 1.f*/, FVector Start /*= FVector(0, 0, 0)*/, FVector End /*= FVector(100, 100, 100)*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenVector3D::DOVector3D(TweenName,DurTime, Start, End, easeType, IsLoop);
}
UDBTweenVector3D* UDBTweenUtil::DOVector3DByCurveSync(FString TweenName, float DurTime, FVector Start, FVector End,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenVector3D::DOVector3DByCurve(TweenName,DurTime, Start, End, Curve, IsLoop);
}
UDBTweenVector4D* UDBTweenUtil::DOVector4DSync(FString TweenName,FVector4 Start, FVector4 End, float DurTime /*= 1.f*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenVector4D::DOVector4D( TweenName,Start, End, DurTime, easeType, IsLoop);
}
UDBTweenVector4D* UDBTweenUtil::DOVector4DByCurveSync(FString TweenName, FVector4 Start, FVector4 End, float DurTime,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenVector4D::DOVector4DByCurve( TweenName,Start, End, DurTime, Curve, IsLoop);
}

View File

@@ -0,0 +1,64 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#include "DBTweenUtil2.h"
UDBTweenCanvasPanelSlot* UDBTweenUtil2::DOMoveSync(FString TweenName,float DurTime /*= 1*/, UCanvasPanelSlot* CanvasPanelSlot /*= nullptr*/, FVector2D End /*= FVector2D(100, 100)*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenCanvasPanelSlot::DOMove(TweenName,DurTime, CanvasPanelSlot, End, easeType, IsLoop);
}
UDBTweenCanvasPanelSlot* UDBTweenUtil2::DOMoveByCurveSync(FString TweenName, float DurTime,UCanvasPanelSlot* CanvasPanelSlot, FVector2D End, UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenCanvasPanelSlot::DOMoveByCurve(TweenName,DurTime, CanvasPanelSlot, End, Curve, IsLoop);
}
UDBTweenCanvasPanelSlot* UDBTweenUtil2::DOSizeSync(FString TweenName,float DurTime /*= 1*/, UCanvasPanelSlot* CanvasPanelSlot /*= nullptr*/, FVector2D End /*= FVector2D(100, 100)*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenCanvasPanelSlot::DOSize(TweenName,DurTime, CanvasPanelSlot, End, easeType, IsLoop);
}
UDBTweenCanvasPanelSlot* UDBTweenUtil2::DOSizeByCurveSync(FString TweenName, float DurTime,UCanvasPanelSlot* CanvasPanelSlot, FVector2D End, UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenCanvasPanelSlot::DOSizeByCurve(TweenName,DurTime, CanvasPanelSlot, End, Curve, IsLoop);
}
UDBTweenWidget* UDBTweenUtil2::DOLocalMoveSync(FString TweenName,float DurTime /*= 1*/, UWidget* UI /*= nullptr*/, FVector2D End /*= FVector2D(100, 100)*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenWidget::DOLocalMove(TweenName,DurTime, UI, End, easeType, IsLoop);
}
UDBTweenWidget* UDBTweenUtil2::DOLocalMoveByCurveSync(FString TweenName, float DurTime, UWidget* UI, FVector2D End,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenWidget::DOLocalMoveByCurve(TweenName,DurTime, UI, End, Curve, IsLoop);
}
UDBTweenWidget* UDBTweenUtil2::DOLocalAngleSync(FString TweenName,float DurTime /*= 1*/, UWidget* UI /*= nullptr*/, float End /*= 90*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenWidget::DOLocalAngle(TweenName,DurTime, UI, End, easeType, IsLoop);
}
UDBTweenWidget* UDBTweenUtil2::DOLocalAngleByCurveSync(FString TweenName, float DurTime, UWidget* UI, float End,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenWidget::DOLocalAngleByCurve(TweenName,DurTime, UI, End, Curve, IsLoop);
}
UDBTweenWidget* UDBTweenUtil2::DOLocalScaleSync(FString TweenName,float DurTime /*= 1*/, UWidget* UI /*= nullptr*/, FVector2D End /*= FVector2D(2, 2)*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenWidget::DOLocalScale(TweenName,DurTime, UI, End, easeType, IsLoop);
}
UDBTweenWidget* UDBTweenUtil2::DOLocalScaleByCurveSync(FString TweenName, float DurTime, UWidget* UI, FVector2D End,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenWidget::DOLocalScaleByCurve(TweenName,DurTime, UI, End, Curve, IsLoop);
}
UDBTweenWidget* UDBTweenUtil2::DOFadeSync(FString TweenName,float DurTime /*= 1*/, UWidget* UI /*= nullptr*/, float End /*= 1*/, EaseType easeType /*= EaseType::Linear*/, bool IsLoop /*= false*/)
{
return UDBTweenWidget::DOFade(TweenName,DurTime, UI, End, easeType, IsLoop);
}
UDBTweenWidget* UDBTweenUtil2::DOFadeByCurveSync(FString TweenName, float DurTime, UWidget* UI, float End,UCurveFloat* Curve, bool IsLoop)
{
return UDBTweenWidget::DOFadeByCurve(TweenName,DurTime, UI, End, Curve, IsLoop);
}

View File

@@ -0,0 +1,54 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#include "DBTweenVector2D.h"
UDBTweenVector2D* UDBTweenVector2D::DOVector2D(FString TweenName,float DurTime, FVector2D Start, FVector2D End, EaseType easeType,bool IsLoop)
{
UDBTweenVector2D* result = NewObject<UDBTweenVector2D>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = Start;
result->EndValue = End;
result->SetLooping(IsLoop);
result->CurEasyType = easeType;
return result;
}
UDBTweenVector2D* UDBTweenVector2D::DOVector2DByCurve(FString TweenName, float DurTime, FVector2D Start, FVector2D End,UCurveFloat* Curve, bool IsLoop)
{
UDBTweenVector2D* result = NewObject<UDBTweenVector2D>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = Start;
result->EndValue = End;
result->SetLooping(IsLoop);
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
void UDBTweenVector2D::UpdateFunc(float deltaTime)
{
if (Paused)return;
Super::UpdateFunc(deltaTime);
if (Finished)
{
OnUpdate.Broadcast(EndValue);
OnComplete.Broadcast(EndValue);
return;
}
if (!isInit)
{
isInit = true;
OnFirst.Broadcast(StartValue);
}
FVector2D CurValue = StartValue + Evaluate() * (EndValue - StartValue);
OnUpdate.Broadcast(CurValue);
}

View File

@@ -0,0 +1,54 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#include "DBTweenVector3D.h"
UDBTweenVector3D* UDBTweenVector3D::DOVector3D(FString TweenName,float DurTime, FVector Start, FVector End, EaseType easeType, bool IsLoop)
{
UDBTweenVector3D* result = NewObject<UDBTweenVector3D>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = Start;
result->EndValue = End;
result->SetLooping(IsLoop);
result->CurEasyType = easeType;
return result;
}
UDBTweenVector3D* UDBTweenVector3D::DOVector3DByCurve(FString TweenName, float DurTime, FVector Start, FVector End,UCurveFloat* Curve, bool IsLoop)
{
UDBTweenVector3D* result = NewObject<UDBTweenVector3D>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = Start;
result->EndValue = End;
result->SetLooping(IsLoop);
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
void UDBTweenVector3D::UpdateFunc(float deltaTime)
{
if (Paused)return;
Super::UpdateFunc(deltaTime);
if (Finished)
{
OnUpdate.Broadcast(EndValue);
OnComplete.Broadcast(EndValue);
return;
}
if (!isInit)
{
isInit = true;
OnFirst.Broadcast(StartValue);
}
FVector CurValue = StartValue + Evaluate() * (EndValue - StartValue);
OnUpdate.Broadcast(CurValue);
}

View File

@@ -0,0 +1,55 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#include "DBTweenVector4D.h"
UDBTweenVector4D* UDBTweenVector4D::DOVector4D(FString TweenName,FVector4 Start, FVector4 End,float DurTime, EaseType easeType, bool IsLoop)
{
UDBTweenVector4D* result = NewObject<UDBTweenVector4D>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = Start;
result->EndValue = End;
result->SetLooping(IsLoop);
result->CurEasyType = easeType;
return result;
}
UDBTweenVector4D* UDBTweenVector4D::DOVector4DByCurve(FString TweenName, FVector4 Start, FVector4 End, float DurTime,UCurveFloat* Curve, bool IsLoop)
{
UDBTweenVector4D* result = NewObject<UDBTweenVector4D>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartValue = Start;
result->EndValue = End;
result->SetLooping(IsLoop);
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
void UDBTweenVector4D::UpdateFunc(float deltaTime)
{
if (Paused)return;
Super::UpdateFunc(deltaTime);
if (Finished)
{
OnUpdate.Broadcast(EndValue);
OnComplete.Broadcast(EndValue);
return;
}
if (!isInit)
{
isInit = true;
OnFirst.Broadcast(StartValue);
}
FVector4 CurValue = StartValue + Evaluate() * (EndValue - StartValue);
OnUpdate.Broadcast(CurValue);
}

View File

@@ -0,0 +1,205 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#include "DBTweenWidget.h"
#include "Kismet/KismetMathLibrary.h"
UDBTweenWidget* UDBTweenWidget::DOLocalMove(FString TweenName,float DurTime, UWidget* UI, FVector2D End, EaseType easeType, bool IsLoop)
{
if(!UI) return nullptr;
UDBTweenWidget* result = NewObject<UDBTweenWidget>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartTranslationValue = UI->GetRenderTransform().Translation;
result->EndTranslationValue = End;
result->SetLooping(IsLoop);
result->Widget = UI;
result->DBTweenWidgetType = EDBTweenWidgetType::E_WidgetTranslation;
result->CurEasyType = easeType;
return result;
}
UDBTweenWidget* UDBTweenWidget::DOLocalMoveByCurve(FString TweenName, float DurTime, UWidget* UI, FVector2D End,UCurveFloat* Curve, bool IsLoop)
{
if(!UI) return nullptr;
UDBTweenWidget* result = NewObject<UDBTweenWidget>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartTranslationValue = UI->GetRenderTransform().Translation;
result->EndTranslationValue = End;
result->SetLooping(IsLoop);
result->Widget = UI;
result->DBTweenWidgetType = EDBTweenWidgetType::E_WidgetTranslation;
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
UDBTweenWidget* UDBTweenWidget::DOLocalAngle(FString TweenName,float DurTime, UWidget* UI, float End, EaseType easeType, bool IsLoop)
{
if(!UI) return nullptr;
UDBTweenWidget* result = NewObject<UDBTweenWidget>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartAngleValue = UI->GetRenderTransformAngle();
result->EndAngleValue = End;
result->SetLooping(IsLoop);
result->Widget = UI;
result->DBTweenWidgetType = EDBTweenWidgetType::E_WidgetAngle;
result->CurEasyType = easeType;
return result;
}
UDBTweenWidget* UDBTweenWidget::DOLocalAngleByCurve(FString TweenName, float DurTime, UWidget* UI, float End,UCurveFloat* Curve, bool IsLoop)
{
if(!UI) return nullptr;
UDBTweenWidget* result = NewObject<UDBTweenWidget>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartAngleValue = UI->GetRenderTransformAngle();
result->EndAngleValue = End;
result->SetLooping(IsLoop);
result->Widget = UI;
result->DBTweenWidgetType = EDBTweenWidgetType::E_WidgetAngle;
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
UDBTweenWidget* UDBTweenWidget::DOLocalScale(FString TweenName,float DurTime, UWidget* UI, FVector2D End, EaseType easeType, bool IsLoop)
{
if(!UI) return nullptr;
UDBTweenWidget* result = NewObject<UDBTweenWidget>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartScaleValue = UI->GetRenderTransform().Scale;
result->EndScaleValue = End;
result->SetLooping(IsLoop);
result->Widget = UI;
result->DBTweenWidgetType = EDBTweenWidgetType::E_WidgetScale;
result->CurEasyType = easeType;
return result;
}
UDBTweenWidget* UDBTweenWidget::DOLocalScaleByCurve(FString TweenName, float DurTime, UWidget* UI, FVector2D End,UCurveFloat* Curve, bool IsLoop)
{
if(!UI) return nullptr;
UDBTweenWidget* result = NewObject<UDBTweenWidget>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartScaleValue = UI->GetRenderTransform().Scale;
result->EndScaleValue = End;
result->SetLooping(IsLoop);
result->Widget = UI;
result->DBTweenWidgetType = EDBTweenWidgetType::E_WidgetScale;
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
UDBTweenWidget* UDBTweenWidget::DOFade(FString TweenName,float DurTime, UWidget* UI, float End, EaseType easeType, bool IsLoop)
{
if(!UI) return nullptr;
UDBTweenWidget* result = NewObject<UDBTweenWidget>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartOpacityValue = UI->GetRenderOpacity();
result->EndOpacityValue = End;
result->SetLooping(IsLoop);
result->Widget = UI;
result->DBTweenWidgetType = EDBTweenWidgetType::E_WidgetFade;
result->CurEasyType = easeType;
return result;
}
UDBTweenWidget* UDBTweenWidget::DOFadeByCurve(FString TweenName, float DurTime, UWidget* UI, float End, UCurveFloat* Curve,bool IsLoop)
{
if(!UI) return nullptr;
UDBTweenWidget* result = NewObject<UDBTweenWidget>();
result->AllocaKey(TweenName);
result->Init(DurTime);
result->StartOpacityValue = UI->GetRenderOpacity();
result->EndOpacityValue = End;
result->SetLooping(IsLoop);
result->Widget = UI;
result->DBTweenWidgetType = EDBTweenWidgetType::E_WidgetFade;
if (Curve == nullptr)
{
result->CurEasyType = EaseType::Linear;
}
else
{
result->FloatCurve = Curve;
}
return result;
}
void UDBTweenWidget::UpdateFunc(float deltaTime)
{
if (Paused)return;
Super::UpdateFunc(deltaTime);
if (!Widget || Widget->GetParent()== nullptr) {
SetReadyToDestroy();
return;
}
if (!isInit)
{
isInit = true;
OnFirst.Broadcast();
}
switch (DBTweenWidgetType)
{
case E_WidgetTranslation:
{
FVector2D CurValue = StartTranslationValue + Evaluate() * (EndTranslationValue - StartTranslationValue);
Widget->SetRenderTranslation(CurValue);
}
break;
case E_WidgetAngle:
{
float CurValue = StartAngleValue + Evaluate() * (EndAngleValue - StartAngleValue);
Widget->SetRenderTransformAngle(CurValue);
}
break;
case E_WidgetScale:
{
FVector2D CurValue = StartScaleValue + Evaluate() * (EndScaleValue - StartScaleValue);
Widget->SetRenderScale(CurValue);
}
break;
case E_WidgetFade:
{
float CurValue = StartOpacityValue + Evaluate() * (EndOpacityValue - StartOpacityValue);
Widget->SetRenderOpacity(CurValue);
}
break;
}
OnUpdate.Broadcast();
if (Finished)
{
OnComplete.Broadcast();
}
}

View File

@@ -0,0 +1,15 @@
// Copyright 2020-2021, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
class FDBTweenModule : public IModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
};

View File

@@ -0,0 +1,89 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "DBTweenBase.h"
#include "DBTweenActor.generated.h"
/**
*
*/
enum EDBTweenActorType
{
E_ActorRelativeLocation,
E_ActorRelativeRotation,
E_ActorRelativeScale,
E_ActorLocation,
E_ActorRotation,
E_ActorScale
};
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FHandleActor);
UCLASS()
class DBTWEEN_API UDBTweenActor : public UDBTweenBase
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"),Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOLocalMove(FString TweenName, float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(100,100,100), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"),Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOLocalMoveByCurve(FString TweenName, float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(100,100,100), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOLocalRotation(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FRotator End = FRotator(0,90 ,0), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOLocalRotationByCurve(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FRotator End = FRotator(0,90 ,0), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOLocalScale(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(2,2,2), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOLocalScaleByCurve(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(2,2,2), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"),Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOMove(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(100,100,100), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"),Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOMoveByCurve(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(100,100,100), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DORotation(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FRotator End = FRotator(0,90 ,0), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DORotationByCurve(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FRotator End = FRotator(0,90 ,0), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOScale(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(2,2,2), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOScaleByCurve(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(2,2,2), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UPROPERTY(BlueprintAssignable)
FHandleActor OnFirst;
UPROPERTY(BlueprintAssignable)
FHandleActor OnUpdate;
UPROPERTY(BlueprintAssignable)
FHandleActor OnComplete;
FVector StartLocValue;
FVector EndLocValue;
FRotator StartRotValue;
FRotator EndRotValue;
FVector StartScaleValue;
FVector EndScaleValue;
protected:
virtual void UpdateFunc(float deltaTime) override;
AActor* Actor = nullptr;
EDBTweenActorType DBTweenActorType = EDBTweenActorType::E_ActorLocation;
};

View File

@@ -0,0 +1,99 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintAsyncActionBase.h"
#include "Runtime/Engine/Classes/Curves/CurveFloat.h"
#include "DBTweenBase.generated.h"
UENUM(BlueprintType)
enum class EaseType : uint8
{
Linear = 0,
InSine = 1,
InQuad = 2,
InCubic = 3,
InQuart = 4,
InQuint = 5,
InExpo = 6,
InCirc = 7,
InElastic = 8,
InBack = 9,
InBounce = 10,
OutQuad = 31,
OutSine = 32,
OutCubic = 33,
OutQuart = 34,
OutQuint = 35,
OutExpo = 36,
OutCirc = 37,
OutElastic = 38,
OutBack = 39,
OutBounce = 40,
InOutQuad = 61,
InOutSine = 62,
InOutCubic = 63,
InOutQuart = 64,
InOutQuint = 65,
InOutExpo = 66,
InOutCirc = 67,
InOutElastic = 68,
InOutBack = 69,
InOutBounce = 70
};
UCLASS()
class DBTWEEN_API UDBTweenBase : public UBlueprintAsyncActionBase
{
GENERATED_BODY()
public:
~UDBTweenBase();
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | UDBTweenBase")
static bool DBTweenStop(FString TweenName);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | UDBTweenBase")
static bool DBTweenReset(FString TweenName);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | UDBTweenBase")
static bool DBTweenPlay(FString TweenName);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | UDBTweenBase")
static bool DBTweenPause(FString TweenName);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | UDBTweenBase")
static bool ExistDBTween(FString DBTweenKey);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | UDBTweenBase")
static TArray<FString> GetAllDBTween();
bool Paused = false;
void SetOvershootOrAmplitudeAndPeriod(float OvershootOrAmplitudeParam = 1.70158f, float PeriodParam = 0);
float easePeriod;
float easeOvershootOrAmplitude = 1.70158f;
FString MyDBTweenKey;
protected:
void Init(float durTime);
virtual void UpdateFunc(float deltaTime);
void SetLooping(bool bIsLoop);
void AllocaKey(FString TweenName);
virtual void SetReadyToDestroy() override;
float TotalTime;
float CurTime;
int UpdateKey;
bool Finished;
bool bLoop = false;
bool bReverse = false;
bool isInit = false;
UCurveFloat* FloatCurve;
EaseType CurEasyType = EaseType::Linear;
float Evaluate();
float BounceEaseIn(float time, float duration, float unusedOvershootOrAmplitude, float unusedPeriod);
float BounceEaseInOut(float time, float duration, float unusedOvershootOrAmplitude, float unusedPeriod);
float BounceEaseOut(float time, float duration, float unusedOvershootOrAmplitude, float unusedPeriod);
};

View File

@@ -0,0 +1,56 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "DBTweenBase.h"
#include "Components/CanvasPanelSlot.h"
#include "DBTweenCanvasPanelSlot.generated.h"
/**
*
*/
enum EDBTweenCanvasSlotType
{
E_CanvasSlotPos,
E_CanvasSlotSize
};
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FHandleCanvasPanel);
UCLASS()
class DBTWEEN_API UDBTweenCanvasPanelSlot : public UDBTweenBase
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenCanvasPanelSlot")
static UDBTweenCanvasPanelSlot* DOMove(FString TweenName,float DurTime = 1, UCanvasPanelSlot* CanvasPanelSlot = nullptr, FVector2D End = FVector2D(100,100), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenCanvasPanelSlot")
static UDBTweenCanvasPanelSlot* DOMoveByCurve(FString TweenName,float DurTime = 1, UCanvasPanelSlot* CanvasPanelSlot = nullptr, FVector2D End = FVector2D(100,100), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenCanvasPanelSlot")
static UDBTweenCanvasPanelSlot* DOSize(FString TweenName,float DurTime = 1, UCanvasPanelSlot* CanvasPanelSlot = nullptr, FVector2D End = FVector2D(100,100), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenCanvasPanelSlot")
static UDBTweenCanvasPanelSlot* DOSizeByCurve(FString TweenName,float DurTime = 1, UCanvasPanelSlot* CanvasPanelSlot = nullptr, FVector2D End = FVector2D(100,100), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UPROPERTY(BlueprintAssignable)
FHandleCanvasPanel OnFirst;
UPROPERTY(BlueprintAssignable)
FHandleCanvasPanel OnUpdate;
UPROPERTY(BlueprintAssignable)
FHandleCanvasPanel OnComplete;
FVector2D StartValue;
FVector2D EndValue;
protected:
virtual void UpdateFunc(float deltaTime) override;
UCanvasPanelSlot* Slot = nullptr;
EDBTweenCanvasSlotType DBTweenCanvasSlotType = EDBTweenCanvasSlotType::E_CanvasSlotPos;
};

View File

@@ -0,0 +1,40 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "DBTweenBase.h"
#include "DBTweenColor.generated.h"
/**
*
*/
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FHandleColor, FLinearColor, curValue);
UCLASS()
class DBTWEEN_API UDBTweenColor : public UDBTweenBase
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"),Category = "DBTweenUtil | DBTweenColor")
static UDBTweenColor* DOColor(FString TweenName,float DurTime = 1, FLinearColor Start = FLinearColor(0,0,0,1), FLinearColor End = FLinearColor(1,1,1,1),EaseType easeType = EaseType::Linear,bool IsLoop = false);
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"),Category = "DBTweenUtil | DBTweenColor")
static UDBTweenColor* DOColorByCurve(FString TweenName,float DurTime = 1, FLinearColor Start = FLinearColor(0,0,0,1), FLinearColor End = FLinearColor(1,1,1,1),UCurveFloat* Curve = nullptr,bool IsLoop = false);
UPROPERTY(BlueprintAssignable)
FHandleColor OnFirst;
UPROPERTY(BlueprintAssignable)
FHandleColor OnUpdate;
UPROPERTY(BlueprintAssignable)
FHandleColor OnComplete;
FLinearColor StartValue;
FLinearColor EndValue;
protected:
virtual void UpdateFunc(float deltaTime) override;
};

View File

@@ -0,0 +1,36 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "DBTweenBase.h"
#include "DBTweenFloat.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FHandleFloat, float, curValue);
UCLASS()
class DBTWEEN_API UDBTweenFloat : public UDBTweenBase
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"),Category = "DBTweenUtil | DBTweenFloat")
static UDBTweenFloat* DOFloat(FString TweenName,float DurTime = 1, float Start = 0, float End = 1, EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenFloat")
static UDBTweenFloat* DOFloatByCurve(FString TweenName,float DurTime = 1, float Start = 0, float End = 1, UCurveFloat* Curve = nullptr,bool IsLoop = false);
UPROPERTY(BlueprintAssignable)
FHandleFloat OnFirst;
UPROPERTY(BlueprintAssignable)
FHandleFloat OnUpdate;
UPROPERTY(BlueprintAssignable)
FHandleFloat OnComplete;
float StartValue;
float EndValue;
protected:
virtual void UpdateFunc(float deltaTime) override;
};

View File

@@ -0,0 +1,48 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "DBTweenBase.h"
#include "DBTweenPath.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FHandleFPath, FVector, curPos,FRotator,curRotator);
UCLASS(BlueprintType, Blueprintable)
class DBTWEEN_API UDBTweenPath: public UDBTweenBase
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"),Category = "DBTweenUtil | DBTweenPath")
static UDBTweenPath* DOPath(FString TweenName,TArray<FVector> Path,float DurTime = 1,EaseType easeType = EaseType::Linear,bool IsLoop = false);
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"),Category = "DBTweenUtil | DBTweenPath")
static UDBTweenPath* DOPathByCurve(FString TweenName,TArray<FVector> Path,float DurTime = 1,UCurveFloat* Curve = nullptr,bool IsLoop = false);
UPROPERTY(BlueprintAssignable)
FHandleFPath OnFirst;
UPROPERTY(BlueprintAssignable)
FHandleFPath OnUpdate;
UPROPERTY(BlueprintAssignable)
FHandleFPath OnComplete;
FVector StartValue;
FVector CurValue;
FRotator CurRotator;
FVector EndValue;
TArray<FVector> PathValue;
float TotalLength;
TArray<float> EachSegmentLength;
void GetCurrentTimePos(FVector& Current, FRotator& Rotator);
protected:
virtual void UpdateFunc(float deltaTime) override;
void CalcLength();
};

View File

@@ -0,0 +1,43 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "DBTweenBase.h"
#include "DBTweenRotator.generated.h"
/**
*
*/
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FHandleFRotator, FRotator, curValue);
UCLASS()
class DBTWEEN_API UDBTweenFRotator : public UDBTweenBase
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenRotator")
static UDBTweenFRotator* DORotator(FString TweenName,FRotator Start, FRotator End, float DurTime = 1.f,EaseType easeType = EaseType::Linear,bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenRotator")
static UDBTweenFRotator* DORotatorByCurve(FString TweenName,FRotator Start, FRotator End, float DurTime = 1.f,UCurveFloat* Curve = nullptr,bool IsLoop = false);
UPROPERTY(BlueprintAssignable)
FHandleFRotator OnFirst;
UPROPERTY(BlueprintAssignable)
FHandleFRotator OnUpdate;
UPROPERTY(BlueprintAssignable)
FHandleFRotator OnComplete;
FRotator StartValue;
FRotator EndValue;
protected:
virtual void UpdateFunc(float deltaTime) override;
};

View File

@@ -0,0 +1,44 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Kismet/BlueprintAsyncActionBase.h"
#include "DBTweenUpdateManager.generated.h"
DECLARE_DELEGATE_OneParam(FTickHandle,float);
UCLASS()
class DBTWEEN_API ADBTweenUpdateManager : public AActor
{
GENERATED_BODY()
public:
friend class UDBTweenBase;
UPROPERTY(VisibleAnywhere, Category = "DBTweenUpdateManager")
TMap<FString, UDBTweenBase*> DBTweenDic;
// Sets default values for this actor's properties
ADBTweenUpdateManager();
static int RegisterUpdateCall(FTickHandle call);
static void RemoveUpdateCall(int key);
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason);
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
static ADBTweenUpdateManager* Instance;
private:
static TMap<int, FTickHandle> CallMap;
static TMap<int, FTickHandle> EnterMap;
static TArray<int> QuitKeys;
static int KeyCount;
};

View File

@@ -0,0 +1,99 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "DBTweenActor.h"
#include "DBTweenCanvasPanelSlot.h"
#include "DBTweenColor.h"
#include "DBTweenFloat.h"
#include "DBTweenPath.h"
#include "DBTweenVector2D.h"
#include "DBTweenVector3D.h"
#include "DBTweenVector4D.h"
#include "DBTweenWidget.h"
#include "DBTweenUtil.generated.h"
/**
*
*/
UCLASS()
class DBTWEEN_API UDBTweenUtil : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable,Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOLocalMoveSync(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(100, 100, 100), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable,Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOLocalMoveByCurveSync(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(100, 100, 100), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable,Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOLocalRotationSync(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FRotator End = FRotator(0, 90, 0), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable,Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOLocalRotationByCurveSync(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FRotator End = FRotator(0, 90, 0), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOLocalScaleSync(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(2, 2, 2), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOLocalScaleByCurveSync(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(2, 2, 2), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOMoveSync(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(100, 100, 100), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOMoveByCurveSync(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(100, 100, 100), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DORotationSync(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FRotator End = FRotator(0, 90, 0), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DORotationByCurveSync(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FRotator End = FRotator(0, 90, 0), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOScaleSync(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(2, 2, 2), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenActor")
static UDBTweenActor* DOScaleByCurveSync(FString TweenName,float DurTime = 1.f, AActor* Actor = nullptr, FVector End = FVector(2, 2, 2), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenColor")
static UDBTweenColor* DOColorSync(FString TweenName,float DurTime = 1, FLinearColor Start = FLinearColor(0, 0, 0, 1), FLinearColor End = FLinearColor(1, 1, 1, 1), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenColor")
static UDBTweenColor* DOColorByCurveSync(FString TweenName,float DurTime = 1, FLinearColor Start = FLinearColor(0, 0, 0, 1), FLinearColor End = FLinearColor(1, 1, 1, 1), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenFloat")
static UDBTweenFloat* DOFloatSync(FString TweenName,float DurTime = 1, float Start = 0, float End = 1, EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenFloat")
static UDBTweenFloat* DOFloatByCurveSync(FString TweenName,float DurTime = 1, float Start = 0, float End = 1, UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenPath")
static UDBTweenPath* DOPathSync(FString TweenName,TArray<FVector> Path, float DurTime = 1, EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenPath")
static UDBTweenPath* DOPathByCurveSync(FString TweenName,TArray<FVector> Path, float DurTime = 1, UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenVector2D")
static UDBTweenVector2D* DOVector2DSync(FString TweenName,float DurTime = 1, FVector2D Start = FVector2D(0, 0), FVector2D End = FVector2D(100, 100), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenVector2D")
static UDBTweenVector2D* DOVector2DByCurveSync(FString TweenName,float DurTime = 1, FVector2D Start = FVector2D(0, 0), FVector2D End = FVector2D(100, 100), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenVector3D")
static UDBTweenVector3D* DOVector3DSync(FString TweenName,float DurTime = 1.f, FVector Start = FVector(0, 0, 0), FVector End = FVector(100, 100, 100), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenVector3D")
static UDBTweenVector3D* DOVector3DByCurveSync(FString TweenName,float DurTime = 1.f, FVector Start = FVector(0, 0, 0), FVector End = FVector(100, 100, 100), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenVector4D")
static UDBTweenVector4D* DOVector4DSync(FString TweenName,FVector4 Start, FVector4 End, float DurTime = 1.f, EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenVector4D")
static UDBTweenVector4D* DOVector4DByCurveSync(FString TweenName,FVector4 Start, FVector4 End, float DurTime = 1.f, UCurveFloat* Curve = nullptr, bool IsLoop = false);
};

View File

@@ -0,0 +1,63 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "DBTweenActor.h"
#include "DBTweenCanvasPanelSlot.h"
#include "DBTweenColor.h"
#include "DBTweenFloat.h"
#include "DBTweenPath.h"
#include "DBTweenVector2D.h"
#include "DBTweenVector3D.h"
#include "DBTweenVector4D.h"
#include "DBTweenWidget.h"
#include "DBTweenUtil2.generated.h"
/**
*
*/
UCLASS()
class DBTWEEN_API UDBTweenUtil2 : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenCanvasPanelSlot")
static UDBTweenCanvasPanelSlot* DOMoveSync(FString TweenName,float DurTime = 1, UCanvasPanelSlot* CanvasPanelSlot = nullptr, FVector2D End = FVector2D(100, 100), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenCanvasPanelSlot")
static UDBTweenCanvasPanelSlot* DOMoveByCurveSync(FString TweenName,float DurTime = 1, UCanvasPanelSlot* CanvasPanelSlot = nullptr, FVector2D End = FVector2D(100, 100), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenCanvasPanelSlot")
static UDBTweenCanvasPanelSlot* DOSizeSync(FString TweenName,float DurTime = 1, UCanvasPanelSlot* CanvasPanelSlot = nullptr, FVector2D End = FVector2D(100, 100), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenCanvasPanelSlot")
static UDBTweenCanvasPanelSlot* DOSizeByCurveSync(FString TweenName,float DurTime = 1, UCanvasPanelSlot* CanvasPanelSlot = nullptr, FVector2D End = FVector2D(100, 100), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOLocalMoveSync(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, FVector2D End = FVector2D(100, 100), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOLocalMoveByCurveSync(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, FVector2D End = FVector2D(100, 100), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOLocalAngleSync(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, float End = 90, EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOLocalAngleByCurveSync(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, float End = 90, UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOLocalScaleSync(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, FVector2D End = FVector2D(2, 2), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOLocalScaleByCurveSync(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, FVector2D End = FVector2D(2, 2), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOFadeSync(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, float End = 1, EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOFadeByCurveSync(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, float End = 1, UCurveFloat* Curve = nullptr, bool IsLoop = false);
};

View File

@@ -0,0 +1,40 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "DBTweenBase.h"
#include "DBTweenVector2D.generated.h"
/**
*
*/
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FHandleVector2D, FVector2D, curValue);
UCLASS()
class DBTWEEN_API UDBTweenVector2D : public UDBTweenBase
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenVector2D")
static UDBTweenVector2D* DOVector2D(FString TweenName,float DurTime = 1, FVector2D Start = FVector2D(0,0), FVector2D End = FVector2D(100,100),EaseType easeType = EaseType::Linear,bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenVector2D")
static UDBTweenVector2D* DOVector2DByCurve(FString TweenName,float DurTime = 1, FVector2D Start = FVector2D(0,0), FVector2D End = FVector2D(100,100),UCurveFloat* Curve = nullptr,bool IsLoop = false);
UPROPERTY(BlueprintAssignable)
FHandleVector2D OnFirst;
UPROPERTY(BlueprintAssignable)
FHandleVector2D OnUpdate;
UPROPERTY(BlueprintAssignable)
FHandleVector2D OnComplete;
FVector2D StartValue;
FVector2D EndValue;
protected:
virtual void UpdateFunc(float deltaTime) override;
};

View File

@@ -0,0 +1,41 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "DBTweenBase.h"
#include "DBTweenVector3D.generated.h"
/**
*
*/
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FHandleVector3D, FVector, curValue);
UCLASS()
class DBTWEEN_API UDBTweenVector3D : public UDBTweenBase
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenVector3D")
static UDBTweenVector3D* DOVector3D(FString TweenName,float DurTime = 1.f, FVector Start = FVector(0,0,0), FVector End = FVector(100,100,100), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenVector3D")
static UDBTweenVector3D* DOVector3DByCurve(FString TweenName,float DurTime = 1.f, FVector Start = FVector(0,0,0), FVector End = FVector(100,100,100), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UPROPERTY(BlueprintAssignable)
FHandleVector3D OnFirst;
UPROPERTY(BlueprintAssignable)
FHandleVector3D OnUpdate;
UPROPERTY(BlueprintAssignable)
FHandleVector3D OnComplete;
FVector StartValue;
FVector EndValue;
protected:
virtual void UpdateFunc(float deltaTime) override;
};

View File

@@ -0,0 +1,43 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "DBTweenBase.h"
#include "DBTweenVector4D.generated.h"
/**
*
*/
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FHandleVector4D, FVector4, curValue);
UCLASS()
class DBTWEEN_API UDBTweenVector4D : public UDBTweenBase
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenVector4D")
static UDBTweenVector4D* DOVector4D(FString TweenName,FVector4 Start, FVector4 End, float DurTime = 1.f,EaseType easeType = EaseType::Linear,bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenVector4D")
static UDBTweenVector4D* DOVector4DByCurve(FString TweenName,FVector4 Start, FVector4 End, float DurTime = 1.f,UCurveFloat* Curve = nullptr,bool IsLoop = false);
UPROPERTY(BlueprintAssignable)
FHandleVector4D OnFirst;
UPROPERTY(BlueprintAssignable)
FHandleVector4D OnUpdate;
UPROPERTY(BlueprintAssignable)
FHandleVector4D OnComplete;
FVector4 StartValue;
FVector4 EndValue;
protected:
virtual void UpdateFunc(float deltaTime) override;
};

View File

@@ -0,0 +1,80 @@
// Copyright 2021-2022, DearBing. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "DBTweenBase.h"
#include "Components/Widget.h"
#include "DBTweenWidget.generated.h"
/**
*
*/
enum EDBTweenWidgetType
{
E_WidgetTranslation,
E_WidgetAngle,
E_WidgetScale,
E_WidgetFade
};
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FHandleWidget);
UCLASS()
class DBTWEEN_API UDBTweenWidget : public UDBTweenBase
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOLocalMove(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, FVector2D End = FVector2D(100,100), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOLocalMoveByCurve(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, FVector2D End = FVector2D(100,100), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"),Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOLocalAngle(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, float End = 90, EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"),Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOLocalAngleByCurve(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, float End = 90, UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOLocalScale(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, FVector2D End = FVector2D(2,2), EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOLocalScaleByCurve(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, FVector2D End = FVector2D(2,2), UCurveFloat* Curve = nullptr, bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOFade(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, float End = 1, EaseType easeType = EaseType::Linear, bool IsLoop = false);
UFUNCTION(BlueprintCallable,meta = (BlueprintInternalUseOnly = "true"), Category = "DBTweenUtil | DBTweenWidget")
static UDBTweenWidget* DOFadeByCurve(FString TweenName,float DurTime = 1, UWidget* UI = nullptr, float End = 1, UCurveFloat* Curve = nullptr, bool IsLoop = false);
UPROPERTY(BlueprintAssignable)
FHandleWidget OnFirst;
UPROPERTY(BlueprintAssignable)
FHandleWidget OnUpdate;
UPROPERTY(BlueprintAssignable)
FHandleWidget OnComplete;
FVector2D StartTranslationValue;
FVector2D EndTranslationValue;
float StartAngleValue;
float EndAngleValue;
FVector2D StartScaleValue;
FVector2D EndScaleValue;
float StartOpacityValue;
float EndOpacityValue;
protected:
virtual void UpdateFunc(float deltaTime) override;
UWidget* Widget = nullptr;
EDBTweenWidgetType DBTweenWidgetType = EDBTweenWidgetType::E_WidgetTranslation;
};

View File

@@ -0,0 +1,18 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "TG_ControllerBase.h"
#include "Framework/Application/NavigationConfig.h"
void ATG_ControllerBase::BeginPlay()
{
Super::BeginPlay();
if (IsLocalPlayerController())
{
auto navigation = MakeShared<FNavigationConfig>();
navigation->bAnalogNavigation = false;
navigation->bTabNavigation = false;
FSlateApplication::Get().SetNavigationConfig(navigation);
}
}

View File

@@ -0,0 +1,18 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "TG_ControllerBase.generated.h"
/**
*
*/
UCLASS()
class TG_ARPG_API ATG_ControllerBase : public APlayerController
{
GENERATED_BODY()
void BeginPlay();
};

View File

@@ -9,5 +9,7 @@ public class TG_ARPG : ModuleRules
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "EnhancedInput","GameplayAbilities", "GameplayTags", "GameplayTasks" }); PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "EnhancedInput","GameplayAbilities", "GameplayTags", "GameplayTasks" });
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
} }
} }

View File

@@ -64,6 +64,13 @@
{ {
"Name": "AudioModulation", "Name": "AudioModulation",
"Enabled": true "Enabled": true
},
{
"Name": "DBTween",
"Enabled": true,
"SupportedTargetPlatforms": [
"Win64"
]
} }
] ]
} }