mirror of
https://github.com/sinbad/StevesUEHelpers.git
synced 2025-02-23 09:35:25 +00:00
Stop propagating a single button style to all the mouse/gamepad versions in option widget
Firstly, this didn't always work correctly because cascading isn't saved in the editor transaction. Probably needs an editor plugin to do correctly. Secondly, maybe you'd want to have different styles anyway and this forces them to be overridden which isn't very flexible. Instead you now style all the buttons individually.
This commit is contained in:
parent
19f1d3e9ac
commit
1b0b22bae6
@ -109,52 +109,6 @@ void UOptionWidgetBase::InputModeChanged(int PlayerIndex, EInputMode NewMode)
|
||||
UpdateFromInputMode(NewMode);
|
||||
}
|
||||
|
||||
void UOptionWidgetBase::SynchronizeProperties()
|
||||
{
|
||||
Super::SynchronizeProperties();
|
||||
|
||||
SyncButtonProperties(MouseUpButton);
|
||||
SyncButtonProperties(MouseDownButton);
|
||||
SyncButtonProperties(GamepadVersion);
|
||||
|
||||
SyncTextProperties(MouseText);
|
||||
SyncTextProperties(GamepadText);
|
||||
|
||||
SyncButtonImageProperties(MouseUpImage);
|
||||
SyncButtonImageProperties(MouseDownImage);
|
||||
SyncButtonImageProperties(GamepadUpImage);
|
||||
SyncButtonImageProperties(GamepadDownImage);
|
||||
}
|
||||
|
||||
void UOptionWidgetBase::SyncButtonProperties(UButton* Button) const
|
||||
{
|
||||
if (Button)
|
||||
{
|
||||
Button->SetStyle(ButtonStyle);
|
||||
}
|
||||
}
|
||||
|
||||
void UOptionWidgetBase::SyncButtonImageProperties(UImage* Img) const
|
||||
{
|
||||
if (Img)
|
||||
{
|
||||
Img->SetBrush(ButtonImage);
|
||||
Img->SetColorAndOpacity(ButtonImageColour);
|
||||
}
|
||||
}
|
||||
|
||||
void UOptionWidgetBase::SyncTextProperties(UTextBlock* Txt) const
|
||||
{
|
||||
if (Txt)
|
||||
{
|
||||
Txt->SetFont(Font);
|
||||
Txt->SetColorAndOpacity(TextColour);
|
||||
Txt->SetStrikeBrush(TextStrikeBrush);
|
||||
Txt->SetShadowOffset(TextShadowOffset);
|
||||
Txt->SetShadowColorAndOpacity(TextShadowColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UOptionWidgetBase::SetMouseMode()
|
||||
{
|
||||
@ -170,8 +124,6 @@ void UOptionWidgetBase::SetMouseMode()
|
||||
|
||||
MouseVersion->SetVisibility(ESlateVisibility::Visible);
|
||||
|
||||
SynchronizeProperties();
|
||||
|
||||
if (bHadFocus)
|
||||
SetFocusProperly();
|
||||
|
||||
@ -188,8 +140,6 @@ void UOptionWidgetBase::SetButtonMode()
|
||||
|
||||
GamepadVersion->SetVisibility(ESlateVisibility::Visible);
|
||||
|
||||
SynchronizeProperties();
|
||||
|
||||
if (bHadFocus)
|
||||
SetFocusProperly();
|
||||
|
||||
|
@ -20,31 +20,6 @@ class STEVESUEHELPERS_API UOptionWidgetBase : public UFocusableUserWidget
|
||||
|
||||
public:
|
||||
|
||||
// -- Properties we replicate to child widgets
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Appearance")
|
||||
FButtonStyle ButtonStyle;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Appearance")
|
||||
FSlateBrush ButtonImage;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Appearance")
|
||||
FLinearColor ButtonImageColour = FLinearColor::White;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Appearance")
|
||||
FSlateFontInfo Font;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Appearance")
|
||||
FLinearColor TextColour = FLinearColor::White;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Appearance")
|
||||
FSlateBrush TextStrikeBrush;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Appearance")
|
||||
FVector2D TextShadowOffset;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Appearance")
|
||||
FLinearColor TextShadowColor;
|
||||
|
||||
// -- Properties automatically bound to Blueprint widget
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (BindWidget))
|
||||
UWidget* MouseVersion;
|
||||
@ -80,8 +55,6 @@ public:
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FOnSelectedOptionChanged OnSelectedOptionChanged;
|
||||
|
||||
virtual void SynchronizeProperties() override;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
/// Remove all options
|
||||
virtual void ClearOptions();
|
||||
@ -117,6 +90,7 @@ public:
|
||||
|
||||
virtual void SetFocusProperly_Implementation() override;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Content)
|
||||
@ -124,10 +98,6 @@ protected:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Content)
|
||||
int SelectedIndex;
|
||||
|
||||
virtual void SyncButtonProperties(UButton* Button) const;
|
||||
virtual void SyncButtonImageProperties(UImage* Img) const;
|
||||
virtual void SyncTextProperties(UTextBlock* Txt) const;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
virtual void SetMouseMode();
|
||||
UFUNCTION(BlueprintCallable)
|
||||
|
Loading…
x
Reference in New Issue
Block a user