| | |
| | | import IpyGameDataPY
|
| | | import PlayerViewCache
|
| | | import PyGameData
|
| | |
|
| | | #--------------------社交圈基本结构-------------------
|
| | | # 社交圈
|
| | | class SocialPlayers(object):
|
| | |
| | |
|
| | | def GetCount(self):
|
| | | return len(self.SocialDict)
|
| | | |
| | | def GetSocialIDList(self): return self.SocialDict.keys()
|
| | |
|
| | | def Find(self, tagID):
|
| | | return self.SocialDict.get(tagID, None)
|
| | |
| | |
|
| | | # 通知地图好友信息
|
| | | def MapServer_SyncFriendInfo(self, curPlayer):
|
| | | if not curPlayer:
|
| | | return
|
| | | sendPack = ChGameToMapPyPack.tagGMFriendInfo() |
| | | sendPack.PlayerID = curPlayer.GetPlayerID()
|
| | | sendPack.FriendCnt = self.GetCount()
|
| | | sendPack.Friends = []
|
| | | |
| | | for friendInfo in self.SocialDict.values():
|
| | | playerFriend = ChGameToMapPyPack.tagGMPlayerFrendInfo()
|
| | | playerFriend.TagID = friendInfo.PlayerID
|
| | | sendPack.Friends.append(playerFriend)
|
| | | NetPackCommon.SendPyPackToMapServer(curPlayer.GetLineNO(), curPlayer.GetRealMapID(), sendPack) |
| | | return
|
| | | #=======================================================================
|
| | | # if not curPlayer:
|
| | | # return
|
| | | # sendPack = ChGameToMapPyPack.tagGMFriendInfo() |
| | | # sendPack.PlayerID = curPlayer.GetPlayerID()
|
| | | # sendPack.FriendCnt = self.GetCount()
|
| | | # sendPack.Friends = []
|
| | | # |
| | | # for friendInfo in self.SocialDict.values():
|
| | | # playerFriend = ChGameToMapPyPack.tagGMPlayerFrendInfo()
|
| | | # playerFriend.TagID = friendInfo.TagID
|
| | | # sendPack.Friends.append(playerFriend)
|
| | | # NetPackCommon.SendPyPackToMapServer(curPlayer.GetLineNO(), curPlayer.GetRealMapID(), sendPack) |
| | | #=======================================================================
|
| | |
|
| | |
|
| | | # 整个游戏的好友管理
|
| | |
| | |
|
| | | # 增加社交对象信息,针对不在社交圈记录并且不在线玩家的情况
|
| | | def AddPlayerInfoByViewCache(self, playerID):
|
| | | curCache = PlayerViewCache.ViewCacheMgr.FindCache(playerID)
|
| | | curCache = PlayerViewCache.FindViewCache(playerID)
|
| | | playerSocial = PyGameDataStruct.tagPersonalSocial()
|
| | | if not curCache:
|
| | | # 实在找不到设置为初始化数据
|
| | |
| | | playerSocial.RealmLV = 1
|
| | | playerSocial.OnlineType = ChConfig.Def_Offline
|
| | | else:
|
| | | cacheDict = eval(curCache.GetPropData())
|
| | | cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
|
| | |
|
| | | playerSocial.clear()
|
| | | playerSocial.PlayerID = playerID
|