140 lines
5.7 KiB
Lua
140 lines
5.7 KiB
Lua
--设置窗口对象
|
|
|
|
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)
|
|
-- print("res.Data.members[1]")
|
|
-- pt(res.Data.members[1])
|
|
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
|
|
local remark = info.tag
|
|
local icon_url = info.portrait
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
self._callback_refren()
|
|
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
|
|
local g = DataManager.groups.groupMap[self.groupId]
|
|
local player = g.memberMap[info.uid]
|
|
|
|
flag_assistant = 1 - flag_assistant
|
|
self._view:GetChild('btn_assistant'):GetController('isAssistant').selectedIndex = flag_assistant
|
|
self._callback_refren()
|
|
|
|
-- 让服务器推送
|
|
local mgr_ctr = ControllerManager.GetController(GroupMgrController)
|
|
mgr_ctr:FG_Update_Assistant(self.groupId, info.uid, function() end)
|
|
else
|
|
ViewUtil.ShowOneChooose("设置助理失败")
|
|
end
|
|
end)
|
|
end)
|
|
end)
|
|
end
|
|
|
|
function M:SetTickCallback(callback)
|
|
self._callback_tick = callback
|
|
end
|
|
|
|
function M:SetRefrenCallback(callback)
|
|
self._callback_refren = callback
|
|
end
|
|
|
|
return M
|