Added phone app icon materials
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -6,20 +6,16 @@
|
||||
#include "Components/Image.h"
|
||||
#include "CommonTextBlock.h"
|
||||
|
||||
void UPhoneAppIconWidget::Init(const FText& InName, UTexture2D* InIcon, TSubclassOf<UPhoneAppWidget> InAppClass)
|
||||
void UPhoneAppIconWidget::Init(const FText& InName, UTexture2D* InIcon, UMaterialInterface* InBgMaterial, TSubclassOf<UPhoneAppWidget> InAppClass)
|
||||
{
|
||||
AppClass = InAppClass;
|
||||
|
||||
if (NameText)
|
||||
{
|
||||
NameText->SetText(InName);
|
||||
}
|
||||
NameText->SetText(InName);
|
||||
|
||||
if (IconImage)
|
||||
{
|
||||
IconImage->SetBrushFromTexture(InIcon);
|
||||
IconImage->SetVisibility(InIcon ? ESlateVisibility::HitTestInvisible : ESlateVisibility::Collapsed);
|
||||
}
|
||||
IconImage->SetBrushFromTexture(InIcon);
|
||||
IconImage->SetVisibility(InIcon ? ESlateVisibility::HitTestInvisible : ESlateVisibility::Collapsed);
|
||||
|
||||
BackgroundImage->SetBrushFromMaterial(InBgMaterial);
|
||||
|
||||
IconButton->OnClicked.AddUniqueDynamic(this, &UPhoneAppIconWidget::HandleClicked);
|
||||
}
|
||||
|
||||
@@ -20,19 +20,22 @@ class NAKEDDESIRE_API UPhoneAppIconWidget : public UCommonUserWidget
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
void Init(const FText& InName, UTexture2D* InIcon, TSubclassOf<UPhoneAppWidget> InAppClass);
|
||||
void Init(const FText& InName, UTexture2D* InIcon, UMaterialInterface* InBgMaterial, TSubclassOf<UPhoneAppWidget> InAppClass);
|
||||
|
||||
DECLARE_DELEGATE_OneParam(FOnAppIconClicked, TSubclassOf<UPhoneAppWidget>);
|
||||
FOnAppIconClicked OnClicked;
|
||||
|
||||
private:
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UImage> BackgroundImage;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UButton> IconButton;
|
||||
|
||||
UPROPERTY(meta = (BindWidgetOptional))
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UImage> IconImage;
|
||||
|
||||
UPROPERTY(meta = (BindWidgetOptional))
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UCommonTextBlock> NameText;
|
||||
|
||||
UPROPERTY()
|
||||
|
||||
@@ -24,7 +24,7 @@ void UPhoneHomeScreenWidget::NativeConstruct()
|
||||
}
|
||||
|
||||
UPhoneAppIconWidget* Icon = CreateWidget<UPhoneAppIconWidget>(this, AppIconWidgetClass);
|
||||
Icon->Init(Entry.AppName, Entry.AppIcon, Entry.AppClass);
|
||||
Icon->Init(Entry.AppName, Entry.AppIcon, Entry.BackgroundMaterial, Entry.AppClass);
|
||||
Icon->OnClicked.BindUObject(this, &UPhoneHomeScreenWidget::HandleAppIconClicked);
|
||||
AppContainer->AddChild(Icon);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ struct FPhoneAppEntry
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Phone App")
|
||||
TSubclassOf<UPhoneAppWidget> AppClass;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Phone App")
|
||||
TObjectPtr<UMaterialInterface> BackgroundMaterial;
|
||||
};
|
||||
|
||||
// The phone home screen — the base of the app stack. Builds a grid of app icons from AppEntries and
|
||||
|
||||
Reference in New Issue
Block a user