51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
#include "CppBaseWidget.h"
|
|
|
|
void UCppBaseWidget::NativeConstruct()
|
|
{
|
|
Super::NativeConstruct();
|
|
|
|
|
|
}
|
|
|
|
void UCppBaseWidget::NativeTick(const FGeometry& MyGeometry, float DeltaTime)
|
|
{
|
|
Super::NativeTick(MyGeometry, DeltaTime);
|
|
}
|
|
|
|
bool UCppBaseWidget::CanTick(float interval)
|
|
{
|
|
if ((GetWorld()->GetTimeSeconds() - timeLastTick) > interval)
|
|
{
|
|
timeLastTick = GetWorld()->GetTimeSeconds();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void UCppBaseWidget::PlayAnimationMode(TEnumAsByte<Enum_AnimMode> mode, int32 priorityIndex)
|
|
{
|
|
CppAnimation* animation = GetAnimationWithMode(&mode);
|
|
if (!animation)
|
|
return;
|
|
animation->PlayAnimationMode(&mode, &priorityIndex);
|
|
}
|
|
|
|
CppAnimation* UCppBaseWidget::GetAnimationWithMode(TEnumAsByte<Enum_AnimMode>* mode)
|
|
{
|
|
for (int32 i = 0; i < Animations.Num(); ++i)
|
|
{
|
|
if (Animations[i].CanMode(mode))
|
|
return &Animations[i];
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
void UCppBaseWidget::AddAnimation(UUserWidget* owner, UWidgetAnimation* animation, TArray<FCppStruct_AnimModeDirection> modes, TEnumAsByte<Enum_AnimMode> modeAtCreation, int32 priorityIndex)
|
|
{
|
|
Animations.Add(CppAnimation(owner, animation, &modes, &modeAtCreation, &priorityIndex));
|
|
}
|
|
|