Still working on event handling for hotkey widgets
This commit is contained in:
@@ -349,48 +349,6 @@ ALuprexGameModeBase *ALuprexGameModeBase::FromContext(const UObject *context) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void ALuprexGameModeBase::ClearLookAtWidget(const UObject *Context)
|
||||
{
|
||||
ALuprexGameModeBase *mode = FromContext(Context);
|
||||
if (mode->LookAtWidget != nullptr)
|
||||
{
|
||||
mode->LookAtWidget->RemoveFromParent();
|
||||
mode->LookAtWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void ALuprexGameModeBase::SetLookAtWidget(const UObject *Context, UlxLookAtWidget *Widget)
|
||||
{
|
||||
ALuprexGameModeBase *Mode = FromContext(Context);
|
||||
if (Mode->LookAtWidget != Widget)
|
||||
{
|
||||
ClearLookAtWidget(Context);
|
||||
}
|
||||
Mode->LookAtWidget = Widget;
|
||||
}
|
||||
|
||||
UlxLookAtWidget *ALuprexGameModeBase::CreateLookAtWidgetByName(UObject *Context, const FString &BlueprintName,
|
||||
ElxFoundOrNotFound &Result, bool ErrorIfNotFound, bool AddToViewport, bool SetLookAtWidget)
|
||||
{
|
||||
ALuprexGameModeBase *Mode = FromContext(Context);
|
||||
Result = ElxFoundOrNotFound::NotFound;
|
||||
auto Blueprint = UlxAssetLookup::GetLookAtWidgetByName(Context, BlueprintName, ErrorIfNotFound);
|
||||
if (Blueprint == nullptr) return nullptr;
|
||||
APlayerController *pc = Context->GetWorld()->GetFirstPlayerController();
|
||||
UlxLookAtWidget *Widget = Cast<UlxLookAtWidget>(UWidgetBlueprintLibrary::Create(Context, Blueprint, pc));
|
||||
check(Widget != nullptr);
|
||||
if (AddToViewport)
|
||||
{
|
||||
Widget->AddToViewport(100);
|
||||
}
|
||||
if (SetLookAtWidget)
|
||||
{
|
||||
Mode->SetLookAtWidget(Context, Widget);
|
||||
}
|
||||
Result = ElxFoundOrNotFound::Found;
|
||||
return Widget;
|
||||
}
|
||||
|
||||
|
||||
void ALuprexGameModeBase::SetLookAt(const UObject *Context, const FHitResult &HitResult)
|
||||
{
|
||||
@@ -402,7 +360,6 @@ void ALuprexGameModeBase::SetLookAt(const UObject *Context, const FHitResult &Hi
|
||||
Mode->CurrentLookAt = HitResult;
|
||||
}
|
||||
|
||||
|
||||
FVector2D ALuprexGameModeBase::GetLookAtPixel(const UObject *Context)
|
||||
{
|
||||
ALuprexGameModeBase *Mode = FromContext(Context);
|
||||
|
||||
Reference in New Issue
Block a user