192 lines
6.0 KiB
Lua
192 lines
6.0 KiB
Lua
------------------------------------------------
|
||
-- 作者: gzy
|
||
-- 日期: 2021-06-22
|
||
-- 文件: CommunityMsgSystem.lua
|
||
-- 模块: CommunityMsgSystem
|
||
-- 描述: 社区系统类
|
||
------------------------------------------------
|
||
-- 引用
|
||
|
||
--===============================================================--
|
||
|
||
local CommunityMsgSystem = {
|
||
RoleId = nil,
|
||
|
||
-- --自己社区面板信息data
|
||
-- MyBoardData = nil,
|
||
-- --他人社区面板信息data
|
||
-- OthersBoardData = nil,
|
||
--当前玩家信息
|
||
CurPlayerInfo = nil,
|
||
--MSGlist
|
||
LeaveMsgList = nil,
|
||
DynamicList = nil,
|
||
--判断要不要关闭时返回自己的社区界面
|
||
isNeedBackToSelf = false,
|
||
}
|
||
|
||
function CommunityMsgSystem:Initialize()
|
||
|
||
|
||
end
|
||
|
||
function CommunityMsgSystem:UnInitialize()
|
||
self.MyBoardData = nil
|
||
self.OthersBoardData = nil
|
||
end
|
||
|
||
-- 获取留言信息列表
|
||
function CommunityMsgSystem:GetLeaveMsgList()
|
||
return self.LeaveMsgList
|
||
end
|
||
|
||
--获取个人动态信息列表
|
||
function CommunityMsgSystem:GetDynamicMsgList()
|
||
return self.DynamicList
|
||
end
|
||
|
||
-------------------req消息(Msg)相关------------------
|
||
-- 请求玩家信息
|
||
function CommunityMsgSystem:ReqPlayerCommunityInfo(palyerId)
|
||
local _msg = ReqMsg.MSG_Community.ReqPlayerCommunityInfo:New()
|
||
_msg.roleId = palyerId
|
||
_msg:Send()
|
||
end
|
||
|
||
-- 向服务器更新设置 设置类型 1,装饰 2,挂件 3,个性签名 4,生日 5,是否允许好友留言
|
||
function CommunityMsgSystem:ReqPlayerCommunityInfoSetting(type , data)
|
||
local _msg = ReqMsg.MSG_Community.ReqPlayerCommunityInfoSetting:New()
|
||
_msg.playerCommunityInfoSettingInfo = {}
|
||
_msg.settingType = type
|
||
if type == 1 then
|
||
_msg.playerCommunityInfoSettingInfo.decorate = data
|
||
elseif type == 2 then
|
||
_msg.playerCommunityInfoSettingInfo.pendan = data
|
||
elseif type == 3 then
|
||
_msg.playerCommunityInfoSettingInfo.sign = data
|
||
elseif type == 4 then
|
||
_msg.playerCommunityInfoSettingInfo.brith = data
|
||
elseif type == 5 then
|
||
_msg.playerCommunityInfoSettingInfo.isNotFriendLeaveMsg = data
|
||
end
|
||
_msg:Send()
|
||
end
|
||
|
||
|
||
---====================req消息(Msg)============================--
|
||
|
||
-- 获取留言列表
|
||
function CommunityMsgSystem:ReqCommunityLeaveMessage(palyerId)
|
||
local _msg = ReqMsg.MSG_Community.ReqCommunityLeaveMessage:New()
|
||
_msg.roleId = palyerId
|
||
_msg:Send()
|
||
end
|
||
|
||
-- 获取动态列表
|
||
function CommunityMsgSystem:ReqCommunityDynamic(palyerId)
|
||
local _msg = ReqMsg.MSG_Community.ReqFriendCircle:New()
|
||
_msg.roleId = palyerId
|
||
_msg:Send()
|
||
end
|
||
|
||
-- 发送一条留言
|
||
function CommunityMsgSystem:ReqAddCommunityLeaveMessage(palyerId , condition)
|
||
local _msg = ReqMsg.MSG_Community.ReqAddCommunityLeaveMessage:New()
|
||
_msg.roleId = palyerId
|
||
_msg.condition = condition
|
||
_msg:Send()
|
||
end
|
||
|
||
-- 删除一条留言
|
||
function CommunityMsgSystem:ReqDeleteCommunityLeaveMessage(palyerId , leaveMessageId)
|
||
local _msg = ReqMsg.MSG_Community.ReqDeleteCommunityLeaveMessage:New()
|
||
_msg.roleId = palyerId
|
||
_msg.leaveMessageId = leaveMessageId
|
||
_msg:Send()
|
||
end
|
||
|
||
-- 删除一条动态
|
||
function CommunityMsgSystem:ReqCommunityDeletedDynamic(friendCircleId)
|
||
local _msg = ReqMsg.MSG_Community.ReqDeleteFriendCircle:New()
|
||
_msg.friendCircleId = friendCircleId
|
||
_msg:Send()
|
||
end
|
||
|
||
-- 发送一条动态
|
||
function CommunityMsgSystem:ReqCommunityAddDynamic(palyerId , condition)
|
||
local _msg = ReqMsg.MSG_Community.ReqSendFriendCircle:New()
|
||
_msg.roleId = palyerId
|
||
_msg.condition = condition
|
||
_msg:Send()
|
||
end
|
||
|
||
-- 评论一条动态
|
||
function CommunityMsgSystem:ReqCommunityPingLunDynamic(palyerId , friendCircleId , commentCondition)
|
||
local _msg = ReqMsg.MSG_Community.ReqCommentFriendCircle:New()
|
||
_msg.targetRoleId = palyerId
|
||
_msg.friendCircleId = friendCircleId
|
||
_msg.commentCondition = commentCondition
|
||
_msg:Send()
|
||
end
|
||
|
||
|
||
|
||
---====================res消息(Msg)============================--
|
||
-- 返回社区信息
|
||
function CommunityMsgSystem:ResPlayerCommunityInfo(msg)
|
||
self.CurPlayerInfo = msg.playerCommunityInfo
|
||
GameCenter.PushFixEvent(UILuaEventDefine.UICommunityMsgForm_OPEN)
|
||
end
|
||
|
||
--更新设置信息
|
||
function CommunityMsgSystem:ResPlayerCommunityInfoSetting(msg)
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_COMMUNITY_SETTING , msg)
|
||
end
|
||
|
||
-- 获取留言信息列表
|
||
function CommunityMsgSystem:ResCommunityLeaveMessage(msg)
|
||
self.LeaveMsgList = msg.communityLeaveMessageInfoList
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_COMMUNITY_MSGBOARD_OPEN)
|
||
end
|
||
|
||
--获取个人动态信息列表
|
||
function CommunityMsgSystem:ResCommunityDynamicMessage(msg)
|
||
self.DynamicList = List:New()
|
||
if msg.friendCircleInfo ~= nil then
|
||
for i = 1, #msg.friendCircleInfo do
|
||
self.DynamicList:Add(msg.friendCircleInfo[i])
|
||
end
|
||
end
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_COMMUNITY_DYNAMCIPANEL_OPEN , 1)
|
||
end
|
||
|
||
-- 收到新的动态
|
||
function CommunityMsgSystem:ResCommunityDynamicMsgAdd(info)
|
||
self.DynamicList:Add(info.friendCircleInfo[1])
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_COMMUNITY_DYNAMCIPANEL_OPEN , 2)
|
||
end
|
||
|
||
-- 删除一条动态
|
||
function CommunityMsgSystem:ResCommunityDynamicMsgDeleted(info)
|
||
for i = 1, #self.DynamicList do
|
||
if info.friendCircleInfo[1].friendCircleId == self.DynamicList[i].friendCircleId then
|
||
self.DynamicList:RemoveAt(i)
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_COMMUNITY_DYNAMCIPANEL_OPEN , 3)
|
||
return
|
||
end
|
||
end
|
||
-- GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_COMMUNITY_DYNAMCIPANEL_OPEN , 3)
|
||
end
|
||
|
||
-- 刷新评论
|
||
function CommunityMsgSystem:ResCommunityDynamicMsgPingLun(info)
|
||
for i = 1, #self.DynamicList do
|
||
if info.friendCircleInfo[1].friendCircleId == self.DynamicList[i].friendCircleId then
|
||
self.DynamicList[i].friendCircleLeaveMessageInfo = info.friendCircleInfo[1].friendCircleLeaveMessageInfo
|
||
end
|
||
end
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_COMMUNITY_DYNAMCIPANEL_OPEN , 4)
|
||
end
|
||
|
||
return CommunityMsgSystem
|