1、Update的使用方法
--主入口函数。从这里开始lua逻辑
function Main()
print("logic start")
//tolua框架提供了UpdateBeat,FixedUpdateBeat,LaterUpdateBeat用来做刷新
UpdateBeat:Add(Update,self)
end
--场景切换通知
function OnLevelWasLoaded(level)
-- LLoading.start()
collectgarbage("collect")
Time.timeSinceLevelLoad = 0
end
function OnApplicationQuit()
end
function Update()
print("Update")
end
2、定时器的使用
print("Loading comming")
LLoading = {}
LLoading.__index = LLoading
function LLoading.new()
local self = {}
setmetatable(self,{__index = LLoading})
end
function LLoading:start()
print("start start start start")
local myTimer = FrameTimer.New(LLoading.Update,10,-1)
myTimer:Start()
end
function LLoading:Update()
print("Update")
end