| | |
| | | import os
|
| | | import GameWorld
|
| | | import md5
|
| | | import IpyGameDataPY
|
| | | import FormulaControl
|
| | | import ConfigParser
|
| | | import ShareDefine
|
| | | import MapConfig
|
| | | #---------------------------------------------------------------------
|
| | | #全局变量
|
| | | #---------------------------------------------------------------------
|
| | |
| | |
|
| | | AllChConfig = {}
|
| | | GeneralProgramme = {}
|
| | | ServersRouteConfig = None
|
| | | PyMongoDataServerConfig = None
|
| | | DBAllChConfig = {}
|
| | |
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def SetReloadConfig():
|
| | | ## 标记重读配置
|
| | | GameWorld.Log("=== 设置重读配置 ===")
|
| | | GameWorld.GetGameWorld().SetGameWorldDict(ShareDefine.Def_Notify_WorldKey_ReloadConfig, 1)
|
| | | IpyGameDataPY.IPYData.IpyDataClear()
|
| | | import DataRecordPack
|
| | | DataRecordPack.DR_Reload("config")
|
| | | return
|
| | |
|
| | | ## 重读,清除配置
|
| | | # @param key 表名
|
| | |
| | | global AllChConfig
|
| | | global GeneralProgramme
|
| | | global PyMongoDataServerConfig
|
| | | global ServersRouteConfig
|
| | | global DBAllChConfig
|
| | |
|
| | | #重读所有的配置表
|
| | |
| | | GeneralProgramme = {}
|
| | | FormulaControl.ClearCompileFormulaDist()
|
| | | PyMongoDataServerConfig = None
|
| | | ServersRouteConfig = None
|
| | | DBAllChConfig = {}
|
| | | |
| | | MapConfig.ClearConfig()
|
| | |
|
| | | GameWorld.Log('MapServer_Reload_ChConfig')
|
| | | #关闭字典
|
| | |
| | |
|
| | | ## -----------------------------------------------------------
|
| | |
|
| | | def GetServersRouteConfig(section, option, raw=False, defaultValue=None, isLog=True):
|
| | | global ServersRouteConfig
|
| | | |
| | | if not ServersRouteConfig:
|
| | | filePath = ChConfig.GetServersRoutePath() + "\\PyMongoDataServer.ini"
|
| | | |
| | | if not os.path.isfile(filePath):
|
| | | GameWorld.Log('无法找到文件 = %s'%(filePath))
|
| | | raise Exception('无法找到文件 = %s'%(filePath))
|
| | | |
| | | ServersRouteConfig = ConfigParser.ConfigParser()
|
| | | ServersRouteConfig.read(filePath)
|
| | | GameWorld.DebugLog("Reload %s" % str(filePath))
|
| | | |
| | | if not ServersRouteConfig.has_option(section, option):
|
| | | if defaultValue != None:
|
| | | return defaultValue
|
| | | if isLog:
|
| | | GameWorld.ErrLog("ServersRoute->PyMongoDataServer.ini找不到配置: section=%s,option=%s" % (section, option))
|
| | | return ""
|
| | | |
| | | strParam = ServersRouteConfig.get(section, option, raw)
|
| | | return strParam
|
| | |
|
| | | ## PyMongoDataServer.ini配置读取
|
| | | # @param section: 分段区块名
|
| | | # @param option: 配置项名
|