60 lines
1.8 KiB
C++
60 lines
1.8 KiB
C++
// © 2025 Naked People Team. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "PhoneAppWidget.h"
|
|
#include "PhoneHomeScreenWidget.generated.h"
|
|
|
|
class UPanelWidget;
|
|
class UPhoneAppIconWidget;
|
|
class UTexture2D;
|
|
|
|
// One launchable app on the home screen. Designers fill the home screen's AppEntries array in the BP,
|
|
// keeping the app roster data-driven (GDD §17.4) rather than hardcoded.
|
|
USTRUCT(BlueprintType)
|
|
struct FPhoneAppEntry
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
UPROPERTY(EditDefaultsOnly, Category = "Phone App")
|
|
FText AppName;
|
|
|
|
UPROPERTY(EditDefaultsOnly, Category = "Phone App")
|
|
TObjectPtr<UTexture2D> AppIcon;
|
|
|
|
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
|
|
// asks the owning phone shell to launch the chosen app via OnAppSelected.
|
|
UCLASS(Abstract)
|
|
class NAKEDDESIRE_API UPhoneHomeScreenWidget : public UPhoneAppWidget
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
DECLARE_DELEGATE_OneParam(FOnAppSelected, TSubclassOf<UPhoneAppWidget>);
|
|
FOnAppSelected OnAppSelected;
|
|
|
|
protected:
|
|
virtual void NativeConstruct() override;
|
|
|
|
private:
|
|
// Container the app icons are spawned into. Use a flow container (WrapBox / Horizontal / VerticalBox)
|
|
// authored in the BP — plain AddChild on a UniformGridPanel stacks every child in cell (0,0).
|
|
UPROPERTY(meta = (BindWidget))
|
|
TObjectPtr<UPanelWidget> AppContainer;
|
|
|
|
UPROPERTY(EditDefaultsOnly, Category = "Phone")
|
|
TSubclassOf<UPhoneAppIconWidget> AppIconWidgetClass;
|
|
|
|
UPROPERTY(EditDefaultsOnly, Category = "Phone")
|
|
TArray<FPhoneAppEntry> AppEntries;
|
|
|
|
void HandleAppIconClicked(TSubclassOf<UPhoneAppWidget> AppClass);
|
|
}; |