33 lines
774 B
C++
33 lines
774 B
C++
// © 2025 Naked People Team. All Rights Reserved.
|
|
|
|
|
|
#include "MainMenuHUD.h"
|
|
|
|
#include "Blueprint/UserWidget.h"
|
|
#include "GameFramework/PlayerController.h"
|
|
#include "NakedDesire/UI/Menu/MainMenuWidget.h"
|
|
|
|
void AMainMenuHUD::BeginPlay()
|
|
{
|
|
Super::BeginPlay();
|
|
|
|
if (!MainMenuWidgetClass)
|
|
return;
|
|
|
|
MainMenuWidget = CreateWidget<UMainMenuWidget>(GetWorld(), MainMenuWidgetClass);
|
|
if (!MainMenuWidget)
|
|
return;
|
|
|
|
MainMenuWidget->AddToViewport();
|
|
MainMenuWidget->ActivateWidget();
|
|
|
|
if (APlayerController* PC = GetOwningPlayerController())
|
|
{
|
|
PC->SetShowMouseCursor(true);
|
|
|
|
FInputModeUIOnly InputMode;
|
|
InputMode.SetWidgetToFocus(MainMenuWidget->TakeWidget());
|
|
InputMode.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);
|
|
PC->SetInputMode(InputMode);
|
|
}
|
|
} |