Space Plunder
Loading...
Searching...
No Matches
USelectionButtonMenuSystem Class Reference

#include <SelectionButtonMenuSystem.h>

Inheritance diagram for USelectionButtonMenuSystem:
UCommonWidgetBase

Public Member Functions

virtual bool Initialize () override
 
virtual void NativePreConstruct () override
 
virtual void NativeConstruct () override
 
virtual void NativeOnMouseEnter (const FGeometry &InGeometry, const FPointerEvent &InMouseEvent) override
 
virtual void NativeOnAddedToFocusPath (const FFocusEvent &InFocusEvent) override
 
virtual void NativeOnRemovedFromFocusPath (const FFocusEvent &InFocusEvent) override
 
virtual void NativeOnMouseLeave (const FPointerEvent &InMouseEvent) override
 
void SetButtonText (FString Text) const
 
void SetButtonFocus () const
 
bool GetIsFocused () const
 
void SetButtonIndex (const int32 Index)
 
int32 GetButtonIndex () const
 
void SetTempDisabled (const bool bValue=true)
 
void SetDisabled (const bool bValue=true)
 
bool GetIsDisabled () const
 
void PlaySelectionAnimation (bool bForward)
 
- Public Member Functions inherited from UCommonWidgetBase
void PlaySlateSound (const FSlateSound &SlateSound) const
 

Public Attributes

FOnSelectionButtonClicked OnSelectionButtonClicked
 

Protected Attributes

class UButton * MainButton = nullptr
 
class UTextBlock * ButtonTextBlock = nullptr
 
class UButtonPromptWidgetButtonPrompt = nullptr
 
FName SelectInputName = "Confirm"
 
FButtonStyle MouseStyle
 
FButtonStyle KeySelected
 
FButtonStyle KeyNotSelected
 
bool bDisabled = false
 
int32 ButtonIndex = 0
 
- Protected Attributes inherited from UCommonWidgetBase
bool bDebuggingMode = false
 

Private Member Functions

void OnClicked ()
 

Additional Inherited Members

- Protected Member Functions inherited from UCommonWidgetBase
virtual void Setup ()
 
void LogDebugError (const FString &Message) const
 
void LogDebugError (const FString &Message, const int32 Value) const
 
void LogDebugError (const FString &Message, const float Value) const
 
void LogDebugWarning (const FString &Message) const
 
void LogDebugWarning (const FString &Message, const int32 Value) const
 
void LogDebugWarning (const FString &Message, const float Value) const
 
void LogDebugMessage (const FString &Message, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const int32 Value, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const float Value, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const bool bValue, const bool bWarning, const bool bError) const
 
void LogOnScreenMessage (const int32 Key, const FString &Message, FColor Color=FColor::Green) const
 
void SetCategoryName (const FLogCategoryBase &Category)
 

Member Function Documentation

◆ GetButtonIndex()

int32 USelectionButtonMenuSystem::GetButtonIndex ( ) const
inline
43{return ButtonIndex;};
int32 ButtonIndex
Definition SelectionButtonMenuSystem.h:80

◆ GetIsDisabled()

bool USelectionButtonMenuSystem::GetIsDisabled ( ) const
inline
50{return bDisabled;};
bool bDisabled
Definition SelectionButtonMenuSystem.h:77

◆ GetIsFocused()

bool USelectionButtonMenuSystem::GetIsFocused ( ) const
inline
38{return MainButton->HasAnyUserFocus();};
class UButton * MainButton
Definition SelectionButtonMenuSystem.h:57

◆ Initialize()

bool USelectionButtonMenuSystem::Initialize ( )
overridevirtual
10{
11 const bool Success = Super::Initialize();
12 if(!Success) return false;
13 if (!ensure(MainButton != nullptr)) return false;
14 if (!ensure(ButtonTextBlock != nullptr)) return false;
15 if (!ensure(ButtonPrompt != nullptr)) return false;
16 MainButton->OnClicked.AddDynamic(this, &USelectionButtonMenuSystem::OnClicked);
17 return true;
18}
void OnClicked()
Definition SelectionButtonMenuSystem.cpp:66
class UTextBlock * ButtonTextBlock
Definition SelectionButtonMenuSystem.h:59
class UButtonPromptWidget * ButtonPrompt
Definition SelectionButtonMenuSystem.h:61

◆ NativeConstruct()

void USelectionButtonMenuSystem::NativeConstruct ( )
overridevirtual

Reimplemented from UCommonWidgetBase.

30{
31 Super::NativeConstruct();
32 if(ButtonPrompt == nullptr || MainButton == nullptr){return;}
33 MainButton->SetIsEnabled(!bDisabled);
36}
void SetInputActionFromTable(const FName &Name)
Definition ButtonPromptWidget.cpp:118
void SetHasProgress(const bool bValue)
Definition ButtonPromptWidget.cpp:98
FName SelectInputName
Definition SelectionButtonMenuSystem.h:68

◆ NativeOnAddedToFocusPath()

void USelectionButtonMenuSystem::NativeOnAddedToFocusPath ( const FFocusEvent & InFocusEvent)
overridevirtual
82{
83 Super::NativeOnAddedToFocusPath(InFocusEvent);
84 MainButton->SetStyle(KeySelected);
86 ButtonPrompt->SetVisibility(ESlateVisibility::Visible);
87 PlaySlateSound(MainButton->GetStyle().HoveredSlateSound);
88}
void PlaySlateSound(const FSlateSound &SlateSound) const
Definition CommonWidgetBase.cpp:8
void PlaySelectionAnimation(bool bForward)
FButtonStyle KeySelected
Definition SelectionButtonMenuSystem.h:72

◆ NativeOnMouseEnter()

void USelectionButtonMenuSystem::NativeOnMouseEnter ( const FGeometry & InGeometry,
const FPointerEvent & InMouseEvent )
overridevirtual
75{
76 Super::NativeOnMouseEnter(InGeometry, InMouseEvent);
77 MainButton->SetStyle(MouseStyle);
79}
FButtonStyle MouseStyle
Definition SelectionButtonMenuSystem.h:70

◆ NativeOnMouseLeave()

void USelectionButtonMenuSystem::NativeOnMouseLeave ( const FPointerEvent & InMouseEvent)
overridevirtual
99{
100 Super::NativeOnMouseLeave(InMouseEvent);
101 MainButton->SetStyle(MouseStyle);
103 ButtonPrompt->SetVisibility(ESlateVisibility::Hidden);
104}

◆ NativeOnRemovedFromFocusPath()

void USelectionButtonMenuSystem::NativeOnRemovedFromFocusPath ( const FFocusEvent & InFocusEvent)
overridevirtual
91{
92 Super::NativeOnRemovedFromFocusPath(InFocusEvent);
93 MainButton->SetStyle(KeyNotSelected);
95 ButtonPrompt->SetVisibility(ESlateVisibility::Hidden);
96}
FButtonStyle KeyNotSelected
Definition SelectionButtonMenuSystem.h:74

◆ NativePreConstruct()

void USelectionButtonMenuSystem::NativePreConstruct ( )
overridevirtual

Reimplemented from UCommonWidgetBase.

21{
22 Super::NativePreConstruct();
23 if(ButtonPrompt == nullptr || MainButton == nullptr){return;}
24 MainButton->SetIsEnabled(!bDisabled);
27}

◆ OnClicked()

void USelectionButtonMenuSystem::OnClicked ( )
private
67{
68 if(!bDisabled)
69 {
71 }
72}
FOnSelectionButtonClicked OnSelectionButtonClicked
Definition SelectionButtonMenuSystem.h:30

◆ PlaySelectionAnimation()

void USelectionButtonMenuSystem::PlaySelectionAnimation ( bool bForward)

◆ SetButtonFocus()

void USelectionButtonMenuSystem::SetButtonFocus ( ) const
39{
40 if(MainButton != nullptr)
41 {
42 if(GetOwningPlayer() != nullptr)
43 {
44 MainButton->SetUserFocus(GetOwningPlayer());
45 }
46 else
47 {
48 MainButton->SetKeyboardFocus();
49 MainButton->SetFocus();
50 }
51 }
52}

◆ SetButtonIndex()

void USelectionButtonMenuSystem::SetButtonIndex ( const int32 Index)
inline
41{ButtonIndex = Index;};

◆ SetButtonText()

void USelectionButtonMenuSystem::SetButtonText ( FString Text) const
108{
109 if(ButtonTextBlock != nullptr)
110 {
111 ButtonTextBlock->SetText(FText::FromString(Text));
112 }
113}

◆ SetDisabled()

void USelectionButtonMenuSystem::SetDisabled ( const bool bValue = true)
inline
48{bDisabled = bValue;};

◆ SetTempDisabled()

void USelectionButtonMenuSystem::SetTempDisabled ( const bool bValue = true)
55{
56 if(bValue)
57 {
58 MainButton->SetIsEnabled(!bValue);
59 }
60 else
61 {
62 MainButton->SetIsEnabled(!bDisabled);
63 }
64}

Member Data Documentation

◆ bDisabled

bool USelectionButtonMenuSystem::bDisabled = false
protected

◆ ButtonIndex

int32 USelectionButtonMenuSystem::ButtonIndex = 0
protected

◆ ButtonPrompt

class UButtonPromptWidget* USelectionButtonMenuSystem::ButtonPrompt = nullptr
protected

◆ ButtonTextBlock

class UTextBlock* USelectionButtonMenuSystem::ButtonTextBlock = nullptr
protected

◆ KeyNotSelected

FButtonStyle USelectionButtonMenuSystem::KeyNotSelected
protected

◆ KeySelected

FButtonStyle USelectionButtonMenuSystem::KeySelected
protected

◆ MainButton

class UButton* USelectionButtonMenuSystem::MainButton = nullptr
protected

◆ MouseStyle

FButtonStyle USelectionButtonMenuSystem::MouseStyle
protected

◆ OnSelectionButtonClicked

FOnSelectionButtonClicked USelectionButtonMenuSystem::OnSelectionButtonClicked

◆ SelectInputName

FName USelectionButtonMenuSystem::SelectInputName = "Confirm"
protected

The documentation for this class was generated from the following files: