martin #27
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,6 +13,18 @@
|
|||||||
#include "Subsystems/SubsystemBlueprintLibrary.h"
|
#include "Subsystems/SubsystemBlueprintLibrary.h"
|
||||||
#include "Gameplay/TargetSelector.h"
|
#include "Gameplay/TargetSelector.h"
|
||||||
#include "UI/Settings/CaptureSettingsUserWidget.h"
|
#include "UI/Settings/CaptureSettingsUserWidget.h"
|
||||||
|
#include "Subsystem/UISubsystem.h"
|
||||||
|
|
||||||
|
void ULuckyRobotsGameInstance::Init()
|
||||||
|
{
|
||||||
|
Super::Init();
|
||||||
|
|
||||||
|
auto UISubsystem = GetSubsystem<UUISubsystem>();
|
||||||
|
if (UISubsystem)
|
||||||
|
{
|
||||||
|
UISubsystem->OnAllRandomMenuStateChanged.AddDynamic(this, &ULuckyRobotsGameInstance::DoAllRandomMenuStateChanged);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ULuckyRobotsGameInstance::DoSendMessage(const FString& SendValue)
|
void ULuckyRobotsGameInstance::DoSendMessage(const FString& SendValue)
|
||||||
{
|
{
|
||||||
@ -416,6 +428,11 @@ void ULuckyRobotsGameInstance::UpdateTargetSelector()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ULuckyRobotsGameInstance::DoAllRandomMenuStateChanged(bool open)
|
||||||
|
{
|
||||||
|
bIsRandomPannel = open;
|
||||||
|
}
|
||||||
|
|
||||||
void ULuckyRobotsGameInstance::SetCurrentFolderName(const FString& FolderName)
|
void ULuckyRobotsGameInstance::SetCurrentFolderName(const FString& FolderName)
|
||||||
{
|
{
|
||||||
CurrentCaptureSettingsData.FolderName = FText::FromString(FolderName);
|
CurrentCaptureSettingsData.FolderName = FText::FromString(FolderName);
|
||||||
|
@ -2,4 +2,63 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "UI/Settings/AllRandomUserWidget.h"
|
#include "UI/Settings/AllRandomUserWidget.h"
|
||||||
|
#include "Subsystem/UISubsystem.h"
|
||||||
|
#include "Components/WrapBox.h"
|
||||||
|
#include "Core/LuckyRobotsGameInstance.h"
|
||||||
|
#include "UI/Settings/ObjectsListUserWidget.h"
|
||||||
|
|
||||||
|
void UAllRandomUserWidget::NativeConstruct()
|
||||||
|
{
|
||||||
|
Super::NativeConstruct();
|
||||||
|
|
||||||
|
SetVisibility(ESlateVisibility::Hidden);
|
||||||
|
|
||||||
|
auto UISubsystem = GetGameInstance()->GetSubsystem<UUISubsystem>();
|
||||||
|
if (UISubsystem)
|
||||||
|
{
|
||||||
|
UISubsystem->OnAllRandomMenuStateChanged.AddDynamic(this, &UAllRandomUserWidget::DoAllRandomMenuStateChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
DoUpdateItemList(EItemCategory::Furniture);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UAllRandomUserWidget::DoAllRandomMenuStateChanged(bool open)
|
||||||
|
{
|
||||||
|
if (open)
|
||||||
|
{
|
||||||
|
DoOpen();
|
||||||
|
SetVisibility(ESlateVisibility::Visible);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetVisibility(ESlateVisibility::Hidden);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UAllRandomUserWidget::DoUpdateItemList(EItemCategory ItemCategory)
|
||||||
|
{
|
||||||
|
if (GetWrapBox() && ObjectsListUserWidgetClass)
|
||||||
|
{
|
||||||
|
GetWrapBox()->ClearChildren();
|
||||||
|
|
||||||
|
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||||
|
if (GameInstance)
|
||||||
|
{
|
||||||
|
TArray<FSelectableItemData> SelectableItemList = GameInstance->GetSelectableItemList(ItemCategory);
|
||||||
|
for (auto SelectableItem : SelectableItemList)
|
||||||
|
{
|
||||||
|
UObjectsListUserWidget* ObjectsListUserWidget = CreateWidget<UObjectsListUserWidget>(this, ObjectsListUserWidgetClass);
|
||||||
|
if (ObjectsListUserWidget)
|
||||||
|
{
|
||||||
|
ObjectsListUserWidget->SelectableItemData = SelectableItem;
|
||||||
|
GetWrapBox()->AddChild(ObjectsListUserWidget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UAllRandomUserWidget::DoOpen()
|
||||||
|
{
|
||||||
|
DoUpdateItemList(EItemCategory::Furniture);
|
||||||
|
}
|
@ -84,13 +84,10 @@ void UCaptureSettingsUserWidget::ToggleRandomPannel()
|
|||||||
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||||
if (GameInstance)
|
if (GameInstance)
|
||||||
{
|
{
|
||||||
GameInstance->bIsRandomPannel = !GameInstance->bIsRandomPannel;
|
auto UISubsystem = GetGameInstance()->GetSubsystem<UUISubsystem>();
|
||||||
if (GameInstance->bIsRandomPannel)
|
if (UISubsystem)
|
||||||
{
|
{
|
||||||
if (GameInstance->GameUserWidget && GameInstance->GameUserWidget->GetAllRandomUserWidget())
|
UISubsystem->OnAllRandomMenuStateChanged.Broadcast(!GameInstance->bIsRandomPannel);
|
||||||
{
|
|
||||||
GameInstance->GameUserWidget->GetAllRandomUserWidget()->DoOpen();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "UI/Settings/ObjectsListUserWidget.h"
|
||||||
|
|
@ -2,4 +2,63 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "UI/Settings/PathfindingSelectorUserWidget.h"
|
#include "UI/Settings/PathfindingSelectorUserWidget.h"
|
||||||
|
#include "Gameplay/TargetSelector.h"
|
||||||
|
#include "Core/LuckyRobotsGameInstance.h"
|
||||||
|
#include "Subsystem/UISubsystem.h"
|
||||||
|
#include "UI/Settings/SelectGoalUserWidget.h"
|
||||||
|
|
||||||
|
void UPathfindingSelectorUserWidget::ClickSelectObjectBtn()
|
||||||
|
{
|
||||||
|
if (CreatedTargetSelector)
|
||||||
|
{
|
||||||
|
CreatedTargetSelector->Destroy();
|
||||||
|
CreatedTargetSelector = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||||
|
if (GameInstance)
|
||||||
|
{
|
||||||
|
FTransform SpawnPoint;
|
||||||
|
CreatedTargetSelector = GetWorld()->SpawnActorDeferred<ATargetSelector>(GameInstance->TargetSelectorClass, SpawnPoint, nullptr, nullptr,
|
||||||
|
ESpawnActorCollisionHandlingMethod::AlwaysSpawn);
|
||||||
|
if (CreatedTargetSelector)
|
||||||
|
{
|
||||||
|
CreatedTargetSelector->FinishSpawning(SpawnPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto UISubsystem = GetGameInstance()->GetSubsystem<UUISubsystem>();
|
||||||
|
if (UISubsystem)
|
||||||
|
{
|
||||||
|
UISubsystem->OnStartTracing.Broadcast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UPathfindingSelectorUserWidget::AddGoal()
|
||||||
|
{
|
||||||
|
if (CreatedTargetSelector)
|
||||||
|
{
|
||||||
|
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||||
|
if (GameInstance)
|
||||||
|
{
|
||||||
|
FGoalsTaskData addTempTask;
|
||||||
|
addTempTask.GoalType = EGoalType::NavigateSimpleEnvironments;
|
||||||
|
addTempTask.TargetLocation = CreatedTargetSelector->GetActorTransform();
|
||||||
|
GameInstance->TempTask = addTempTask;
|
||||||
|
GameInstance->bIsChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto UISubsystem = GetGameInstance()->GetSubsystem<UUISubsystem>();
|
||||||
|
if (UISubsystem)
|
||||||
|
{
|
||||||
|
UISubsystem->OnEndTracing.Broadcast();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OwnerSelectGoalUserWidget)
|
||||||
|
{
|
||||||
|
OwnerSelectGoalUserWidget->DoAddGoalAndStopTracing();
|
||||||
|
}
|
||||||
|
|
||||||
|
CreatedTargetSelector->bIsTracing = false;
|
||||||
|
}
|
||||||
|
}
|
@ -102,7 +102,10 @@ void USelectGoalUserWidget::DoSelectionChanged(const FString& SelectedItem)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NavigateSimpleEnvironments = Cast<UPathfindingSelectorUserWidget>(CreatedUserWidget);
|
NavigateSimpleEnvironments = Cast<UPathfindingSelectorUserWidget>(CreatedUserWidget);
|
||||||
|
if (NavigateSimpleEnvironments)
|
||||||
|
{
|
||||||
|
NavigateSimpleEnvironments->OwnerSelectGoalUserWidget = this;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,6 +198,6 @@ void USelectGoalUserWidget::DelayAddGoal()
|
|||||||
|
|
||||||
if (NavigateSimpleEnvironments)
|
if (NavigateSimpleEnvironments)
|
||||||
{
|
{
|
||||||
NavigateSimpleEnvironments->BPClickSelectObjectBtn();
|
NavigateSimpleEnvironments->ClickSelectObjectBtn();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -20,6 +20,9 @@ class LUCKYWORLDV2_API ULuckyRobotsGameInstance : public UGameInstance
|
|||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual void Init();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
||||||
UDataTable* RobotDataDataTable;
|
UDataTable* RobotDataDataTable;
|
||||||
@ -210,6 +213,9 @@ public:
|
|||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
void UpdateTargetSelector();
|
void UpdateTargetSelector();
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void DoAllRandomMenuStateChanged(bool open);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
void SetCurrentFolderName(const FString& FolderName);
|
void SetCurrentFolderName(const FString& FolderName);
|
||||||
|
@ -14,6 +14,7 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnStopCapture);
|
|||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnReset);
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnReset);
|
||||||
|
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnOpenMenuStateChanged, bool, Open);
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnOpenMenuStateChanged, bool, Open);
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAllRandomMenuStateChanged, bool, Open);
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -40,4 +41,7 @@ public:
|
|||||||
|
|
||||||
UPROPERTY(BlueprintCallable, BlueprintAssignable)
|
UPROPERTY(BlueprintCallable, BlueprintAssignable)
|
||||||
FOnOpenMenuStateChanged OnOpenMenuStateChanged;
|
FOnOpenMenuStateChanged OnOpenMenuStateChanged;
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintCallable, BlueprintAssignable)
|
||||||
|
FOnAllRandomMenuStateChanged OnAllRandomMenuStateChanged;
|
||||||
};
|
};
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include "Blueprint/UserWidget.h"
|
#include "Blueprint/UserWidget.h"
|
||||||
#include "AllRandomUserWidget.generated.h"
|
#include "AllRandomUserWidget.generated.h"
|
||||||
|
|
||||||
|
class UWrapBox;
|
||||||
|
class UObjectsListUserWidget;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -13,8 +15,25 @@ UCLASS()
|
|||||||
class LUCKYWORLDV2_API UAllRandomUserWidget : public UUserWidget
|
class LUCKYWORLDV2_API UAllRandomUserWidget : public UUserWidget
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void NativeConstruct() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
||||||
|
TSubclassOf<UObjectsListUserWidget> ObjectsListUserWidgetClass;
|
||||||
|
|
||||||
|
public:
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void DoAllRandomMenuStateChanged(bool open);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void DoUpdateItemList(EItemCategory ItemCategory);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
void DoOpen();
|
void DoOpen();
|
||||||
|
|
||||||
|
public:
|
||||||
|
UFUNCTION(BlueprintPure, BlueprintImplementableEvent)
|
||||||
|
UWrapBox* GetWrapBox();
|
||||||
};
|
};
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Blueprint/UserWidget.h"
|
||||||
|
#include "SharedDef.h"
|
||||||
|
#include "ObjectsListUserWidget.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class LUCKYWORLDV2_API UObjectsListUserWidget : public UUserWidget
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
|
FSelectableItemData SelectableItemData;
|
||||||
|
};
|
@ -6,6 +6,8 @@
|
|||||||
#include "Blueprint/UserWidget.h"
|
#include "Blueprint/UserWidget.h"
|
||||||
#include "PathfindingSelectorUserWidget.generated.h"
|
#include "PathfindingSelectorUserWidget.generated.h"
|
||||||
|
|
||||||
|
class ATargetSelector;
|
||||||
|
class USelectGoalUserWidget;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -15,6 +17,16 @@ class LUCKYWORLDV2_API UPathfindingSelectorUserWidget : public UUserWidget
|
|||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
void BPClickSelectObjectBtn();
|
ATargetSelector* CreatedTargetSelector;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
|
USelectGoalUserWidget* OwnerSelectGoalUserWidget;
|
||||||
|
|
||||||
|
public:
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void ClickSelectObjectBtn();
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void AddGoal();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user