Setup phone UI
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// © 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.AppClass);
|
||||
Icon->OnClicked.BindUObject(this, &UPhoneHomeScreenWidget::HandleAppIconClicked);
|
||||
AppContainer->AddChild(Icon);
|
||||
}
|
||||
}
|
||||
|
||||
void UPhoneHomeScreenWidget::HandleAppIconClicked(TSubclassOf<UPhoneAppWidget> AppClass)
|
||||
{
|
||||
OnAppSelected.ExecuteIfBound(AppClass);
|
||||
}
|
||||
Reference in New Issue
Block a user