补充上一条
...
This commit is contained in:
@ -81,9 +81,13 @@ function CookManager:CheckFinishStatus()
|
||||
end
|
||||
|
||||
function CookManager:AddCookMaterial(cook_material_id, is_auto_push)
|
||||
local BusyGamePlayLibrary = import("BusyGamePlayLibrary")
|
||||
|
||||
local config = Utils.GetDataTableConfig(
|
||||
"CookMaterialStateConfig", cook_material_id
|
||||
)
|
||||
BusyGamePlayLibrary.SetTest(config)
|
||||
print("?>????", config)
|
||||
if not config then
|
||||
print("ERROR: can't find ", cook_material_id, " in CookMaterialStateConfig")
|
||||
return
|
||||
|
||||
@ -82,3 +82,10 @@ bool UBusyGamePlayLibrary::GetItemDescription(const FName& RowName, FBusyItemDes
|
||||
bool UBusyGamePlayLibrary::GetCookMaterialStateConfig(const FName& RowName, FBusyCookMaterialStateConfig& 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"
|
||||
|
||||
|
||||
bool UPW_UILayer::PushWidget(UPW_UserWidget* WidgetInst){
|
||||
UOverlay* Overlay;
|
||||
UOverlaySlot* OverlaySlot;
|
||||
|
||||
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 nullptr;
|
||||
}
|
||||
Widget->SetVisible(true);
|
||||
return Widget;
|
||||
}
|
||||
Overlay = _GetOverlayByLayerType(WidgetInst->LayoutType);
|
||||
if (!Overlay) return false;
|
||||
|
||||
bool UPW_UILayer::HideWidget(const FName& WidgetName){
|
||||
UPW_UserWidget* Widget = *WidgetPool.Find(WidgetName);
|
||||
if (Widget == nullptr) {
|
||||
return false;
|
||||
Overlay->AddChild(WidgetInst);
|
||||
OverlaySlot = Cast<UOverlaySlot>(WidgetInst->Slot);
|
||||
if (!OverlaySlot) 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;
|
||||
}
|
||||
|
||||
bool UPW_UILayer::PushWidget(const FName& WidgetName, UPW_UserWidget* WidgetInst){
|
||||
void UPW_UILayer::PopWidget(const UPW_UserWidget* WidgetInst){
|
||||
UOverlay* Overlay;
|
||||
UOverlaySlot* OverlaySlot;
|
||||
switch (WidgetInst->LayoutType) {
|
||||
case EWidgetLayoutType::MainLayer: Overlay = MainLayer; break;
|
||||
case EWidgetLayoutType::PopupLayer: Overlay = PopupLayer; break;
|
||||
case EWidgetLayoutType::FloatLayer: Overlay = FloatLayer; break;
|
||||
case EWidgetLayoutType::TopLayer: Overlay = TopLayer; break;
|
||||
default: return false;
|
||||
bool bNeedRemove;
|
||||
int32 i, OverlayWidgetCount;
|
||||
UPW_UserWidget* Child, * NeedShowWidget;
|
||||
TArray<UWidget*> AllOverlayChildren;
|
||||
TArray<UPW_UserWidget*> NeedRemoveWidgets;
|
||||
|
||||
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);
|
||||
if ((OverlaySlot = Cast<UOverlaySlot>(WidgetInst->Slot))) {
|
||||
OverlaySlot->SetVerticalAlignment(EVerticalAlignment::VAlign_Fill);
|
||||
OverlaySlot->SetHorizontalAlignment(EHorizontalAlignment::HAlign_Fill);
|
||||
WidgetInst->SetVisible(true);
|
||||
WidgetPool.Add(WidgetName, WidgetInst);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
for (i = 0; i < NeedRemoveWidgets.Num(); ++i) {
|
||||
NeedRemoveWidgets[i]->RemoveFromParent();
|
||||
}
|
||||
if (NeedShowWidget) {
|
||||
NeedShowWidget->FrameWorkSetVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
bool UPW_UILayer::PopWidget(const FName& WidgetName){
|
||||
return HideWidget(WidgetName);
|
||||
UOverlay* UPW_UILayer::_GetOverlayByLayerType(EWidgetLayoutType InLayoutType){
|
||||
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