require("sysinfo.MessageItem")
|
|
require("sysinfo.ChuanwenItem")
|
|
require("game.chat.HornTv")
|
|
require("sysinfo.SysInfoMiniView")
|
|
require("sysinfo.MessageItemNew")
|
|
require("sysinfo.SysInfoNoticeView")
|
|
require("sysinfo.ExpMessageItem")
|
|
require("sysinfo.SysInfoExpView")
|
|
require("sysinfo.SysInfoHornView")
|
|
require("sysinfo.MiniMessageView")
|
|
|
|
SysInfoCtrl = SysInfoCtrl or BaseClass()
|
|
|
|
SysInfoCtrl.SysInfoType = {
|
|
MINI = 1,
|
|
NOTICE = 2,
|
|
EXP = 3,
|
|
HORN = 4,
|
|
}
|
|
|
|
function SysInfoCtrl:__init()
|
|
|
|
if SysInfoCtrl.Instance ~= nil then
|
|
LogError("SysInfoCtrl is a singleton class")
|
|
end
|
|
SysInfoCtrl.Instance = self
|
|
|
|
self.callback_table = {} --回调列表
|
|
self.mini_view = MiniMessageView.New()
|
|
self.mini_view:Open()
|
|
self.notice_view = SysInfoNoticeView.New()
|
|
self.horn_view = SysInfoHornView.New()
|
|
self.exp_view = SysInfoExpView.New()
|
|
self.count_down_time = 9999999 --倒计时时间
|
|
self.down_time_id = false
|
|
self.msg_handle_map = {
|
|
[SysInfoCtrl.SysInfoType.MINI] = SysInfoCtrl.AppendMiniMsg,
|
|
[SysInfoCtrl.SysInfoType.NOTICE] = SysInfoCtrl.AppendNoticeMsg,
|
|
[SysInfoCtrl.SysInfoType.HORN] = SysInfoCtrl.AppendHornMsg,
|
|
[SysInfoCtrl.SysInfoType.EXP] = SysInfoCtrl.AppendExpMsg,
|
|
}
|
|
end
|
|
|
|
function SysInfoCtrl:__delete()
|
|
self.mini_view:DeleteMe()
|
|
self.notice_view:DeleteMe()
|
|
self.horn_view:DeleteMe()
|
|
self.exp_view:DeleteMe()
|
|
end
|
|
|
|
function SysInfoCtrl:AppendMsg(msg_type, ...)
|
|
|
|
local handle_func = self.msg_handle_map[msg_type]
|
|
if not handle_func then
|
|
print ("Error!SystemInfo Type Error!", msg_type)
|
|
return
|
|
end
|
|
|
|
handle_func(self, ...)
|
|
end
|
|
|
|
|
|
function SysInfoCtrl:AppendMiniMsg(content)
|
|
if content == nil or content == "" then return end
|
|
if self.mini_view.can_show then
|
|
self.mini_view:AppendMessage(content)
|
|
end
|
|
end
|
|
|
|
function SysInfoCtrl:AppendNoticeMsg(content)
|
|
if SceneManager:getInstance():IsNoonQuizScene() then return end
|
|
|
|
self.notice_view:AppendMessage(content)
|
|
end
|
|
|
|
function SysInfoCtrl:AppendHornMsg(content)
|
|
if SceneManager:getInstance():IsNoonQuizScene() then return end
|
|
self.horn_view:AppendMessage(content)
|
|
end
|
|
|
|
function SysInfoCtrl:AppendExpMsg( content, percent, is_normal, is_score )
|
|
if not lua_viewM.main_cancas_last_visible then
|
|
return
|
|
end
|
|
if content == nil or content == "" then
|
|
return
|
|
end
|
|
|
|
self.exp_view:AppendMessage(content, percent, is_normal, is_score)
|
|
end
|
|
|
|
function SysInfoCtrl:HideHornView(bool)
|
|
if self.horn_view then
|
|
self.horn_view:SetHide(bool)
|
|
end
|
|
end
|
|
|
|
function SysInfoCtrl:HideNoticeView(bool)
|
|
if self.notice_view then
|
|
self.notice_view:SetHide(bool)
|
|
end
|
|
end
|
|
|
|
function SysInfoCtrl:HideMiniView(bool)
|
|
if self.mini_view then
|
|
self.mini_view:SetHide(bool)
|
|
end
|
|
end
|
|
|
|
function SysInfoCtrl:ShowMiniView()
|
|
if self.mini_view then
|
|
self.mini_view.can_show = true
|
|
end
|
|
end
|
|
|
|
function SysInfoCtrl:TimeLater()
|
|
local function on_time_down( )
|
|
if self.count_down_time <= 0 or TableSize(self.callback_table) <=0 then
|
|
if self.down_time_id then
|
|
GlobalTimerQuest:CancelQuest(self.down_time_id)
|
|
self.down_time_id = nil
|
|
self.count_down_time = 9999999
|
|
end
|
|
else
|
|
self.count_down_time = self.count_down_time - 1
|
|
for k,v in pairs(self.callback_table) do
|
|
if type(v) == "function" then
|
|
v()
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if not self.down_time_id then
|
|
self.down_time_id = GlobalTimerQuest:AddPeriodQuest(on_time_down, 1, -1)
|
|
end
|
|
end
|
|
|
|
function SysInfoCtrl:DeleteFuncCallBack( index )--删除计时器方法列表里面的方法
|
|
self.callback_table[index] = nil
|
|
end
|
|
|
|
function SysInfoCtrl:SetFuncCallBack( func,index )--添加计时器方法列表里面的方法
|
|
if type(func) == "function" then
|
|
self.callback_table[index] = func
|
|
self:TimeLater()
|
|
end
|
|
end
|