准备制作食材预处理流程,为lua直接读data table做基建

...
This commit is contained in:
2025-08-19 03:23:36 +08:00
parent 6fafddc43d
commit 626808fde9
29 changed files with 328 additions and 51 deletions

View File

@ -0,0 +1,39 @@
local DataTableUtils = {}
local BusyGamePlayLibrary = import("BusyGamePlayLibrary")
function DataTableUtils.GetDataTable(table_name)
return BusyGamePlayLibrary.GetGameDataTable(table_name)
end
function DataTableUtils.GetDataTableRow(table_name, row_name)
local data_table = DataTableUtils.GetDataTable(table_name)
if not data_table then
return nil
end
return data_table:FindRow(row_name)
end
--[[
LuaExtensionMethod.cpp:22-28
// 封装函数示例
static int FindRowWrapper(lua_State* L) {
UDataTable* dataTable = LuaObject::checkUD<UDataTable>(L, 1);
FName rowName = LuaObject::checkValue<FName>(L, 2);
UScriptStruct* rowStruct = LuaObject::checkUD<UScriptStruct>(L, 3);
// 使用反射调用 FindRow
uint8* rowData = dataTable->FindRowUnchecked(rowName);
if (rowData && rowStruct) {
// 将结果推送到 Lua
return LuaObject::pushStruct(L, rowStruct, rowData);
}
return LuaObject::pushNil(L);
}
这段代码中pushStruct只接受两个参数如何改
]]
return DataTableUtils

View File

@ -10,10 +10,10 @@ end
function WidgetUtils.Show(wco, widget_name)
local hud = GetHud(wco)
if not hud then return end
return hud:ShowWidget(widget_name)
return hud:BP_PushWidget(widget_name)
end
function WidgetUtils.Hide(wco, widget_name)
function WidgetUtils.Close(wco, widget_name)
local hud = GetHud(wco)
if not hud then return end
return hud:PopWidget(widget_name)