hengyang_client/lua_probject/base_project/Game/View/Family/FamilyNotice.lua

41 lines
1.5 KiB
Lua
Raw Permalink Normal View History

2025-10-17 18:30:44 +08:00
local FamilyNotice = {}
local M = FamilyNotice
function M.New(data, callback)
setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, { __index = M })
self.class = "FamilyNotice"
self._close_destroy = true
self._close_zone = false
self._data = data
self._callback = callback
self:init("ui://Family/com_FamilyNotice")
return self
end
function M:init(url)
BaseWindow.init(self, url)
local group = self._data.group
self._view:GetChild('text_familyName').text = string.format("%s(%s)", group.name, group.id)
self._view:GetChild('label_detial').text = group.notice
end
function M.TryShow(data, callback)
local group = data.group
local noticeTime = Utils.LoadLocalFile(string.format("Family_%s_notice_time", group.id)) or 0
local noticeText = Utils.LoadLocalFile(string.format("Family_%s_notice_text", group.id)) or ""
2025-10-20 18:30:18 +08:00
printlog("lingmeng notice", os.date("%Y%m%d", tonumber(noticeTime)), os.date("%Y%m%d", os.time()), group.notice,
group.notice)
if group.notice and #group.notice > 0 and (tonumber(os.date("%Y%m%d", tonumber(noticeTime))) - tonumber(os.date("%Y%m%d", os.time())) <= -1 or noticeText ~= group.notice) then
2025-10-17 18:30:44 +08:00
Utils.SaveLocalFile(string.format("Family_%s_notice_time", group.id), os.time())
Utils.SaveLocalFile(string.format("Family_%s_notice_text", group.id), group.notice)
local my = M.New(data, callback)
my:Show()
end
end
return M