// Oleg Petruny proprietary.

#include "AutohideWidget.h"

#include "Animation/WidgetAnimation.h"
#include "Engine/World.h"
#include "TimerManager.h"

void UAutohideWidget::Show()
{
    SetVisibility(ESlateVisibility::Visible);
    if(!showTimer.IsValid())
        PlayAnimation(showAnimation, GetAnimationCurrentTime(showAnimation), 1, EUMGSequencePlayMode::Forward, 1, false);
    GetWorld()->GetTimerManager().SetTimer(showTimer, this, &UAutohideWidget::Hide, showDuration, false);
}

void UAutohideWidget::Hide()
{
    GetWorld()->GetTimerManager().ClearTimer(showTimer);
    PlayAnimation(showAnimation, GetAnimationCurrentTime(showAnimation), 1, EUMGSequencePlayMode::Reverse, 1, false);
}