You've already forked LuckyWorld
Rename entire project to LuckyWorldV2, including uproject file, folders and so on
This commit is contained in:
51
Source/LuckyWorldV2/Private/UI/GameUserWidget.cpp
Normal file
51
Source/LuckyWorldV2/Private/UI/GameUserWidget.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "UI/GameUserWidget.h"
|
||||
#include "Core/LuckyRobotsGameInstance.h"
|
||||
|
||||
void UGameUserWidget::NativeConstruct()
|
||||
{
|
||||
Super::NativeConstruct();
|
||||
|
||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (GameInstance)
|
||||
{
|
||||
GameInstance->GameUserWidget = this;
|
||||
}
|
||||
}
|
||||
|
||||
void UGameUserWidget::DoWaitSecond()
|
||||
{
|
||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (GameInstance)
|
||||
{
|
||||
if (GameInstance->bIsFirstOpenGame)
|
||||
{
|
||||
DownCount = 3;
|
||||
GetWorld()->GetTimerManager().ClearTimer(UpdateDownCountTimerHandle);
|
||||
GetWorld()->GetTimerManager().SetTimer(UpdateDownCountTimerHandle, this, &UGameUserWidget::UpdateDownCount, 1.0f, true);
|
||||
|
||||
UpdateDownCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UGameUserWidget::UpdateDownCount()
|
||||
{
|
||||
if (DownCount > 0)
|
||||
{
|
||||
DownCountStr = FString::FromInt(DownCount);
|
||||
DownCount--;
|
||||
}
|
||||
else
|
||||
{
|
||||
DownCountStr = "";
|
||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (GameInstance)
|
||||
{
|
||||
GameInstance->DoQualitySettings(0, true);
|
||||
}
|
||||
GetWorld()->GetTimerManager().ClearTimer(UpdateDownCountTimerHandle);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "UI/Settings/CaptureSettingsUserWidget.h"
|
||||
#include "Core/LuckyRobotsGameInstance.h"
|
||||
#include "UI/GameUserWidget.h"
|
||||
|
||||
void UCaptureSettingsUserWidget::NativeConstruct()
|
||||
{
|
||||
Super::NativeConstruct();
|
||||
|
||||
BPRefreshTaskList();
|
||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (GameInstance)
|
||||
{
|
||||
GameInstance->OnRandomMeshesUpdated.AddDynamic(this, &UCaptureSettingsUserWidget::BPOnRandomMeshesUpdated);
|
||||
}
|
||||
}
|
||||
|
||||
void UCaptureSettingsUserWidget::ToggleMenu()
|
||||
{
|
||||
bIsOpen = !bIsOpen;
|
||||
|
||||
if (bIsOpen)
|
||||
{
|
||||
BPLoadSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (GameInstance && GameInstance->GameUserWidget)
|
||||
{
|
||||
GameInstance->GameUserWidget->DoAutoConfirm();
|
||||
}
|
||||
}
|
||||
|
||||
OnOpenMenuStateChanged.Broadcast(bIsOpen);
|
||||
|
||||
ToggleMenuDisplay();
|
||||
}
|
Reference in New Issue
Block a user