添加技能资源的菜单创建
This commit is contained in:
parent
f99367951a
commit
39c95a5ed5
@ -0,0 +1,17 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "AssetActions/SkillAssetTypeAction.h"
|
||||
|
||||
#include "ProjectFish/DataAsset/SkillAsset.h"
|
||||
|
||||
|
||||
UClass* FSkillAssetTypeAction::GetSupportedClass() const
|
||||
{
|
||||
return USkillAsset::StaticClass();
|
||||
}
|
||||
|
||||
uint32 FSkillAssetTypeAction::GetCategories()
|
||||
{
|
||||
return MyAssetCategory;
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "Factory/SkillAssetFactory.h"
|
||||
|
||||
#include "ProjectFish/DataAsset/SkillAsset.h"
|
||||
|
||||
USkillAssetFactory::USkillAssetFactory()
|
||||
{
|
||||
SupportedClass = USkillAsset::StaticClass();
|
||||
}
|
||||
|
||||
UObject* USkillAssetFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags,
|
||||
UObject* Context, FFeedbackContext* Warn)
|
||||
{
|
||||
USkillAsset* NewSkillAsset = NewObject<USkillAsset>(InParent, Class, Name, Flags | RF_Transactional);
|
||||
return NewSkillAsset;
|
||||
}
|
||||
|
||||
bool USkillAssetFactory::ShouldShowInNewMenu() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "AssetTypeActions_Base.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class PROJECTFISHEDITOR_API FSkillAssetTypeAction: public FAssetTypeActions_Base
|
||||
{
|
||||
public:
|
||||
FSkillAssetTypeAction(EAssetTypeCategories::Type InAssetCategory)
|
||||
{
|
||||
MyAssetCategory = InAssetCategory;
|
||||
}
|
||||
virtual FText GetName() const override { return FText::FromString("Skill Asset"); }
|
||||
virtual FColor GetTypeColor() const override { return FColor(255, 196, 115); }
|
||||
virtual UClass* GetSupportedClass() const override;
|
||||
virtual uint32 GetCategories() override;
|
||||
virtual bool CanFilter() override { return true; }
|
||||
|
||||
|
||||
private:
|
||||
EAssetTypeCategories::Type MyAssetCategory;
|
||||
};
|
||||
@ -0,0 +1,22 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Factories/Factory.h"
|
||||
#include "SkillAssetFactory.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROJECTFISHEDITOR_API USkillAssetFactory : public UFactory
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
USkillAssetFactory();
|
||||
|
||||
//interface
|
||||
virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
|
||||
virtual bool ShouldShowInNewMenu() const override;
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user