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

170 lines
4.8 KiB
Lua
Raw Normal View History

2025-06-17 15:29:16 +08:00
--region LOCAL
local FamilyMyFamily = {}
local root = {}
local rootLastIndex = 0
local function HideMainView()
rootLastIndex = root.familyType.selectedIndex
root.familyType.selectedIndex = 0
end
local function ShowMainView()
root.familyType.selectedIndex = rootLastIndex or 1
end
2025-06-19 14:29:16 +08:00
--endregion
2025-06-17 15:29:16 +08:00
2025-06-20 01:55:55 +08:00
function FamilyMyFamily:TryShow(groupId, r)
2025-06-19 14:29:16 +08:00
self:Init()
root = r
2025-06-20 01:55:55 +08:00
self.groupId = groupId
2025-06-17 15:29:16 +08:00
self:Show()
end
2025-06-19 14:29:16 +08:00
function FamilyMyFamily:Show()
2025-06-17 15:29:16 +08:00
2025-06-19 18:17:02 +08:00
self:Refalsh()
2025-06-17 15:29:16 +08:00
HideMainView()
2025-06-19 14:29:16 +08:00
BaseWindow.Show(self)
2025-06-17 15:29:16 +08:00
end
function FamilyMyFamily:Close()
2025-06-19 14:29:16 +08:00
BaseWindow.Close(self)
2025-06-17 15:29:16 +08:00
ShowMainView()
end
2025-06-19 18:17:02 +08:00
function FamilyMyFamily:Refalsh()
2025-06-20 01:55:55 +08:00
--local family = root._group
local family = DataManager.groups.groupMap[self.groupId]
2025-06-19 18:17:02 +08:00
self.tex_fName.text = family.name
self.tex_playerName.text = "亲友圈号:" .. family.id
self.tex_fNumber.text = family.member_num
self.tex_cradNum.text = family.diamo
self.tex_nocice.text = family.notice
ImageLoad.Load(family.o_portrait, self.loader_icon)
self.cStyle.selectedIndex = family.lev -1
end
2025-06-17 15:29:16 +08:00
function FamilyMyFamily:Init()
2025-06-19 14:29:16 +08:00
setmetatable(FamilyMyFamily, { __index = BaseWindow })
2025-06-20 01:55:55 +08:00
2025-06-19 14:29:16 +08:00
self._close_destroy = true
self._full = true
self._animation = false
2025-06-20 01:55:55 +08:00
self._full_offset = false
BaseWindow.init(self, 'ui://Family/com_myFamily')
-- 隐藏背景图
2025-06-19 14:29:16 +08:00
self._root_view:GetChild("win_mode").visible = false
2025-06-17 15:29:16 +08:00
self._view:GetChild("btn_close").onClick:Set(function()
self:Close()
end)
self.loader_icon = self._view:GetChild("loader_icon")
self.tex_fName = self._view:GetChild("tex_fName")
self.tex_wxId = self._view:GetChild("tex_wxId")
self.tex_fNumber = self._view:GetChild("tex_fNumber")
self.tex_cradNum = self._view:GetChild("tex_cradNum")
self.tex_nocice = self._view:GetChild("tex_nocice")
self.tex_playerName = self._view:GetChild("tex_playerName")
self.btn_quitFamily = self._view:GetChild("btn_quitFamily")
self.btn_playSet = self._view:GetChild("btn_playSet")
self.btn_invite = self._view:GetChild("btn_invite")
self.btn_czRecord = self._view:GetChild("btn_czRecord")
self.btn_applyMsg = self._view:GetChild("btn_applyMsg")
self.btn_buyCrad = self._view:GetChild("btn_buyCrad")
self.btn_checkNumber = self._view:GetChild("btn_checkNumber")
2025-06-19 18:17:02 +08:00
self.btn_editNotice = self._view:GetChild("btn_editNotice")
self.btn_quitNotice = self._view:GetChild("btn_quitNotice")
self.btn_bgNotice = self._view:GetChild("btn_bgNotice")
self.btn_confirmNotice = self._view:GetChild("btn_confirmNotice")
self.input_notice = self._view:GetChild("input_notice")
2025-06-17 15:29:16 +08:00
2025-06-19 14:29:16 +08:00
self.cStyle = self._view:GetController("cStyle")
2025-06-19 18:17:02 +08:00
self.cWindow = self._view:GetController("cWindow")
2025-06-17 15:29:16 +08:00
self.btn_playSet.onClick:Set(function()
self:Close()
root:PlayEdit()
end)
self.btn_invite.onClick:Set(function()
self:Close()
root:ShareWx()
end)
self.btn_buyCrad.onClick:Set(function()
self:Close()
root:ShowShop()
end)
self.btn_checkNumber.onClick:Set(function()
self:Close()
2025-06-20 01:55:55 +08:00
local family = DataManager.groups.groupMap[self.groupId]
root:OpenAllNumber(family)
2025-06-17 15:29:16 +08:00
end)
self.btn_applyMsg.onClick:Set(function()
self:Close()
root:AuditNumber()
end)
2025-06-19 14:29:16 +08:00
self.btn_quitFamily.onClick:Set(function()
local fgCtr = ControllerManager.GetController(NewGroupController)
print("发送了退出协议 familyid = ",root._group.id)
fgCtr:FG_ExitGroup(root._group.id, function(res)
pt(res)
end)
end)
2025-06-19 18:17:02 +08:00
self.btn_quitNotice.onClick:Set(function()
self.cWindow.selectedIndex = 0
end)
self.btn_bgNotice.onClick:Set(function()
self.cWindow.selectedIndex = 0
end)
self.btn_editNotice.onClick:Set(function()
self.cWindow.selectedIndex = 1
end)
self.btn_confirmNotice.onClick:Set(function()
local family = root._group
local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_UpdateGroupInfo(
family.id,
family.name,
self.input_notice.text,
not family.ban,
family.dissolve_opt,
family.kick_opt,
family.apply,
family.ban_chat1,
family.ban_chat2,
family.option,
0,
function(res)
if res.ReturnCode ~= 0 then
ViewUtil.ErrorTip(res.ReturnCode, "更改公告失败,请稍后再试")
else
ViewUtil.ErrorTip(res.ReturnCode, "修改成功!")
2025-06-20 01:55:55 +08:00
family.notice = self.input_notice.text
2025-06-19 18:17:02 +08:00
self:Refalsh()
2025-06-20 01:55:55 +08:00
self.cWindow.selectedIndex = 0
2025-06-19 18:17:02 +08:00
end
end
)
end)
2025-06-17 15:29:16 +08:00
return self
end
return FamilyMyFamily