xdh
2018-09-19 ffb34f87fe65c84cc9c204371cbbb3a2a0b43ec1
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package MergeBroadcast.py
# ¿ç·þÈü·þÎñÆ÷¹ã²¥
#
# @author wdb
# @date 2012-10-31 16:50
# @version 1.1
# @note
# @change: "2012-12-12 15:00" wdb ¿ç·þ¹ã²¥ÐÞ¸Ä
#---------------------------------------------------------------------
"""Version = 2012-12-12 15:00"""
#---------------------------------------------------------------------
import IPY_GameServer
import GameWorld
import ChConfig
#---------------------------------------------------------------------
# Òª¿ç·þ¹ã²¥µÄÐÅÏ¢ÄÚÈÝ
g_broadcastMsgList= []
 
# Öظ´¹ã²¥3´Î
Def_MaxBroadcastCnt = 3
 
 
## ¹ã²¥ÐÅÏ¢µ½×Ó·þÎñÆ÷ÉÏ
#  @param sendType ¹ã²¥ÀàÐÍ
#  @param infoDict ¹ã²¥ÐÅÏ¢×Öµä
#  @return None
def SendBroadcastMerge(operType, mapID, dataDict, isRepeat=True):
    global g_broadcastMsgList
    
    sendDict = {'Oper':operType, 'MapID':mapID, 'Data':dataDict}
    GameWorld.Log("SendBroadcastMerge=>isRepeat:%s, sendDict%s"%(isRepeat, sendDict))
    # ÐèÒª¼ÓÈëÖØ¸´¹ã²¥ÐÅÏ¢Áбí
    if isRepeat:
        g_broadcastMsgList.append((0, operType, mapID, dataDict))
        
    # Ö±½Ó·¢ËÍ
    else:
        GameWorld.GetGameWorld().SendBroadcastMergeClient(str(sendDict))    
    return
 
 
## Ê±ÖÓµ÷Óô¦Àí
#  @param tick: Ê±ÖÓtick
#  @return None
def OnBroadcastProccee(tick):
    global g_broadcastMsgList    
    tempMsgList = []
    
    #¼ä¸ôδµ½
    if not GameWorld.SetWorldDictKey(ChConfig.TYPE_MergeBroadcastTick, tick):
        return  
    
    # Òª¿ç·þ¹ã²¥µÄÐÅÏ¢ÄÚÈÝ
    for msgInfo in g_broadcastMsgList:
        
        broadcastCnt, operType, mapID, dataDict = msgInfo
        # ´ïµ½Öظ´¹ã²¥´ÎÊý
        if broadcastCnt >= Def_MaxBroadcastCnt:
            continue
        
        # ¹ã²¥ÐÅÏ¢µ½×Ó·þÎñÆ÷ÉÏ
        SendBroadcastMerge(operType, mapID, dataDict, False)
        # ¸üй㲥´ÎÊý
        tempMsgList.append((broadcastCnt + 1, operType, mapID, dataDict))
    
    g_broadcastMsgList = tempMsgList[:]
    return