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

223 lines
6.6 KiB
Lua

local FamilyRoomCardRecord = import(".FamilyRoomCardRecord")
--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
--endregion
function FamilyMyFamily:TryShow(groupId, r)
self:Init()
root = r
self.groupId = groupId
self:Show()
end
function FamilyMyFamily:Show()
self:Refalsh()
HideMainView()
BaseWindow.Show(self)
end
function FamilyMyFamily:Close()
BaseWindow.Close(self)
ShowMainView()
end
function FamilyMyFamily:Refalsh()
--local family = root._group
local family = DataManager.groups.groupMap[self.groupId]
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
-- index = 0 是显示隐藏按钮
self.showNumber = family.isShow
print("family.isShow",family.isShow)
pt(family)
if self.showNumber == 0 then
self.cDisplayNumber.selectedIndex = 1
self.tex_fNumber.text = "*"
elseif self.showNumber == 1 then
self.cDisplayNumber.selectedIndex = 0
end
end
function FamilyMyFamily:Init()
setmetatable(FamilyMyFamily, { __index = BaseWindow })
self._close_destroy = true
self._full = true
self._animation = false
self._full_offset = false
BaseWindow.init(self, 'ui://Family/com_myFamily')
-- 隐藏背景图
self._root_view:GetChild("win_mode").visible = false
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")
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.btn_hideNumber = self._view:GetChild("btn_hideNumber")
self.btn_showNumber = self._view:GetChild("btn_showNumber")
self.input_notice = self._view:GetChild("input_notice")
self.cStyle = self._view:GetController("cStyle")
self.cWindow = self._view:GetController("cWindow")
self.cDisplayNumber = self._view:GetController("cDisplayNumber")
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_czRecord.onClick:Set(function()
local view = FamilyRoomCardRecord.New()
view:Show()
end)
self.btn_checkNumber.onClick:Set(function()
self:Close()
local family = DataManager.groups.groupMap[self.groupId]
root:OpenAllNumber(family)
end)
self.btn_applyMsg.onClick:Set(function()
self:Close()
root:AuditNumber()
end)
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)
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, "修改成功!")
family.notice = self.input_notice.text
self:Refalsh()
self.cWindow.selectedIndex = 0
end
end
)
end)
self.btn_hideNumber.onClick:Set(function()
local family = root._group
local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_SetGroupShow(0, family.id, function (res)
print("收到协议M:FG_SetGroupShow")
pt(res)
if res.ReturnCode ~= 0 then
return
end
--self.showNumber = 0
local family = DataManager.groups.groupMap[self.groupId]
family.isShow = 0
self:Refalsh()
end)
end)
self.btn_showNumber.onClick:Set(function()
local family = root._group
local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_SetGroupShow(1, family.id, function (res)
print("收到协议M:FG_SetGroupShow")
pt(res)
if res.ReturnCode ~= 0 then
return
end
--self.showNumber = 1
local family = DataManager.groups.groupMap[self.groupId]
family.isShow = 1
self:Refalsh()
end)
end)
return self
end
return FamilyMyFamily