Download LyraStarterGame/Source/LyraGame/UI/Common/LyraBoundActionButton.cpp from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/UI/Common/LyraBoundActionButton.cpp
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Source/LyraGame/UI/Common/LyraBoundActionButton.cpp
-
curl -L -o LyraBoundActionButton.cpp https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/UI/Common/LyraBoundActionButton.cpp
1.01 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| class UCommonButtonStyle; | |
| void ULyraBoundActionButton::NativeConstruct() | |
| { | |
| Super::NativeConstruct(); | |
| if (UCommonInputSubsystem* InputSubsystem = GetInputSubsystem()) | |
| { | |
| InputSubsystem->OnInputMethodChangedNative.AddUObject(this, &ThisClass::HandleInputMethodChanged); | |
| HandleInputMethodChanged(InputSubsystem->GetCurrentInputType()); | |
| } | |
| } | |
| void ULyraBoundActionButton::HandleInputMethodChanged(ECommonInputType NewInputMethod) | |
| { | |
| TSubclassOf<UCommonButtonStyle> NewStyle = nullptr; | |
| if (NewInputMethod == ECommonInputType::Gamepad) | |
| { | |
| NewStyle = GamepadStyle; | |
| } | |
| else if (NewInputMethod == ECommonInputType::Touch) | |
| { | |
| NewStyle = TouchStyle; | |
| } | |
| else | |
| { | |
| NewStyle = KeyboardStyle; | |
| } | |
| if (NewStyle) | |
| { | |
| SetStyle(NewStyle); | |
| } | |
| } | |