Setup phone UI

This commit is contained in:
koritsa
2026-06-02 00:06:13 +03:00
parent d840f59bda
commit dad848cfbc
20 changed files with 350 additions and 5 deletions
@@ -0,0 +1,57 @@
// © 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;
};
// 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);
};