Optimize some UI
This commit is contained in:
parent
eb650a2afd
commit
532aab0664
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/GameBP/UI/Settings/WB_ObjectsListCheckbox.uasset
Normal file
BIN
Content/GameBP/UI/Settings/WB_ObjectsListCheckbox.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,3 +2,40 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "UI/Settings/TaskListViewUserWidget.h"
|
#include "UI/Settings/TaskListViewUserWidget.h"
|
||||||
|
#include "Components/VerticalBox.h"
|
||||||
|
#include "Components/WidgetSwitcher.h"
|
||||||
|
#include "Core/LuckyRobotsGameInstance.h"
|
||||||
|
#include "UI/Settings/ObjectsListUserWidget.h"
|
||||||
|
|
||||||
|
void UTaskListViewUserWidget::DoUpdateObject(TArray<TSoftObjectPtr<UStaticMesh>> StaticMeshList)
|
||||||
|
{
|
||||||
|
if (GetObjectListView())
|
||||||
|
{
|
||||||
|
GetObjectListView()->ClearChildren();
|
||||||
|
|
||||||
|
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||||
|
if (GameInstance)
|
||||||
|
{
|
||||||
|
TArray<FSelectableItemData> SelectableItemList = GameInstance->GetSelectableItemList(EItemCategory::Furniture);
|
||||||
|
for (auto TempStaticMesh : StaticMeshList)
|
||||||
|
{
|
||||||
|
for (auto SelectableItem : SelectableItemList)
|
||||||
|
{
|
||||||
|
if (SelectableItem.Mesh == TempStaticMesh)
|
||||||
|
{
|
||||||
|
UObjectsListUserWidget* ObjectsListUserWidget = CreateWidget<UObjectsListUserWidget>(this, ObjectsListUserWidgetClass);
|
||||||
|
if (ObjectsListUserWidget)
|
||||||
|
{
|
||||||
|
ObjectsListUserWidget->SelectableItemData = SelectableItem;
|
||||||
|
GetObjectListView()->AddChild(ObjectsListUserWidget);
|
||||||
|
ObjectsListUserWidget->SetPadding(FMargin(0.0f, 5.0f, 0.0f, 0.0f));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GetWidgetSwitcher()->SetActiveWidgetIndex(1);
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,13 @@
|
|||||||
#include "Blueprint/UserWidget.h"
|
#include "Blueprint/UserWidget.h"
|
||||||
#include "TaskListViewUserWidget.generated.h"
|
#include "TaskListViewUserWidget.generated.h"
|
||||||
|
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnAddButtonClick);
|
||||||
|
|
||||||
class UListView;
|
class UListView;
|
||||||
|
class UVerticalBox;
|
||||||
|
class UWidgetSwitcher;
|
||||||
|
class UObjectsListUserWidget;
|
||||||
|
class UStaticMesh;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -15,7 +21,46 @@ class LUCKYWORLDV2_API UTaskListViewUserWidget : public UUserWidget
|
|||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
||||||
|
FString TaskListLabel;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
||||||
|
bool bIsEnableSetting;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
||||||
|
FString SettingFieldLabel;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
||||||
|
UTexture2D* SettingIcon;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
||||||
|
FString SettingString;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
||||||
|
bool bIsEnableAddButton;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
||||||
|
FString AddButtonLabel;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
||||||
|
TSubclassOf<UObjectsListUserWidget> ObjectsListUserWidgetClass;
|
||||||
|
|
||||||
|
public:
|
||||||
|
UPROPERTY(BlueprintCallable, BlueprintAssignable)
|
||||||
|
FOnAddButtonClick OnAddButtonClick;
|
||||||
|
|
||||||
|
public:
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void DoUpdateObject(TArray<TSoftObjectPtr<UStaticMesh>> StaticMeshList);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UFUNCTION(BlueprintPure, BlueprintImplementableEvent)
|
UFUNCTION(BlueprintPure, BlueprintImplementableEvent)
|
||||||
UListView* GetTaskListView();
|
UListView* GetTaskListView();
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, BlueprintImplementableEvent)
|
||||||
|
UVerticalBox* GetObjectListView();
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure, BlueprintImplementableEvent)
|
||||||
|
UWidgetSwitcher* GetWidgetSwitcher();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user