martin #24

Merged
martinluckyrobots merged 4 commits from martin into main 2025-04-16 04:25:15 +00:00
13 changed files with 123 additions and 23 deletions
Showing only changes of commit 78f94c5985 - Show all commits

View File

@ -0,0 +1,5 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "Subsystem/UISubsystem.h"

View File

@ -7,6 +7,7 @@
#include "UI/Settings/SelectGoalUserWidget.h"
#include "Kismet/GameplayStatics.h"
#include "Gameplay/NaviSplineCreator.h"
#include "Subsystem/UISubsystem.h"
void UGameUserWidget::NativeConstruct()
{
@ -17,6 +18,13 @@ void UGameUserWidget::NativeConstruct()
{
GameInstance->GameUserWidget = this;
}
auto UISubsystem = GetGameInstance()->GetSubsystem<UUISubsystem>();
if (UISubsystem)
{
UISubsystem->OnStartTracing.AddDynamic(this, &UGameUserWidget::OnStartTracing);
UISubsystem->OnEndTracing.AddDynamic(this, &UGameUserWidget::OnEndTracing);
}
}
void UGameUserWidget::DoWaitSecond()
@ -54,6 +62,23 @@ void UGameUserWidget::UpdateDownCount()
}
}
void UGameUserWidget::OnStartTracing()
{
bIsTracing = true;
}
void UGameUserWidget::OnEndTracing()
{
bIsTracing = false;
BPPlayShowTipAnimation();
if (GetCaptureSettingsUserWidget())
{
GetCaptureSettingsUserWidget()->BPSaveSettings();
}
}
void UGameUserWidget::ToggleHide()
{
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
@ -103,7 +128,11 @@ void UGameUserWidget::DoReset()
}
}
OnReset.Broadcast();
auto UISubsystem = GetGameInstance()->GetSubsystem<UUISubsystem>();
if (UISubsystem)
{
UISubsystem->OnReset.Broadcast();
}
}
void UGameUserWidget::DoExit()

View File

@ -8,6 +8,7 @@
#include "UI/Settings/TaskListViewUserWidget.h"
#include "Components/ListView.h"
#include "Object/ListviewObject.h"
#include "Subsystem/UISubsystem.h"
void UCaptureSettingsUserWidget::NativeConstruct()
{
@ -29,7 +30,11 @@ void UCaptureSettingsUserWidget::OnAnimationFinished(const UWidgetAnimation* Ani
if (CheckIsStopAnim(Animation))
{
OnOpenMenuStateChanged.Broadcast(bIsOpen);
auto UISubsystem = GetGameInstance()->GetSubsystem<UUISubsystem>();
if (UISubsystem)
{
UISubsystem->OnOpenMenuStateChanged.Broadcast(bIsOpen);
}
}
}
@ -50,7 +55,11 @@ void UCaptureSettingsUserWidget::ToggleMenu()
}
}
OnOpenMenuStateChanged.Broadcast(bIsOpen);
auto UISubsystem = GetGameInstance()->GetSubsystem<UUISubsystem>();
if (UISubsystem)
{
UISubsystem->OnOpenMenuStateChanged.Broadcast(bIsOpen);
}
ToggleMenuDisplay();
}
@ -63,7 +72,11 @@ void UCaptureSettingsUserWidget::DoStopCapture()
GameInstance->bIsMouseOpen = false;
}
OnStopCapture.Broadcast();
auto UISubsystem = GetGameInstance()->GetSubsystem<UUISubsystem>();
if (UISubsystem)
{
UISubsystem->OnStopCapture.Broadcast();
}
}
void UCaptureSettingsUserWidget::ToggleRandomPannel()

View File

@ -0,0 +1,5 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "UI/Settings/PathfindingSelectorUserWidget.h"

View File

@ -0,0 +1,43 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Subsystems/GameInstanceSubsystem.h"
#include "UISubsystem.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnStartTracing);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnEndTracing);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnStartCapture);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnStopCapture);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnReset);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnOpenMenuStateChanged, bool, Open);
/**
*
*/
UCLASS()
class LUCKYWORLDV2_API UUISubsystem : public UGameInstanceSubsystem
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintCallable, BlueprintAssignable)
FOnStartTracing OnStartTracing;
UPROPERTY(BlueprintCallable, BlueprintAssignable)
FOnEndTracing OnEndTracing;
UPROPERTY(BlueprintCallable, BlueprintAssignable)
FOnStartCapture OnStartCapture;
UPROPERTY(BlueprintCallable, BlueprintAssignable)
FOnStopCapture OnStopCapture;
UPROPERTY(BlueprintCallable, BlueprintAssignable)
FOnReset OnReset;
UPROPERTY(BlueprintCallable, BlueprintAssignable)
FOnOpenMenuStateChanged OnOpenMenuStateChanged;
};

View File

@ -7,8 +7,6 @@
#include "SharedDef.h"
#include "GameUserWidget.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnReset);
class UCaptureSettingsUserWidget;
class USelectGoalUserWidget;
class UAllRandomUserWidget;
@ -42,10 +40,6 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString DownCountStr;
public:
UPROPERTY(BlueprintCallable, BlueprintAssignable, Category = "Event")
FOnReset OnReset;
public:
UFUNCTION(BlueprintCallable)
void DoWaitSecond();
@ -75,6 +69,10 @@ public:
void ToggleShowPath();
void UpdateDownCount();
void OnStartTracing();
void OnEndTracing();
public:
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
void DoLogItemAdd(const FString& Topic, const FString& MsgText, ELogItemType LogItemType);
@ -87,4 +85,7 @@ public:
UFUNCTION(BlueprintPure, BlueprintImplementableEvent)
UAllRandomUserWidget* GetAllRandomUserWidget();
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
void BPPlayShowTipAnimation();
};

View File

@ -7,10 +7,6 @@
#include "SharedDef.h"
#include "CaptureSettingsUserWidget.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnOpenMenuStateChanged, bool, Open);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnStartCapture);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnStopCapture);
class UTaskListViewUserWidget;
/**
*
@ -27,15 +23,6 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bIsOpen;
UPROPERTY(BlueprintCallable, BlueprintAssignable, Category = "Event")
FOnOpenMenuStateChanged OnOpenMenuStateChanged;
UPROPERTY(BlueprintCallable, BlueprintAssignable, Category = "Event")
FOnStartCapture OnStartCapture;
UPROPERTY(BlueprintCallable, BlueprintAssignable, Category = "Event")
FOnStopCapture OnStopCapture;
public:
UFUNCTION(BlueprintCallable)
void ToggleMenu();

View File

@ -0,0 +1,17 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "PathfindingSelectorUserWidget.generated.h"
/**
*
*/
UCLASS()
class LUCKYWORLDV2_API UPathfindingSelectorUserWidget : public UUserWidget
{
GENERATED_BODY()
};