37 lines
1.1 KiB
C++
37 lines
1.1 KiB
C++
// Project Lab - NHTV Igad
|
|
|
|
#include "UnrealProject.h"
|
|
#include "SpellInfoDisplay.h"
|
|
#include "BaseSkillObject.h"
|
|
#include "SpellInfo.h"
|
|
|
|
void USpellInfoDisplay::NativeConstruct()
|
|
{
|
|
m_container = Cast<UPanelWidget>(WidgetTree->FindWidget("Container"));
|
|
}
|
|
|
|
void USpellInfoDisplay::OnLevelUp(class ANetworkPlayer* _player, TArray<FIngameSkillTreeSkill> updatedSkills)
|
|
{
|
|
if (!m_container)
|
|
return;
|
|
|
|
player = _player;
|
|
|
|
for (int32 i = 0; i < updatedSkills.Num(); i++)
|
|
{
|
|
USpellInfo* info = CreateWidget<USpellInfo>(GetWorld(), spellInfoClass);
|
|
UPanelSlot* slot = m_container->AddChild(info);
|
|
if (Cast<UHorizontalBoxSlot>(slot))
|
|
{
|
|
Cast<UHorizontalBoxSlot>(slot)->SetHorizontalAlignment(HAlign_Right);
|
|
}
|
|
else if(Cast<UVerticalBoxSlot>(slot))
|
|
{
|
|
UVerticalBoxSlot* vslot = Cast<UVerticalBoxSlot>(slot);
|
|
vslot->SetHorizontalAlignment(HAlign_Left);
|
|
Cast<UVerticalBoxSlot>(slot)->SetVerticalAlignment(VAlign_Fill);
|
|
}
|
|
info->Set(updatedSkills[i].selectedEffect, updatedSkills[i].level, updatedSkills[i].power, this);
|
|
}
|
|
}
|