43 lines
1.5 KiB
C++
43 lines
1.5 KiB
C++
|
|
// Copyright Echo Devgroup
|
||
|
|
|
||
|
|
|
||
|
|
#include "AbilitySystem/AuraAbilitySystemLibrary.h"
|
||
|
|
|
||
|
|
#include "Kismet/GameplayStatics.h"
|
||
|
|
#include "Player/AuraPlayerState.h"
|
||
|
|
#include "UI/WidgetController/AuraWidgetController.h"
|
||
|
|
#include "UI/HUD/AuraHUD.h"
|
||
|
|
|
||
|
|
UOverlayWidgetController* UAuraAbilitySystemLibrary::GetOverlayWidgetController(const UObject* WorldContextObject)
|
||
|
|
{
|
||
|
|
if (APlayerController* PC = UGameplayStatics::GetPlayerController(WorldContextObject, 0))
|
||
|
|
{
|
||
|
|
if (AAuraHUD* AuraHUD = Cast<AAuraHUD>(PC->GetHUD()))
|
||
|
|
{
|
||
|
|
AAuraPlayerState* PS = PC->GetPlayerState<AAuraPlayerState>();
|
||
|
|
UAbilitySystemComponent* ASC = PS->GetAbilitySystemComponent();
|
||
|
|
UAttributeSet* AS = PS->GetAttributeSet();
|
||
|
|
const FWidgetControllerParams WidgetControllerParams(PC, PS, ASC, AS);
|
||
|
|
return AuraHUD->GetOverlayWidgetController(WidgetControllerParams);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return nullptr;
|
||
|
|
}
|
||
|
|
|
||
|
|
UAttributeMenuWidgetController* UAuraAbilitySystemLibrary::GetAttributeMenuWidgetController(
|
||
|
|
const UObject* WorldContextObject)
|
||
|
|
{
|
||
|
|
if (APlayerController* PC = UGameplayStatics::GetPlayerController(WorldContextObject, 0))
|
||
|
|
{
|
||
|
|
if (AAuraHUD* AuraHUD = Cast<AAuraHUD>(PC->GetHUD()))
|
||
|
|
{
|
||
|
|
AAuraPlayerState* PS = PC->GetPlayerState<AAuraPlayerState>();
|
||
|
|
UAbilitySystemComponent* ASC = PS->GetAbilitySystemComponent();
|
||
|
|
UAttributeSet* AS = PS->GetAttributeSet();
|
||
|
|
const FWidgetControllerParams WidgetControllerParams(PC, PS, ASC, AS);
|
||
|
|
return AuraHUD->GetAttributeMenuWidgetController(WidgetControllerParams);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return nullptr;
|
||
|
|
}
|