require "BaseClass" SpecialNoticeMgr = SpecialNoticeMgr or BaseClass() function SpecialNoticeMgr:__init() -- self.msgList = {} -- self.msgList = { -- "get item 10", -- "get item 100", -- "get item 1000", -- "get item 10000", -- "get item 100000", -- "get item 1000000", -- "get item 10000000", -- "get item 100000000", -- "get item 1000000000", -- "get item 10000000000", -- } end function SpecialNoticeMgr.GetInstance() if SpecialNoticeMgr.instance == nil then SpecialNoticeMgr.instance = SpecialNoticeMgr.New() end return SpecialNoticeMgr.instance end function SpecialNoticeMgr:AddMsg(msg) -- body table.insert(self.msgList,msg) end function SpecialNoticeMgr:PopMsg() local msg if #self.msgList > 0 then msg = table.remove(self.msgList,1) end return msg end function SpecialNoticeMgr:TopMsg() if #self.msgList > 0 then return self.msgList[1] end end function SpecialNoticeMgr:ClearMsg() self.msgList = {} end function SpecialNoticeMgr:GetMsgList() return self.msgList end