12001刷新成员状态、状态排序、退出游戏按钮修复
parent
e9cdfbbbc2
commit
cd6cc8b60c
|
|
@ -249,6 +249,20 @@ function M:OnEvtUpdateRoom(evt_data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
group.update_room = true
|
group.update_room = true
|
||||||
|
|
||||||
|
-- ↓↓刷新成员状态
|
||||||
|
|
||||||
|
for _, player in pairs(group.members) do
|
||||||
|
player.playing = "stopPlaying"
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, room in pairs(cmds) do
|
||||||
|
for _, palyingUser in pairs(room.plist) do
|
||||||
|
local _player = group.memberMap[palyingUser.aid]
|
||||||
|
_player.playing = "startPlaying"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
DispatchEvent(self._dispatcher, GroupMgrEvent.OnFamilyRoomReflash, self.groupId)
|
DispatchEvent(self._dispatcher, GroupMgrEvent.OnFamilyRoomReflash, self.groupId)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ function M:init(url)
|
||||||
self:Destroy()
|
self:Destroy()
|
||||||
end)
|
end)
|
||||||
local tex_message = view:GetChild("tex_message")
|
local tex_message = view:GetChild("tex_message")
|
||||||
|
tex_message.emojies = EmojiDitc.EmojiesDitc
|
||||||
if (self._tip) then tex_message.text = self._tip end
|
if (self._tip) then tex_message.text = self._tip end
|
||||||
|
|
||||||
local btn_close = view:GetChild('btn_close1')
|
local btn_close = view:GetChild('btn_close1')
|
||||||
|
|
|
||||||
|
|
@ -314,12 +314,9 @@ function M:_evtOnFamilyReflash(...)
|
||||||
view:ChangeOther()
|
view:ChangeOther()
|
||||||
view._child_familyAuditNumber:Reflash()
|
view._child_familyAuditNumber:Reflash()
|
||||||
end
|
end
|
||||||
|
|
||||||
if reflashType == "" then
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 刷新房间和成员
|
||||||
function M:_evtOnFamilyRoomReflash(...)
|
function M:_evtOnFamilyRoomReflash(...)
|
||||||
local arg = { ... }
|
local arg = { ... }
|
||||||
print("_evtOnFamilyRoomReflash")
|
print("_evtOnFamilyRoomReflash")
|
||||||
|
|
@ -336,6 +333,7 @@ function M:_evtOnFamilyRoomReflash(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
view:UpdateFamilyRoom(nil, groupId)
|
view:UpdateFamilyRoom(nil, groupId)
|
||||||
|
view:ReflashMember()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:_evtOnFamilyMemberOut(...)
|
function M:_evtOnFamilyMemberOut(...)
|
||||||
|
|
@ -354,7 +352,8 @@ function M:_evtOnFamilyMemberOut(...)
|
||||||
end
|
end
|
||||||
local tips = "成员 【%s(%s)】退出了【%s(%s)】亲友圈"
|
local tips = "成员 【%s(%s)】退出了【%s(%s)】亲友圈"
|
||||||
tips = string.format(tips, name, uid, group.name, groupId)
|
tips = string.format(tips, name, uid, group.name, groupId)
|
||||||
ViewUtil.ShowTips("成员 【%s】")
|
local win = MsgWindow.new(view._view, tips, MsgWindow.MsgMode.OnlyOk)
|
||||||
|
win:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,45 @@ local function FamilyOffline(groupId, self)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function SortMembers(Members)
|
||||||
|
local re = {}
|
||||||
|
local online = {}
|
||||||
|
local playing = {}
|
||||||
|
local offline = {}
|
||||||
|
|
||||||
|
for _, player in pairs(Members) do
|
||||||
|
|
||||||
|
-- 在线 绿色状态
|
||||||
|
if player.online == 1 and player.playing == "stopPlaying" then
|
||||||
|
online[#online + 1] = player
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 在线游戏中 红色状态
|
||||||
|
if player.online == 1 and player.playing == "startPlaying" then
|
||||||
|
playing[#playing + 1] = player
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 离线
|
||||||
|
if player.online == 0 then
|
||||||
|
offline[#offline + 1] = player
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, player in pairs(online) do
|
||||||
|
re[#re + 1] = player
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, player in pairs(playing) do
|
||||||
|
re[#re + 1] = player
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, player in pairs(offline) do
|
||||||
|
re[#re + 1] = player
|
||||||
|
end
|
||||||
|
|
||||||
|
return re
|
||||||
|
end
|
||||||
|
|
||||||
function FamilyView.new()
|
function FamilyView.new()
|
||||||
UIPackage.AddPackage("base/Family/ui/Family")
|
UIPackage.AddPackage("base/Family/ui/Family")
|
||||||
|
|
||||||
|
|
@ -351,9 +390,12 @@ function M:BanDeskmate()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ReflashMember()
|
function M:ReflashMember()
|
||||||
|
|
||||||
|
self.members = SortMembers(self._group.members)
|
||||||
|
|
||||||
local list_familyNumber = self._view:GetChild('list_familyNumber')
|
local list_familyNumber = self._view:GetChild('list_familyNumber')
|
||||||
if list_familyNumber.itemRenderer == nil then
|
if list_familyNumber.itemRenderer == nil then
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if list_familyNumber.numItems == #self._group.members then
|
if list_familyNumber.numItems == #self._group.members then
|
||||||
|
|
@ -367,7 +409,7 @@ function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type)
|
||||||
local list_familyNumber = self._view:GetChild('list_familyNumber')
|
local list_familyNumber = self._view:GetChild('list_familyNumber')
|
||||||
list_familyNumber:SetVirtual()
|
list_familyNumber:SetVirtual()
|
||||||
fgCtr:FG_GroupMembers12(group_id, limit, num, 2, 2, function(res)
|
fgCtr:FG_GroupMembers12(group_id, limit, num, 2, 2, function(res)
|
||||||
local members = self._group.members
|
self.members = SortMembers(self._group.members) --local members = self._group.members
|
||||||
print("FG_GroupMembers12")
|
print("FG_GroupMembers12")
|
||||||
pt(self._group.members)
|
pt(self._group.members)
|
||||||
--ViewUtil:CloseModalWait()
|
--ViewUtil:CloseModalWait()
|
||||||
|
|
@ -375,16 +417,18 @@ function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type)
|
||||||
ViewUtil.ErrorTip(res.ReturnCode, "获取成员列表失败")
|
ViewUtil.ErrorTip(res.ReturnCode, "获取成员列表失败")
|
||||||
else
|
else
|
||||||
list_familyNumber.itemRenderer = function(index, obj)
|
list_familyNumber.itemRenderer = function(index, obj)
|
||||||
|
local player = self.members[index + 1]
|
||||||
obj:GetChild('title').emojies = EmojiDitc.EmojiesDitc
|
obj:GetChild('title').emojies = EmojiDitc.EmojiesDitc
|
||||||
obj:GetChild('title').text = Utils.TextOmit(members[index + 1].nick, 5)
|
obj:GetChild('title').text = Utils.TextOmit(player.nick, 5)
|
||||||
obj:GetController('type').selectedIndex = members[index + 1].online and members[index + 1].online or 0
|
obj:GetController('type').selectedIndex = player.online and player.online or 0
|
||||||
if members[index + 1].playing == "startPlaying" then
|
if player.playing == "startPlaying" then
|
||||||
obj:GetController('type').selectedIndex = 2
|
obj:GetController('type').selectedIndex = 2
|
||||||
end
|
end
|
||||||
local loader_icon = obj:GetChild("btn_head"):GetChild("icon")
|
local loader_icon = obj:GetChild("btn_head"):GetChild("icon")
|
||||||
ImageLoad.Load(members[index + 1].portrait, loader_icon)
|
ImageLoad.Load(player.portrait, loader_icon)
|
||||||
end
|
end
|
||||||
list_familyNumber.numItems = #self._group.members
|
--list_familyNumber.numItems = #self._group.members
|
||||||
|
list_familyNumber.numItems = #self.members
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
@ -678,10 +722,11 @@ function M:ConnetFamily(index, groups, isCreate)
|
||||||
if isCreate then
|
if isCreate then
|
||||||
list_family.itemRenderer = function(i, obj)
|
list_family.itemRenderer = function(i, obj)
|
||||||
local j = i + 1
|
local j = i + 1
|
||||||
|
local group = DataManager.groups.groupList[j]
|
||||||
obj:GetChild("title").emojies = EmojiDitc.EmojiesDitc
|
obj:GetChild("title").emojies = EmojiDitc.EmojiesDitc
|
||||||
obj.text = Utils.TextOmit(groups[j].name, 6)
|
obj.text = Utils.TextOmit(group.name, 6)
|
||||||
obj.onClick:Add(function()
|
obj.onClick:Add(function()
|
||||||
if groups[j].id == self._group.id then
|
if group.id == self._group.id then
|
||||||
ViewUtil.ShowBannerOnScreenCenter("已在家族中")
|
ViewUtil.ShowBannerOnScreenCenter("已在家族中")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,14 @@ local M = {}
|
||||||
setmetatable(M, { __index = MainView })
|
setmetatable(M, { __index = MainView })
|
||||||
|
|
||||||
local default_bg = 1
|
local default_bg = 1
|
||||||
function M:InitView(url, use_custom_bg, custom_bg_config)
|
|
||||||
|
|
||||||
|
local function IsRoomOwer()
|
||||||
|
--local roomOwner = self._room.player_list[1].self_user.account_id
|
||||||
|
local roomOwner = DataManager.CurrenRoom.player_list[1].self_user.account_id
|
||||||
|
return roomOwner == DataManager.SelfUser.account_id
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:InitView(url, use_custom_bg, custom_bg_config)
|
||||||
-- 加载牌型数据
|
-- 加载牌型数据
|
||||||
if not DataManager.CardTypeList then
|
if not DataManager.CardTypeList then
|
||||||
local json_data = Utils.LoadLocalFile("CardTypeData")
|
local json_data = Utils.LoadLocalFile("CardTypeData")
|
||||||
|
|
@ -177,22 +183,8 @@ function M:InitView(url, use_custom_bg, custom_bg_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
self._view:GetChild('btn_closeRoom').onClick:Set(function()
|
self._view:GetChild('btn_closeRoom').onClick:Set(function()
|
||||||
local tip_owner = '您是否退出房间?\n(退出房间后房间将解散)'
|
if IsRoomOwer() then
|
||||||
local tip = '您是否退出房间?' -- \n (请注意,申请洗牌后退出,不会返还洗牌分)
|
self._gamectr:AskDismissRoom(
|
||||||
local tipStr = ''
|
|
||||||
if self._room.agent then
|
|
||||||
tipStr = '您是否退出房间?'
|
|
||||||
else
|
|
||||||
tipStr = self._room.owner_id == self._room.self_player.self_user.account_id and tip_owner or tip
|
|
||||||
end
|
|
||||||
local _curren_msg = MsgWindow.new(self._root_view, tipStr, MsgWindow.MsgMode.OkAndCancel)
|
|
||||||
_curren_msg.onOk:Add(
|
|
||||||
function()
|
|
||||||
if self._state.selectedIndex > 0 and self._state.selectedIndex < 3 then
|
|
||||||
ViewUtil.ErrorTip(nil, '房间已开始,无法退出游戏。')
|
|
||||||
else
|
|
||||||
ViewUtil.ShowModalWait(self._root_view)
|
|
||||||
self._gamectr:LevelRoom(
|
|
||||||
function(res)
|
function(res)
|
||||||
ViewUtil.CloseModalWait()
|
ViewUtil.CloseModalWait()
|
||||||
if res.ReturnCode == 0 then
|
if res.ReturnCode == 0 then
|
||||||
|
|
@ -200,12 +192,15 @@ function M:InitView(url, use_custom_bg, custom_bg_config)
|
||||||
else
|
else
|
||||||
ViewUtil.ErrorTip(res.ReturnCode)
|
ViewUtil.ErrorTip(res.ReturnCode)
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
|
return
|
||||||
end
|
end
|
||||||
)
|
self._gamectr:LevelRoom(function(res)
|
||||||
|
if res.ReturnCode ~= 0 then
|
||||||
|
ViewUtil.ErrorTip(res.ReturnCode)
|
||||||
end
|
end
|
||||||
end
|
ViewManager.ChangeView(ViewManager.View_Family)
|
||||||
)
|
end)
|
||||||
_curren_msg:Show()
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self:InitXiPai()
|
self:InitXiPai()
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<image id="n17_nuxq" name="bg" src="xblm7jbk" fileName="images/bg.png" xy="0,0" size="682,406">
|
<image id="n17_nuxq" name="bg" src="xblm7jbk" fileName="images/bg.png" xy="0,0" size="682,406">
|
||||||
<relation target="" sidePair="width-width,height-height"/>
|
<relation target="" sidePair="width-width,height-height"/>
|
||||||
</image>
|
</image>
|
||||||
<text id="n18_xblm" name="tex_message" xy="0,110" size="682,149" font="Alimama FangYuanTi VF" fontSize="36" color="#614103" align="center" vAlign="middle" ubb="true" autoSize="none" text="空间和空间
空间和空间"/>
|
<richtext id="n18_xblm" name="tex_message" xy="41,110" size="600,149" font="Alimama FangYuanTi VF" fontSize="36" color="#614103" align="center" vAlign="middle" ubb="true" autoSize="none" text="空间和空间
空间和空间
空间和空间"/>
|
||||||
<component id="n4_m0vo" name="btn_ok" src="eeqmcgp" fileName="buttons/Btn_Common.xml" xy="223,272" size="235,92">
|
<component id="n4_m0vo" name="btn_ok" src="eeqmcgp" fileName="buttons/Btn_Common.xml" xy="223,272" size="235,92">
|
||||||
<Button title=" " icon="ui://27vd145bxblm7jbl"/>
|
<Button title=" " icon="ui://27vd145bxblm7jbl"/>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue