[박치영] UI 이슈 해결 중
parent
51505f13cf
commit
be066a599f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -63,14 +63,14 @@ void ABossEnemy::BeginPlay()
|
|||
if (World)
|
||||
{
|
||||
APlayerController* Contorller = World->GetFirstPlayerController();
|
||||
if(Controller)
|
||||
if(!Controller) //TODO : 임시
|
||||
{
|
||||
UUI_BossHealth* BossHealthRef = CreateWidget<UUI_BossHealth>(Contorller, UUI_BossHealth::StaticClass());
|
||||
if (BossHealthRef) //ExposeOnSpawn 대용으로 사용
|
||||
{
|
||||
BossHealthWidget = BossHealthRef;
|
||||
BossHealthWidget->InitializeWidget(StatsComponent);
|
||||
BossHealthRef->AddToViewport();
|
||||
BossHealthWidget->InitializeWidget(StatsComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
|
||||
#include "UI/CombatHUD.h"
|
||||
|
||||
#include "UI_BossHealth.h"
|
||||
#include "UI/UI_MainHUD.h"
|
||||
|
||||
void ACombatHUD::BeginPlay()
|
||||
|
|
@ -17,5 +19,11 @@ void ACombatHUD::BeginPlay()
|
|||
UUI_MainHUD* outputUI = CreateWidget<UUI_MainHUD>(Contorller, MainUI);
|
||||
outputUI->AddToViewport();
|
||||
}
|
||||
|
||||
UUI_BossHealth* BossHealthRef = CreateWidget<UUI_BossHealth>(Contorller, UUI_BossHealth::StaticClass());
|
||||
if (BossHealthRef) //ExposeOnSpawn 대용으로 사용
|
||||
{
|
||||
BossHealthRef->AddToViewport();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,13 +5,28 @@
|
|||
|
||||
#include "UI_HealthBar.h"
|
||||
#include "Components/StatsComponent.h"
|
||||
#include "Components/TextBlock.h"
|
||||
|
||||
UUI_BossHealth::UUI_BossHealth()
|
||||
void UUI_BossHealth::NativeConstruct()
|
||||
{
|
||||
|
||||
/*
|
||||
* TODO :
|
||||
* Blueprint로 호출할때는 호출되지만
|
||||
* C++로 호출할 때는 nullptr로 들어옴
|
||||
*/
|
||||
Super::NativeConstruct();
|
||||
HealthBar = Cast<UUI_HealthBar>(GetWidgetFromName(TEXT("HealthBarWidget")));
|
||||
if(HealthBar)
|
||||
//HealthBar->InitializeHealthBar(StatsComponent, EStats::Health);
|
||||
|
||||
Test1 = Cast<UTextBlock>(GetWidgetFromName(TEXT("Test1Widget")));
|
||||
Test2 = Cast<UTextBlock>(GetWidgetFromName(TEXT("Test2Widget")));
|
||||
// ensure(Test1);
|
||||
// ensure(Test2);
|
||||
}
|
||||
|
||||
void UUI_BossHealth::InitializeWidget(UStatsComponent* InputStatsComponent)
|
||||
{
|
||||
HealthBar->InitializeHealthBar(InputStatsComponent, EStats::Health);
|
||||
if(IsValid(InputStatsComponent))
|
||||
StatsComponent = InputStatsComponent;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@ class D1_API UUI_BossHealth : public UUserWidget
|
|||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
UUI_BossHealth();
|
||||
virtual void NativeConstruct() override;
|
||||
void InitializeWidget(class UStatsComponent* InputStatsComponent);
|
||||
private:
|
||||
/*
|
||||
* TODO :
|
||||
* 해당 파일은 Blueprint Widget을 사용하는데
|
||||
* UUI_HealthBar는 C++ 파일이라서 서로 매칭이 안됨.
|
||||
* 어떻게 해야하는지 물어봐야됨
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget, AllowPrivateAccess="true"))
|
||||
TSubclassOf<class UUI_HealthBar> HealthBar;
|
||||
UPROPERTY()
|
||||
TObjectPtr<class UUI_HealthBar> HealthBar;
|
||||
UPROPERTY()
|
||||
TObjectPtr<class UTextBlock> Test1;
|
||||
UPROPERTY()
|
||||
TObjectPtr<class UTextBlock> Test2;
|
||||
UPROPERTY()
|
||||
TObjectPtr<class UStatsComponent> StatsComponent;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue