#include "PokktAdsPrivatePCH.h"
#include "PokktAdsComponent.h"


UPokktAdsComponent::FPKT_AdCachingCompletedDelegate UPokktAdsComponent::VideoAdCachingCompletedDelegate;
UPokktAdsComponent::FPKT_AdCachingFailedDelegate UPokktAdsComponent::VideoAdCachingFailedDelegate;
UPokktAdsComponent::FPKT_AdClosedDelegate UPokktAdsComponent::VideoAdClosedDelegate;
UPokktAdsComponent::FPKT_AdCompletedDelegate UPokktAdsComponent::VideoAdCompletedDelegate;
UPokktAdsComponent::FPKT_AdFailedToShowDelegate UPokktAdsComponent::VideoAdFailedToShowDelegate;
UPokktAdsComponent::FPKT_AdDisplayedDelegate UPokktAdsComponent::VideoAdDisplayedDelegate;
UPokktAdsComponent::FPKT_AdClickedDelegate UPokktAdsComponent::VideoAdClickedDelegate;
UPokktAdsComponent::FPKT_AdSkippedDelegate UPokktAdsComponent::VideoAdSkippedDelegate;
UPokktAdsComponent::FPKT_AdGratifiedDelegate UPokktAdsComponent::VideoAdGratifiedDelegate;

UPokktAdsComponent::FPKT_AdCachingCompletedDelegate UPokktAdsComponent::InterstitialCachingCompletedDelegate;
UPokktAdsComponent::FPKT_AdCachingFailedDelegate UPokktAdsComponent::InterstitialCachingFailedDelegate;
UPokktAdsComponent::FPKT_AdClosedDelegate UPokktAdsComponent::InterstitialClosedDelegate;
UPokktAdsComponent::FPKT_AdCompletedDelegate UPokktAdsComponent::InterstitialCompletedDelegate;
UPokktAdsComponent::FPKT_AdFailedToShowDelegate UPokktAdsComponent::InterstitialFailedToShowDelegate;
UPokktAdsComponent::FPKT_AdDisplayedDelegate UPokktAdsComponent::InterstitialDisplayedDelegate;
UPokktAdsComponent::FPKT_AdClickedDelegate UPokktAdsComponent::InterstitialClickedDelegate;
UPokktAdsComponent::FPKT_AdSkippedDelegate UPokktAdsComponent::InterstitialSkippedDelegate;
UPokktAdsComponent::FPKT_AdGratifiedDelegate UPokktAdsComponent::InterstitialGratifiedDelegate;

UPokktAdsComponent::FPKT_BannerLoadedDelegate UPokktAdsComponent::BannerLoadedDelegate;
UPokktAdsComponent::FPKT_BannerLoadFailedDelegate UPokktAdsComponent::BannerLoadFailedDelegate;
UPokktAdsComponent::FPKT_BannerClickedDelegate UPokktAdsComponent::BannerClickedDelegate;


void UPokktAdsComponent::OnRegister()
{
	Super::OnRegister();

	UPokktAdsComponent::VideoAdCachingCompletedDelegate.AddUObject(this, &UPokktAdsComponent::HandleVideoAdCachingCompleted);
	UPokktAdsComponent::VideoAdCachingFailedDelegate.AddUObject(this, &UPokktAdsComponent::HandleVideoAdCachingFailed);
	UPokktAdsComponent::VideoAdClosedDelegate.AddUObject(this, &UPokktAdsComponent::HandleVideoAdClosed);
	UPokktAdsComponent::VideoAdCompletedDelegate.AddUObject(this, &UPokktAdsComponent::HandleVideoAdCompleted);
	UPokktAdsComponent::VideoAdFailedToShowDelegate.AddUObject(this, &UPokktAdsComponent::HandleVideoAdFailedToShow);
	UPokktAdsComponent::VideoAdDisplayedDelegate.AddUObject(this, &UPokktAdsComponent::HandleVideoAdDisplayed);
    UPokktAdsComponent::VideoAdClickedDelegate.AddUObject(this, &UPokktAdsComponent::HandleVideoAdClicked);
    UPokktAdsComponent::VideoAdSkippedDelegate.AddUObject(this, &UPokktAdsComponent::HandleVideoAdSkipped);
	UPokktAdsComponent::VideoAdGratifiedDelegate.AddUObject(this, &UPokktAdsComponent::HandleVideoAdGratified);

	UPokktAdsComponent::InterstitialCachingCompletedDelegate.AddUObject(this, &UPokktAdsComponent::HandleInterstitialCachingCompleted);
	UPokktAdsComponent::InterstitialCachingFailedDelegate.AddUObject(this, &UPokktAdsComponent::HandleInterstitialCachingFailed);
	UPokktAdsComponent::InterstitialClosedDelegate.AddUObject(this, &UPokktAdsComponent::HandleInterstitialClosed);
	UPokktAdsComponent::InterstitialCompletedDelegate.AddUObject(this, &UPokktAdsComponent::HandleInterstitialCompleted);
	UPokktAdsComponent::InterstitialFailedToShowDelegate.AddUObject(this, &UPokktAdsComponent::HandleInterstitialFailedToShow);
	UPokktAdsComponent::InterstitialDisplayedDelegate.AddUObject(this, &UPokktAdsComponent::HandleInterstitialDisplayed);
    UPokktAdsComponent::InterstitialClickedDelegate.AddUObject(this, &UPokktAdsComponent::HandleInterstitialClicked);
	UPokktAdsComponent::InterstitialSkippedDelegate.AddUObject(this, &UPokktAdsComponent::HandleInterstitialSkipped);
	UPokktAdsComponent::InterstitialGratifiedDelegate.AddUObject(this, &UPokktAdsComponent::HandleInterstitialGratified);

	UPokktAdsComponent::BannerLoadedDelegate.AddUObject(this, &UPokktAdsComponent::HandleBannerLoaded);
	UPokktAdsComponent::BannerLoadFailedDelegate.AddUObject(this, &UPokktAdsComponent::HandleBannerLoadFailed);
    UPokktAdsComponent::BannerClickedDelegate.AddUObject(this, &UPokktAdsComponent::HandleBannerClicked);
}

void UPokktAdsComponent::OnUnregister()
{
	Super::OnUnregister();

	UPokktAdsComponent::VideoAdCachingCompletedDelegate.RemoveAll(this);
	UPokktAdsComponent::VideoAdCachingFailedDelegate.RemoveAll(this);
	UPokktAdsComponent::VideoAdClosedDelegate.RemoveAll(this);
	UPokktAdsComponent::VideoAdCompletedDelegate.RemoveAll(this);
	UPokktAdsComponent::VideoAdFailedToShowDelegate.RemoveAll(this);
	UPokktAdsComponent::VideoAdDisplayedDelegate.RemoveAll(this);
    UPokktAdsComponent::VideoAdClickedDelegate.RemoveAll(this);
	UPokktAdsComponent::VideoAdSkippedDelegate.RemoveAll(this);
	UPokktAdsComponent::VideoAdGratifiedDelegate.RemoveAll(this);

	UPokktAdsComponent::InterstitialCachingCompletedDelegate.RemoveAll(this);
	UPokktAdsComponent::InterstitialCachingFailedDelegate.RemoveAll(this);
	UPokktAdsComponent::InterstitialClosedDelegate.RemoveAll(this);
	UPokktAdsComponent::InterstitialCompletedDelegate.RemoveAll(this);
	UPokktAdsComponent::InterstitialFailedToShowDelegate.RemoveAll(this);
	UPokktAdsComponent::InterstitialDisplayedDelegate.RemoveAll(this);
    UPokktAdsComponent::InterstitialClickedDelegate.RemoveAll(this);
	UPokktAdsComponent::InterstitialSkippedDelegate.RemoveAll(this);
	UPokktAdsComponent::InterstitialGratifiedDelegate.RemoveAll(this);

	UPokktAdsComponent::BannerLoadedDelegate.RemoveAll(this);
	UPokktAdsComponent::BannerLoadFailedDelegate.RemoveAll(this);
    UPokktAdsComponent::BannerClickedDelegate.RemoveAll(this);
}
