补充上一条
...
This commit is contained in:
@ -81,9 +81,13 @@ function CookManager:CheckFinishStatus()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function CookManager:AddCookMaterial(cook_material_id, is_auto_push)
|
function CookManager:AddCookMaterial(cook_material_id, is_auto_push)
|
||||||
|
local BusyGamePlayLibrary = import("BusyGamePlayLibrary")
|
||||||
|
|
||||||
local config = Utils.GetDataTableConfig(
|
local config = Utils.GetDataTableConfig(
|
||||||
"CookMaterialStateConfig", cook_material_id
|
"CookMaterialStateConfig", cook_material_id
|
||||||
)
|
)
|
||||||
|
BusyGamePlayLibrary.SetTest(config)
|
||||||
|
print("?>????", config)
|
||||||
if not config then
|
if not config then
|
||||||
print("ERROR: can't find ", cook_material_id, " in CookMaterialStateConfig")
|
print("ERROR: can't find ", cook_material_id, " in CookMaterialStateConfig")
|
||||||
return
|
return
|
||||||
|
|||||||
@ -82,3 +82,10 @@ bool UBusyGamePlayLibrary::GetItemDescription(const FName& RowName, FBusyItemDes
|
|||||||
bool UBusyGamePlayLibrary::GetCookMaterialStateConfig(const FName& RowName, FBusyCookMaterialStateConfig& RowData){
|
bool UBusyGamePlayLibrary::GetCookMaterialStateConfig(const FName& RowName, FBusyCookMaterialStateConfig& RowData){
|
||||||
return GetTableConfig<FBusyCookMaterialStateConfig>(TEXT("CookMaterialStateConfig"), RowName, RowData);
|
return GetTableConfig<FBusyCookMaterialStateConfig>(TEXT("CookMaterialStateConfig"), RowName, RowData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FLuaBPVar UBusyGamePlayLibrary::TestTable(const FName& RowName){
|
||||||
|
UDataTable* Table = UBusyGamePlayLibrary::GetGameDataTable("CookMaterialStateConfig");
|
||||||
|
auto Config = Table->FindRow<FTableRowBase>(RowName, "", true);
|
||||||
|
|
||||||
|
return FLuaBPVar();
|
||||||
|
}
|
||||||
|
|||||||
@ -7,51 +7,82 @@
|
|||||||
#include "Components/OverlaySlot.h"
|
#include "Components/OverlaySlot.h"
|
||||||
|
|
||||||
|
|
||||||
|
bool UPW_UILayer::PushWidget(UPW_UserWidget* WidgetInst){
|
||||||
|
UOverlay* Overlay;
|
||||||
|
UOverlaySlot* OverlaySlot;
|
||||||
|
|
||||||
UPW_UserWidget* UPW_UILayer::ShowWidget(const FName& WidgetName){
|
Overlay = _GetOverlayByLayerType(WidgetInst->LayoutType);
|
||||||
UPW_UserWidget **result = WidgetPool.Find(WidgetName);
|
if (!Overlay) return false;
|
||||||
if (result == nullptr) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
UPW_UserWidget* Widget = *result;
|
|
||||||
if (Widget == nullptr) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
Widget->SetVisible(true);
|
|
||||||
return Widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UPW_UILayer::HideWidget(const FName& WidgetName){
|
Overlay->AddChild(WidgetInst);
|
||||||
UPW_UserWidget* Widget = *WidgetPool.Find(WidgetName);
|
OverlaySlot = Cast<UOverlaySlot>(WidgetInst->Slot);
|
||||||
if (Widget == nullptr) {
|
if (!OverlaySlot) return false;
|
||||||
return false;
|
|
||||||
|
OverlaySlot->SetVerticalAlignment(EVerticalAlignment::VAlign_Fill);
|
||||||
|
OverlaySlot->SetHorizontalAlignment(EHorizontalAlignment::HAlign_Fill);
|
||||||
|
|
||||||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㼶<EFBFBD>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD>push<73><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD>widget
|
||||||
|
auto AllOverlayChildren = Overlay->GetAllChildren();
|
||||||
|
for (int i = 0; i < AllOverlayChildren.Num() - 1; ++i) {
|
||||||
|
UPW_UserWidget* Child = Cast<UPW_UserWidget>(AllOverlayChildren[i]);
|
||||||
|
if (!Child) continue;
|
||||||
|
Child->FrameWorkSetVisible(false);
|
||||||
}
|
}
|
||||||
Widget->SetVisible(false);
|
|
||||||
|
WidgetInst->FrameWorkSetVisible(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UPW_UILayer::PushWidget(const FName& WidgetName, UPW_UserWidget* WidgetInst){
|
void UPW_UILayer::PopWidget(const UPW_UserWidget* WidgetInst){
|
||||||
UOverlay* Overlay;
|
UOverlay* Overlay;
|
||||||
UOverlaySlot* OverlaySlot;
|
bool bNeedRemove;
|
||||||
switch (WidgetInst->LayoutType) {
|
int32 i, OverlayWidgetCount;
|
||||||
case EWidgetLayoutType::MainLayer: Overlay = MainLayer; break;
|
UPW_UserWidget* Child, * NeedShowWidget;
|
||||||
case EWidgetLayoutType::PopupLayer: Overlay = PopupLayer; break;
|
TArray<UWidget*> AllOverlayChildren;
|
||||||
case EWidgetLayoutType::FloatLayer: Overlay = FloatLayer; break;
|
TArray<UPW_UserWidget*> NeedRemoveWidgets;
|
||||||
case EWidgetLayoutType::TopLayer: Overlay = TopLayer; break;
|
|
||||||
default: return false;
|
bNeedRemove = true;
|
||||||
|
NeedShowWidget = nullptr;
|
||||||
|
|
||||||
|
Overlay = _GetOverlayByLayerType(WidgetInst->LayoutType);
|
||||||
|
if (!Overlay) return;
|
||||||
|
|
||||||
|
AllOverlayChildren = Overlay->GetAllChildren();
|
||||||
|
OverlayWidgetCount = AllOverlayChildren.Num();
|
||||||
|
|
||||||
|
for (i = OverlayWidgetCount - 1; i >= 0; --i) {
|
||||||
|
Child = Cast<UPW_UserWidget>(AllOverlayChildren[i]);
|
||||||
|
if (!Child) continue;
|
||||||
|
if(bNeedRemove){
|
||||||
|
NeedRemoveWidgets.Add(Child);
|
||||||
|
}
|
||||||
|
else if(Child->bVisible) {
|
||||||
|
NeedShowWidget = Child;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (Child == WidgetInst) {
|
||||||
|
bNeedRemove = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Overlay->AddChild(WidgetInst);
|
for (i = 0; i < NeedRemoveWidgets.Num(); ++i) {
|
||||||
if ((OverlaySlot = Cast<UOverlaySlot>(WidgetInst->Slot))) {
|
NeedRemoveWidgets[i]->RemoveFromParent();
|
||||||
OverlaySlot->SetVerticalAlignment(EVerticalAlignment::VAlign_Fill);
|
}
|
||||||
OverlaySlot->SetHorizontalAlignment(EHorizontalAlignment::HAlign_Fill);
|
if (NeedShowWidget) {
|
||||||
WidgetInst->SetVisible(true);
|
NeedShowWidget->FrameWorkSetVisible(true);
|
||||||
WidgetPool.Add(WidgetName, WidgetInst);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UPW_UILayer::PopWidget(const FName& WidgetName){
|
UOverlay* UPW_UILayer::_GetOverlayByLayerType(EWidgetLayoutType InLayoutType){
|
||||||
return HideWidget(WidgetName);
|
switch (LayoutType) {
|
||||||
|
case EWidgetLayoutType::MainLayer:
|
||||||
|
return MainLayer;
|
||||||
|
case EWidgetLayoutType::PopupLayer:
|
||||||
|
return PopupLayer;
|
||||||
|
case EWidgetLayoutType::FloatLayer:
|
||||||
|
return FloatLayer;
|
||||||
|
case EWidgetLayoutType::TopLayer:
|
||||||
|
return TopLayer;
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user