15秒心跳
parent
81e28ee578
commit
84b9f60fde
|
|
@ -20,6 +20,7 @@ GroupMgrEvent = {
|
||||||
OnMemberState = "OnMemberState",
|
OnMemberState = "OnMemberState",
|
||||||
Onpush_assistant = "Onpush_assistant",
|
Onpush_assistant = "Onpush_assistant",
|
||||||
OnFamilyReflash = "OnFamilyReflash",
|
OnFamilyReflash = "OnFamilyReflash",
|
||||||
|
OnFamilyRoomReflash = "OnFamilyRoomReflash",
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupMgrController = {
|
GroupMgrController = {
|
||||||
|
|
@ -245,6 +246,7 @@ function M:OnEvtUpdateRoom(evt_data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
group.update_room = true
|
group.update_room = true
|
||||||
|
DispatchEvent(self._dispatcher, GroupMgrEvent.OnFamilyRoomReflash, self.groupId)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnEvtUpdatePlayerInfo(evt_data)
|
function M:OnEvtUpdatePlayerInfo(evt_data)
|
||||||
|
|
@ -430,6 +432,36 @@ end
|
||||||
function M:FG_Data_Member_State(evt_data)
|
function M:FG_Data_Member_State(evt_data)
|
||||||
print("收到成员状态推送")
|
print("收到成员状态推送")
|
||||||
pt(evt_data)
|
pt(evt_data)
|
||||||
|
local offlineUserId = evt_data.offlineUserId
|
||||||
|
local onlineUserId = evt_data.onlineUserId
|
||||||
|
local playingUserId = evt_data.playingUserId
|
||||||
|
|
||||||
|
local group = DataManager.groups:get(self.groupId)
|
||||||
|
|
||||||
|
for _, uid in pairs(offlineUserId) do
|
||||||
|
local player = group.memberMap[uid]
|
||||||
|
if player then
|
||||||
|
player.online = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, uid in pairs(onlineUserId) do
|
||||||
|
local player = group.memberMap[uid]
|
||||||
|
if player then
|
||||||
|
player.online = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, p in pairs(group.memberMap) do
|
||||||
|
p.playing = "stopPlaying"
|
||||||
|
end
|
||||||
|
for _, uid in pairs(playingUserId) do
|
||||||
|
local player = group.memberMap[uid]
|
||||||
|
if player then
|
||||||
|
player.playing = "startPlaying"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
DispatchEvent(self._dispatcher, GroupMgrEvent.OnMemberState, evt_data)
|
DispatchEvent(self._dispatcher, GroupMgrEvent.OnMemberState, evt_data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,9 @@ function FamilyEventView.new(root)
|
||||||
mgr_ctr:AddEventListener(GroupMgrEvent.OnNewApply, handler(self, self._evtOnNewApply))
|
mgr_ctr:AddEventListener(GroupMgrEvent.OnNewApply, handler(self, self._evtOnNewApply))
|
||||||
mgr_ctr:AddEventListener(GroupMgrEvent.OnNewRecord, handler(self, self._evtOnNewRecord))
|
mgr_ctr:AddEventListener(GroupMgrEvent.OnNewRecord, handler(self, self._evtOnNewRecord))
|
||||||
mgr_ctr:AddEventListener(GroupMgrEvent.Onpush_assistant, handler(self, self._evtOnPush_assistant))
|
mgr_ctr:AddEventListener(GroupMgrEvent.Onpush_assistant, handler(self, self._evtOnPush_assistant))
|
||||||
--mgr_ctr:AddEventListener(GroupMgrEvent.OnMemberState, handler(self, self._evtOnMemberState))
|
mgr_ctr:AddEventListener(GroupMgrEvent.OnMemberState, handler(self, self._evtOnMemberState))
|
||||||
mgr_ctr:AddEventListener(GroupMgrEvent.OnFamilyReflash, handler(self, self._evtOnPush_assistant))
|
mgr_ctr:AddEventListener(GroupMgrEvent.OnFamilyReflash, handler(self, self._evtOnPush_assistant))
|
||||||
|
mgr_ctr:AddEventListener(GroupMgrEvent.OnFamilyRoomReflash, handler(self, self._evtOnFamilyRoomReflash))
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -48,6 +49,9 @@ function M:RemoveAll()
|
||||||
mgr_ctr:RemoveEventListener(GroupMgrEvent.ChatRoomData, handler(self, self._evtChatRoomData))
|
mgr_ctr:RemoveEventListener(GroupMgrEvent.ChatRoomData, handler(self, self._evtChatRoomData))
|
||||||
mgr_ctr:RemoveEventListener(GroupMgrEvent.OnNewApply, handler(self, self._evtOnNewApply))
|
mgr_ctr:RemoveEventListener(GroupMgrEvent.OnNewApply, handler(self, self._evtOnNewApply))
|
||||||
mgr_ctr:RemoveEventListener(GroupMgrEvent.OnNewRecord, handler(self, self._evtOnNewRecord))
|
mgr_ctr:RemoveEventListener(GroupMgrEvent.OnNewRecord, handler(self, self._evtOnNewRecord))
|
||||||
|
mgr_ctr:RemoveEventListener(GroupMgrEvent.Onpush_assistant, handler(self, self._evtOnPush_assistant))
|
||||||
|
mgr_ctr:RemoveEventListener(GroupMgrEvent.OnMemberState, handler(self, self._evtOnMemberState))
|
||||||
|
mgr_ctr:RemoveEventListener(GroupMgrEvent.OnFamilyReflash, handler(self, self._evtOnFamilyRoomReflash))
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:_evtAddPlay(...)
|
function M:_evtAddPlay(...)
|
||||||
|
|
@ -92,6 +96,11 @@ end
|
||||||
|
|
||||||
function M:_evtUpdateGroup(...)
|
function M:_evtUpdateGroup(...)
|
||||||
local arg = { ... }
|
local arg = { ... }
|
||||||
|
local view = ViewManager.GetCurrenView()
|
||||||
|
if view.class ~= "FamilyMainView" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
view:ReflashFamilyList()
|
||||||
print("family event _evtUpdateGroup")
|
print("family event _evtUpdateGroup")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -187,6 +196,12 @@ function M:_evtOnNewRecord(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:_evtOnMemberState(...)
|
function M:_evtOnMemberState(...)
|
||||||
|
local view = ViewManager.GetCurrenView()
|
||||||
|
if view.class ~= "FamilyMainView" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
view:ReflashMember(...)
|
||||||
|
--[[
|
||||||
local view = ViewManager.GetCurrenView()
|
local view = ViewManager.GetCurrenView()
|
||||||
if view.class ~= "FamilyMainView" then
|
if view.class ~= "FamilyMainView" then
|
||||||
return
|
return
|
||||||
|
|
@ -201,6 +216,11 @@ function M:_evtOnMemberState(...)
|
||||||
for _, player in pairs(arg[1].onlineUserId) do
|
for _, player in pairs(arg[1].onlineUserId) do
|
||||||
group.memberMap[player].online = 0
|
group.memberMap[player].online = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for _, player in pairs(arg[1].playingUserId) do
|
||||||
|
group.memberMap[player].playing = "startPlaying"
|
||||||
|
end
|
||||||
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:_evtOnPush_assistant(...)
|
function M:_evtOnPush_assistant(...)
|
||||||
|
|
@ -237,4 +257,22 @@ function M:_evtOnFamilyReflash(...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:_evtOnFamilyRoomReflash(...)
|
||||||
|
local arg = { ... }
|
||||||
|
print("_evtOnFamilyRoomReflash")
|
||||||
|
pt(arg)
|
||||||
|
local groupId = arg[1]
|
||||||
|
|
||||||
|
local view = ViewManager.GetCurrenView()
|
||||||
|
if view.class ~= "FamilyMainView" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if groupId ~= view._group.id then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
view:UpdateFamilyRoom(nil, groupId)
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,12 @@ FamilyView = {}
|
||||||
local M = FamilyView
|
local M = FamilyView
|
||||||
|
|
||||||
local function FamilyOnline(groupId, self)
|
local function FamilyOnline(groupId, self)
|
||||||
--localfgCtr = ControllerManager.GetController(GroupMgrController)
|
|
||||||
self._mgr_ctr:FG_Get_Online_Member(groupId, function(res)
|
self._mgr_ctr:FG_Get_Online_Member(groupId, function(res)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function FamilyOffline(groupId, self)
|
local function FamilyOffline(groupId, self)
|
||||||
--local fgCtr = ControllerManager.GetController(GroupMgrController)
|
|
||||||
self._mgr_ctr:FG_Get_Offline_Member(groupId, function(res)
|
self._mgr_ctr:FG_Get_Offline_Member(groupId, function(res)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
@ -347,6 +345,19 @@ function M:BanDeskmate()
|
||||||
self.FamilyBanDesk = FamilyBanDesk:TryShow(self)
|
self.FamilyBanDesk = FamilyBanDesk:TryShow(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:ReflashMember()
|
||||||
|
local list_familyNumber = self._view:GetChild('list_familyNumber')
|
||||||
|
if list_familyNumber.itemRenderer == nil then
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if list_familyNumber.numItems == #self._group.members then
|
||||||
|
list_familyNumber:RefreshVirtualList()
|
||||||
|
else
|
||||||
|
list_familyNumber.numItems = #self._group.members
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type)
|
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()
|
||||||
|
|
@ -405,7 +416,6 @@ function M:OnEnterGroupCallBack()
|
||||||
group.ApplyRedPoint = ApplyRp.
|
group.ApplyRedPoint = ApplyRp.
|
||||||
end
|
end
|
||||||
]]
|
]]
|
||||||
|
|
||||||
end)
|
end)
|
||||||
self._view:GetController('familyBan').selectedIndex = self._group.ban and 1 or 0
|
self._view:GetController('familyBan').selectedIndex = self._group.ban and 1 or 0
|
||||||
|
|
||||||
|
|
@ -626,9 +636,21 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
||||||
]]
|
]]
|
||||||
local all_num = #playList + #roomList
|
local all_num = #playList + #roomList
|
||||||
-- print("=================================================list_room", list_room, list_room.numItems, all_num)
|
-- print("=================================================list_room", list_room, list_room.numItems, all_num)
|
||||||
pt(list_room)
|
print("游戏中的房间")
|
||||||
|
pt(roomList)
|
||||||
|
--list_room.numItems = all_num
|
||||||
|
|
||||||
|
if list_room.numItems == all_num then
|
||||||
|
list_room:RefreshVirtualList()
|
||||||
|
else
|
||||||
list_room.numItems = all_num
|
list_room.numItems = all_num
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:ReflashFamilyList()
|
||||||
|
local list_family = self._view:GetChild('list_family')
|
||||||
|
list_family.numItems = #DataManager.groups.groupList
|
||||||
|
end
|
||||||
|
|
||||||
function M:ConnetFamily(index, groups, isCreate)
|
function M:ConnetFamily(index, groups, isCreate)
|
||||||
if self._group then
|
if self._group then
|
||||||
|
|
@ -749,8 +771,8 @@ function M:OnUpdate()
|
||||||
-- -- print("====================================UpdateFamilyRoom", fgCtr, self._group.id)
|
-- -- print("====================================UpdateFamilyRoom", fgCtr, self._group.id)
|
||||||
self:UpdateFamilyRoom(fgCtr, self._group.id)
|
self:UpdateFamilyRoom(fgCtr, self._group.id)
|
||||||
end
|
end
|
||||||
--[[
|
|
||||||
local HeartbeatTime = 3
|
local HeartbeatTime = 15
|
||||||
if newTime - self.lastTime > HeartbeatTime then
|
if newTime - self.lastTime > HeartbeatTime then
|
||||||
fgCtr:FG_SetFamilyHeartbeat(self._group.id, DataManager.SelfUser.account_id, function(res)
|
fgCtr:FG_SetFamilyHeartbeat(self._group.id, DataManager.SelfUser.account_id, function(res)
|
||||||
print(res)
|
print(res)
|
||||||
|
|
@ -760,7 +782,7 @@ function M:OnUpdate()
|
||||||
self._view:GetChild('list_familyNumber').numItems = #self._group.members
|
self._view:GetChild('list_familyNumber').numItems = #self._group.members
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local IDENTITY_LIST = {
|
local IDENTITY_LIST = {
|
||||||
|
|
|
||||||
|
|
@ -1731,7 +1731,7 @@ function M:__loadGroupData()
|
||||||
mgr_ctr:AddEventListener(GroupMgrEvent.UpdatePlayerInfo, handler(self, self._evtUpdatePlayerInfo))
|
mgr_ctr:AddEventListener(GroupMgrEvent.UpdatePlayerInfo, handler(self, self._evtUpdatePlayerInfo))
|
||||||
-- mgr_ctr:AddEventListener(GroupMgrEvent.UpdateMessage, handler(self,self._evtUpdateMsg))
|
-- mgr_ctr:AddEventListener(GroupMgrEvent.UpdateMessage, handler(self,self._evtUpdateMsg))
|
||||||
mgr_ctr:AddEventListener(GroupMgrEvent.BeInvited, handler(self, self._evtInvited))
|
mgr_ctr:AddEventListener(GroupMgrEvent.BeInvited, handler(self, self._evtInvited))
|
||||||
mgr_ctr:AddEventListener(GroupMgrEvent.UpdateGroup, handler(self, self._evtUpdateGroup))
|
-- mgr_ctr:AddEventListener(GroupMgrEvent.UpdateGroup, handler(self, self._evtUpdateGroup))
|
||||||
mgr_ctr:AddEventListener(GroupMgrEvent.NewMailTip, handler(self, self._evtNewMailTip))
|
mgr_ctr:AddEventListener(GroupMgrEvent.NewMailTip, handler(self, self._evtNewMailTip))
|
||||||
local ctr_manager = self._view:GetController('manager')
|
local ctr_manager = self._view:GetController('manager')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue