2025-04-01 10:48:36 +08:00
|
|
|
|
local JoinGroupView = import('.JoinGroupView')
|
|
|
|
|
|
local GroupJoinsView = import('.GroupJoinsView')
|
|
|
|
|
|
local GroupSetDefaultGameView = import('.GroupSetDefaultGameView')
|
|
|
|
|
|
local GroupManagerView = import('.GroupManagerView')
|
|
|
|
|
|
local GroupRemitView = import('.GroupRemitView')
|
|
|
|
|
|
local RoomItem = import('.RoomItem')
|
|
|
|
|
|
local FGInvitedMsgView = import('.FGInvitedMsgView')
|
|
|
|
|
|
local GroupMemberFagLogView = import('./MngView/GroupMemberFagLogView')
|
|
|
|
|
|
local GroupMngGameListView = import(".MngView/GroupMngGameListView")
|
|
|
|
|
|
local GroupMngFagPackView = import('.GroupMngFagPackView')
|
|
|
|
|
|
local GroupMailView = import('.GroupMailView')
|
|
|
|
|
|
local GroupSelectPlayView = import('.GroupSelectPlayView')
|
|
|
|
|
|
local GroupMngSettingView = import('.GroupMngSettingView')
|
|
|
|
|
|
-- local HeadView = require('Game/View/LobbyHeadView')
|
|
|
|
|
|
GroupNumberInputView_Game = import(".MngView.GroupNumberInputView")
|
|
|
|
|
|
|
|
|
|
|
|
local GroupInfoView = {}
|
|
|
|
|
|
local M = GroupInfoView
|
|
|
|
|
|
|
2025-04-11 12:49:08 +08:00
|
|
|
|
local currentSelectPlay = 0
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
|
|
function GroupInfoView.new(curGroup, fg_info)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
setmetatable(M, { __index = BaseView })
|
|
|
|
|
|
local self = setmetatable({}, { __index = M })
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self.class = 'GroupInfoView'
|
|
|
|
|
|
self.curGroup = curGroup
|
|
|
|
|
|
curGroup.layer = 0
|
|
|
|
|
|
self.fg_info = fg_info
|
|
|
|
|
|
self.roominfo = {}
|
|
|
|
|
|
self.gameIdList = {}
|
|
|
|
|
|
self.playIdList = {}
|
|
|
|
|
|
self._full = true
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self._get_data = false -- 标记是否已获取到数据
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self._showVipRooms = 0
|
|
|
|
|
|
self.lstgameVisible = false
|
|
|
|
|
|
self.isShowRoomItem = (self.curGroup.lev == 1 or self.curGroup.lev == 2)
|
|
|
|
|
|
DataManager.SelfUser.cur_group = self
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self.FillGameItemList = {}
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self:InitView('ui://NewGroup/Main_GroupInfo')
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
return self
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 获取玩法名
|
|
|
|
|
|
local function __getLayerName(self, pid)
|
|
|
|
|
|
if pid == 0 then
|
|
|
|
|
|
return '全 部'
|
|
|
|
|
|
end
|
|
|
|
|
|
--if not self._get_data then
|
|
|
|
|
|
-- return self.playNames[pid] or '已删除'
|
|
|
|
|
|
--end
|
|
|
|
|
|
local p_data = self.curGroup:getPlay(pid)
|
|
|
|
|
|
return p_data and p_data.name or '已删除'
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 加载背景图
|
|
|
|
|
|
local bg_pref = 'base/newgroup/bg/bg0'
|
|
|
|
|
|
local function __setBG(url)
|
|
|
|
|
|
local tex_bg = ResourcesManager.LoadObjectByGroup(url .. '.png', typeof(UnityEngine.Texture), url)
|
|
|
|
|
|
local bg = GImage()
|
|
|
|
|
|
bg.texture = FairyGUI.NTexture(tex_bg)
|
|
|
|
|
|
bg.width = 1751
|
|
|
|
|
|
bg.height = 1001
|
|
|
|
|
|
return bg
|
|
|
|
|
|
end
|
|
|
|
|
|
-- 显示背景
|
|
|
|
|
|
local function __showBG(main_view)
|
|
|
|
|
|
local num = PlayerPrefs.GetInt('fgroup_bg')
|
|
|
|
|
|
if num == 0 then
|
|
|
|
|
|
num = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
local url = bg_pref .. num
|
|
|
|
|
|
local anchor = main_view:GetChild('bg_anchor')
|
|
|
|
|
|
anchor:RemoveChildren(0, -1, true)
|
|
|
|
|
|
local bg = __setBG(url)
|
|
|
|
|
|
anchor:AddChild(bg)
|
|
|
|
|
|
bg.x = -50
|
|
|
|
|
|
bg.y = 0
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local function RoomWeight(room)
|
|
|
|
|
|
local weight = 0
|
|
|
|
|
|
if room.status == 1 then
|
|
|
|
|
|
weight = weight + 1
|
|
|
|
|
|
elseif room.default then
|
|
|
|
|
|
weight = weight + 0
|
|
|
|
|
|
elseif #room.plist == 0 then
|
|
|
|
|
|
weight = weight + 0
|
|
|
|
|
|
elseif room.maxPlayers > #room.plist then
|
|
|
|
|
|
weight = weight + (10 - room.maxPlayers + #room.plist)
|
|
|
|
|
|
elseif room.maxPlayers == #room.plist then
|
|
|
|
|
|
weight = weight + 1
|
|
|
|
|
|
end
|
|
|
|
|
|
room.weight = weight
|
|
|
|
|
|
return weight
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local function RoomWeight1(room)
|
|
|
|
|
|
--printlog("aaaaaaaaawwwwwwwwwwwwwwwwwwwwwwwwwwwww")
|
|
|
|
|
|
--pt(room)
|
|
|
|
|
|
local weight = 0
|
|
|
|
|
|
if room.status == 1 then
|
|
|
|
|
|
weight = weight + 20
|
|
|
|
|
|
elseif room.default then
|
|
|
|
|
|
weight = weight + 0
|
|
|
|
|
|
elseif #room.plist == 0 then
|
|
|
|
|
|
weight = weight + 0
|
|
|
|
|
|
elseif room.maxPlayers > #room.plist then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
weight = 0.5 --weight + (10 - room.maxPlayers + #room.plist)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
elseif room.maxPlayers == #room.plist then
|
|
|
|
|
|
weight = weight + 1
|
|
|
|
|
|
end
|
|
|
|
|
|
room.weight = weight
|
2025-04-11 12:49:08 +08:00
|
|
|
|
-- printlog("aaaaaaaaaaaaaaaaaaaccccccccccccccccccccccc ",weight)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
--pt(room)
|
|
|
|
|
|
return weight
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 房间排序
|
|
|
|
|
|
local function SortRooms(a, b)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
-- printlog("SortRooms====》》》》",currentSelectPlay)
|
|
|
|
|
|
if currentSelectPlay == 0 then
|
|
|
|
|
|
local rwa = RoomWeight(a)
|
|
|
|
|
|
local rwb = RoomWeight(b)
|
|
|
|
|
|
if rwa ~= rwb then
|
|
|
|
|
|
return rwa > rwb
|
|
|
|
|
|
else
|
|
|
|
|
|
return a.pid < b.pid
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
local rwa = RoomWeight1(a)
|
|
|
|
|
|
local rwb = RoomWeight1(b)
|
|
|
|
|
|
if rwa ~= rwb then
|
|
|
|
|
|
return rwa < rwb
|
|
|
|
|
|
else
|
|
|
|
|
|
return a.pid < b.pid
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 填充房间对象
|
|
|
|
|
|
local list_offline = {}
|
|
|
|
|
|
local function __fillRoomItem(self, index, item, room)
|
|
|
|
|
|
if not room then
|
|
|
|
|
|
local rooms = self.curRooms
|
|
|
|
|
|
if not rooms then
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
room = rooms[index + 1]
|
|
|
|
|
|
end
|
|
|
|
|
|
if not room then
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
local curGroup = self.curGroup
|
|
|
|
|
|
local roomid = room.id
|
|
|
|
|
|
local plist = room.plist
|
|
|
|
|
|
local state = room.status
|
|
|
|
|
|
local str = nil
|
|
|
|
|
|
local room_item = self.roomItems[item]
|
|
|
|
|
|
local play = self.curGroup:getPlay(room.pid)
|
|
|
|
|
|
if not room_item then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
room_item = RoomItem.new(item, room.maxPlayers, self.isShowRoomItem)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self.roomItems[item] = room_item
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
room_item:SetPlay(play)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
-- local str="(人数:".. room.maxPlayers
|
|
|
|
|
|
-- if room.limitInRoom then
|
|
|
|
|
|
-- str=str.." 限制积分:"..room.limitInRoom/1000 ..")"
|
|
|
|
|
|
-- else
|
|
|
|
|
|
-- str=str..")"
|
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local str = ""
|
|
|
|
|
|
if room.limitInRoom then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
str = str .. room.limitInRoom / 1000
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if room.round == nil then
|
|
|
|
|
|
room.round = 0
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
|
|
|
|
|
--printlog("wwwwwwwwwww1111111111111111 ",room.round," ",room.times)
|
|
|
|
|
|
room_item.tex_round.text = room.status >= -1 and string.format('%s/%s', room.round, room.times) or ""
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local name = __getLayerName(self, room.pid)
|
|
|
|
|
|
room_item.tex_gamename.text = name
|
|
|
|
|
|
room_item.tex_limit.text = str
|
|
|
|
|
|
|
|
|
|
|
|
-- local currentNum = 0
|
|
|
|
|
|
-- if plist ~= nil then
|
|
|
|
|
|
-- currentNum = #plist
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- room_item.tex_roomid.text = tostring(currentNum) .. '/' .. tostring(room.maxPlayers)
|
|
|
|
|
|
|
|
|
|
|
|
-- local desk = __fillDesk(room.maxPlayers,item)
|
|
|
|
|
|
local desk = room_item.desk
|
|
|
|
|
|
--local play = self.curGroup:getPlay(room.pid)
|
|
|
|
|
|
local isHidden = 0
|
|
|
|
|
|
if play then
|
|
|
|
|
|
if play.isHidden and play.isHidden == 1 then
|
|
|
|
|
|
isHidden = 1
|
|
|
|
|
|
elseif play.config then
|
|
|
|
|
|
local config = json.decode(play.config)
|
|
|
|
|
|
if config.isHidden and config.isHidden == 1 then
|
|
|
|
|
|
isHidden = 1
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
play.isHidden = isHidden
|
|
|
|
|
|
end
|
|
|
|
|
|
room_item.ctr_color.selectedIndex = play and play.deskId or room.color or 0
|
|
|
|
|
|
|
|
|
|
|
|
if not room.default then
|
|
|
|
|
|
for i = 1, room.maxPlayers do
|
|
|
|
|
|
local p_head = room_item.heads[i]
|
|
|
|
|
|
local p_item = p_head.p_item
|
|
|
|
|
|
local btn_head = p_head.btn_head
|
|
|
|
|
|
btn_head._iconObject.texture = room_item.def_icon
|
|
|
|
|
|
if i > #plist then
|
|
|
|
|
|
p_item.visible = false
|
|
|
|
|
|
else
|
|
|
|
|
|
p_item.visible = true
|
|
|
|
|
|
local p = plist[i]
|
|
|
|
|
|
if isHidden == 0 then
|
|
|
|
|
|
p_head.tex_name.text = ViewUtil.stringEllipsis(p.nick)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
p_head.tex_id.text = "ID:" .. p.aid
|
2025-04-01 10:48:36 +08:00
|
|
|
|
ImageLoad.Load(p.portrait, btn_head._iconObject, self.class)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
|
|
|
|
|
if p.hp then
|
|
|
|
|
|
local str1 = "积分:"
|
|
|
|
|
|
local hp = p.hp / 1000
|
|
|
|
|
|
p_head.text_score.text = str1 .. hp
|
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
else
|
|
|
|
|
|
p_head.tex_name.text = "智能"
|
|
|
|
|
|
p_head.tex_id.text = "防作弊"
|
|
|
|
|
|
-- btn_head._iconObject.url = "ui://Common/hiddenHead"
|
|
|
|
|
|
-- ImageLoad.Load("ui://Common/hiddenHead", btn_head._iconObject, self.class)
|
|
|
|
|
|
end
|
|
|
|
|
|
if p.off_time and p.off_time > 0 then
|
|
|
|
|
|
p_item:GetController('offline').selectedIndex = 1
|
|
|
|
|
|
local cur_time = os.time()
|
|
|
|
|
|
local tex_time = p_item:GetChild('tex_time')
|
|
|
|
|
|
tex_time.text = (cur_time - math.min(p.off_time, cur_time)) .. '秒'
|
|
|
|
|
|
local tem = {}
|
|
|
|
|
|
tem.time = math.min(p.off_time, cur_time)
|
|
|
|
|
|
tem.item = tex_time
|
|
|
|
|
|
table.insert(list_offline, tem)
|
|
|
|
|
|
else
|
|
|
|
|
|
p_item:GetController('offline').selectedIndex = 0
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
for i = 1, room.maxPlayers do
|
|
|
|
|
|
local p_head = room_item.heads[i]
|
|
|
|
|
|
local p_item = p_head.p_item
|
|
|
|
|
|
p_item.visible = false
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
-- desk.touchable = false
|
2025-04-01 10:48:36 +08:00
|
|
|
|
desk.onClick:Set(
|
|
|
|
|
|
function()
|
|
|
|
|
|
if room.default or self.curGroup.lev == 3 then
|
|
|
|
|
|
-- 房间点击:假房间 匹配,真房间 加入
|
|
|
|
|
|
if room.default or isHidden == 1 then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self:__startGame(room.id, room.pid, true, isHidden)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
else
|
|
|
|
|
|
self:__joinRoom(roomid)
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
if self.roominfo.view and not self.roominfo.view.isDisposed then
|
|
|
|
|
|
self.roominfo.view:Dispose()
|
|
|
|
|
|
end
|
|
|
|
|
|
local riv = UIPackage.CreateObjectFromURL('ui://NewGroup/Win_roomInfo')
|
|
|
|
|
|
self.roominfo.view = riv
|
|
|
|
|
|
self.roominfo.room = room
|
|
|
|
|
|
riv:GetChild('tex_room_id').text = room.id and '房间号:' .. room.id or ''
|
|
|
|
|
|
local play = self.curGroup:getPlay(room.pid)
|
|
|
|
|
|
riv:GetChild('tex_room_name').text = play.name
|
|
|
|
|
|
self:InitRoomInfoView()
|
|
|
|
|
|
riv:GetChild('btn_enter').onClick:Set(
|
|
|
|
|
|
function()
|
|
|
|
|
|
riv:Dispose()
|
|
|
|
|
|
if room.default or isHidden == 1 then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self:__startGame(room.id, room.pid, true, isHidden)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
else
|
|
|
|
|
|
self:__joinRoom(roomid)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
riv:GetChild('btn_del').onClick:Set(
|
|
|
|
|
|
function()
|
|
|
|
|
|
local _curren_msg =
|
|
|
|
|
|
MsgWindow.new(
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self._root_view,
|
|
|
|
|
|
'确定解散该桌子吗?\r(解散该桌子没有任何结算信息,请谨慎操作)',
|
|
|
|
|
|
MsgWindow.MsgMode.OkAndCancel
|
|
|
|
|
|
)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
_curren_msg.onOk:Add(
|
|
|
|
|
|
function()
|
|
|
|
|
|
ViewUtil.ShowModalWait(self._root_view)
|
|
|
|
|
|
local fgCtr = ControllerManager.GetController(NewGroupController)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
fgCtr:FG_RemoveRoom(
|
|
|
|
|
|
self.curGroup.id,
|
|
|
|
|
|
roomid,
|
|
|
|
|
|
function(res)
|
|
|
|
|
|
if self._is_destroy then
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
ViewUtil.CloseModalWait()
|
|
|
|
|
|
if res.ReturnCode ~= 0 then
|
|
|
|
|
|
ViewUtil.ErrorTip(res.ReturnCode, '删除房间失败!')
|
|
|
|
|
|
return
|
|
|
|
|
|
else
|
|
|
|
|
|
riv:Dispose()
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
_curren_msg:Show()
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
riv:GetChild('btn_close').onClick:Set(
|
|
|
|
|
|
function()
|
|
|
|
|
|
riv:Dispose()
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
self._view:AddChild(riv)
|
|
|
|
|
|
riv:Center()
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local key = tostring(self.curGroup.id)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self.fg_info[key] = room.pid
|
|
|
|
|
|
local filename = 'fginfo_' .. DataManager.SelfUser.account_id
|
|
|
|
|
|
Utils.SaveLocalFile(filename, json.encode(self.fg_info))
|
2025-04-11 12:49:08 +08:00
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local ROOM_ITEM = {}
|
|
|
|
|
|
ROOM_ITEM[2] = 'ui://NewGroup/Item_room2'
|
|
|
|
|
|
ROOM_ITEM[3] = 'ui://NewGroup/Item_room3'
|
|
|
|
|
|
ROOM_ITEM[4] = 'ui://NewGroup/Item_room4'
|
|
|
|
|
|
ROOM_ITEM[5] = 'ui://NewGroup/Item_room5'
|
|
|
|
|
|
ROOM_ITEM[6] = 'ui://NewGroup/Item_room6'
|
|
|
|
|
|
ROOM_ITEM[8] = 'ui://NewGroup/Item_room8'
|
|
|
|
|
|
ROOM_ITEM[9] = 'ui://NewGroup/Item_room9'
|
|
|
|
|
|
ROOM_ITEM[10] = 'ui://NewGroup/Item_room10'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 填充房间列表
|
|
|
|
|
|
-- 全部玩法和单个玩法的假房间填充方式不同
|
|
|
|
|
|
local function __fillRoomData(self)
|
|
|
|
|
|
local curGroup = self.curGroup
|
|
|
|
|
|
local lst_room = self.lst_room
|
|
|
|
|
|
local currentPlayID = self:GetSelectedPlayID()
|
|
|
|
|
|
local currentGameID = self:GetSelectedGameID()
|
|
|
|
|
|
|
2025-04-11 12:49:08 +08:00
|
|
|
|
-- self.lst_layer.visible = currentGameID > 0
|
2025-04-01 10:48:36 +08:00
|
|
|
|
--self.line1.visible = currentGameID > 0
|
|
|
|
|
|
if currentPlayID > 0 then
|
|
|
|
|
|
--printlog("aaaaaaaaaaaaaaaaa11111111111111111111111111111111")
|
|
|
|
|
|
-- 单个玩法
|
|
|
|
|
|
local rooms = self.curGroup:getPlay(currentPlayID).rooms
|
|
|
|
|
|
local trooms = {}
|
2025-04-11 12:49:08 +08:00
|
|
|
|
for i = 1, #rooms do
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local room = rooms[i]
|
|
|
|
|
|
local play = self.curGroup:getPlay(room.pid)
|
|
|
|
|
|
local isvip = 0
|
|
|
|
|
|
local isHidden = 0
|
|
|
|
|
|
if play then
|
|
|
|
|
|
if play.isvip and play.isvip == 1 then
|
|
|
|
|
|
isvip = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
if play.isHidden and play.isHidden == 1 then
|
|
|
|
|
|
isHidden = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if (play.isvip == nil or play.isHidden == nil) and play.config then
|
|
|
|
|
|
local config = json.decode(play.config)
|
|
|
|
|
|
if config.isvip and config.isvip == 1 then
|
|
|
|
|
|
isvip = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
if config.isHidden and config.isHidden == 1 then
|
|
|
|
|
|
isHidden = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
play.isHidden = isHidden
|
2025-04-01 10:48:36 +08:00
|
|
|
|
play.isvip = isvip
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-----------
|
|
|
|
|
|
if isvip == self._showVipRooms then
|
|
|
|
|
|
if isHidden == 1 then
|
|
|
|
|
|
if #room.plist == room.maxPlayers or self.curGroup.lev < 3 then
|
|
|
|
|
|
table.insert(trooms, room)
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
table.insert(trooms, room)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
self.curRooms = membe_clone(trooms)
|
|
|
|
|
|
|
|
|
|
|
|
local room = membe_clone(self.curGroup.default_rooms[self.curGroup:getPlayIndex(currentPlayID)])
|
|
|
|
|
|
local play = self.curGroup:getPlay(room.pid)
|
|
|
|
|
|
local isvip = 0
|
|
|
|
|
|
if play then
|
|
|
|
|
|
if play.isvip and play.isvip == 1 then
|
|
|
|
|
|
isvip = 1
|
|
|
|
|
|
elseif play.config then
|
|
|
|
|
|
local config = json.decode(play.config)
|
|
|
|
|
|
if config.isvip and config.isvip == 1 then
|
|
|
|
|
|
isvip = 1
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
play.isvip = isvip
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
|
|
|
|
|
------
|
|
|
|
|
|
if isvip == self._showVipRooms then
|
|
|
|
|
|
local hp = json.decode(play.hpData)
|
|
|
|
|
|
if hp and hp.maxRound then
|
|
|
|
|
|
room.times = hp.maxRound
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if hp and hp.limitInRoom then
|
|
|
|
|
|
room.limitInRoom = hp.limitInRoom
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table.insert(self.curRooms, room)
|
|
|
|
|
|
end
|
|
|
|
|
|
-----
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
if currentGameID == 0 then
|
|
|
|
|
|
--printlog("aaaaaaaaaaaaaaaaa222222222222222222222222222")
|
|
|
|
|
|
local rooms = curGroup.rooms
|
|
|
|
|
|
local trooms = {}
|
2025-04-11 12:49:08 +08:00
|
|
|
|
for i = 1, #rooms do
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local room = rooms[i]
|
|
|
|
|
|
local play = self.curGroup:getPlay(room.pid)
|
|
|
|
|
|
local isvip = 0
|
|
|
|
|
|
local isHidden = 0
|
|
|
|
|
|
if play then
|
|
|
|
|
|
if play.isvip and play.isvip == 1 then
|
|
|
|
|
|
isvip = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
if play.isHidden and play.isHidden == 1 then
|
|
|
|
|
|
isHidden = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if (play.isvip == nil or play.isHidden == nil) and play.config then
|
|
|
|
|
|
local config = json.decode(play.config)
|
|
|
|
|
|
if config.isvip and config.isvip == 1 then
|
|
|
|
|
|
isvip = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
if config.isHidden and config.isHidden == 1 then
|
|
|
|
|
|
isHidden = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
play.isHidden = isHidden
|
2025-04-01 10:48:36 +08:00
|
|
|
|
play.isvip = isvip
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
|
|
|
|
|
-----
|
|
|
|
|
|
if isvip == self._showVipRooms then
|
|
|
|
|
|
if play.isHidden == 1 then
|
|
|
|
|
|
if #room.plist == room.maxPlayers or self.curGroup.lev < 3 then
|
|
|
|
|
|
table.insert(trooms, room)
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
table.insert(trooms, room)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
self.curRooms = membe_clone(trooms)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
for i = 1, #self.curGroup.playList do
|
|
|
|
|
|
local defaultRoom = self.curGroup.default_rooms[i]
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local play = self.curGroup:getPlay(defaultRoom.pid)
|
|
|
|
|
|
local isvip = 0
|
|
|
|
|
|
if play then
|
|
|
|
|
|
if play.isvip and play.isvip == 1 then
|
|
|
|
|
|
isvip = 1
|
|
|
|
|
|
elseif play.config then
|
|
|
|
|
|
local config = json.decode(play.config)
|
|
|
|
|
|
if config.isvip and config.isvip == 1 then
|
|
|
|
|
|
isvip = 1
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
play.isvip = isvip
|
|
|
|
|
|
end
|
|
|
|
|
|
if isvip == self._showVipRooms then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
local hp = json.decode(self.curGroup.playList[i].hpData)
|
|
|
|
|
|
defaultRoom.limitInRoom = hp.limitInRoom
|
|
|
|
|
|
if hp.maxRound then
|
|
|
|
|
|
defaultRoom.times = hp.maxRound
|
|
|
|
|
|
end
|
|
|
|
|
|
local totalNum = 1
|
|
|
|
|
|
if hp.tex_times_room then
|
|
|
|
|
|
totalNum = hp.tex_times_room / 1000
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
for i = 1, totalNum do
|
|
|
|
|
|
self.curRooms[#self.curRooms + 1] = defaultRoom
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
--printlog("aaaaaaaaaaaaaaaaa33333333333333333333333333333333")
|
|
|
|
|
|
self.curRooms = {}
|
|
|
|
|
|
|
|
|
|
|
|
for i = 1, #self.curGroup.playList do
|
|
|
|
|
|
local p_data = self.curGroup.playList[i]
|
|
|
|
|
|
local isvip = 0
|
|
|
|
|
|
local isHidden = 0
|
|
|
|
|
|
if p_data.isvip and p_data.isvip == 1 then
|
|
|
|
|
|
isvip = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
if p_data.isHidden and p_data.isHidden == 1 then
|
|
|
|
|
|
isHidden = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
if (p_data.isvip == nil or p_data.isHidden == nil) and p_data.config then
|
|
|
|
|
|
local config = json.decode(p_data.config)
|
|
|
|
|
|
if config.isvip and config.isvip == 1 then
|
|
|
|
|
|
isvip = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
if config.isHidden and config.isHidden == 1 then
|
|
|
|
|
|
isHidden = 1
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
p_data.isvip = isvip
|
|
|
|
|
|
p_data.isHidden = isHidden
|
|
|
|
|
|
|
|
|
|
|
|
if p_data.gameId == currentGameID and isvip == self._showVipRooms then
|
|
|
|
|
|
local tempRooms = membe_clone(p_data.rooms)
|
|
|
|
|
|
if #tempRooms > 0 then
|
|
|
|
|
|
for j = 1, #tempRooms do
|
|
|
|
|
|
local tempRoom = tempRooms[j]
|
|
|
|
|
|
if isHidden == 1 then
|
|
|
|
|
|
if tempRoom.maxPlayers == #tempRoom.plist or self.curGroup.lev < 3 then
|
|
|
|
|
|
self.curRooms[#self.curRooms + 1] = tempRoom
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
self.curRooms[#self.curRooms + 1] = tempRoom
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local hp = json.decode(p_data.hpData)
|
|
|
|
|
|
if hp and hp.maxRound then
|
|
|
|
|
|
self.curGroup.default_rooms[i].times = hp.maxRound
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if hp and hp.limitInRoom then
|
|
|
|
|
|
self.curGroup.default_rooms[i].limitInRoom = hp.limitInRoom
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local totalNum = 1
|
|
|
|
|
|
if hp and hp.tex_times_room then
|
|
|
|
|
|
totalNum = hp.tex_times_room / 1000
|
|
|
|
|
|
end
|
|
|
|
|
|
for j = 1, totalNum do
|
|
|
|
|
|
self.curRooms[#self.curRooms + 1] = self.curGroup.default_rooms[i]
|
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
|
|
|
|
|
currentSelectPlay = self:GetSelectedPlayID()
|
|
|
|
|
|
table.sort(self.curRooms, SortRooms)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
list_offline = {}
|
|
|
|
|
|
|
|
|
|
|
|
if self.curGroup.lev < 3 then
|
|
|
|
|
|
self.lst_room.numItems = #self.curRooms
|
|
|
|
|
|
else
|
|
|
|
|
|
if self.curGroup.show_num > 0 and #self.curRooms > self.curGroup.show_num then
|
|
|
|
|
|
local tr = {}
|
|
|
|
|
|
|
|
|
|
|
|
for j = 1, #self.curRooms do
|
|
|
|
|
|
if #tr < self.curGroup.show_num or self.curRooms[j].default == true then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
table.insert(tr, self.curRooms[j])
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
self.curRooms = tr
|
|
|
|
|
|
end
|
|
|
|
|
|
self.lst_room.numItems = #self.curRooms
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
|
|
-- if self._ctr_search.selectedIndex == 1 then
|
|
|
|
|
|
-- self.lst_room_search:RemoveChildrenToPool()
|
|
|
|
|
|
-- for i = 1, #curGroup.rooms do
|
|
|
|
|
|
-- local room = curGroup.rooms[i]
|
|
|
|
|
|
-- if room.id == self.search_key then
|
|
|
|
|
|
-- local item = self.lst_room_search:AddItemFromPool(ROOM_ITEM[room.maxPlayers])
|
|
|
|
|
|
-- __fillRoomItem(self, nil, item, room)
|
|
|
|
|
|
-- else
|
|
|
|
|
|
-- for i = 1, #room.plist do
|
|
|
|
|
|
-- local p = room.plist[i]
|
|
|
|
|
|
-- if self.search_key == tostring(p.aid) then
|
|
|
|
|
|
-- local item = self.lst_room_search:AddItemFromPool(ROOM_ITEM[room.maxPlayers])
|
|
|
|
|
|
-- __fillRoomItem(self, nil, item, room)
|
|
|
|
|
|
-- break
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
|
|
if self.roominfo.view and not self.roominfo.view.isDisposed then
|
|
|
|
|
|
for i = 1, #curGroup.rooms do
|
|
|
|
|
|
if curGroup.rooms[i].id == self.roominfo.room.id then
|
|
|
|
|
|
self.roominfo.room = curGroup.rooms[i]
|
|
|
|
|
|
self:InitRoomInfoView()
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:InitRoomInfoView()
|
|
|
|
|
|
local room = self.roominfo.room
|
|
|
|
|
|
if not room.default then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
printlog("wwwwwwwwwww22222222222222222 ", room.round, " ", room.times)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self.roominfo.view:GetChild('tex_round').text = string.format('(%s/%s)', room.round, room.times)
|
|
|
|
|
|
local lst_player = self.roominfo.view:GetChild('lst_player')
|
|
|
|
|
|
lst_player:RemoveChildrenToPool()
|
|
|
|
|
|
if room.plist and #room.plist > 0 then
|
|
|
|
|
|
for i = 1, #room.plist do
|
|
|
|
|
|
local p = room.plist[i]
|
|
|
|
|
|
local item = lst_player:AddItemFromPool()
|
|
|
|
|
|
item:GetChild('tex_name').text = ViewUtil.stringEllipsis(p.nick)
|
|
|
|
|
|
local play = self.curGroup:getPlay(room.pid)
|
|
|
|
|
|
-- local score = play.hpOnOff == 0 and p.score or d2ad(p.score * play.hp_times)
|
|
|
|
|
|
-- score = score >= 0 and '+' .. score or score
|
|
|
|
|
|
-- item:GetController('nega').selectedIndex = p.score >= 0 and 0 or 1
|
|
|
|
|
|
-- item:GetChild('tex_score').text = score
|
|
|
|
|
|
item:GetChild('tex_score').visible = false
|
|
|
|
|
|
ImageLoad.Load(p.portrait, item:GetChild('btn_head')._iconObject, self.class)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 显示默认选择的玩法
|
|
|
|
|
|
function M:ShowSelectedGame()
|
|
|
|
|
|
do return end
|
|
|
|
|
|
|
|
|
|
|
|
local btn_choose = self._view:GetChild('btn_choose')
|
|
|
|
|
|
local tex_gamename = btn_choose:GetChild('tex_gamename')
|
|
|
|
|
|
local pid = self.fg_info[tostring(self.curGroup.id)]
|
|
|
|
|
|
local play = self.curGroup:getPlay(pid)
|
|
|
|
|
|
if play then
|
|
|
|
|
|
tex_gamename.text = play.name
|
|
|
|
|
|
else
|
|
|
|
|
|
btn_choose:GetController('null').selectedIndex = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 玩法名字显示
|
|
|
|
|
|
local function __fillPlayItem(self, index, item)
|
|
|
|
|
|
local tex_game = item:GetChild('tex_game')
|
|
|
|
|
|
local pipeijoin = item:GetChild('pipeijoin')
|
|
|
|
|
|
|
|
|
|
|
|
if (index == 0) then
|
|
|
|
|
|
tex_game.text = __getLayerName(self, 0)
|
|
|
|
|
|
else
|
|
|
|
|
|
pipeijoin.onClick:Add(
|
|
|
|
|
|
function()
|
|
|
|
|
|
local currentPlayID = self:GetSelectedPlayID()
|
|
|
|
|
|
if currentPlayID == 0 then
|
|
|
|
|
|
if self.lst_layer.selectedIndex == 0 and self.lst_game.selectedIndex > 0 then
|
|
|
|
|
|
local pid = self.fg_info[tostring(self.curGroup.id)]
|
|
|
|
|
|
if pid == 0 then
|
|
|
|
|
|
ViewUtil.ErrorTip(nil, '没有选择玩法')
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
local p_data = self.curGroup:getPlay(pid)
|
|
|
|
|
|
local currentGameID = self:GetSelectedGameID()
|
|
|
|
|
|
if currentGameID == p_data.gameId then
|
|
|
|
|
|
currentPlayID = pid
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
if currentPlayID == 0 then
|
|
|
|
|
|
ViewUtil.ErrorTip(nil, '没有选择玩法')
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self:__startGame("", currentPlayID, false)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
tex_game.text = __getLayerName(self, self.playIdList[index])
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local _iconMap = {}
|
|
|
|
|
|
local function __fillExtendIcon(id, callback)
|
|
|
|
|
|
local File = System.IO.File
|
|
|
|
|
|
local path = Application.persistentDataPath .. '/UserData/Icon'
|
|
|
|
|
|
if not System.IO.Directory.Exists(path) then
|
|
|
|
|
|
System.IO.Directory.CreateDirectory(path)
|
|
|
|
|
|
end
|
|
|
|
|
|
local file = path .. '/icon_' .. id .. '.png'
|
|
|
|
|
|
local version
|
|
|
|
|
|
for k, v in pairs(DataManager.SelfUser.games) do
|
|
|
|
|
|
if v.game_id == id then
|
|
|
|
|
|
version = v.version
|
|
|
|
|
|
break
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
local loc_version
|
|
|
|
|
|
local ver_file = path .. '/Icon_' .. id
|
|
|
|
|
|
if _iconMap[id] then
|
|
|
|
|
|
callback(_iconMap[id].ntexture)
|
|
|
|
|
|
else
|
|
|
|
|
|
if File.Exists(ver_file) then
|
|
|
|
|
|
loc_version = File.ReadAllText(ver_file)
|
|
|
|
|
|
end
|
|
|
|
|
|
if not File.Exists(file) or not loc_version or loc_version ~= version then
|
|
|
|
|
|
coroutine.start(
|
|
|
|
|
|
function()
|
|
|
|
|
|
Utils.DownloadFile(
|
|
|
|
|
|
GetGameInfo('pack_url') .. '/icons/icon_' .. id .. '.png',
|
|
|
|
|
|
file,
|
|
|
|
|
|
function(...)
|
|
|
|
|
|
File.WriteAllText(ver_file, version)
|
|
|
|
|
|
local bytes = File.ReadAllBytes(file)
|
|
|
|
|
|
local texture = UnityEngine.Texture2D(128, 128)
|
|
|
|
|
|
texture:LoadImage(bytes)
|
|
|
|
|
|
local ntexture = FairyGUI.NTexture(texture)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
_iconMap[id] = { texture = texture, ntexture = ntexture }
|
2025-04-01 10:48:36 +08:00
|
|
|
|
callback(ntexture)
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
else
|
|
|
|
|
|
local bytes = File.ReadAllBytes(file)
|
|
|
|
|
|
local texture = UnityEngine.Texture2D(128, 128)
|
|
|
|
|
|
texture:LoadImage(bytes)
|
|
|
|
|
|
local ntexture = FairyGUI.NTexture(texture)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
_iconMap[id] = { texture = texture, ntexture = ntexture }
|
2025-04-01 10:48:36 +08:00
|
|
|
|
callback(ntexture)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local function GetGameName(index)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
if index == 0 then return "全 部" end
|
|
|
|
|
|
local list = DataManager.SelfUser.games
|
|
|
|
|
|
for k, v in ipairs(list) do
|
|
|
|
|
|
if v.game_id == index then
|
|
|
|
|
|
return v.name
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
return ""
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 玩法名字显示
|
|
|
|
|
|
local function __fillGameItem(self, index, item)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
local gameName = ""
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if (index == 0) then
|
|
|
|
|
|
item.icon = 'ui://NewGroup/quyxtb'
|
2025-04-11 12:49:08 +08:00
|
|
|
|
gameName = GetGameName(0)
|
|
|
|
|
|
item:GetChild("n11").text = gameName
|
|
|
|
|
|
if self.currentGameItemName == nil then
|
|
|
|
|
|
item.icon = 'ui://NewGroup/quyxtb-1'
|
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
else
|
|
|
|
|
|
local gameId = self.gameIdList[index]
|
|
|
|
|
|
local config = ExtendManager.GetExtendConfig(gameId)
|
|
|
|
|
|
local mode = config:GetGameInfo()
|
2025-04-11 12:49:08 +08:00
|
|
|
|
local iconName = mode:GetIconUrl1()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
item.icon = iconName
|
2025-04-11 12:49:08 +08:00
|
|
|
|
gameName = GetGameName(gameId)
|
|
|
|
|
|
item:GetChild("n11").text = gameName
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if item.icon == self.currentGameItemName then
|
|
|
|
|
|
item.icon = self.currentGameItemName .. "-1"
|
|
|
|
|
|
item:GetChild("n11").text = gameName
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
item:GetChild("n22").text = index + 1
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local function __analysePlayListData(self)
|
|
|
|
|
|
self.playIdList = {}
|
2025-04-11 12:49:08 +08:00
|
|
|
|
DataManager.SelfUser.PlayLocalList = {}
|
|
|
|
|
|
|
|
|
|
|
|
local playName = "playfaconfig" .. self.curGroup.id
|
|
|
|
|
|
local json_data = Utils.LoadLocalFile(playName)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if json_data then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
local data = json.decode(json_data)
|
|
|
|
|
|
DataManager.SelfUser.PlayLocalList = data
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local count = 0
|
|
|
|
|
|
local curGroup = self.curGroup
|
|
|
|
|
|
local gameid = self:GetSelectedGameID()
|
|
|
|
|
|
for i = 1, #curGroup.playList do
|
|
|
|
|
|
local p_data = curGroup.playList[i]
|
|
|
|
|
|
local isvip = 0
|
|
|
|
|
|
if p_data.isvip and p_data.isvip == 1 then
|
|
|
|
|
|
isvip = 1
|
|
|
|
|
|
elseif p_data.config then
|
|
|
|
|
|
local config = json.decode(p_data.config)
|
|
|
|
|
|
if config.isvip and config.isvip == 1 then
|
|
|
|
|
|
isvip = 1
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
p_data.isvip = isvip
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
|
|
|
|
|
local isHasPlayC = true
|
|
|
|
|
|
--[[for k,v in pairs(DataManager.SelfUser.PlayLocalList) do
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if tonumber(k)==p_data.id then
|
|
|
|
|
|
isHasPlayC=v
|
|
|
|
|
|
end
|
|
|
|
|
|
end--]]
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
|
|
|
|
|
if (gameid == 0 or p_data.gameId == gameid) and isHasPlayC and isvip == self._showVipRooms then
|
2025-04-01 10:48:36 +08:00
|
|
|
|
count = count + 1
|
|
|
|
|
|
self.playIdList[count] = p_data.id
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local lst_layer = self.lst_layer
|
2025-04-11 12:49:08 +08:00
|
|
|
|
-- printlog("添加玩法====>>>>",count)
|
|
|
|
|
|
-- pt(curGroup.playList)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
lst_layer.numItems = count + 1
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local function __analyseGameListData(self)
|
|
|
|
|
|
self.gameIdList = {}
|
|
|
|
|
|
|
|
|
|
|
|
local count = 0
|
|
|
|
|
|
local curGroup = self.curGroup
|
|
|
|
|
|
|
|
|
|
|
|
for i = 1, #curGroup.playList do
|
|
|
|
|
|
local p_data = curGroup.playList[i]
|
|
|
|
|
|
local isvip = 0
|
|
|
|
|
|
if p_data.isvip and p_data.isvip == 1 then
|
|
|
|
|
|
isvip = 1
|
|
|
|
|
|
elseif p_data.config then
|
|
|
|
|
|
local config = json.decode(p_data.config)
|
|
|
|
|
|
if config.isvip and config.isvip == 1 then
|
|
|
|
|
|
isvip = 1
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
p_data.isvip = isvip
|
|
|
|
|
|
|
|
|
|
|
|
if isvip == self._showVipRooms then
|
|
|
|
|
|
local existed = false
|
|
|
|
|
|
for j = 1, #self.gameIdList do
|
|
|
|
|
|
if self.gameIdList[j] == p_data.gameId then
|
|
|
|
|
|
existed = true
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if existed == false then
|
|
|
|
|
|
self.gameIdList[#self.gameIdList + 1] = p_data.gameId
|
2025-04-11 12:49:08 +08:00
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
self.lst_game.numItems = #self.gameIdList + 1
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:GetSelectedGameID()
|
|
|
|
|
|
if self.lst_game.selectedIndex == -1 or self.lst_game.selectedIndex == 0 then
|
|
|
|
|
|
return 0
|
|
|
|
|
|
else
|
|
|
|
|
|
if self.lst_game.selectedIndex <= #self.gameIdList then
|
|
|
|
|
|
return self.gameIdList[self.lst_game.selectedIndex]
|
|
|
|
|
|
else
|
|
|
|
|
|
return 0
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:GetSelectedPlayID()
|
|
|
|
|
|
local lst_layer = self.lst_layer
|
|
|
|
|
|
|
|
|
|
|
|
if lst_layer.selectedIndex == 0 or lst_layer.selectedIndex == -1 then
|
|
|
|
|
|
return 0
|
|
|
|
|
|
else
|
|
|
|
|
|
if lst_layer.selectedIndex <= #self.playIdList then
|
|
|
|
|
|
return self.playIdList[lst_layer.selectedIndex]
|
|
|
|
|
|
else
|
|
|
|
|
|
return 0
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:InitView(url)
|
|
|
|
|
|
BaseView.InitView(self, url)
|
|
|
|
|
|
self._full_offset = false
|
2025-07-22 20:00:07 +08:00
|
|
|
|
|
|
|
|
|
|
self._view:GetChild('tex_name').emojies = EmojiDitc.EmojiesDitc
|
2025-04-01 10:48:36 +08:00
|
|
|
|
-- __showBG(self._view)
|
|
|
|
|
|
|
|
|
|
|
|
-- local btndel = self._view:GetChild("btn_del")
|
|
|
|
|
|
-- local texroomid = self._view:GetChild('tex_roomid')
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
-- btndel.onClick:Set(
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
-- function()
|
|
|
|
|
|
-- local delroomid
|
|
|
|
|
|
-- delroomid = (texroomid.text) or 0
|
|
|
|
|
|
-- if texroomid.text == "" then
|
|
|
|
|
|
-- ViewUtil.CloseModalWait()
|
|
|
|
|
|
-- ViewUtil.ErrorTip(nil, '输入不能为空')
|
|
|
|
|
|
-- return
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- local _curren_msg =
|
|
|
|
|
|
-- MsgWindow.new(
|
|
|
|
|
|
-- self._root_view,
|
|
|
|
|
|
-- '确定解散该桌子吗?\r(解散该桌子没有任何结算信息,请谨慎操作)',
|
|
|
|
|
|
-- MsgWindow.MsgMode.OkAndCancel
|
|
|
|
|
|
-- )
|
|
|
|
|
|
-- _curren_msg.onOk:Add(
|
|
|
|
|
|
-- function()
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
-- ViewUtil.ShowModalWait(self._root_view)
|
|
|
|
|
|
-- local fgCtr = ControllerManager.GetController(NewGroupController)
|
|
|
|
|
|
-- fgCtr:FG_RemoveRoom(
|
|
|
|
|
|
-- self.curGroup.id,
|
|
|
|
|
|
-- delroomid,
|
|
|
|
|
|
-- function(res)
|
|
|
|
|
|
-- if self._is_destroy then
|
|
|
|
|
|
-- return
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- ViewUtil.CloseModalWait()
|
|
|
|
|
|
-- if res.ReturnCode ~= 0 then
|
|
|
|
|
|
-- ViewUtil.ErrorTip(res.ReturnCode, '删除房间失败!')
|
|
|
|
|
|
-- return
|
|
|
|
|
|
-- else
|
|
|
|
|
|
-- ViewUtil.ErrorTip(res.ReturnCode, '删除房间成功!')
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- )
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- )
|
|
|
|
|
|
-- _curren_msg:Show()
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self._view:GetChild('tex_id').text = "ID:" .. self.curGroup.id
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
2025-07-22 20:00:07 +08:00
|
|
|
|
self._view:GetChild('tex_name').text = Utils.TextOmit(self.curGroup.name, 6)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
|
|
-- self._view:GetChild('tex_p_name').text = ViewUtil.stringEllipsis(DataManager.SelfUser.nick_name)
|
|
|
|
|
|
|
|
|
|
|
|
-- self._view:GetChild('tex_p_id').text = DataManager.SelfUser.account_id
|
|
|
|
|
|
|
|
|
|
|
|
-- local player_diamond = self._view:GetChild('player_diamond')
|
|
|
|
|
|
-- player_diamond.onClick:Add(
|
|
|
|
|
|
-- function()
|
|
|
|
|
|
-- local pay_url = GetGameInfo('pay_url') .. 'accId=' .. DataManager.SelfUser.account_id
|
|
|
|
|
|
-- UnityEngine.Application.OpenURL(pay_url)
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- )
|
|
|
|
|
|
|
|
|
|
|
|
--local btn_head = self._view:GetChild('btn_head')
|
|
|
|
|
|
--ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject)
|
|
|
|
|
|
-- btn_head.onClick:Set(
|
|
|
|
|
|
-- function()
|
|
|
|
|
|
-- local headView = HeadView.new(self._root_view, DataManager.SelfUser)
|
|
|
|
|
|
-- headView:Show()
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- )
|
|
|
|
|
|
|
|
|
|
|
|
-- self._view:GetChild('player_diamond').text = self.curGroup.diamo
|
|
|
|
|
|
|
|
|
|
|
|
self._view:GetController('alliance').selectedIndex = self.curGroup.type == 2 and 1 or 0
|
|
|
|
|
|
self.ctr_newmail = self._view:GetController('new_mail')
|
|
|
|
|
|
|
|
|
|
|
|
self.lst_game = self._view:GetChild('game_list')
|
|
|
|
|
|
self.lst_game:SetVirtual()
|
|
|
|
|
|
self.lst_game.itemRenderer = function(index, item)
|
|
|
|
|
|
__fillGameItem(self, index, item)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- local btn_remit = self._view:GetChild('btn_remit')
|
2025-04-11 12:49:08 +08:00
|
|
|
|
-- btn_remit.visible = false
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
|
|
self.lst_game.onClickItem:Add(
|
|
|
|
|
|
function(pas)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
if self.currentSelectItem == pas.data then return end
|
|
|
|
|
|
local name = pas.data.icon
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self.currentSelectItem = pas.data
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self.currentGameItemName = name
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self.lst_layer.selectedIndex = 0
|
|
|
|
|
|
self:__refreshPay()
|
|
|
|
|
|
__analyseGameListData(self)
|
|
|
|
|
|
__analysePlayListData(self)
|
|
|
|
|
|
__fillRoomData(self)
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
-- self.line1 = self._view:GetChild('line1')
|
2025-04-01 10:48:36 +08:00
|
|
|
|
--self.line1.visible = false
|
|
|
|
|
|
self.lst_layer = self._view:GetChild('lst_layer')
|
|
|
|
|
|
self.lst_layer:SetVirtual()
|
|
|
|
|
|
self.lst_layer.itemRenderer = function(index, item)
|
|
|
|
|
|
__fillPlayItem(self, index, item)
|
|
|
|
|
|
--if index>0 then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
-- __fillPlayItem(self, index, item)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
--else
|
2025-04-11 12:49:08 +08:00
|
|
|
|
-- item.width = 0
|
|
|
|
|
|
-- item.height = 0
|
|
|
|
|
|
-- item.visible = false
|
|
|
|
|
|
-- end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
|
|
self.lst_layer.onClickItem:Add(
|
|
|
|
|
|
function()
|
|
|
|
|
|
self:__loadPlayData()
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local btn_quanbu = self._view:GetChild('btn_quanbu')
|
|
|
|
|
|
btn_quanbu.onClick:Set(
|
2025-04-11 12:49:08 +08:00
|
|
|
|
function()
|
|
|
|
|
|
self.lst_layer.selectedIndex = 0
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self:__loadPlayData()
|
2025-04-11 12:49:08 +08:00
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.roomItems = {}
|
|
|
|
|
|
self.lst_room = self._view:GetChild('lst_room')
|
|
|
|
|
|
self.lst_room:SetVirtual()
|
|
|
|
|
|
self.lst_room.itemRenderer = function(index, item)
|
|
|
|
|
|
__fillRoomItem(self, index, item)
|
|
|
|
|
|
end
|
|
|
|
|
|
self.lst_room.itemProvider = function(index)
|
|
|
|
|
|
local rooms = self.curRooms
|
|
|
|
|
|
if not rooms then
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local room = rooms[index + 1]
|
|
|
|
|
|
if not room then
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
return ROOM_ITEM[room.maxPlayers]
|
|
|
|
|
|
end
|
|
|
|
|
|
self.lst_room.fairyBatching = true
|
|
|
|
|
|
|
|
|
|
|
|
-- 全部玩法的快速开始按钮
|
|
|
|
|
|
local btn_start = self._view:GetChild('btn_start')
|
|
|
|
|
|
btn_start.onClick:Set(
|
|
|
|
|
|
function()
|
|
|
|
|
|
local pid = self.fg_info[tostring(self.curGroup.id)]
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if pid == 0 then
|
|
|
|
|
|
ViewUtil.ErrorTip(nil, '没有选择玩法')
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self:__startGame("", pid, false)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
-- 快速开始按钮
|
|
|
|
|
|
local btn_start2 = self._view:GetChild('btn_start2')
|
|
|
|
|
|
btn_start2.onClick:Set(
|
|
|
|
|
|
function()
|
|
|
|
|
|
local currentPlayID = self:GetSelectedPlayID()
|
|
|
|
|
|
if currentPlayID == 0 then
|
|
|
|
|
|
if self.lst_layer.selectedIndex == 0 and self.lst_game.selectedIndex > 0 then
|
|
|
|
|
|
local pid = self.fg_info[tostring(self.curGroup.id)]
|
|
|
|
|
|
if pid == 0 then
|
|
|
|
|
|
ViewUtil.ErrorTip(nil, '没有选择玩法')
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
local p_data = self.curGroup:getPlay(pid)
|
|
|
|
|
|
local currentGameID = self:GetSelectedGameID()
|
|
|
|
|
|
if currentGameID == p_data.gameId then
|
|
|
|
|
|
currentPlayID = pid
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
if currentPlayID == 0 then
|
|
|
|
|
|
ViewUtil.ErrorTip(nil, '没有选择玩法')
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self:__startGame("", currentPlayID, false)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
-- 选择玩法按钮
|
|
|
|
|
|
local btn_choose = self._view:GetChild('btn_choose')
|
|
|
|
|
|
btn_choose.onClick:Set(
|
2025-04-11 12:49:08 +08:00
|
|
|
|
function()
|
|
|
|
|
|
self.lstgameVisible = not self.lstgameVisible
|
|
|
|
|
|
if (self.lstgameVisible) then
|
|
|
|
|
|
self.lst_game:TweenMove(Vector2.New(3, 100), 0.3)
|
|
|
|
|
|
else
|
|
|
|
|
|
self.lst_game:TweenMove(Vector2.New(3, 760), 0.3)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
-- function()
|
|
|
|
|
|
-- local sgv =
|
|
|
|
|
|
-- GroupSetDefaultGameView.new(
|
|
|
|
|
|
-- self.curGroup.id,
|
|
|
|
|
|
-- self._root_view,
|
|
|
|
|
|
-- function(num)
|
|
|
|
|
|
-- if num == 0 then
|
|
|
|
|
|
-- return
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- local pid = 0
|
|
|
|
|
|
-- pid = self.curGroup.playList[num].id
|
|
|
|
|
|
-- btn_choose:GetChild('tex_gamename').text = __getLayerName(self, pid)
|
|
|
|
|
|
-- btn_choose:GetController('null').selectedIndex = 0
|
|
|
|
|
|
-- local key = tostring(self.curGroup.id)
|
|
|
|
|
|
-- self.fg_info[key] = pid
|
|
|
|
|
|
-- local filename = 'fginfo_' .. DataManager.SelfUser.account_id
|
|
|
|
|
|
-- Utils.SaveLocalFile(filename, json.encode(self.fg_info))
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- )
|
|
|
|
|
|
-- local tem = self.fg_info[tostring(self.curGroup.id)]
|
|
|
|
|
|
-- local play_index = self.curGroup:getPlayIndex(tem)
|
|
|
|
|
|
-- if play_index == -1 then
|
|
|
|
|
|
-- play_index = 1
|
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
|
|
-- local setCallBackFunc=function()
|
|
|
|
|
|
-- __analysePlayListData(self)
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- sgv:FillData(self.curGroup.playList, play_index,setCallBackFunc)
|
|
|
|
|
|
-- sgv:Show()
|
|
|
|
|
|
-- end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
local btn_close = self._view:GetChild('btn_close')
|
|
|
|
|
|
btn_close.onClick:Set(
|
|
|
|
|
|
function()
|
|
|
|
|
|
self:Destroy()
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
-- local btn_cancel = self._view:GetChild('node_matching'):GetChild('btn_cancel')
|
|
|
|
|
|
-- btn_cancel.onClick:Set(
|
|
|
|
|
|
-- function()
|
|
|
|
|
|
-- local _gameCtrl = ControllerManager.GetController(GameController)
|
|
|
|
|
|
-- local _currentCtrl = ControllerManager.GetCurrenController()
|
|
|
|
|
|
-- if _gameCtrl == _currentCtrl then
|
|
|
|
|
|
-- _gameCtrl:LevelRoom(
|
|
|
|
|
|
-- function(res)
|
|
|
|
|
|
-- if res.ReturnCode == 0 then
|
|
|
|
|
|
-- self._view:GetController('pipei').selectedIndex = 0
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- )
|
|
|
|
|
|
-- return
|
2025-04-11 12:49:08 +08:00
|
|
|
|
-- end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
-- self._view:GetController('pipei').selectedIndex = 0
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- )
|
|
|
|
|
|
|
|
|
|
|
|
local lst_layer = self._view:GetChild('lst_layer')
|
|
|
|
|
|
|
|
|
|
|
|
self._layer_index = self.curGroup.layer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- self._ctr_search = self._view:GetController('search')
|
|
|
|
|
|
-- self.lst_room_search = self._view:GetChild('lst_room_search')
|
|
|
|
|
|
-- local btn_search = self._view:GetChild('btn_search')
|
|
|
|
|
|
-- btn_search.onClick:Set(
|
|
|
|
|
|
-- function()
|
|
|
|
|
|
-- local search_key = self._view:GetChild('tex_id_search').text
|
|
|
|
|
|
-- if (self._ctr_search.selectedIndex == 1 and search_key == self.search_key) or search_key == '' then
|
|
|
|
|
|
-- return
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- self.search_key = search_key
|
|
|
|
|
|
-- self._ctr_search.selectedIndex = 1
|
|
|
|
|
|
-- __fillRoomData(self)
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- )
|
|
|
|
|
|
|
|
|
|
|
|
self.tex_fag = self._view:GetChild('tex_fag')
|
|
|
|
|
|
-- self.tex_diamo = self._view:GetChild('player_diamond')
|
|
|
|
|
|
|
|
|
|
|
|
-- self:__loadLastData()
|
|
|
|
|
|
|
|
|
|
|
|
self:__loadGroupData()
|
|
|
|
|
|
self:__refreshManager()
|
|
|
|
|
|
UpdateBeat:Add(self.__onUpdate, self)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self._view.visible = false
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:__saveLastData()
|
|
|
|
|
|
if not self._get_data then self._get_data = true end
|
|
|
|
|
|
local data = json.encode(self.curGroup.playList)
|
|
|
|
|
|
Utils.SaveLocalFile(self.curGroup.id .. "fg_table_info", data)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:__loadLastData()
|
|
|
|
|
|
local json_data = Utils.LoadLocalFile(self.curGroup.id .. "fg_table_info")
|
|
|
|
|
|
if not json_data then return end
|
|
|
|
|
|
pcall(function()
|
|
|
|
|
|
local data = json.decode(json_data)
|
|
|
|
|
|
self.curRooms = {}
|
|
|
|
|
|
self.playNames = {}
|
|
|
|
|
|
for i = 1, #data do
|
|
|
|
|
|
local t = data[i]
|
|
|
|
|
|
if not list_check(self.gameIdList, t.gameId) then
|
|
|
|
|
|
table.insert(self.gameIdList, t.gameId)
|
|
|
|
|
|
end
|
|
|
|
|
|
table.insert(self.playIdList, t.id)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
local room = { maxPlayers = t.maxPlayers, status = 0, default = true, pid = t.id, color = t.deskId }
|
2025-04-01 10:48:36 +08:00
|
|
|
|
table.insert(self.curRooms, room)
|
|
|
|
|
|
self.playNames[t.id] = t.name
|
|
|
|
|
|
end
|
|
|
|
|
|
self.lst_game.numItems = #self.gameIdList + 1
|
|
|
|
|
|
self.lst_layer.visible = false
|
|
|
|
|
|
--self.line1.visible = false
|
|
|
|
|
|
self.lst_layer.numItems = #self.playIdList + 1
|
|
|
|
|
|
self.lst_room.numItems = #self.curRooms
|
|
|
|
|
|
end)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local CLASS_LOBBT = 'LobbyView'
|
|
|
|
|
|
local timer = 0
|
|
|
|
|
|
function M:__onUpdate()
|
|
|
|
|
|
if self.pause then
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
if self._pipeiTime and self._pipeiTime > 0 then
|
|
|
|
|
|
local deltaTime = Time.deltaTime
|
|
|
|
|
|
self._pipeiTime = self._pipeiTime - deltaTime
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self._pipeiTime = math.max(self._pipeiTime, 0)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if self._pipeiTime == 0 then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self._view:GetChild('node_matching'):GetChild('text_time').text = "当前排位时间较长,请耐心等待..."
|
|
|
|
|
|
self._view:GetChild('node_matching'):GetController('quxiao').selectedIndex = 1
|
2025-04-01 10:48:36 +08:00
|
|
|
|
else
|
|
|
|
|
|
local time = math.floor(self._pipeiTime)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self._view:GetChild('node_matching'):GetChild('text_time').text = "玩家排位中," .. time .. "秒后可退出..."
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
if self.__join_room then
|
|
|
|
|
|
local cview = ViewManager.GetCurrenView()
|
|
|
|
|
|
if (cview.class == CLASS_LOBBT) then
|
|
|
|
|
|
self.__join_room = false
|
|
|
|
|
|
self._view.visible = true
|
|
|
|
|
|
self:__ShowNotice()
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
if self.curGroup then
|
|
|
|
|
|
if self.curGroup.update_room then
|
|
|
|
|
|
self.curGroup.update_room = false
|
|
|
|
|
|
__fillRoomData(self)
|
|
|
|
|
|
end
|
|
|
|
|
|
if self.curGroup.update_info then
|
|
|
|
|
|
self.curGroup.update_info = false
|
|
|
|
|
|
self:_evtUpdatePlayerInfo()
|
|
|
|
|
|
end
|
|
|
|
|
|
if self.curGroup.update_joins then
|
|
|
|
|
|
self.curGroup.update_joins = false
|
|
|
|
|
|
self:_setHongDian(false)
|
|
|
|
|
|
if self.curGroup.lev < 3 then
|
|
|
|
|
|
self:_evtUpdateMsg()
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
if self.curGroup.update_play then
|
|
|
|
|
|
self.curGroup.update_play = false
|
|
|
|
|
|
self:_evtAddPlay()
|
|
|
|
|
|
if self.mng_view4 then
|
|
|
|
|
|
self.mng_view4:RefreshPage(4)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
local deltaTime = Time.deltaTime
|
|
|
|
|
|
timer = timer + deltaTime
|
|
|
|
|
|
if timer > 1 then
|
|
|
|
|
|
timer = 0
|
|
|
|
|
|
for i = 1, #list_offline do
|
|
|
|
|
|
local tem = list_offline[i]
|
|
|
|
|
|
if tem and not tem.item.isDisposed then
|
|
|
|
|
|
tem.item.text = (os.time() - tem.time) .. '秒'
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:__joinRoom(room_id)
|
|
|
|
|
|
ViewUtil.ShowModalWait(self._root_view, '正在加入游戏...', 'join_room')
|
|
|
|
|
|
local roomCtr = ControllerManager.GetController(RoomController)
|
|
|
|
|
|
local _gameCtrl = ControllerManager.GetController(GameController)
|
|
|
|
|
|
local _currentCtrl = ControllerManager.GetCurrenController()
|
|
|
|
|
|
if _gameCtrl == _currentCtrl then
|
|
|
|
|
|
if _gameCtrl.tmpRoomID ~= room_id then
|
|
|
|
|
|
_gameCtrl:LevelRoom(
|
|
|
|
|
|
function(res)
|
|
|
|
|
|
roomCtr:PublicJoinRoom(
|
|
|
|
|
|
Protocol.WEB_FG_JOIN_ROOM,
|
|
|
|
|
|
room_id,
|
|
|
|
|
|
false,
|
|
|
|
|
|
function(response)
|
|
|
|
|
|
if (response.ReturnCode == -1) then
|
|
|
|
|
|
ViewUtil.CloseModalWait('join_room')
|
|
|
|
|
|
RestartGame()
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if response.ReturnCode == -2 then
|
|
|
|
|
|
self:__joinRoom(room_id)
|
|
|
|
|
|
return
|
|
|
|
|
|
elseif response.ReturnCode ~= 0 then
|
|
|
|
|
|
ViewUtil.CloseModalWait('join_room')
|
|
|
|
|
|
ViewUtil.ErrorMsg(self._root_view, response.ReturnCode, '进入房间失败')
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
self.__join_room = true
|
|
|
|
|
|
-- local mgr_ctr = ControllerManager.GetController(GroupMgrController)
|
|
|
|
|
|
-- mgr_ctr:disconnect()
|
|
|
|
|
|
self._view.visible = false
|
|
|
|
|
|
ImageLoad.Clear(self.class)
|
|
|
|
|
|
ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
|
|
|
|
|
|
ViewUtil.CloseModalWait('join_room')
|
|
|
|
|
|
timer = 0
|
|
|
|
|
|
end,
|
|
|
|
|
|
self.curGroup.id
|
|
|
|
|
|
)
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
return
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
roomCtr:PublicJoinRoom(
|
|
|
|
|
|
Protocol.WEB_FG_JOIN_ROOM,
|
|
|
|
|
|
room_id,
|
|
|
|
|
|
false,
|
|
|
|
|
|
function(response)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
printlog("进入房间返回事件==========》》》")
|
|
|
|
|
|
pt(response)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if (response.ReturnCode == -1) then
|
|
|
|
|
|
ViewUtil.CloseModalWait('join_room')
|
|
|
|
|
|
RestartGame()
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if response.ReturnCode == -2 then
|
|
|
|
|
|
self:__joinRoom(room_id)
|
|
|
|
|
|
return
|
|
|
|
|
|
elseif response.ReturnCode ~= 0 then
|
|
|
|
|
|
ViewUtil.CloseModalWait('join_room')
|
|
|
|
|
|
ViewUtil.ErrorMsg(self._root_view, response.ReturnCode, '进入房间失败')
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
self.__join_room = true
|
|
|
|
|
|
-- local mgr_ctr = ControllerManager.GetController(GroupMgrController)
|
|
|
|
|
|
-- mgr_ctr:disconnect()
|
|
|
|
|
|
self._view.visible = false
|
|
|
|
|
|
ImageLoad.Clear(self.class)
|
|
|
|
|
|
ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
|
|
|
|
|
|
ViewUtil.CloseModalWait('join_room')
|
|
|
|
|
|
timer = 0
|
|
|
|
|
|
end,
|
|
|
|
|
|
self.curGroup.id
|
|
|
|
|
|
)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-11 12:49:08 +08:00
|
|
|
|
function M:__joinRoom_match(roomid, pid, is_null, isHidden, callback)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if isHidden == nil then
|
|
|
|
|
|
isHidden = 0
|
|
|
|
|
|
local play = self.curGroup:getPlay(pid)
|
|
|
|
|
|
if play then
|
|
|
|
|
|
if play.isHidden and play.isHidden == 1 then
|
|
|
|
|
|
isHidden = 1
|
|
|
|
|
|
elseif play.config then
|
|
|
|
|
|
local config = json.decode(play.config)
|
|
|
|
|
|
if config.isHidden and config.isHidden == 1 then
|
|
|
|
|
|
isHidden = 1
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
end
|
|
|
|
|
|
play.isHidden = isHidden
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
if isHidden == 1 then
|
|
|
|
|
|
ViewUtil.CloseModalWait()
|
|
|
|
|
|
if not DataManager.SelfUser.location then
|
|
|
|
|
|
DataManager.SelfUser.location = Location.new()
|
|
|
|
|
|
end
|
|
|
|
|
|
if DataManager.SelfUser.location:Location2String() == "" then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
-- if DataManager.SelfUser.location:Location2String() == "" then
|
2025-04-01 10:48:36 +08:00
|
|
|
|
ViewUtil.ErrorTip(nil, "没有打开GPS定位,不能参与该游戏")
|
|
|
|
|
|
get_gps()
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if self.wait_Pipei ~= nil then
|
|
|
|
|
|
coroutine.stop(self.wait_Pipei)
|
|
|
|
|
|
end
|
|
|
|
|
|
self.wait_Pipei = nil
|
|
|
|
|
|
self.wait_Pipei = coroutine.start(function()
|
|
|
|
|
|
-- local t = math.random( 1, 3 )
|
|
|
|
|
|
-- coroutine.wait(t)
|
|
|
|
|
|
local roomCtr = ControllerManager.GetController(RoomController)
|
|
|
|
|
|
roomCtr:PublicJoinRoom(
|
|
|
|
|
|
Protocol.WEB_FG_QUEUE_ROOM,
|
|
|
|
|
|
roomid,
|
|
|
|
|
|
is_null,
|
|
|
|
|
|
function(response)
|
|
|
|
|
|
if (response.ReturnCode == -1) then
|
|
|
|
|
|
self._view:GetController('pipei').selectedIndex = 0
|
|
|
|
|
|
ViewUtil.CloseModalWait('join_room')
|
|
|
|
|
|
RestartGame()
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if response.ReturnCode ~= 0 then
|
|
|
|
|
|
self._view:GetController('pipei').selectedIndex = 0
|
|
|
|
|
|
callback(response.ReturnCode)
|
|
|
|
|
|
return
|
|
|
|
|
|
else
|
|
|
|
|
|
self:showPipei(self.curGroup:getPlay(pid))
|
|
|
|
|
|
ControllerManager.GetCurrenController():PlayerReady()
|
|
|
|
|
|
-- UpdateBeat:Add(__checkExitRoom,self)
|
|
|
|
|
|
-- local mgr_ctr = ControllerManager.GetController(GroupMgrController)
|
|
|
|
|
|
-- mgr_ctr:disconnect()
|
|
|
|
|
|
|
|
|
|
|
|
-- self.__join_room = true
|
|
|
|
|
|
-- self._view.visible = false
|
|
|
|
|
|
-- ImageLoad.Clear(self.class)
|
|
|
|
|
|
-- ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
|
|
|
|
|
|
-- callback(response.ReturnCode)
|
|
|
|
|
|
-- ViewUtil.CloseModalWait('join_room')
|
|
|
|
|
|
-- timer = 0
|
|
|
|
|
|
end
|
|
|
|
|
|
end,
|
|
|
|
|
|
self.curGroup.id,
|
|
|
|
|
|
pid
|
2025-04-11 12:49:08 +08:00
|
|
|
|
)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local roomCtr = ControllerManager.GetController(RoomController)
|
|
|
|
|
|
roomCtr:PublicJoinRoom(
|
|
|
|
|
|
Protocol.WEB_FG_MATCH_ROOM,
|
|
|
|
|
|
roomid,
|
|
|
|
|
|
is_null,
|
|
|
|
|
|
function(response)
|
|
|
|
|
|
if (response.ReturnCode == -1) then
|
|
|
|
|
|
ViewUtil.CloseModalWait('join_room')
|
|
|
|
|
|
RestartGame()
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if response.ReturnCode ~= 0 then
|
|
|
|
|
|
callback(response.ReturnCode)
|
|
|
|
|
|
return
|
|
|
|
|
|
else
|
|
|
|
|
|
-- UpdateBeat:Add(__checkExitRoom,self)
|
|
|
|
|
|
self.__join_room = true
|
|
|
|
|
|
-- local mgr_ctr = ControllerManager.GetController(GroupMgrController)
|
|
|
|
|
|
-- mgr_ctr:disconnect()
|
|
|
|
|
|
self._view.visible = false
|
|
|
|
|
|
ImageLoad.Clear(self.class)
|
|
|
|
|
|
ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
|
|
|
|
|
|
callback(response.ReturnCode)
|
|
|
|
|
|
ViewUtil.CloseModalWait('join_room')
|
|
|
|
|
|
timer = 0
|
|
|
|
|
|
end
|
|
|
|
|
|
end,
|
|
|
|
|
|
self.curGroup.id,
|
|
|
|
|
|
pid
|
|
|
|
|
|
)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:_evtAddPlay()
|
|
|
|
|
|
local lst_layer = self.lst_layer
|
|
|
|
|
|
__analyseGameListData(self)
|
|
|
|
|
|
__analysePlayListData(self)
|
|
|
|
|
|
|
|
|
|
|
|
__fillRoomData(self)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:_evtDelPlay()
|
|
|
|
|
|
local lst_layer = self.lst_layer
|
|
|
|
|
|
__analyseGameListData(self)
|
|
|
|
|
|
__analysePlayListData(self)
|
|
|
|
|
|
__fillRoomData(self)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:_evtUpdatePlay()
|
|
|
|
|
|
local lst_layer = self.lst_layer
|
|
|
|
|
|
__analyseGameListData(self)
|
|
|
|
|
|
__analysePlayListData(self)
|
|
|
|
|
|
__fillRoomData(self)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:_evtDelRoom()
|
|
|
|
|
|
local lst_room = self.lst_room
|
|
|
|
|
|
__fillRoomData(self)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:_evtAddRoom()
|
|
|
|
|
|
local lst_room = self.lst_room
|
|
|
|
|
|
__fillRoomData(self)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:_evtUpdateRoom()
|
|
|
|
|
|
local lst_room = self.lst_room
|
|
|
|
|
|
__fillRoomData(self)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:_evtUpdatePlayerInfo()
|
|
|
|
|
|
self.tex_fag.text = '' .. d2ad(self.curGroup.hp)
|
|
|
|
|
|
-- self.tex_diamo.text = self.curGroup.diamo
|
|
|
|
|
|
-- self._view:GetController("manager").selectedIndex = (self.curGroup.lev < 3 or self.curGroup.partnerLev > 0) and 1 or 0
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:_evtUpdateMsg()
|
|
|
|
|
|
local joins = self.curGroup.joins
|
|
|
|
|
|
self._view:GetChild('btn_msg'):GetController('tip').selectedIndex = joins > 0 and 1 or 0
|
|
|
|
|
|
if joins > 0 and self.curGroup.apply == 0 then
|
|
|
|
|
|
local msg = '有玩家申请加入您的大联盟,请尽快处理'
|
|
|
|
|
|
local msg_view = MsgWindow.new(self._root_view, msg, MsgWindow.MsgMode.OnlyOk)
|
|
|
|
|
|
msg_view:Show()
|
|
|
|
|
|
self:_setHongDian(true)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
function M:_setHongDian(isShow)
|
|
|
|
|
|
--红点提示
|
|
|
|
|
|
local member_tips = self._view:GetChild('member_tips')
|
|
|
|
|
|
member_tips.visible = isShow
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
function M:_evtInvited(...)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local data = arg[1]
|
|
|
|
|
|
local imv =
|
|
|
|
|
|
FGInvitedMsgView.new(
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self._root_view,
|
|
|
|
|
|
self.curGroup.id,
|
|
|
|
|
|
function(roomid)
|
|
|
|
|
|
self:__joinRoom(roomid)
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
imv:FillData(data)
|
|
|
|
|
|
imv:Show()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 更新牌友圈事件
|
|
|
|
|
|
function M:_evtUpdateGroup(...)
|
|
|
|
|
|
-- local btn_remit = self._view:GetChild('btn_remit')
|
|
|
|
|
|
-- local option = self.curGroup.option or 0
|
|
|
|
|
|
|
|
|
|
|
|
-- btn_remit.visible = self.curGroup.hide_action == 0 and true or false
|
|
|
|
|
|
|
|
|
|
|
|
-- if bit:_and(option,4) > 0 then
|
|
|
|
|
|
-- btn_remit.visible = false
|
|
|
|
|
|
-- else
|
|
|
|
|
|
-- btn_remit.visible = true
|
|
|
|
|
|
-- end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 未读邮件通知
|
|
|
|
|
|
function M:_evtNewMailTip(...)
|
|
|
|
|
|
self.ctr_newmail.selectedIndex = 1
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:SetRoomListVisible(visible)
|
|
|
|
|
|
self.lst_room.visible = visible
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:__refreshManager()
|
|
|
|
|
|
local btn_manager = self._view:GetChild('btn_manager')
|
|
|
|
|
|
btn_manager.onClick:Set(function()
|
|
|
|
|
|
local win = GroupMngSettingView.new(self.curGroup.id)
|
|
|
|
|
|
win:Show()
|
|
|
|
|
|
end)
|
|
|
|
|
|
local btn_stat = self._view:GetChild('btn_stat')
|
|
|
|
|
|
btn_stat.onClick:Set(
|
|
|
|
|
|
function()
|
|
|
|
|
|
if not self.mng_view2 then
|
|
|
|
|
|
self.mng_view2 = GroupManagerView.new(self._root_view, self.curGroup.id, 2)
|
|
|
|
|
|
end
|
|
|
|
|
|
-- self:SetRoomListVisible(false)
|
|
|
|
|
|
self.mng_view2:Show()
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
local btn_partner = self._view:GetChild('btn_partner')
|
2025-04-11 12:49:08 +08:00
|
|
|
|
btn_partner.onClick:Set(
|
2025-04-01 10:48:36 +08:00
|
|
|
|
function()
|
2025-04-11 12:49:08 +08:00
|
|
|
|
---- print("成员..........................................")
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if not self.mng_view3 then
|
|
|
|
|
|
self.mng_view3 = GroupManagerView.new(self._root_view, self.curGroup.id, 5)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self.mng_view3:SetCurrentGroupInfoViewIns(function()
|
|
|
|
|
|
self:OnclickMember()
|
|
|
|
|
|
end)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
self.mng_view3:Show()
|
|
|
|
|
|
-- self:SetRoomListVisible(false)
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local btn_play = self._view:GetChild('btn_play')
|
|
|
|
|
|
btn_play.onClick:Set(function()
|
2025-04-11 12:49:08 +08:00
|
|
|
|
local gl_view = GroupMngGameListView.new(self.curGroup.id)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
gl_view:Show()
|
|
|
|
|
|
-- self:SetRoomListVisible(false)
|
|
|
|
|
|
end)
|
|
|
|
|
|
local btn_fginfo = self._view:GetChild('btn_fginfo')
|
|
|
|
|
|
btn_fginfo.onClick:Set(
|
|
|
|
|
|
function()
|
|
|
|
|
|
local m = {}
|
|
|
|
|
|
m.uid = DataManager.SelfUser.account_id
|
|
|
|
|
|
m.portrait = DataManager.SelfUser.head_url
|
|
|
|
|
|
m.nick = DataManager.SelfUser.nick_name
|
|
|
|
|
|
local mflv = GroupMemberFagLogView.new(self.curGroup.id, m, true)
|
|
|
|
|
|
mflv:Show()
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:OnclickMember()
|
2025-04-11 12:49:08 +08:00
|
|
|
|
if not self.mng_view3 then
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self.mng_view3 = GroupManagerView.new(self._root_view, self.curGroup.id, 5)
|
|
|
|
|
|
end
|
|
|
|
|
|
self.mng_view3:Show()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 显示公告
|
|
|
|
|
|
function M:__ShowNotice()
|
|
|
|
|
|
local group = DataManager.groups:get(self.curGroup.id)
|
|
|
|
|
|
local str_notice = group.notice
|
|
|
|
|
|
local empty_notice = not str_notice or str_notice == ''
|
|
|
|
|
|
local com_notice = self._view:GetChild('com_notice')
|
|
|
|
|
|
local com_message = com_notice:GetChild('message')
|
|
|
|
|
|
com_notice.visible = not empty_notice
|
|
|
|
|
|
local tex_notice = com_message:GetChild('tex_message')
|
|
|
|
|
|
tex_notice.text = str_notice
|
|
|
|
|
|
local speed_x = 100
|
|
|
|
|
|
local start_x = com_message.width + 100
|
|
|
|
|
|
-- local dd = tex_notice.width / com_message.width
|
|
|
|
|
|
local dur_time = (start_x + tex_notice.width + 100) / speed_x
|
|
|
|
|
|
if self._tw_notice then
|
|
|
|
|
|
self._tw_notice:Stop()
|
|
|
|
|
|
end
|
|
|
|
|
|
self._tw_notice =
|
|
|
|
|
|
DSTween.To(
|
2025-04-11 12:49:08 +08:00
|
|
|
|
0,
|
|
|
|
|
|
1,
|
|
|
|
|
|
dur_time,
|
|
|
|
|
|
function(value)
|
|
|
|
|
|
tex_notice.x = start_x - speed_x * value * dur_time
|
|
|
|
|
|
end
|
|
|
|
|
|
):OnComplete(
|
|
|
|
|
|
function()
|
|
|
|
|
|
self._tw_notice = nil
|
|
|
|
|
|
self:__ShowNotice()
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 显示玩法信息
|
|
|
|
|
|
function M:__loadPlayData()
|
|
|
|
|
|
-- 体力值显示
|
|
|
|
|
|
self:__refreshPay()
|
|
|
|
|
|
-- 房间对象填充
|
|
|
|
|
|
__fillRoomData(self)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 初始化圈子信息
|
|
|
|
|
|
function M:__loadGroupData()
|
|
|
|
|
|
if self.mng_view then
|
|
|
|
|
|
self.mng_view:Close()
|
|
|
|
|
|
end
|
|
|
|
|
|
local curGroup = self.curGroup
|
|
|
|
|
|
curGroup.update_room = false
|
|
|
|
|
|
curGroup.update_info = false
|
|
|
|
|
|
curGroup.update_joins = false
|
2025-04-11 12:49:08 +08:00
|
|
|
|
ViewUtil.ShowModalWait(self._root_view, "正在进入牌友圈,请稍等...")
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local fgCtr = ControllerManager.GetController(NewGroupController)
|
|
|
|
|
|
fgCtr:FG_EnterGroup(
|
|
|
|
|
|
curGroup.id,
|
|
|
|
|
|
function(res)
|
|
|
|
|
|
-- if self._is_destroy then
|
|
|
|
|
|
-- return
|
|
|
|
|
|
-- end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
ViewUtil.CloseModalWait()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if res.ReturnCode ~= 0 then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
--self._view.visible=false
|
|
|
|
|
|
--ViewUtil.ErrorTip(res.ReturnCode, "获取圈子数据失败")
|
2025-04-01 10:48:36 +08:00
|
|
|
|
else
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self._view.visible = true
|
|
|
|
|
|
self:Show()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self:__saveLastData()
|
|
|
|
|
|
local mgr_ctr = ControllerManager.GetController(GroupMgrController)
|
|
|
|
|
|
mgr_ctr:AddEventListener(GroupMgrEvent.AddPlay, handler(self, self._evtAddPlay))
|
|
|
|
|
|
mgr_ctr:AddEventListener(GroupMgrEvent.DelPlay, handler(self, self._evtDelPlay))
|
|
|
|
|
|
mgr_ctr:AddEventListener(GroupMgrEvent.UpdatePlay, handler(self, self._evtUpdatePlay))
|
|
|
|
|
|
mgr_ctr:AddEventListener(GroupMgrEvent.AddRoom, handler(self, self._evtAddRoom))
|
|
|
|
|
|
mgr_ctr:AddEventListener(GroupMgrEvent.DelRoom, handler(self, self._evtDelRoom))
|
|
|
|
|
|
mgr_ctr:AddEventListener(GroupMgrEvent.UpdateRoom, handler(self, self._evtUpdateRoom))
|
|
|
|
|
|
mgr_ctr:AddEventListener(GroupMgrEvent.UpdatePlayerInfo, handler(self, self._evtUpdatePlayerInfo))
|
|
|
|
|
|
-- mgr_ctr:AddEventListener(GroupMgrEvent.UpdateMessage, handler(self,self._evtUpdateMsg))
|
|
|
|
|
|
mgr_ctr:AddEventListener(GroupMgrEvent.BeInvited, handler(self, self._evtInvited))
|
2025-07-24 21:41:05 +08:00
|
|
|
|
-- mgr_ctr:AddEventListener(GroupMgrEvent.UpdateGroup, handler(self, self._evtUpdateGroup))
|
2025-04-01 10:48:36 +08:00
|
|
|
|
mgr_ctr:AddEventListener(GroupMgrEvent.NewMailTip, handler(self, self._evtNewMailTip))
|
|
|
|
|
|
local ctr_manager = self._view:GetController('manager')
|
|
|
|
|
|
|
|
|
|
|
|
ctr_manager.selectedIndex =
|
|
|
|
|
|
self.curGroup.lev < 3 and self.curGroup.lev or (self.curGroup.partnerLev > 0 and 3 or 0)
|
|
|
|
|
|
if self.curGroup.lev < 3 then
|
|
|
|
|
|
local ctr_msg = self._view:GetController('msg')
|
|
|
|
|
|
ctr_msg.selectedIndex = 1
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local btn_vip = self._view:GetChild("btn_vip")
|
|
|
|
|
|
if self.curGroup.isvip == 1 then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
local vip = self.fg_info[tostring(self.curGroup.id) .. "vip"] or 0
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self._showVipRooms = vip
|
2025-04-11 12:49:08 +08:00
|
|
|
|
btn_vip:GetController("vip").selectedIndex = math.abs(self._showVipRooms - 1)
|
|
|
|
|
|
btn_vip.onClick:Set(function()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
btn_vip:GetController("vip").selectedIndex = self._showVipRooms
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self._showVipRooms = math.abs(self._showVipRooms - 1)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self:_evtUpdatePlay()
|
|
|
|
|
|
local key = tostring(self.curGroup.id) .. "vip"
|
|
|
|
|
|
self.fg_info[key] = self._showVipRooms
|
|
|
|
|
|
local filename = 'fginfo_' .. DataManager.SelfUser.account_id
|
2025-04-11 12:49:08 +08:00
|
|
|
|
Utils.SaveLocalFile(filename, json.encode(self.fg_info))
|
|
|
|
|
|
end)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
-- 玩法列表初始化
|
|
|
|
|
|
__analyseGameListData(self)
|
|
|
|
|
|
__analysePlayListData(self)
|
|
|
|
|
|
|
|
|
|
|
|
self.lst_layer.selectedIndex = 0
|
|
|
|
|
|
self.lst_game.selectedIndex = 0
|
|
|
|
|
|
|
|
|
|
|
|
self._view:GetController('all').selectedIndex = 1
|
|
|
|
|
|
|
|
|
|
|
|
self:ShowSelectedGame()
|
|
|
|
|
|
-- 加载玩法信息
|
|
|
|
|
|
self:__loadPlayData()
|
|
|
|
|
|
-- 显示公告
|
|
|
|
|
|
self:__ShowNotice()
|
|
|
|
|
|
curGroup.update_room = false
|
|
|
|
|
|
|
|
|
|
|
|
local btn_msg = self._view:GetChild('btn_msg')
|
|
|
|
|
|
btn_msg.onClick:Set(
|
|
|
|
|
|
function()
|
|
|
|
|
|
if not self.mng_view1 then
|
|
|
|
|
|
self.mng_view1 = GroupManagerView.new(self._root_view, self.curGroup.id, 1)
|
|
|
|
|
|
end
|
|
|
|
|
|
self.mng_view1:Show(5)
|
|
|
|
|
|
-- self:SetRoomListVisible(false)
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
local btn_invite = self._view:GetChild('btn_invite')
|
2025-04-11 12:49:08 +08:00
|
|
|
|
btn_invite.displayObject.gameObject:SetActive(false)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
--[[btn_invite.onClick:Set(function()
|
|
|
|
|
|
if not self.mng_view3 then
|
|
|
|
|
|
self.mng_view3 = GroupManagerView.new(self._root_view, self.curGroup.id, 3)
|
|
|
|
|
|
end
|
|
|
|
|
|
self.mng_view3:Show(1)
|
|
|
|
|
|
end)--]]
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
-- local btn_rank = self._view:GetChild("btn_rank")
|
|
|
|
|
|
-- btn_rank.onClick:Set(function()
|
|
|
|
|
|
-- local rv = GroupRank.new(self._root_view, self.curGroup.id)
|
|
|
|
|
|
-- rv:Show()
|
|
|
|
|
|
-- end)
|
|
|
|
|
|
-- local btn_remit = self._view:GetChild('btn_remit')
|
|
|
|
|
|
-- btn_remit.onClick:Set(
|
|
|
|
|
|
-- function()
|
|
|
|
|
|
-- local remit_view = GroupRemitView.new(self._root_view, self.curGroup)
|
|
|
|
|
|
-- remit_view:Show()
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- )
|
|
|
|
|
|
local option = self.curGroup.option or 0
|
|
|
|
|
|
|
|
|
|
|
|
if self.curGroup.lev < 3 then
|
|
|
|
|
|
self:_evtUpdateMsg()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- btn_remit.visible = self.curGroup.hide_action == 0 and true or false
|
|
|
|
|
|
|
|
|
|
|
|
-- if bit:_and(option,4) > 0 then
|
|
|
|
|
|
-- btn_remit.visible = false
|
|
|
|
|
|
-- else
|
|
|
|
|
|
-- btn_remit.visible = true
|
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
|
|
-- 选择玩法面板
|
|
|
|
|
|
local btn_mail = self._view:GetChild('btn_mail')
|
|
|
|
|
|
self.ctr_newmail.selectedIndex = self.curGroup.mail_tip or -1
|
|
|
|
|
|
btn_mail.onClick:Set(
|
|
|
|
|
|
function()
|
|
|
|
|
|
self.ctr_newmail.selectedIndex = 0
|
|
|
|
|
|
local gmv = GroupMailView.new(self._root_view, self.curGroup)
|
|
|
|
|
|
gmv:SetCallback(
|
|
|
|
|
|
function()
|
|
|
|
|
|
btn_mail.selected = false
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
2025-04-11 12:49:08 +08:00
|
|
|
|
gmv:Show()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
local btn_bxx = self._view:GetChild('btn_bxx')
|
|
|
|
|
|
btn_bxx.onClick:Set(
|
|
|
|
|
|
function()
|
2025-04-11 12:49:08 +08:00
|
|
|
|
local ctrNum = 1
|
|
|
|
|
|
-- if self.curGroup.lev==3 and self.curGroup.partnerLev>0 or self.curGroup.lev==1 or self.curGroup.lev==2 then
|
|
|
|
|
|
-- ctrNum=2
|
|
|
|
|
|
-- end
|
|
|
|
|
|
if self.curGroup.lev == 1 then
|
|
|
|
|
|
ctrNum = 2
|
|
|
|
|
|
end
|
|
|
|
|
|
ctrNum = 2
|
|
|
|
|
|
local gmv = GroupMngFagPackView.new(self.curGroup.id, self._root_view, ctrNum,
|
|
|
|
|
|
DataManager.SelfUser.account_id)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
gmv:SetCallback(
|
|
|
|
|
|
function()
|
|
|
|
|
|
btn_bxx.selected = false
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
gmv:Show()
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 匹配游戏
|
2025-04-11 12:49:08 +08:00
|
|
|
|
function M:__startGame(roomid, pid, is_null, isHidden, callback)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
ViewUtil.ShowModalWait(self._root_view, '正在加入游戏...', 'join_room')
|
|
|
|
|
|
local _gameCtrl = ControllerManager.GetController(GameController)
|
|
|
|
|
|
local _currentCtrl = ControllerManager.GetCurrenController()
|
|
|
|
|
|
if _gameCtrl == _currentCtrl then
|
|
|
|
|
|
_gameCtrl:LevelRoom(
|
|
|
|
|
|
function(res)
|
|
|
|
|
|
self:__joinRoom_match(
|
|
|
|
|
|
roomid,
|
|
|
|
|
|
pid,
|
|
|
|
|
|
is_null,
|
|
|
|
|
|
isHidden,
|
|
|
|
|
|
function(code)
|
|
|
|
|
|
if code == -2 then
|
2025-04-11 12:49:08 +08:00
|
|
|
|
self:__startGame(roomid, pid, is_null, isHidden, callback)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
elseif code ~= 0 then
|
|
|
|
|
|
ViewUtil.ErrorMsg(self._root_view, code, '进入房间失败')
|
|
|
|
|
|
ViewUtil.CloseModalWait('join_room')
|
|
|
|
|
|
end
|
|
|
|
|
|
if callback then
|
|
|
|
|
|
callback()
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
self:__joinRoom_match(
|
|
|
|
|
|
roomid,
|
|
|
|
|
|
pid,
|
|
|
|
|
|
is_null,
|
|
|
|
|
|
isHidden,
|
|
|
|
|
|
function(code)
|
|
|
|
|
|
if code == -2 then
|
|
|
|
|
|
self:__startGame(roomid, pid, is_null, isHidden, callback)
|
|
|
|
|
|
elseif code ~= 0 then
|
|
|
|
|
|
ViewUtil.ErrorMsg(self._root_view, code, '进入房间失败')
|
|
|
|
|
|
ViewUtil.CloseModalWait('join_room')
|
|
|
|
|
|
end
|
|
|
|
|
|
if callback then
|
|
|
|
|
|
callback()
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 显示各玩法体力值信息
|
|
|
|
|
|
function M:__refreshPay()
|
2025-04-11 12:49:08 +08:00
|
|
|
|
--printlog("1111111111111111111111111111",self.curGroup.hp)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self.tex_fag.text = '' .. d2ad(self.curGroup.hp or 0)
|
|
|
|
|
|
-- self.tex_diamo.text = self.curGroup.diamo
|
|
|
|
|
|
|
|
|
|
|
|
local ctr_all = self._view:GetController('all')
|
|
|
|
|
|
|
|
|
|
|
|
local currentPlayID = self:GetSelectedPlayID()
|
|
|
|
|
|
local currentGameID = self:GetSelectedGameID()
|
|
|
|
|
|
|
|
|
|
|
|
if currentPlayID > 0 then
|
|
|
|
|
|
--self._view:GetChild("tex_name").text = __getLayerName(self,currentPlayID)
|
|
|
|
|
|
ctr_all.selectedIndex = 0
|
|
|
|
|
|
else
|
|
|
|
|
|
if currentGameID == 0 then
|
|
|
|
|
|
ctr_all.selectedIndex = 1
|
|
|
|
|
|
else
|
|
|
|
|
|
ctr_all.selectedIndex = 0
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- self._view:GetChild("tex_name").text = __getLayerName(self,0)
|
2025-07-22 20:00:07 +08:00
|
|
|
|
self._view:GetChild('tex_name').text = Utils.TextOmit(self.curGroup.name, 6)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 分享牌友圈
|
|
|
|
|
|
function M:__share()
|
|
|
|
|
|
local tem = self.curGroup
|
|
|
|
|
|
local str = string.format('【%s】 邀请您加入!', tem.name)
|
|
|
|
|
|
local url =
|
|
|
|
|
|
string.format(
|
2025-04-11 12:49:08 +08:00
|
|
|
|
'%s?type=t1&playerId=%s&groupId=%s',
|
|
|
|
|
|
GetGameInfo('share_group_link'),
|
|
|
|
|
|
DataManager.SelfUser.account_id,
|
|
|
|
|
|
tem.id
|
|
|
|
|
|
)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local json_data = {}
|
|
|
|
|
|
json_data['title'] = string.format('大联盟号【%s】', tem.id)
|
|
|
|
|
|
local mediaObject = {}
|
|
|
|
|
|
mediaObject['url'] = url
|
|
|
|
|
|
mediaObject['type'] = 0
|
|
|
|
|
|
json_data['mediaObject'] = mediaObject
|
|
|
|
|
|
json_data['description'] = str
|
|
|
|
|
|
json_data['scene'] = 0
|
|
|
|
|
|
GameApplication.Instance:ShareLink(1, json.encode(json_data), nil)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:showPipei(play)
|
|
|
|
|
|
self._view:GetController('pipei').selectedIndex = 1
|
|
|
|
|
|
self._view:GetChild('node_matching'):GetController('quxiao').selectedIndex = 0
|
|
|
|
|
|
if play then
|
|
|
|
|
|
self._view:GetChild('node_matching'):GetChild('text_title').text = play.name
|
|
|
|
|
|
self._view:GetChild('node_matching'):GetChild('text_des').text = DataManager.CurrenRoom.room_config:GetDes()
|
|
|
|
|
|
end
|
|
|
|
|
|
self._pipeiTime = 20
|
|
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
function M:hidePipei()
|
2025-04-11 12:49:08 +08:00
|
|
|
|
---- print("hidePipei=============")
|
|
|
|
|
|
---- print(self._view)
|
|
|
|
|
|
---- print(self._view:GetController('pipei'))
|
|
|
|
|
|
if self._view:GetController('pipei') then
|
|
|
|
|
|
self._view:GetController('pipei').selectedIndex = 0
|
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
2025-04-11 12:49:08 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
function M:SetCallBack(callback)
|
|
|
|
|
|
self._callback = nil
|
|
|
|
|
|
self._callback = callback
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:Reconnect()
|
|
|
|
|
|
self:__loadGroupData()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:Show()
|
|
|
|
|
|
get_gps()
|
|
|
|
|
|
BaseView.Show(self)
|
|
|
|
|
|
local user = DataManager.SelfUser
|
|
|
|
|
|
local roomid = user.room_id
|
|
|
|
|
|
if user.group_id == self.curGroup.id and string.len(roomid) > 1 then
|
|
|
|
|
|
self:__joinRoom(roomid)
|
|
|
|
|
|
user.group_id = 0
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:Destroy()
|
|
|
|
|
|
BaseView.Destroy(self)
|
|
|
|
|
|
UpdateBeat:Remove(self.__onUpdate, self)
|
|
|
|
|
|
ImageLoad.Clear(self.class)
|
|
|
|
|
|
GRoot.inst:HidePopup()
|
|
|
|
|
|
timer = 0
|
|
|
|
|
|
self.pause = true
|
|
|
|
|
|
local fgCtr = ControllerManager.GetController(NewGroupController)
|
|
|
|
|
|
fgCtr:FG_ExitGroupMgr()
|
|
|
|
|
|
if self._pm_mgr_view then
|
|
|
|
|
|
self._pm_mgr_view:Dispose()
|
|
|
|
|
|
end
|
|
|
|
|
|
if self._pm_set_view then
|
|
|
|
|
|
self._pm_set_view:Dispose()
|
|
|
|
|
|
end
|
|
|
|
|
|
if self._pm_rs_view then
|
|
|
|
|
|
self._pm_rs_view:Dispose()
|
|
|
|
|
|
end
|
|
|
|
|
|
if self._callback then
|
|
|
|
|
|
self._callback()
|
|
|
|
|
|
end
|
|
|
|
|
|
if self.mng_view1 then
|
|
|
|
|
|
self.mng_view1:Destroy()
|
|
|
|
|
|
end
|
|
|
|
|
|
if self.mng_view2 then
|
|
|
|
|
|
self.mng_view2:Destroy()
|
|
|
|
|
|
end
|
|
|
|
|
|
if self.mng_view3 then
|
|
|
|
|
|
self.mng_view3:Destroy()
|
|
|
|
|
|
end
|
|
|
|
|
|
if self.mng_view4 then
|
|
|
|
|
|
self.mng_view4:Destroy()
|
|
|
|
|
|
end
|
|
|
|
|
|
DataManager.SelfUser.cur_group = nil
|
|
|
|
|
|
if self._tw_notice then
|
|
|
|
|
|
self._tw_notice:Stop()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
for i, v in pairs(_iconMap) do
|
|
|
|
|
|
v.texture:Destroy()
|
|
|
|
|
|
v.ntexture:Unload()
|
|
|
|
|
|
end
|
|
|
|
|
|
_iconMap = {}
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
return M
|