1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package Player.PlayerFuncTeam
#
# @todo:¹¦ÄܶÓÎé±í
# @author hxp
# @date 2024-08-02
# @version 1.0
#
# ÏêϸÃèÊö: ¹¦ÄܶÓÎé±í
#
#-------------------------------------------------------------------------------
#"""Version = 2024-08-02 16:30"""
#-------------------------------------------------------------------------------
 
import PyGameData
 
def OnFuncTeamMemIDRefresh(msgList):
    ## ¹¦ÄܶÓÎé³ÉÔ±IDË¢ÐÂ
    teamIDList, delTeamIDList, teamMemIDInfoDict = msgList
    
    # Ã»ÓÐÖ¸¶¨Ê±£¬È«²¿Ë¢ÐÂ
    if not teamIDList:
        PyGameData.g_funcTeamPlayerDict = {}
        
    for key, refreshDict in teamMemIDInfoDict.items():
        if key not in PyGameData.g_funcTeamPlayerDict:
            PyGameData.g_funcTeamPlayerDict[key] = {}
        infoDict = PyGameData.g_funcTeamPlayerDict[key]
        infoDict.update(refreshDict)
        
    for teamInfoDict in PyGameData.g_funcTeamPlayerDict.values():
        for delTeamID in delTeamIDList[::-1]:
            if delTeamID not in teamInfoDict:
                continue
            teamInfoDict.pop(delTeamID, None)
            delTeamIDList.remove(delTeamID)
            
    return
 
def GetPlayerTeamID(playerID, funcMapID):
    for key, infoDict in PyGameData.g_funcTeamPlayerDict.items():
        if funcMapID != key[1]:
            continue
        for teamID, memIDList in infoDict.items():
            if playerID in memIDList:
                return teamID
    return 0
 
def GetMemberIDList(teamID):
    for infoDict in PyGameData.g_funcTeamPlayerDict.values():
        if teamID in infoDict:
            return infoDict[teamID]
    return []