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

127 lines
5.2 KiB
Lua
Raw Normal View History

2025-05-09 14:56:23 +08:00
--设置窗口对象
local FamilyNumberDetail = {}
local M = FamilyNumberDetail
setmetatable(M, { __index = BaseWindow })
2025-05-14 10:59:30 +08:00
function FamilyNumberDetail.new(groupId, lev, res)
2025-05-09 14:56:23 +08:00
local self = setmetatable({}, { __index = M })
self.class = 'FamilyNumberDetail'
self._close_destroy = true
2025-05-09 16:56:59 +08:00
self.groupId = groupId
2025-05-09 14:56:23 +08:00
2025-05-14 10:59:30 +08:00
self:init('ui://Family/NumberDetail', lev, res)
2025-05-09 14:56:23 +08:00
return self
end
2025-05-14 10:59:30 +08:00
function M:init(url, lev, res)
2025-05-09 16:56:59 +08:00
local fgCtr = ControllerManager.GetController(NewGroupController)
2025-05-09 14:56:23 +08:00
BaseWindow.init(self, url)
2025-06-23 18:12:12 +08:00
print("res.Data.members[1]")
pt(res.Data.members[1])
2025-05-20 19:06:00 +08:00
local info = res.Data.members[1]
local flag_assistant = info.lev == 2 and 1 or 0
local flag_band = info.ban
local MJScore = info.mj_score
local PKScore = info.pk_score
2025-06-23 18:12:12 +08:00
local remark = info.tag
local icon_url = info.portrait
2025-05-20 19:06:00 +08:00
self._view:GetChild('name').text = string.format("%s(%s)", info.nick, info.uid)
self._view:GetChild('text_allRounds').text = info.total_round
self._view:GetChild('text_joinTime').text = os.date('%Y-%m-%d %H:%M', info.join_time)
self._view:GetChild('text_score_majiang').text = MJScore
self._view:GetChild('text_score_poker').text = PKScore
2025-05-09 14:56:23 +08:00
2025-06-23 18:12:12 +08:00
ImageLoad.Load(icon_url, self._view:GetChild('btn_head'):GetChild('icon'))
if remark == "" then
self._view:GetChild("tex_remark").text = "备注:无"
else
self._view:GetChild("tex_remark").text = remark
end
2025-05-14 10:59:30 +08:00
self._view:GetController('isAssistant').selectedIndex = info.lev == 1 and 0 or (lev == 2 and 1 or 2)
2025-05-09 14:56:23 +08:00
self._view:GetChild('btn_changeTag').onClick:Set(function()
ViewUtil.ShowOneChooose("该功能还未开放")
end)
self._view:GetChild('btn_changeMJScore').onClick:Set(function()
2025-05-20 18:59:14 +08:00
ViewUtil.ShowOneInput("修改麻将进入限制分", function(text)
print("lingmeng修改扑克进入限制分", text)
fgCtr:FG_SetJoinScore(self.groupId, info.uid, tonumber(text), MJScore, function(res)
if res.ReturnCode ~= 0 then
ViewUtil.ShowOneChooose("修改限制分失败" .. res.ReturnCode)
else
MJScore = tonumber(text)
self._view:GetChild('text_score_majiang').text = MJScore
end
end)
end)
2025-05-09 14:56:23 +08:00
end)
self._view:GetChild('btn_changePokerScore').onClick:Set(function()
2025-05-20 18:59:14 +08:00
ViewUtil.ShowOneInput("修改扑克进入限制分", function(text)
print("lingmeng修改扑克进入限制分", text)
fgCtr:FG_SetJoinScore(self.groupId, info.uid, MJScore, tonumber(text), function(res)
if res.ReturnCode ~= 0 then
ViewUtil.ShowOneChooose("修改限制分失败" .. res.ReturnCode)
else
PKScore = tonumber(text)
self._view:GetChild('text_score_poker').text = PKScore
end
end)
end)
2025-05-09 14:56:23 +08:00
end)
self._view:GetChild('btn_tick').onClick:Set(function()
2025-05-14 10:59:30 +08:00
ViewUtil.ShowTwoChooose(string.format("是否将用户(%s)踢出", info.nick), function()
fgCtr:FG_GroupRemoveMember(self.groupId, info.uid, self._callback_tick)
2025-05-09 16:56:59 +08:00
self:Destroy()
end)
2025-05-09 14:56:23 +08:00
end)
self._view:GetChild('btn_band'):GetController('band').selectedIndex = flag_band
2025-05-09 14:56:23 +08:00
self._view:GetChild('btn_band').onClick:Set(function()
2025-05-14 10:59:30 +08:00
ViewUtil.ShowTwoChooose(string.format("是否禁止用户(%s)进入房间", info.nick), function()
fgCtr:FG_BanMember(self.groupId, info.uid, 1 - flag_band, 1, function()
if res.ReturnCode == 0 then
flag_band = 1 - flag_band
self._view:GetChild('btn_band'):GetController('band').selectedIndex = flag_band
else
ViewUtil.ShowOneChooose("设置进房权限失败")
end
2025-05-09 16:56:59 +08:00
end)
end)
2025-05-09 14:56:23 +08:00
end)
2025-05-14 10:59:30 +08:00
self._view:GetChild('btn_makeOver').onClick:Set(function()
ViewUtil.ShowOneChooose("该功能还未开放")
end)
self._view:GetChild('btn_assistant'):GetController('isAssistant').selectedIndex = flag_assistant
self._view:GetChild('btn_assistant').onClick:Set(function()
ViewUtil.ShowTwoChooose(
string.format("是否%s用户(%s)%s", flag_assistant == 1 and "取消" or "", info.nick,
flag_assistant == 1 and "助理身份" or "设置为助理"), function()
fgCtr:FG_SetManager(self.groupId, info.uid, flag_assistant + 1, function(res)
if res.ReturnCode == 0 then
flag_assistant = 1 - flag_assistant
self._view:GetChild('btn_assistant'):GetController('isAssistant').selectedIndex = flag_assistant
else
ViewUtil.ShowOneChooose("设置助理失败")
end
2025-05-14 10:59:30 +08:00
end)
end)
end)
2025-05-09 14:56:23 +08:00
end
2025-05-09 16:56:59 +08:00
function M:SetTickCallback(callback)
self._callback_tick = callback
end
2025-05-09 14:56:23 +08:00
return M