37 lines
746 B
Lua
Raw Normal View History

2025-01-09 13:36:39 +08:00
--[[
[使]
========
local UGCDelegate = require("Script.Common.UGCDelegate");
local DelObj = UGCDelegate.New(self, self.SomeFunction);
========
DelObj:Execute(Par1, Par2, Par3);
--]]
---@class UGCDelegate
local UGCDelegate = LuaClass("UGCDelegate");
UGCDelegate.Object = nil;
UGCDelegate.Func = nil;
--- 构造函数
---@param InObject any
---@param InFunc function @函数变量
function UGCDelegate:ctor(InObject, InFunc)
self.Object = InObject;
self.Func = InFunc;
end
--- 调用回调函数
function UGCDelegate:Execute(...)
if self.Object ~= nil then
self.Func(self.Object, ...);
elseif self.Func ~= nil then
self.Func(...);
end
end
return UGCDelegate;