#!/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  
 | 
      
 | 
      
 |