diff --git a/.idea/.idea.TG_ARPG/.idea/encodings.xml b/.idea/.idea.TG_ARPG/.idea/encodings.xml index df87cf951..d84cf2665 100644 --- a/.idea/.idea.TG_ARPG/.idea/encodings.xml +++ b/.idea/.idea.TG_ARPG/.idea/encodings.xml @@ -1,4 +1,7 @@ - + + + + \ No newline at end of file diff --git a/Config/DefaultEngine.ini b/Config/DefaultEngine.ini index 17baa9465..631def36e 100644 --- a/Config/DefaultEngine.ini +++ b/Config/DefaultEngine.ini @@ -155,3 +155,4 @@ bInitServerOnClient=true [/Script/OnlineSubsystemSteam.SteamNetDriver] NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection" + diff --git a/Config/DefaultGame.ini b/Config/DefaultGame.ini index 95ad35cd9..c3d15654f 100644 --- a/Config/DefaultGame.ini +++ b/Config/DefaultGame.ini @@ -9,4 +9,5 @@ bRequiresPushToTalk=true [/Script/CommonInput.CommonInputSettings] InputData=/CommonUI/GenericInputData.GenericInputData_C +bEnableEnhancedInputSupport=True diff --git a/Content/Blueprint/Base/TG_GameInstance.uasset b/Content/Blueprint/Base/TG_GameInstance.uasset index d3df438b7..a0d28a269 100644 Binary files a/Content/Blueprint/Base/TG_GameInstance.uasset and b/Content/Blueprint/Base/TG_GameInstance.uasset differ diff --git a/Content/Blueprint/Base/TG_GameModeBase.uasset b/Content/Blueprint/Base/TG_GameModeBase.uasset index eb87a33fd..672eb7fda 100644 Binary files a/Content/Blueprint/Base/TG_GameModeBase.uasset and b/Content/Blueprint/Base/TG_GameModeBase.uasset differ diff --git a/Content/Blueprint/Base/TG_PlayerControllerBase.uasset b/Content/Blueprint/Base/TG_PlayerControllerBase.uasset index 0ed2da29c..956cebb0a 100644 Binary files a/Content/Blueprint/Base/TG_PlayerControllerBase.uasset and b/Content/Blueprint/Base/TG_PlayerControllerBase.uasset differ diff --git a/Content/Blueprint/Base/TG_PlayerStateBase.uasset b/Content/Blueprint/Base/TG_PlayerStateBase.uasset index 0b50e0594..db9ad17a2 100644 Binary files a/Content/Blueprint/Base/TG_PlayerStateBase.uasset and b/Content/Blueprint/Base/TG_PlayerStateBase.uasset differ diff --git a/Content/Blueprint/Character/BP_NPCBase.uasset b/Content/Blueprint/Character/BP_NPCBase.uasset index 53ef4662c..4a225f45a 100644 Binary files a/Content/Blueprint/Character/BP_NPCBase.uasset and b/Content/Blueprint/Character/BP_NPCBase.uasset differ diff --git a/Content/Blueprint/Character/BP_Player1.uasset b/Content/Blueprint/Character/BP_Player1.uasset index 436dab581..7b412011a 100644 Binary files a/Content/Blueprint/Character/BP_Player1.uasset and b/Content/Blueprint/Character/BP_Player1.uasset differ diff --git a/Content/Blueprint/Character/BP_PlayerBase.uasset b/Content/Blueprint/Character/BP_PlayerBase.uasset index 5c6bff42b..f2bc04629 100644 Binary files a/Content/Blueprint/Character/BP_PlayerBase.uasset and b/Content/Blueprint/Character/BP_PlayerBase.uasset differ diff --git a/Content/Blueprint/Character/BP_PlayerGamePlay.uasset b/Content/Blueprint/Character/BP_PlayerGamePlay.uasset index 7a5872a2f..f14c39cfd 100644 Binary files a/Content/Blueprint/Character/BP_PlayerGamePlay.uasset and b/Content/Blueprint/Character/BP_PlayerGamePlay.uasset differ diff --git a/Content/Blueprint/FunctionLib/F_DataLib.uasset b/Content/Blueprint/FunctionLib/F_DataLib.uasset index 43dc566ca..de2f779e3 100644 Binary files a/Content/Blueprint/FunctionLib/F_DataLib.uasset and b/Content/Blueprint/FunctionLib/F_DataLib.uasset differ diff --git a/Content/Blueprint/Lobby/TG_PlayerControllerLobby.uasset b/Content/Blueprint/Lobby/TG_PlayerControllerLobby.uasset index 3bd6c0af0..bd3bed1ba 100644 Binary files a/Content/Blueprint/Lobby/TG_PlayerControllerLobby.uasset and b/Content/Blueprint/Lobby/TG_PlayerControllerLobby.uasset differ diff --git a/Content/Blueprint/MainMenu/TG_GameModeMainMenu.uasset b/Content/Blueprint/MainMenu/TG_GameModeMainMenu.uasset index f985083db..55cc71d42 100644 Binary files a/Content/Blueprint/MainMenu/TG_GameModeMainMenu.uasset and b/Content/Blueprint/MainMenu/TG_GameModeMainMenu.uasset differ diff --git a/Content/Blueprint/MainMenu/TG_PlayerControllerMainMenu.uasset b/Content/Blueprint/MainMenu/TG_PlayerControllerMainMenu.uasset index ccf413e44..c4974e2d7 100644 Binary files a/Content/Blueprint/MainMenu/TG_PlayerControllerMainMenu.uasset and b/Content/Blueprint/MainMenu/TG_PlayerControllerMainMenu.uasset differ diff --git a/Content/Blueprint/Material/Function/DrawQuad.uasset b/Content/Blueprint/Material/Function/DrawQuad.uasset new file mode 100644 index 000000000..b51a021e8 Binary files /dev/null and b/Content/Blueprint/Material/Function/DrawQuad.uasset differ diff --git a/Content/Maps/Login.umap b/Content/Maps/Login.umap index 270f58145..362ce30f6 100644 Binary files a/Content/Maps/Login.umap and b/Content/Maps/Login.umap differ diff --git a/Content/Tengen/Data/S_CharacterData.uasset b/Content/Tengen/Data/S_CharacterData.uasset index 9b86d342e..ad2a79324 100644 Binary files a/Content/Tengen/Data/S_CharacterData.uasset and b/Content/Tengen/Data/S_CharacterData.uasset differ diff --git a/Content/Tengen/Data/S_Resources.uasset b/Content/Tengen/Data/S_Resources.uasset new file mode 100644 index 000000000..5a088ae4b Binary files /dev/null and b/Content/Tengen/Data/S_Resources.uasset differ diff --git a/Content/Tengen/Data/WBS_Weapon_Table.uasset b/Content/Tengen/Data/WBS_Weapon_Table.uasset index 956e7ca69..c1f3426aa 100644 Binary files a/Content/Tengen/Data/WBS_Weapon_Table.uasset and b/Content/Tengen/Data/WBS_Weapon_Table.uasset differ diff --git a/Content/Tengen/Input/IA_MainMenu.uasset b/Content/Tengen/Input/IA_MainMenu.uasset new file mode 100644 index 000000000..aa9c1d2dc Binary files /dev/null and b/Content/Tengen/Input/IA_MainMenu.uasset differ diff --git a/Content/Tengen/Input/IMC_MoveBase.uasset b/Content/Tengen/Input/IMC_MoveBase.uasset index 4dafa81bf..91a7115e4 100644 Binary files a/Content/Tengen/Input/IMC_MoveBase.uasset and b/Content/Tengen/Input/IMC_MoveBase.uasset differ diff --git a/Content/Tengen/UI/UI_GP_PlayerLIst.uasset b/Content/Tengen/UI/UI_GP_PlayerLIst.uasset index f76663f01..0a17873af 100644 Binary files a/Content/Tengen/UI/UI_GP_PlayerLIst.uasset and b/Content/Tengen/UI/UI_GP_PlayerLIst.uasset differ diff --git a/Content/ThirdPerson/Input/Actions/IA_UI_Up.uasset b/Content/ThirdPerson/Input/Actions/IA_UI_Up.uasset new file mode 100644 index 000000000..a40fa6a72 Binary files /dev/null and b/Content/ThirdPerson/Input/Actions/IA_UI_Up.uasset differ diff --git a/Content/ThirdPerson/Input/IMC_Default.uasset b/Content/ThirdPerson/Input/IMC_Default.uasset index 4ff192e10..85eadbad0 100644 Binary files a/Content/ThirdPerson/Input/IMC_Default.uasset and b/Content/ThirdPerson/Input/IMC_Default.uasset differ diff --git a/Content/ThirdPerson/Input/IMC_UI_GenericActions.uasset b/Content/ThirdPerson/Input/IMC_UI_GenericActions.uasset new file mode 100644 index 000000000..a2232c260 Binary files /dev/null and b/Content/ThirdPerson/Input/IMC_UI_GenericActions.uasset differ diff --git a/Content/ThirdPerson/Input/UI_IA_GenericMetadata.uasset b/Content/ThirdPerson/Input/UI_IA_GenericMetadata.uasset new file mode 100644 index 000000000..063bc6b27 Binary files /dev/null and b/Content/ThirdPerson/Input/UI_IA_GenericMetadata.uasset differ diff --git a/Content/ThirdPerson/Input/UI_IA_SpecificMetadata.uasset b/Content/ThirdPerson/Input/UI_IA_SpecificMetadata.uasset new file mode 100644 index 000000000..f7cf134fd Binary files /dev/null and b/Content/ThirdPerson/Input/UI_IA_SpecificMetadata.uasset differ diff --git a/Content/UI/Login/WB_Login.uasset b/Content/UI/Login/WB_Login.uasset index 4d11d78b3..71271450c 100644 Binary files a/Content/UI/Login/WB_Login.uasset and b/Content/UI/Login/WB_Login.uasset differ diff --git a/Content/Widget/Chat/WB_Chat.uasset b/Content/Widget/Chat/WB_Chat.uasset new file mode 100644 index 000000000..152744ae3 Binary files /dev/null and b/Content/Widget/Chat/WB_Chat.uasset differ diff --git a/Content/Widget/Lobby/CWB_MainBar.uasset b/Content/Widget/Lobby/CWB_MainBar.uasset index 5ad920d15..8a805f2d0 100644 Binary files a/Content/Widget/Lobby/CWB_MainBar.uasset and b/Content/Widget/Lobby/CWB_MainBar.uasset differ diff --git a/Content/Widget/Lobby/CWB_MainBarBotton.uasset b/Content/Widget/Lobby/CWB_MainBarBotton.uasset index 0cd5d3f8d..040b47f97 100644 Binary files a/Content/Widget/Lobby/CWB_MainBarBotton.uasset and b/Content/Widget/Lobby/CWB_MainBarBotton.uasset differ diff --git a/Content/Widget/Lobby/NewBlueprint.uasset b/Content/Widget/Lobby/NewBlueprint.uasset new file mode 100644 index 000000000..d0e2910fc Binary files /dev/null and b/Content/Widget/Lobby/NewBlueprint.uasset differ diff --git a/Content/Widget/Lobby/Sprint/MiniMap.uasset b/Content/Widget/Lobby/Sprint/MiniMap.uasset new file mode 100644 index 000000000..cc5646a98 Binary files /dev/null and b/Content/Widget/Lobby/Sprint/MiniMap.uasset differ diff --git a/Content/Widget/Lobby/Sprint/Rectangle_2.uasset b/Content/Widget/Lobby/Sprint/Rectangle_2.uasset new file mode 100644 index 000000000..0bc02eabe Binary files /dev/null and b/Content/Widget/Lobby/Sprint/Rectangle_2.uasset differ diff --git a/Content/Widget/Lobby/Sprint/Stage_Lobby_Host_Host.uasset b/Content/Widget/Lobby/Sprint/Stage_Lobby_Host_Host.uasset new file mode 100644 index 000000000..7aaeb42a7 Binary files /dev/null and b/Content/Widget/Lobby/Sprint/Stage_Lobby_Host_Host.uasset differ diff --git a/Content/Widget/Lobby/Sprint/UM_MainBar.uasset b/Content/Widget/Lobby/Sprint/UM_MainBar.uasset new file mode 100644 index 000000000..7c892368f Binary files /dev/null and b/Content/Widget/Lobby/Sprint/UM_MainBar.uasset differ diff --git a/Content/Widget/Lobby/Sprint/UM_MainBar_Inst.uasset b/Content/Widget/Lobby/Sprint/UM_MainBar_Inst.uasset new file mode 100644 index 000000000..f314d9ddc Binary files /dev/null and b/Content/Widget/Lobby/Sprint/UM_MainBar_Inst.uasset differ diff --git a/Content/Widget/Lobby/Sprint/多边形_1.uasset b/Content/Widget/Lobby/Sprint/多边形_1.uasset new file mode 100644 index 000000000..c69331a0c Binary files /dev/null and b/Content/Widget/Lobby/Sprint/多边形_1.uasset differ diff --git a/Content/Widget/Lobby/WB_Main_Lobby.uasset b/Content/Widget/Lobby/WB_Main_Lobby.uasset index 9df2a13c6..aa349d935 100644 Binary files a/Content/Widget/Lobby/WB_Main_Lobby.uasset and b/Content/Widget/Lobby/WB_Main_Lobby.uasset differ diff --git a/Content/Widget/MainMenu/CommonMainMuneButtonStyle.uasset b/Content/Widget/MainMenu/CommonMainMuneButtonStyle.uasset index 3913d28ae..865806e98 100644 Binary files a/Content/Widget/MainMenu/CommonMainMuneButtonStyle.uasset and b/Content/Widget/MainMenu/CommonMainMuneButtonStyle.uasset differ diff --git a/Content/Widget/MainMenu/WB_MainMenu.uasset b/Content/Widget/MainMenu/WB_MainMenu.uasset index 4e91bf094..d5b2270fe 100644 Binary files a/Content/Widget/MainMenu/WB_MainMenu.uasset and b/Content/Widget/MainMenu/WB_MainMenu.uasset differ diff --git a/Content/Widget/Profile/WB_Info.uasset b/Content/Widget/Profile/WB_Info.uasset new file mode 100644 index 000000000..21a7ffcd2 Binary files /dev/null and b/Content/Widget/Profile/WB_Info.uasset differ diff --git a/Content/Widget/Profile/WB_Profile.uasset b/Content/Widget/Profile/WB_Profile.uasset new file mode 100644 index 000000000..3d8006ee6 Binary files /dev/null and b/Content/Widget/Profile/WB_Profile.uasset differ diff --git a/Content/Widget/Profile/ditu.uasset b/Content/Widget/Profile/ditu.uasset new file mode 100644 index 000000000..396b0cc44 Binary files /dev/null and b/Content/Widget/Profile/ditu.uasset differ diff --git a/Content/Widget/Profile/levelcircle.uasset b/Content/Widget/Profile/levelcircle.uasset new file mode 100644 index 000000000..2384158ab Binary files /dev/null and b/Content/Widget/Profile/levelcircle.uasset differ diff --git a/Content/Widget/Profile/传奇.uasset b/Content/Widget/Profile/传奇.uasset new file mode 100644 index 000000000..e989b6748 Binary files /dev/null and b/Content/Widget/Profile/传奇.uasset differ diff --git a/Content/Widget/Profile/图层_26.uasset b/Content/Widget/Profile/图层_26.uasset new file mode 100644 index 000000000..b667e4310 Binary files /dev/null and b/Content/Widget/Profile/图层_26.uasset differ diff --git a/Content/Widget/Profile/图层_27.uasset b/Content/Widget/Profile/图层_27.uasset new file mode 100644 index 000000000..6da3c95e1 Binary files /dev/null and b/Content/Widget/Profile/图层_27.uasset differ diff --git a/Content/Widget/Profile/大师.uasset b/Content/Widget/Profile/大师.uasset new file mode 100644 index 000000000..d44f657e2 Binary files /dev/null and b/Content/Widget/Profile/大师.uasset differ diff --git a/Content/Widget/Profile/头像框.uasset b/Content/Widget/Profile/头像框.uasset new file mode 100644 index 000000000..41705c49b Binary files /dev/null and b/Content/Widget/Profile/头像框.uasset differ diff --git a/Content/Widget/Profile/白银.uasset b/Content/Widget/Profile/白银.uasset new file mode 100644 index 000000000..0b2c780f5 Binary files /dev/null and b/Content/Widget/Profile/白银.uasset differ diff --git a/Content/Widget/Profile/钻石.uasset b/Content/Widget/Profile/钻石.uasset new file mode 100644 index 000000000..0f9247b0e Binary files /dev/null and b/Content/Widget/Profile/钻石.uasset differ diff --git a/Content/Widget/Profile/铂金.uasset b/Content/Widget/Profile/铂金.uasset new file mode 100644 index 000000000..275b44232 Binary files /dev/null and b/Content/Widget/Profile/铂金.uasset differ diff --git a/Content/Widget/Profile/青铜.uasset b/Content/Widget/Profile/青铜.uasset new file mode 100644 index 000000000..7b31e2285 Binary files /dev/null and b/Content/Widget/Profile/青铜.uasset differ diff --git a/Content/Widget/Profile/黄金.uasset b/Content/Widget/Profile/黄金.uasset new file mode 100644 index 000000000..f4154237c Binary files /dev/null and b/Content/Widget/Profile/黄金.uasset differ diff --git a/Content/Widget/Quest/Line_1.uasset b/Content/Widget/Quest/Line_1.uasset new file mode 100644 index 000000000..29d39e44c Binary files /dev/null and b/Content/Widget/Quest/Line_1.uasset differ diff --git a/Content/Widget/Quest/WB_Quest.uasset b/Content/Widget/Quest/WB_Quest.uasset new file mode 100644 index 000000000..e81bd65f0 Binary files /dev/null and b/Content/Widget/Quest/WB_Quest.uasset differ diff --git a/Plugins/DBTween/DBTween.uplugin b/Plugins/DBTween/DBTween.uplugin new file mode 100644 index 000000000..876b8525c --- /dev/null +++ b/Plugins/DBTween/DBTween.uplugin @@ -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" + ] + } + ] +} \ No newline at end of file diff --git a/Plugins/DBTween/Resources/Icon128.png b/Plugins/DBTween/Resources/Icon128.png new file mode 100644 index 000000000..1231d4aad Binary files /dev/null and b/Plugins/DBTween/Resources/Icon128.png differ diff --git a/Plugins/DBTween/Source/DBTween/DBTween.Build.cs b/Plugins/DBTween/Source/DBTween/DBTween.Build.cs new file mode 100644 index 000000000..1abce138d --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/DBTween.Build.cs @@ -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 ... + } + ); + } +} diff --git a/Plugins/DBTween/Source/DBTween/Private/DBTween.cpp b/Plugins/DBTween/Source/DBTween/Private/DBTween.cpp new file mode 100644 index 000000000..b2d17e93c --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Private/DBTween.cpp @@ -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) diff --git a/Plugins/DBTween/Source/DBTween/Private/DBTweenActor.cpp b/Plugins/DBTween/Source/DBTween/Private/DBTweenActor.cpp new file mode 100644 index 000000000..936d4f8b2 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Private/DBTweenActor.cpp @@ -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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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; + } +} diff --git a/Plugins/DBTween/Source/DBTween/Private/DBTweenBase.cpp b/Plugins/DBTween/Source/DBTween/Private/DBTweenBase.cpp new file mode 100644 index 000000000..e4f39a331 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Private/DBTweenBase.cpp @@ -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 UDBTweenBase::GetAllDBTween() +{ + TArray 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); + +} diff --git a/Plugins/DBTween/Source/DBTween/Private/DBTweenCanvasPanelSlot.cpp b/Plugins/DBTween/Source/DBTween/Private/DBTweenCanvasPanelSlot.cpp new file mode 100644 index 000000000..487284b9d --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Private/DBTweenCanvasPanelSlot.cpp @@ -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(); + 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(); + 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(); + 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(); + 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(); + } +} diff --git a/Plugins/DBTween/Source/DBTween/Private/DBTweenColor.cpp b/Plugins/DBTween/Source/DBTween/Private/DBTweenColor.cpp new file mode 100644 index 000000000..5ee643ff6 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Private/DBTweenColor.cpp @@ -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(); + 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(); + 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); +} diff --git a/Plugins/DBTween/Source/DBTween/Private/DBTweenFloat.cpp b/Plugins/DBTween/Source/DBTween/Private/DBTweenFloat.cpp new file mode 100644 index 000000000..c4142079d --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Private/DBTweenFloat.cpp @@ -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(); + 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(); + 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); +} diff --git a/Plugins/DBTween/Source/DBTween/Private/DBTweenPath.cpp b/Plugins/DBTween/Source/DBTween/Private/DBTweenPath.cpp new file mode 100644 index 000000000..b411a0f72 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Private/DBTweenPath.cpp @@ -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 Path, float DurTime,EaseType easeType, bool IsLoop) +{ + if (Path.Num() == 0) return nullptr; + + UDBTweenPath* result = NewObject(); + 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 Path, float DurTime, UCurveFloat* Curve,bool IsLoop) +{ + if (Path.Num() == 0) return nullptr; + + UDBTweenPath* result = NewObject(); + 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(); + 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(); + 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); +} diff --git a/Plugins/DBTween/Source/DBTween/Private/DBTweenUpdateManager.cpp b/Plugins/DBTween/Source/DBTween/Private/DBTweenUpdateManager.cpp new file mode 100644 index 000000000..266c319c9 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Private/DBTweenUpdateManager.cpp @@ -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 ADBTweenUpdateManager::CallMap; + +TMap ADBTweenUpdateManager::EnterMap; + +TArray 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(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& 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& element : CallMap) + { + element.Value.ExecuteIfBound(DeltaTime); + } +} + diff --git a/Plugins/DBTween/Source/DBTween/Private/DBTweenUtil.cpp b/Plugins/DBTween/Source/DBTween/Private/DBTweenUtil.cpp new file mode 100644 index 000000000..b964dd3ad --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Private/DBTweenUtil.cpp @@ -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 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 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); +} diff --git a/Plugins/DBTween/Source/DBTween/Private/DBTweenUtil2.cpp b/Plugins/DBTween/Source/DBTween/Private/DBTweenUtil2.cpp new file mode 100644 index 000000000..50781d1a8 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Private/DBTweenUtil2.cpp @@ -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); +} diff --git a/Plugins/DBTween/Source/DBTween/Private/DBTweenVector2D.cpp b/Plugins/DBTween/Source/DBTween/Private/DBTweenVector2D.cpp new file mode 100644 index 000000000..d5a83716b --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Private/DBTweenVector2D.cpp @@ -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(); + 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(); + 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); +} diff --git a/Plugins/DBTween/Source/DBTween/Private/DBTweenVector3D.cpp b/Plugins/DBTween/Source/DBTween/Private/DBTweenVector3D.cpp new file mode 100644 index 000000000..bcfab51a4 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Private/DBTweenVector3D.cpp @@ -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(); + 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(); + 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); +} diff --git a/Plugins/DBTween/Source/DBTween/Private/DBTweenVector4D.cpp b/Plugins/DBTween/Source/DBTween/Private/DBTweenVector4D.cpp new file mode 100644 index 000000000..5a40e8099 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Private/DBTweenVector4D.cpp @@ -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(); + 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(); + 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); +} diff --git a/Plugins/DBTween/Source/DBTween/Private/DBTweenWidget.cpp b/Plugins/DBTween/Source/DBTween/Private/DBTweenWidget.cpp new file mode 100644 index 000000000..c47b2dab4 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Private/DBTweenWidget.cpp @@ -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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + } + +} + diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTween.h b/Plugins/DBTween/Source/DBTween/Public/DBTween.h new file mode 100644 index 000000000..5633f04ce --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTween.h @@ -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; +}; diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTweenActor.h b/Plugins/DBTween/Source/DBTween/Public/DBTweenActor.h new file mode 100644 index 000000000..7c16d268b --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTweenActor.h @@ -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; +}; diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTweenBase.h b/Plugins/DBTween/Source/DBTween/Public/DBTweenBase.h new file mode 100644 index 000000000..3681786eb --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTweenBase.h @@ -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 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); +}; diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTweenCanvasPanelSlot.h b/Plugins/DBTween/Source/DBTween/Public/DBTweenCanvasPanelSlot.h new file mode 100644 index 000000000..8a798b1b4 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTweenCanvasPanelSlot.h @@ -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; +}; diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTweenColor.h b/Plugins/DBTween/Source/DBTween/Public/DBTweenColor.h new file mode 100644 index 000000000..d47a1fb31 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTweenColor.h @@ -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; +}; diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTweenFloat.h b/Plugins/DBTween/Source/DBTween/Public/DBTweenFloat.h new file mode 100644 index 000000000..83915c044 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTweenFloat.h @@ -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; +}; diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTweenPath.h b/Plugins/DBTween/Source/DBTween/Public/DBTweenPath.h new file mode 100644 index 000000000..3229b924f --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTweenPath.h @@ -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 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 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 PathValue; + + float TotalLength; + TArray EachSegmentLength; + + void GetCurrentTimePos(FVector& Current, FRotator& Rotator); + +protected: + virtual void UpdateFunc(float deltaTime) override; + void CalcLength(); + +}; diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTweenRotator.h b/Plugins/DBTween/Source/DBTween/Public/DBTweenRotator.h new file mode 100644 index 000000000..8c46d580b --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTweenRotator.h @@ -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; + + +}; diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTweenUpdateManager.h b/Plugins/DBTween/Source/DBTween/Public/DBTweenUpdateManager.h new file mode 100644 index 000000000..18cda5fed --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTweenUpdateManager.h @@ -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 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 CallMap; + static TMap EnterMap; + static TArray QuitKeys; + static int KeyCount; +}; diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTweenUtil.h b/Plugins/DBTween/Source/DBTween/Public/DBTweenUtil.h new file mode 100644 index 000000000..aec1c0ac9 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTweenUtil.h @@ -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 Path, float DurTime = 1, EaseType easeType = EaseType::Linear, bool IsLoop = false); + + UFUNCTION(BlueprintCallable, Category = "DBTweenUtil | DBTweenPath") + static UDBTweenPath* DOPathByCurveSync(FString TweenName,TArray 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); +}; diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTweenUtil2.h b/Plugins/DBTween/Source/DBTween/Public/DBTweenUtil2.h new file mode 100644 index 000000000..89b4927a3 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTweenUtil2.h @@ -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); +}; diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTweenVector2D.h b/Plugins/DBTween/Source/DBTween/Public/DBTweenVector2D.h new file mode 100644 index 000000000..c96381f3f --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTweenVector2D.h @@ -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; +}; diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTweenVector3D.h b/Plugins/DBTween/Source/DBTween/Public/DBTweenVector3D.h new file mode 100644 index 000000000..c424c7b64 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTweenVector3D.h @@ -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; + +}; diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTweenVector4D.h b/Plugins/DBTween/Source/DBTween/Public/DBTweenVector4D.h new file mode 100644 index 000000000..a130928ab --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTweenVector4D.h @@ -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; + + +}; diff --git a/Plugins/DBTween/Source/DBTween/Public/DBTweenWidget.h b/Plugins/DBTween/Source/DBTween/Public/DBTweenWidget.h new file mode 100644 index 000000000..05a2bf2c6 --- /dev/null +++ b/Plugins/DBTween/Source/DBTween/Public/DBTweenWidget.h @@ -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; +}; diff --git a/Source/TG_ARPG/Private/TG_ControllerBase.cpp b/Source/TG_ARPG/Private/TG_ControllerBase.cpp new file mode 100644 index 000000000..d7f4aee41 --- /dev/null +++ b/Source/TG_ARPG/Private/TG_ControllerBase.cpp @@ -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(); + navigation->bAnalogNavigation = false; + navigation->bTabNavigation = false; + FSlateApplication::Get().SetNavigationConfig(navigation); + } +} + diff --git a/Source/TG_ARPG/Public/TG_ControllerBase.h b/Source/TG_ARPG/Public/TG_ControllerBase.h new file mode 100644 index 000000000..b11126e09 --- /dev/null +++ b/Source/TG_ARPG/Public/TG_ControllerBase.h @@ -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(); +}; diff --git a/Source/TG_ARPG/TG_ARPG.Build.cs b/Source/TG_ARPG/TG_ARPG.Build.cs index 3b7fd8a16..2ca7337ac 100644 --- a/Source/TG_ARPG/TG_ARPG.Build.cs +++ b/Source/TG_ARPG/TG_ARPG.Build.cs @@ -9,5 +9,7 @@ public class TG_ARPG : ModuleRules PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "EnhancedInput","GameplayAbilities", "GameplayTags", "GameplayTasks" }); + + PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); } } diff --git a/TG_ARPG.uproject b/TG_ARPG.uproject index d600d581c..7d9bb268d 100644 --- a/TG_ARPG.uproject +++ b/TG_ARPG.uproject @@ -64,6 +64,13 @@ { "Name": "AudioModulation", "Enabled": true + }, + { + "Name": "DBTween", + "Enabled": true, + "SupportedTargetPlatforms": [ + "Win64" + ] } ] } \ No newline at end of file