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

65 lines
2.0 KiB
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

local FamilyMsgDiamond = {}
local M = FamilyMsgDiamond
--类型字段1为进入游戏预扣2为结束游戏返还
local TypeTable = { "亲友圈开局游戏预扣", "因游戏结束返还您", "您为亲友圈充值" }
function M.New(data, callback)
setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, { __index = M })
self._full = true
self.class = "com_FamilyMsgRecord"
BaseWindow.init(self, 'ui://Family/com_FamilyMsgDiamond')
self.data = data
self:Init()
self.closeCallback = callback
return self
end
function M:Init()
local list_msg = self._view:GetChild('list_msg')
list_msg.itemRenderer = function(index, obj)
self:msgRenderer(index, obj)
end
local fgCtr = ControllerManager.GetController(NewGroupController)
ViewUtil.ShowModalWait2()
fgCtr:FG_Get_Diamond_Msg(self.data.groupId, function(res)
ViewUtil.CloseModalWait2()
if res.ReturnCode ~= 0 then
ViewUtil.ErrorTip(res.ReturnCode, "获取房卡记录失败")
else
self.msgData = res.Data.messages
list_msg.numItems = #self.msgData
end
end)
end
function M:msgRenderer(index, obj)
local data = self.msgData[index + 1]
local type = data.diamo_type
obj:GetChild('tex_time').text = os.date("%Y-%m-%d %H:%M:%S", math.floor(data.m_time / 1000))
if type == 2 and data.user_nick and #data.user_nick > 0 then
obj:GetChild('tex_msg').text = string.format("【%s(%s)】用户为亲友圈充值%d房卡剩余%d房卡", data.user_nick, data.uid,
data.diamo_num, data.diamo_cur)
else
obj:GetChild('tex_msg').text = string.format("%s%d房卡剩余%d房卡", TypeTable[data.diamo_type + 1],
data.diamo_num, data.diamo_cur)
end
end
function M:Show(groupId)
getmetatable(M).__index.Show(self)
end
function M:Close()
if self.closeCallback then
self.closeCallback()
end
getmetatable(M).__index.Close(self)
end
return M