2025-04-01 10:48:36 +08:00
|
|
|
-- 牌友圈设置界面
|
|
|
|
|
local GroupMngSettingView = {}
|
|
|
|
|
|
|
|
|
|
local M = GroupMngSettingView
|
|
|
|
|
|
|
|
|
|
function GroupMngSettingView.new(gid)
|
2025-09-30 15:34:35 +08:00
|
|
|
setmetatable(M, { __index = BaseWindow })
|
|
|
|
|
local self = setmetatable({}, { __index = M })
|
2025-04-01 10:48:36 +08:00
|
|
|
self.class = "GroupMngSettingView"
|
|
|
|
|
self._close_destroy = true
|
|
|
|
|
self.group_id = gid
|
2025-09-30 15:34:35 +08:00
|
|
|
-- self._full = true
|
2025-04-01 10:48:36 +08:00
|
|
|
self:init("ui://NewGroup/Win_GroupSetting")
|
|
|
|
|
self:FillView()
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:initData()
|
2025-09-30 15:34:35 +08:00
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:FillView()
|
|
|
|
|
local tex_name = self._view:GetChild("tex_name")
|
|
|
|
|
local tex_notice = self._view:GetChild("tex_notice")
|
|
|
|
|
local ctr_ban = self._view:GetController("ban")
|
|
|
|
|
local ctr_dissolve_time = self._view:GetController("dissolve_time")
|
|
|
|
|
local ctr_kick_time = self._view:GetController("kick_time")
|
|
|
|
|
local ctr_apply = self._view:GetController("apply")
|
|
|
|
|
local ctr_alliance = self._view:GetController("alliance")
|
|
|
|
|
|
|
|
|
|
local ctr_pt = self._view:GetController("pt")
|
|
|
|
|
local ctr_wq = self._view:GetController("wq")
|
|
|
|
|
local ctr_es = self._view:GetController("es")
|
|
|
|
|
local ctr_ua = self._view:GetController("ua")
|
|
|
|
|
|
|
|
|
|
local ctl_show_num = self._view:GetController("showAll")
|
|
|
|
|
|
|
|
|
|
local btn_chat_input = self._view:GetChild("btn_chat_input")
|
|
|
|
|
local btn_chat_voice = self._view:GetChild("btn_chat_voice")
|
|
|
|
|
local group = DataManager.groups:get(self.group_id)
|
|
|
|
|
tex_name.text = group.name
|
|
|
|
|
tex_notice.text = group.notice
|
|
|
|
|
ctr_ban.selectedIndex = group.ban and 1 or 0
|
|
|
|
|
ctr_dissolve_time.selectedIndex = group.dissolve_opt - 1
|
|
|
|
|
ctr_kick_time.selectedIndex = group.kick_opt - 1
|
|
|
|
|
ctr_alliance.selectedIndex = group.type - 1
|
|
|
|
|
ctr_apply.selectedIndex = group.apply or 0
|
|
|
|
|
btn_chat_input.selected = not group.ban_chat1
|
|
|
|
|
btn_chat_voice.selected = not group.ban_chat2
|
|
|
|
|
|
|
|
|
|
if group.show_num == 0 then
|
|
|
|
|
ctl_show_num.selectedIndex = 0
|
|
|
|
|
else
|
|
|
|
|
ctl_show_num.selectedIndex = 1
|
|
|
|
|
self._view:GetChild("txt_show_num").text = tostring(group.show_num)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local option = group.option or 0
|
|
|
|
|
|
2025-09-30 15:34:35 +08:00
|
|
|
ctr_pt.selectedIndex = bit:_and(option, 1) > 0 and 1 or 0
|
|
|
|
|
ctr_wq.selectedIndex = bit:_and(option, 2) > 0 and 1 or 0
|
|
|
|
|
ctr_es.selectedIndex = bit:_and(option, 4) > 0 and 1 or 0
|
|
|
|
|
ctr_ua.selectedIndex = bit:_and(option, 8) > 0 and 1 or 0
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
self._view:GetChild("btn_ok").onClick:Set(function()
|
2025-11-06 17:37:53 +08:00
|
|
|
ViewUtil.ShowModalWait2()
|
2025-07-02 17:19:20 +08:00
|
|
|
local data = {}
|
|
|
|
|
data.id = self.group_id
|
|
|
|
|
data.name = tex_name.text
|
|
|
|
|
data.notice = tex_notice.text
|
|
|
|
|
data.ban = ctr_ban.selectedIndex == 1
|
|
|
|
|
data.dissolve_opt = ctr_dissolve_time.selectedIndex + 1
|
|
|
|
|
data.kick_opt = ctr_kick_time.selectedIndex + 1
|
|
|
|
|
data.apply = ctr_alliance.selectedIndex == 1 and ctr_apply.selectedIndex or 0
|
|
|
|
|
data.ban_chat1 = not btn_chat_input.selected
|
|
|
|
|
data.ban_chat2 = not btn_chat_voice.selected
|
2025-04-01 10:48:36 +08:00
|
|
|
local fgCtr = ControllerManager.GetController(NewGroupController)
|
|
|
|
|
|
|
|
|
|
local pt = ctr_pt.selectedIndex
|
|
|
|
|
local wq = ctr_wq.selectedIndex
|
|
|
|
|
local es = ctr_es.selectedIndex
|
|
|
|
|
local ua = ctr_ua.selectedIndex
|
|
|
|
|
|
|
|
|
|
local option = 0
|
2025-09-30 15:34:35 +08:00
|
|
|
if ctr_pt.selectedIndex == 1 then
|
|
|
|
|
option = bit:_or(option, 1)
|
|
|
|
|
end
|
|
|
|
|
if ctr_wq.selectedIndex == 1 then
|
|
|
|
|
option = bit:_or(option, 2)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
2025-09-30 15:34:35 +08:00
|
|
|
if ctr_es.selectedIndex == 1 then
|
|
|
|
|
option = bit:_or(option, 4)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
2025-09-30 15:34:35 +08:00
|
|
|
if ctr_ua.selectedIndex == 1 then
|
|
|
|
|
option = bit:_or(option, 8)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local showNum = 0
|
|
|
|
|
if ctl_show_num.selectedIndex == 1 then
|
|
|
|
|
local strShowNum = self._view:GetChild("txt_show_num").text
|
|
|
|
|
if strShowNum ~= nil and strShowNum ~= "" then
|
|
|
|
|
showNum = tonumber(self._view:GetChild("txt_show_num").text)
|
|
|
|
|
end
|
2025-09-30 15:34:35 +08:00
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
2025-07-02 17:19:20 +08:00
|
|
|
fgCtr:FG_UpdateGroupInfo(data, function(res)
|
2025-11-06 17:37:53 +08:00
|
|
|
ViewUtil.CloseModalWait2()
|
2025-04-01 10:48:36 +08:00
|
|
|
if res.ReturnCode ~= 0 then
|
2025-09-30 15:34:35 +08:00
|
|
|
ViewUtil.ErrorTip(res.ReturnCode, "设置大联盟失败。")
|
2025-04-01 10:48:36 +08:00
|
|
|
else
|
2025-09-30 15:34:35 +08:00
|
|
|
ViewUtil.ErrorTip(-1, "设置成功")
|
2025-04-01 10:48:36 +08:00
|
|
|
group.name = name
|
|
|
|
|
group.notice = notice
|
|
|
|
|
group.ban = ban
|
|
|
|
|
group.ban_ip = ban_ip
|
|
|
|
|
group.ban_gps = ban_gps
|
|
|
|
|
group.apply = apply
|
|
|
|
|
group.option = option
|
|
|
|
|
group.ban_chat1 = ban_chat1
|
|
|
|
|
group.ban_chat2 = ban_chat2
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
2025-09-30 15:34:35 +08:00
|
|
|
return M
|