36 lines
855 B
C++
36 lines
855 B
C++
// © 2025 Naked People Team. All Rights Reserved.
|
|
|
|
#include "PhoneHomeScreenWidget.h"
|
|
|
|
#include "PhoneAppIconWidget.h"
|
|
#include "Components/PanelWidget.h"
|
|
|
|
void UPhoneHomeScreenWidget::NativeConstruct()
|
|
{
|
|
Super::NativeConstruct();
|
|
|
|
if (!AppContainer || !AppIconWidgetClass)
|
|
{
|
|
return;
|
|
}
|
|
|
|
AppContainer->ClearChildren();
|
|
|
|
for (const FPhoneAppEntry& Entry : AppEntries)
|
|
{
|
|
if (!Entry.AppClass)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
UPhoneAppIconWidget* Icon = CreateWidget<UPhoneAppIconWidget>(this, AppIconWidgetClass);
|
|
Icon->Init(Entry.AppName, Entry.AppIcon, Entry.BackgroundMaterial, Entry.AppClass);
|
|
Icon->OnClicked.BindUObject(this, &UPhoneHomeScreenWidget::HandleAppIconClicked);
|
|
AppContainer->AddChild(Icon);
|
|
}
|
|
}
|
|
|
|
void UPhoneHomeScreenWidget::HandleAppIconClicked(TSubclassOf<UPhoneAppWidget> AppClass)
|
|
{
|
|
OnAppSelected.ExecuteIfBound(AppClass);
|
|
} |