You've already forked LuckyWorld
optimization some umg
This commit is contained in:
@ -4,6 +4,10 @@
|
||||
#include "UI/Settings/CaptureSettingsUserWidget.h"
|
||||
#include "Core/LuckyRobotsGameInstance.h"
|
||||
#include "UI/GameUserWidget.h"
|
||||
#include "UI/Settings/AllRandomUserWidget.h"
|
||||
#include "UI/Settings/TaskListViewUserWidget.h"
|
||||
#include "Components/ListView.h"
|
||||
#include "Object/ListviewObject.h"
|
||||
|
||||
void UCaptureSettingsUserWidget::NativeConstruct()
|
||||
{
|
||||
@ -19,6 +23,16 @@ void UCaptureSettingsUserWidget::NativeConstruct()
|
||||
}
|
||||
}
|
||||
|
||||
void UCaptureSettingsUserWidget::OnAnimationFinished(const UWidgetAnimation* Animation)
|
||||
{
|
||||
Super::OnAnimationFinished(Animation);
|
||||
|
||||
if (CheckIsStopAnim(Animation))
|
||||
{
|
||||
OnOpenMenuStateChanged.Broadcast(bIsOpen);
|
||||
}
|
||||
}
|
||||
|
||||
void UCaptureSettingsUserWidget::ToggleMenu()
|
||||
{
|
||||
bIsOpen = !bIsOpen;
|
||||
@ -39,4 +53,71 @@ void UCaptureSettingsUserWidget::ToggleMenu()
|
||||
OnOpenMenuStateChanged.Broadcast(bIsOpen);
|
||||
|
||||
ToggleMenuDisplay();
|
||||
}
|
||||
|
||||
void UCaptureSettingsUserWidget::DoStopCapture()
|
||||
{
|
||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (GameInstance)
|
||||
{
|
||||
GameInstance->bIsMouseOpen = false;
|
||||
}
|
||||
|
||||
OnStopCapture.Broadcast();
|
||||
}
|
||||
|
||||
void UCaptureSettingsUserWidget::ToggleRandomPannel()
|
||||
{
|
||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (GameInstance)
|
||||
{
|
||||
GameInstance->bIsRandomPannel = !GameInstance->bIsRandomPannel;
|
||||
if (GameInstance->bIsRandomPannel)
|
||||
{
|
||||
if (GameInstance->GameUserWidget && GameInstance->GameUserWidget->GetAllRandomUserWidget())
|
||||
{
|
||||
GameInstance->GameUserWidget->GetAllRandomUserWidget()->DoOpen();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UCaptureSettingsUserWidget::BPRefreshTaskList()
|
||||
{
|
||||
UTaskListViewUserWidget* TaskListViewUserWidget = GetTaskListViewUserWidget();
|
||||
UListView* TaskListView = nullptr;
|
||||
if (TaskListViewUserWidget)
|
||||
{
|
||||
TaskListView = TaskListViewUserWidget->GetTaskListView();
|
||||
}
|
||||
|
||||
if (TaskListViewUserWidget && TaskListView)
|
||||
{
|
||||
TaskListView->ClearListItems();
|
||||
}
|
||||
|
||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (GameInstance)
|
||||
{
|
||||
TArray<FGoalsTaskData> TaskList = GameInstance->GetTaskList();
|
||||
int index = 0;
|
||||
for (auto task : TaskList)
|
||||
{
|
||||
UListviewObject* ListviewObject = NewObject<UListviewObject>();
|
||||
if (ListviewObject)
|
||||
{
|
||||
ListviewObject->GoalsTaskData = task;
|
||||
++index;
|
||||
ListviewObject->Index = index;
|
||||
if (TaskListViewUserWidget && TaskListView)
|
||||
{
|
||||
TaskListView->AddItem(ListviewObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GameInstance->UpdateTargetSelector();
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user