require("Base/BasePanel") NoticePopup = Inherit(BasePanel) local this = NoticePopup local LoginRoot_Url = VersionManager:GetVersionInfo("serverUrl") --初始化组件(用于子类重写) function NoticePopup:InitComponent() this.BtnBack = Util.GetGameObject(self.transform, "bg/bg/btnBack") this.TitleText=Util.GetGameObject(self.transform,"bg/bg/title"):GetComponent("Text") this.ContentText=Util.GetGameObject(self.transform,"bg/bg/rect/content"):GetComponent("Text") end --绑定事件(用于子类重写) function NoticePopup:BindEvent() Util.AddClick(this.BtnBack, function() self:ClosePanel() end) end --添加事件监听(用于子类重写) function NoticePopup:AddListener() end --移除事件监听(用于子类重写) function NoticePopup:RemoveListener() end --界面打开时调用(用于子类重写) function NoticePopup:OnOpen(...) this.GetNotice() end --界面打开或者重新打开后,界面刷新时调用(用于子类重写) function NoticePopup:OnShow() end --界面关闭时调用(用于子类重写) function NoticePopup:OnClose() end --界面销毁时调用(用于子类重写) function NoticePopup:OnDestroy() end function this.GetNotice() local timeStamp = Time.realtimeSinceStartup local timeSign = Util.MD5Encrypt(string.format("%s%s", timeStamp, LoginManager.sign)) RequestPanel.Show(Language[11128]) networkMgr:SendGetHttp(LoginRoot_Url .. "jl_loginserver/getNotice?timestamp="..timeStamp.."&sign=".. timeSign, function (str) RequestPanel.Hide() if str == nil then return end --Log(str) local json = require 'cjson' local data = json.decode(str) --Log("data.parms.title:"..data.parms.title) --Log("data.parms.content:"..data.parms.content) if data.parms then this.TitleText.text=data.parms.title this.ContentText.text=string.gsub(data.parms.content, "\\n", "\n") else this.TitleText.text=Language[11129] this.ContentText.text=Language[11130] end end, nil, nil, nil) end return NoticePopup