Download LyraStarterGame/Source/LyraGame/UI/Foundation/LyraConfirmationScreen.cpp from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 2.91 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/UI/Foundation/LyraConfirmationScreen.cpp
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Source/LyraGame/UI/Foundation/LyraConfirmationScreen.cpp
-
curl -L -o LyraConfirmationScreen.cpp https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/UI/Foundation/LyraConfirmationScreen.cpp
2.91 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| void ULyraConfirmationScreen::SetupDialog(UCommonGameDialogDescriptor* Descriptor, FCommonMessagingResultDelegate ResultCallback) | |
| { | |
| Super::SetupDialog(Descriptor, ResultCallback); | |
| Text_Title->SetText(Descriptor->Header); | |
| RichText_Description->SetText(Descriptor->Body); | |
| EntryBox_Buttons->Reset<ULyraButtonBase>([](ULyraButtonBase& Button) | |
| { | |
| Button.OnClicked().Clear(); | |
| }); | |
| for (const FConfirmationDialogAction& Action : Descriptor->ButtonActions) | |
| { | |
| FDataTableRowHandle ActionRow; | |
| switch(Action.Result) | |
| { | |
| case ECommonMessagingResult::Confirmed: | |
| ActionRow = ICommonInputModule::GetSettings().GetDefaultClickAction(); | |
| break; | |
| case ECommonMessagingResult::Declined: | |
| ActionRow = ICommonInputModule::GetSettings().GetDefaultBackAction(); | |
| break; | |
| case ECommonMessagingResult::Cancelled: | |
| ActionRow = CancelAction; | |
| break; | |
| default: | |
| ensure(false); | |
| continue; | |
| } | |
| ULyraButtonBase* Button = EntryBox_Buttons->CreateEntry<ULyraButtonBase>(); | |
| Button->SetTriggeringInputAction(ActionRow); | |
| Button->OnClicked().AddUObject(this, &ThisClass::CloseConfirmationWindow, Action.Result); | |
| Button->SetButtonText(Action.OptionalDisplayText); | |
| } | |
| OnResultCallback = ResultCallback; | |
| } | |
| void ULyraConfirmationScreen::KillDialog() | |
| { | |
| Super::KillDialog(); | |
| } | |
| void ULyraConfirmationScreen::NativeOnInitialized() | |
| { | |
| Super::NativeOnInitialized(); | |
| Border_TapToCloseZone->OnMouseButtonDownEvent.BindDynamic(this, &ULyraConfirmationScreen::HandleTapToCloseZoneMouseButtonDown); | |
| } | |
| void ULyraConfirmationScreen::CloseConfirmationWindow(ECommonMessagingResult Result) | |
| { | |
| DeactivateWidget(); | |
| OnResultCallback.ExecuteIfBound(Result); | |
| } | |
| FEventReply ULyraConfirmationScreen::HandleTapToCloseZoneMouseButtonDown(FGeometry MyGeometry, const FPointerEvent& MouseEvent) | |
| { | |
| FEventReply Reply; | |
| Reply.NativeReply = FReply::Unhandled(); | |
| if (MouseEvent.IsTouchEvent() || MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton) | |
| { | |
| CloseConfirmationWindow(ECommonMessagingResult::Declined); | |
| Reply.NativeReply = FReply::Handled(); | |
| } | |
| return Reply; | |
| } | |
| void ULyraConfirmationScreen::ValidateCompiledDefaults(IWidgetCompilerLog& CompileLog) const | |
| { | |
| if (CancelAction.IsNull()) | |
| { | |
| CompileLog.Error(FText::Format(FText::FromString(TEXT("{0} has unset property: CancelAction.")), FText::FromString(GetName()))); | |
| } | |
| } | |