134 if (!PopupWidgetPtr || !(*PopupWidgetPtr))
137 UUserWidget* PopupWidget = *PopupWidgetPtr;
140 if (PopupWidget->IsInViewport())
142 PopupWidget->RemoveFromParent();
151 FString MapName = GetWorld()->GetMapName();
152 MapName.RemoveFromStart(GetWorld()->StreamingLevelsPrefix);
153 if (MapName.Contains(TEXT(
"Map1")) ||
154 MapName.Contains(TEXT(
"Person")) )
273 const FString& InTitle,
274 const FString& InDescription,
276 const FOnMsgBoxOkDelegate& InOkDelegate,
277 const FOnMsgBoxCancelDelegate& InCancelDelegate)
279 UUserWidget* Widget =
ShowPopup(EPopupType::MsgBox);
283 if (
auto Popup = Cast<UPopup_MsgBox>(Widget))
285 Popup->InitPopup(InTitle, InDescription, InType, InOkDelegate, InCancelDelegate);
290 const FString& InTitle,
291 const FString& InDescription,
295 UUserWidget* Widget =
ShowPopup(EPopupType::MsgBox);
299 if (
auto MsgBox = Cast<UPopup_MsgBox>(Widget))
302 FOnMsgBoxOkDelegate EmptyOkDelegate;
303 FOnMsgBoxCancelDelegate EmptyCancelDelegate;
304 MsgBox->InitPopup(InTitle, InDescription, InType, EmptyOkDelegate, EmptyCancelDelegate);
314 UWorld* World = GetWorld();
315 if (!World || !World->IsGameWorld())
320 if (ExistingWidgetPtr && IsValid(*ExistingWidgetPtr))
322 UUserWidget* ExistingWidget = *ExistingWidgetPtr;
324 if (ExistingWidget->GetWorld() == World)
326 return ExistingWidget;
331 if (ExistingWidget->IsInViewport())
332 ExistingWidget->RemoveFromParent();
338 TSubclassOf<UUserWidget>* PopupClassPtr =
PopupClassMap.Find(Type);
339 if (!PopupClassPtr || !(*PopupClassPtr))
341 PRINTLOG(TEXT(
"[UPopupManager] No popup class registered for type: %s"),
347 ULocalPlayer* LocalPlayer = GetLocalPlayer();
351 APlayerController* PC = LocalPlayer->GetPlayerController(World);
360 UUserWidget* NewWidget = NewObject<UUserWidget>(GetTransientPackage(), *PopupClassPtr, NAME_None, RF_Transient);
364 NewWidget->Initialize();
367 NewWidget->SetOwningPlayer(PC);