// Project Lab - NHTV IGAD
//////////////////////////////////////////
// Author: Yoshi van Belkom - 130118
//////////////////////////////////////////

#include "SkillTreeEditorPrivatePCH.h"
#include "SkillTreeAsset.h"
#include "AssetToolsModule.h"
#include "Classes/SkillTreeObject.h"
#include "SkillTreeEditorViewport.h"

#define LOCTEXT_NAMESPACE "AssetTypeActions"

FSkillTreeAsset::FSkillTreeAsset( EAssetTypeCategories::Type a_assetCategory )
	: m_assetCategory( a_assetCategory )
{
}

//Gets the name of the asset.
FText FSkillTreeAsset::GetName() const
{
	return LOCTEXT( "FSkillTreeName", "Skill Tree" );
}

//Gets the type color of the asset.
FColor FSkillTreeAsset::GetTypeColor() const
{
	return FColor::Cyan;
}

//Gets a pointer to the class this asset implements.
UClass* FSkillTreeAsset::GetSupportedClass() const
{
	return USkillTreeObject::StaticClass();
}

//Gets the category of this asset.
uint32 FSkillTreeAsset::GetCategories()
{
	return m_assetCategory;
}

//Opens an editor with this asset.
void FSkillTreeAsset::OpenAssetEditor( const TArray<UObject*>& a_objects, TSharedPtr<class IToolkitHost> a_editWithinLevelEditor )
{
	const EToolkitMode::Type mode = a_editWithinLevelEditor.IsValid() ? EToolkitMode::WorldCentric : EToolkitMode::Standalone;

	for ( auto i = a_objects.CreateConstIterator(); i; ++i )
	{
		if ( USkillTreeObject* skillTree = Cast<USkillTreeObject>( *i ) )
		{
			TSharedRef<FSkillTreeEditorViewport> newSkillTreeEditor( new FSkillTreeEditorViewport() );
			newSkillTreeEditor->InitSkillTreeEditor( mode, a_editWithinLevelEditor, skillTree );
		}
	}
};

#undef LOCTEXT_NAMESPACE