补充上传

master
罗家炜 2025-06-26 01:34:35 +08:00
parent ceaa9dfb55
commit ab2c4df351
3 changed files with 66 additions and 136 deletions

View File

@ -14,23 +14,8 @@ local function ShowMainView(self)
self.root.familyType.selectedIndex = rootLastIndex or 1 self.root.familyType.selectedIndex = rootLastIndex or 1
end end
local function LoadData(BanData)
end
local function GetIconFromGroupData(playerId, group)
local player = group.memberMap[playerId]
if player then
return player.portrait
end
print("玩家不在group中无法找到头像 玩家id=", playerId)
return ""
end
local function RemoveItem(table, condition) local function RemoveItem(table, condition)
for _, item in pairs(table) do for _,item in pairs(table) do
if condition(item) then if condition(item) then
table[_] = nil table[_] = nil
end end
@ -38,7 +23,7 @@ local function RemoveItem(table, condition)
--修复下标 --修复下标
local re = {} local re = {}
for _, item in pairs(table) do for _,item in pairs(table) do
re[#re + 1] = item re[#re + 1] = item
end end
@ -51,11 +36,12 @@ local function GetPlayerFromGroupData(playerId, group)
return player return player
end end
print("玩家不在group中 玩家id=", playerId) print("玩家不在group中 玩家id=",playerId)
return nil return nil
end end
local function AllUid(deskList) local function AllUid(deskList)
local re = {} local re = {}
pt(deskList) pt(deskList)
for _, player in pairs(deskList) do for _, player in pairs(deskList) do
@ -65,6 +51,7 @@ local function AllUid(deskList)
end end
local function AddPlayer(data, self) local function AddPlayer(data, self)
if self.sending then if self.sending then
ViewUtil.ShowBannerOnScreenCenter("正在操作中。。") ViewUtil.ShowBannerOnScreenCenter("正在操作中。。")
return return
@ -83,7 +70,7 @@ local function AddPlayer(data, self)
ViewUtil.ShowBannerOnScreenCenter("设置失败") ViewUtil.ShowBannerOnScreenCenter("设置失败")
return return
end end
data.deskList[#data.deskList + 1] = { uid = number.uid } data.deskList[#data.deskList + 1] = {uid = number.uid}
self:ReflashDesk() self:ReflashDesk()
end) end)
end) end)
@ -111,13 +98,25 @@ local function DelPalyer(data, uid, self)
end end
players = fix players = fix
self.sending = true
local fgCtr = ControllerManager.GetController(NewGroupController) local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_SetBanTable1(self.root._group.id, data.deskId, players, data.deskName, function() self:ReflashDesk() end) fgCtr:FG_SetBanTable1(self.root._group.id, data.deskId, players, data.deskName, function(res)
self.sending = false
if res.ReturnCode ~= 0 then
ViewUtil.ShowBannerOnScreenCenter("删除失败")
return
end
data.deskList = RemoveItem(data.deskList, function(item)
if item.uid == uid then
return true
end
end)
self:ReflashDesk()
end)
end end
local function DelDesk(data, self) local function DelDesk(data, self)
if self.sending then if self.sending then
ViewUtil.ShowBannerOnScreenCenter("正在操作中。。") ViewUtil.ShowBannerOnScreenCenter("正在操作中。。")
return return
@ -186,7 +185,7 @@ local function list_BanedPlayersRenderer(index, obj, data, self, fatherIndex)
end end
local function list_banItemRenderer(index, obj, self) local function list_banItemRenderer(index, obj, self)
local data = self.BanData[index + 1] local data = self.BanData[index +1]
--print("刷新关系") --print("刷新关系")
--pt(data) --pt(data)
local tex_name = obj:GetChild("tex_name") local tex_name = obj:GetChild("tex_name")
@ -198,7 +197,7 @@ local function list_banItemRenderer(index, obj, self)
obj:GetController("cStyle").selectedIndex = 0 obj:GetController("cStyle").selectedIndex = 0
btn_edit.onClick:Set(function() btn_edit.onClick:Set(function()
-- 修改备注 -- 修改备注
self.changedIndex = index self.changedIndex = index
self.selectBanItem = data self.selectBanItem = data
self:OpenRemaskWindow() self:OpenRemaskWindow()
@ -227,6 +226,7 @@ end
function BanDesk:TryShow(r) function BanDesk:TryShow(r)
local view = BanDesk.New() local view = BanDesk.New()
self.root = r self.root = r
@ -259,6 +259,7 @@ function BanDesk.New()
end end
function BanDesk:Init() function BanDesk:Init()
self.sending = false self.sending = false
self.btn_close = self._view:GetChild("btn_close") self.btn_close = self._view:GetChild("btn_close")
@ -292,48 +293,20 @@ function BanDesk:Init()
list_banItemRenderer(index, obj, self) list_banItemRenderer(index, obj, self)
end end
-- list_BanedPlayers.itemRenderer = function(playerIndex, playerObj)
-- local loader_icon = playerObj:GetChild("loader_icon")
-- local tex_name = playerObj:GetChild("tex_name")
-- local player = data.deskList[playerIndex + 1]
-- playerObj:GetController("cStyle").selectedIndex = 0
-- tex_name.text = player.nick
-- local img = GetIconFromGroupData(player.uid, self.root._group)
-- ImageLoad.Load(img, loader_icon)
-- local btn_delPlayer = playerObj:GetChild("btn_delPlayer")
-- btn_delPlayer.onClick:Set(function()
-- -- 删除玩家按钮
-- self.changedIndex = index
-- DelPalyer(data, player.uid, self)
-- end)
-- end
-- list_BanedPlayers.numItems = #data.deskList
-- local add_play = list_BanedPlayers:AddItemFromPool()
-- add_play:GetController("cStyle").selectedIndex = 1
-- add_play:GetChild("btn_addPlayer").onClick:Set(function()
-- -- 添加玩家按钮
-- self.changedIndex = index
-- AddPlayer(data, self)
-- end)
-- end
end end
function BanDesk:Reflash() function BanDesk:Reflash()
local fgCtr = ControllerManager.GetController(NewGroupController) local fgCtr = ControllerManager.GetController(NewGroupController)
local groupId = self.root._group.id local groupId = self.root._group.id
fgCtr:FG_GetBanTable1(groupId, function(res) fgCtr:FG_GetBanTable1(groupId,function(res)
self:GetBanTableCallback(res) self:GetBanTableCallback(res)
end) end)
end end
function BanDesk:GetBanTableCallback(res) function BanDesk:GetBanTableCallback(res)
self.BanData = Sort(res.Data.ban_list) self.BanData = Sort(res.Data.ban_list)
self.list_banItem.numItems = #self.BanData self.list_banItem.numItems = #self.BanData
@ -342,6 +315,7 @@ function BanDesk:GetBanTableCallback(res)
local btn_addBanItem = addBanItem:GetChild("btn_addBanItem") local btn_addBanItem = addBanItem:GetChild("btn_addBanItem")
addBanItem:GetController("cStyle").selectedIndex = 1 addBanItem:GetController("cStyle").selectedIndex = 1
btn_addBanItem.onClick:Set(function() btn_addBanItem.onClick:Set(function()
if self.sending then if self.sending then
ViewUtil.ShowBannerOnScreenCenter("正在操作中。。") ViewUtil.ShowBannerOnScreenCenter("正在操作中。。")
return return
@ -372,4 +346,5 @@ function BanDesk:CloseRemaskWindow()
self.cSetName.selectedIndex = 0 self.cSetName.selectedIndex = 0
end end
return BanDesk return BanDesk

View File

@ -54,6 +54,7 @@ function FamilyMyFamily:TryShow(groupId, r)
end end
function FamilyMyFamily:Show() function FamilyMyFamily:Show()
self:Refalsh() self:Refalsh()
HideMainView() HideMainView()
@ -66,6 +67,7 @@ function FamilyMyFamily:Close()
end end
function FamilyMyFamily:Refalsh() function FamilyMyFamily:Refalsh()
self.family = DataManager.groups.groupMap[self.groupId] self.family = DataManager.groups.groupMap[self.groupId]
self.tex_fName.text = self.family.name self.tex_fName.text = self.family.name
@ -75,7 +77,7 @@ function FamilyMyFamily:Refalsh()
self.tex_nocice.text = self.family.notice self.tex_nocice.text = self.family.notice
ImageLoad.Load(self.family.o_portrait, self.loader_icon) ImageLoad.Load(self.family.o_portrait, self.loader_icon)
self.cStyle.selectedIndex = self.family.lev - 1 self.cStyle.selectedIndex = self.family.lev -1
-- index = 0 是显示隐藏按钮 -- index = 0 是显示隐藏按钮
self.showNumber = self.family.isShow self.showNumber = self.family.isShow
@ -166,7 +168,7 @@ function FamilyMyFamily:Init()
self.btn_quitFamily.onClick:Set(function() self.btn_quitFamily.onClick:Set(function()
local fgCtr = ControllerManager.GetController(NewGroupController) local fgCtr = ControllerManager.GetController(NewGroupController)
print("发送了退出协议 familyid = ", self.family.id) print("发送了退出协议 familyid = ",self.family.id)
fgCtr:FG_ExitGroup(self.family.id, function(res) fgCtr:FG_ExitGroup(self.family.id, function(res)
if res.ReturnCode ~= 0 then if res.ReturnCode ~= 0 then
return return
@ -192,6 +194,7 @@ function FamilyMyFamily:Init()
self.btn_confirmNotice.onClick:Set(ChangeNotice) self.btn_confirmNotice.onClick:Set(ChangeNotice)
self.btn_hideNumber.onClick:Set(function() self.btn_hideNumber.onClick:Set(function()
if self.isShowContenting == true then if self.isShowContenting == true then
ViewUtil.ShowBannerOnScreenCenter("设置中,请稍后再试。。") ViewUtil.ShowBannerOnScreenCenter("设置中,请稍后再试。。")
return return
@ -201,7 +204,7 @@ function FamilyMyFamily:Init()
local fgCtr = ControllerManager.GetController(NewGroupController) local fgCtr = ControllerManager.GetController(NewGroupController)
self.isShowContenting = true self.isShowContenting = true
fgCtr:FG_SetGroupShow(0, self.family.id, function(res) fgCtr:FG_SetGroupShow(0, self.family.id, function (res)
print("收到协议M:FG_SetGroupShow") print("收到协议M:FG_SetGroupShow")
pt(res) pt(res)
self.isShowContenting = false self.isShowContenting = false
@ -225,55 +228,7 @@ function FamilyMyFamily:Init()
local fgCtr = ControllerManager.GetController(NewGroupController) local fgCtr = ControllerManager.GetController(NewGroupController)
self.isShowContenting = true self.isShowContenting = true
fgCtr:FG_SetGroupShow(1, self.family.id, function(res) fgCtr:FG_SetGroupShow(1, self.family.id, function (res)
print("收到协议M:FG_SetGroupShow")
pt(res)
self.isShowContenting = false
if res.ReturnCode ~= 0 then
ViewUtil.ShowBannerOnScreenCenter("设置失败,请稍后再试。。")
return
end
self.family.isShow = 1
self:Refalsh()
ViewUtil.ShowBannerOnScreenCenter("设置成功")
end)
end)
self.btn_hideNumber.onClick:Set(function()
if self.isShowContenting == true then
ViewUtil.ShowBannerOnScreenCenter("设置中,请稍后再试。。")
return
end
print("点击了")
local fgCtr = ControllerManager.GetController(NewGroupController)
self.isShowContenting = true
fgCtr:FG_SetGroupShow(0, self.family.id, function(res)
print("收到协议M:FG_SetGroupShow")
pt(res)
self.isShowContenting = false
if res.ReturnCode ~= 0 then
ViewUtil.ShowBannerOnScreenCenter("设置失败,请稍后再试。。")
return
end
self.family.isShow = 0
self:Refalsh()
ViewUtil.ShowBannerOnScreenCenter("设置成功")
end)
end)
self.btn_showNumber.onClick:Set(function()
if self.isShowContenting == true then
ViewUtil.ShowBannerOnScreenCenter("设置中,请稍后再试。。")
return
end
print("点击了")
local fgCtr = ControllerManager.GetController(NewGroupController)
self.isShowContenting = true
fgCtr:FG_SetGroupShow(1, self.family.id, function(res)
print("收到协议M:FG_SetGroupShow") print("收到协议M:FG_SetGroupShow")
pt(res) pt(res)
self.isShowContenting = false self.isShowContenting = false