You've already forked LuckyWorld
optimization some umg
This commit is contained in:
@ -3,6 +3,10 @@
|
||||
|
||||
#include "UI/GameUserWidget.h"
|
||||
#include "Core/LuckyRobotsGameInstance.h"
|
||||
#include "UI/Settings/CaptureSettingsUserWidget.h"
|
||||
#include "UI/Settings/SelectGoalUserWidget.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "Gameplay/NaviSplineCreator.h"
|
||||
|
||||
void UGameUserWidget::NativeConstruct()
|
||||
{
|
||||
@ -48,4 +52,105 @@ void UGameUserWidget::UpdateDownCount()
|
||||
}
|
||||
GetWorld()->GetTimerManager().ClearTimer(UpdateDownCountTimerHandle);
|
||||
}
|
||||
}
|
||||
|
||||
void UGameUserWidget::ToggleHide()
|
||||
{
|
||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (GameInstance)
|
||||
{
|
||||
GameInstance->bIsDebug = !GameInstance->bIsDebug;
|
||||
}
|
||||
}
|
||||
|
||||
void UGameUserWidget::ToggleTestMode()
|
||||
{
|
||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (GameInstance)
|
||||
{
|
||||
GameInstance->bIsWidgetTestMode = !GameInstance->bIsWidgetTestMode;
|
||||
}
|
||||
}
|
||||
|
||||
void UGameUserWidget::DoCapture()
|
||||
{
|
||||
if (GetCaptureSettingsUserWidget())
|
||||
{
|
||||
GetCaptureSettingsUserWidget()->ToggleMenu();
|
||||
}
|
||||
}
|
||||
|
||||
void UGameUserWidget::DoAutoConfirm()
|
||||
{
|
||||
USelectGoalUserWidget* SelectGoalUserWidget = GetSelectGoalUserWidget();
|
||||
if (SelectGoalUserWidget)
|
||||
{
|
||||
SelectGoalUserWidget->DoAutoConfirm();
|
||||
}
|
||||
}
|
||||
|
||||
void UGameUserWidget::DoReset()
|
||||
{
|
||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (GameInstance)
|
||||
{
|
||||
if (GameInstance->bIsCapture)
|
||||
{
|
||||
if (GetCaptureSettingsUserWidget())
|
||||
{
|
||||
GetCaptureSettingsUserWidget()->BPChangeCaptureState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OnReset.Broadcast();
|
||||
}
|
||||
|
||||
void UGameUserWidget::DoExit()
|
||||
{
|
||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (GameInstance)
|
||||
{
|
||||
if (GameInstance->bIsCapture)
|
||||
{
|
||||
if (GetCaptureSettingsUserWidget())
|
||||
{
|
||||
GetCaptureSettingsUserWidget()->BPChangeCaptureState();
|
||||
}
|
||||
}
|
||||
|
||||
if (GameInstance->LobbyLevelObject)
|
||||
{
|
||||
UGameplayStatics::OpenLevelBySoftObjectPtr(this, GameInstance->LobbyLevelObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UGameUserWidget::SwitchGamePaused()
|
||||
{
|
||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (GameInstance)
|
||||
{
|
||||
GameInstance->SwitchGamePaused();
|
||||
}
|
||||
}
|
||||
|
||||
void UGameUserWidget::ToggleShowPath()
|
||||
{
|
||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (GameInstance)
|
||||
{
|
||||
GameInstance->bIsShowPath = !GameInstance->bIsShowPath;
|
||||
}
|
||||
|
||||
TArray<AActor*> AllNaviSplineCreator;
|
||||
UGameplayStatics::GetAllActorsOfClass(this, ANaviSplineCreator::StaticClass(), AllNaviSplineCreator);
|
||||
for (auto NaviSplineCreatorActor : AllNaviSplineCreator)
|
||||
{
|
||||
ANaviSplineCreator* NaviSplineCreator = Cast<ANaviSplineCreator>(NaviSplineCreatorActor);
|
||||
if (NaviSplineCreator)
|
||||
{
|
||||
NaviSplineCreator->UpdateSplineVisibility();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user