test: add comprehensive ts2lua-unreal TS/Lua 5.4 test suites and upgrade to v0.2.2
This commit is contained in:
1 parent
ee2e62bb34
commit
3dd61c32a9
75 files changed
+9929
-10
No files matched your search
@@ -0,0 +1,43 @@
|
||||
local Ex03_BindDelegates = UnLua.Class()
|
||||
function Ex03_BindDelegates.Construct(self)
|
||||
self.clickCount = 0
|
||||
self.timerTickCount = 0
|
||||
if self.ClickMeButton ~= nil then
|
||||
self.ClickMeButton.OnClicked:Add(self, self.OnButtonClicked)
|
||||
end
|
||||
if self.CustomSingleDelegate ~= nil then
|
||||
self.CustomSingleDelegate:Bind(self, self.OnCustomExecute)
|
||||
end
|
||||
self.timerHandle = UE.UKismetSystemLibrary.K2_SetTimerDelegate({self, self.OnTimerTick}, 0.5, true)
|
||||
end
|
||||
function Ex03_BindDelegates.OnButtonClicked(self)
|
||||
self.clickCount = self.clickCount + 1
|
||||
end
|
||||
function Ex03_BindDelegates.OnCustomExecute(self, value)
|
||||
return value * 10 + self.clickCount
|
||||
end
|
||||
function Ex03_BindDelegates.OnTimerTick(self)
|
||||
if not UE.UKismetSystemLibrary.IsValid(self) then
|
||||
return
|
||||
end
|
||||
self.timerTickCount = self.timerTickCount + 1
|
||||
end
|
||||
function Ex03_BindDelegates.Destruct(self)
|
||||
if self.ClickMeButton ~= nil then
|
||||
self.ClickMeButton.OnClicked:Remove(self, self.OnButtonClicked)
|
||||
end
|
||||
if self.CustomSingleDelegate ~= nil then
|
||||
self.CustomSingleDelegate:Unbind()
|
||||
end
|
||||
UE.UKismetSystemLibrary.K2_ClearAndInvalidateTimerHandle(self, self.timerHandle)
|
||||
end
|
||||
function Ex03_BindDelegates.GetClickCount(self)
|
||||
return self.clickCount
|
||||
end
|
||||
function Ex03_BindDelegates.GetTimerTickCount(self)
|
||||
return self.timerTickCount
|
||||
end
|
||||
function Ex03_BindDelegates.GetTimerHandle(self)
|
||||
return self.timerHandle
|
||||
end
|
||||
return Ex03_BindDelegates
|
||||
Reference in new issue
Block a user