源战役客户端
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 

45 rindas
1.0 KiB

require("game.common.BarrageView")
require("game.common.BarrageItem")
BarrageManager = BarrageManager or BaseClass(BaseController)
function BarrageManager:__init()
BarrageManager.Instance = self
self.max_count_limit = 20
self.width = ScreenWidth
self.height = ScreenHeight - 300
end
function BarrageManager:getInstance()
if not BarrageManager.Instance then
BarrageManager.Instance = BarrageManager.New()
end
return BarrageManager.Instance
end
--[[
data = {
str = "弹幕内容",
fontSize = 文本字号,
duration = 停留屏幕时间,
}
]]
function BarrageManager:AppendItem(data)
if not self.barrageView then
self.barrageView = BarrageView.New()
end
if not self.barrageView:HasOpen() then
self.barrageView:Open()
end
self.barrageView:AppendNewItem(data)
end
function BarrageManager:GetRandomFirePosY()
local curTime = os.time()
if self.last_random_time ~= curTime then
self.last_random_time = curTime
--math.randomseed(curTime)
math.random(-self.height/2, self.height/2)
end
return math.random(-self.height/2, self.height/2)
end