开始接入厨房

This commit is contained in:
2025-07-13 15:47:08 +08:00
parent d2e517b341
commit 608486444e
25 changed files with 92 additions and 17 deletions

View File

@ -35,3 +35,28 @@ UPW_UserWidget* APW_UIHud::PushWidget(const FName& WidgetName) {
}
}
bool APW_UIHud::PopWidget(const FName& WidgetName){
if (UILayer == nullptr) {
return false;
}
return UILayer->PopWidget(WidgetName);
}
UPW_UserWidget* APW_UIHud::ShowWidget(const FName& WidgetName){
UPW_UserWidget* Widget;
if (!UILayer) {
return nullptr;
}
if ((Widget = UILayer->ShowWidget(WidgetName))) {
return Widget;
}
return PushWidget(WidgetName);
}
bool APW_UIHud::HideWidget(const FName& WidgetName){
if (UILayer == nullptr) {
return false;
}
return UILayer->PopWidget(WidgetName);
}

View File

@ -8,13 +8,17 @@
bool UPW_UILayer::ShowWidget(const FName& WidgetName){
UPW_UserWidget* Widget = *WidgetPool.Find(WidgetName);
UPW_UserWidget* UPW_UILayer::ShowWidget(const FName& WidgetName){
UPW_UserWidget **result = WidgetPool.Find(WidgetName);
if (result == nullptr) {
return nullptr;
}
UPW_UserWidget* Widget = *result;
if (Widget == nullptr) {
return false;
return nullptr;
}
Widget->SetVisible(true);
return true;
return Widget;
}
bool UPW_UILayer::HideWidget(const FName& WidgetName){
@ -49,5 +53,5 @@ bool UPW_UILayer::PushWidget(const FName& WidgetName, UPW_UserWidget* WidgetInst
}
bool UPW_UILayer::PopWidget(const FName& WidgetName){
return true;
return HideWidget(WidgetName);
}

View File

@ -1,3 +1,4 @@
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/HUD.h"
#include "LuaOverriderInterface.h"
@ -18,15 +19,23 @@ public:
UFUNCTION(BlueprintCallable)
UPW_UserWidget* PushWidget(const FName& WidgetName);
UFUNCTION(BlueprintCallable)
bool PopWidget(const FName& WidgetName);
UFUNCTION(BlueprintCallable)
UPW_UserWidget* ShowWidget(const FName& WidgetName);
UFUNCTION(BlueprintCallable)
bool HideWidget(const FName& WidgetName);
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
FString LuaFilePath;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category="UI配置")
TSubclassOf<UPW_UILayer> LayerClass;
UPROPERTY(EditAnywhere, Category = "UI Class Mapping")
UPROPERTY(EditAnywhere, Category = "UI配置")
TMap<FName, TSubclassOf<UPW_UserWidget>> UIClassMapping;
protected:

View File

@ -17,16 +17,12 @@ class BUSYRABBIT_API UPW_UILayer : public UPW_UserWidget
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable)
bool ShowWidget(const FName& WidgetName);
UPW_UserWidget* ShowWidget(const FName& WidgetName);
UFUNCTION(BlueprintCallable)
bool HideWidget(const FName& WidgetName);
UFUNCTION(BlueprintCallable)
bool PushWidget(const FName& WidgetName, UPW_UserWidget* WidgetInst);
UFUNCTION(BlueprintCallable)
bool PopWidget(const FName& WidgetName);