--设置窗口对象 local FamilyNumberDetail = {} local M = FamilyNumberDetail setmetatable(M, { __index = BaseWindow }) function FamilyNumberDetail.new(groupId, lev, res) local self = setmetatable({}, { __index = M }) self.class = 'FamilyNumberDetail' self._close_destroy = true self.groupId = groupId self:init('ui://Family/NumberDetail', lev, res) return self end function M:init(url, lev, res) local fgCtr = ControllerManager.GetController(NewGroupController) BaseWindow.init(self, url) 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 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 self._view:GetController('isAssistant').selectedIndex = info.lev == 1 and 0 or (lev == 2 and 1 or 2) self._view:GetChild('btn_changeTag').onClick:Set(function() ViewUtil.ShowOneChooose("该功能还未开放") end) self._view:GetChild('btn_changeMJScore').onClick:Set(function() 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) end) self._view:GetChild('btn_changePokerScore').onClick:Set(function() 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) end) self._view:GetChild('btn_tick').onClick:Set(function() ViewUtil.ShowTwoChooose(string.format("是否将用户(%s)踢出", info.nick), function() fgCtr:FG_GroupRemoveMember(self.groupId, info.uid, self._callback_tick) self:Destroy() end) end) self._view:GetChild('btn_band'):GetController('band').selectedIndex = flag_band self._view:GetChild('btn_band').onClick:Set(function() 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 end) end) end) 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 end) end) end) end function M:SetTickCallback(callback) self._callback_tick = callback end return M