public static bool Init() { try { MapMgr.random = new ThreadSafeRandom(); MapMgr.m_lock = new ReaderWriterLock(); MapMgr._maps = new Dictionary <int, MapPoint>(); MapMgr._mapInfos = new Dictionary <int, Map>(); if (!MapMgr.LoadMap(MapMgr._maps, MapMgr._mapInfos)) { bool result = false; return(result); } MapMgr._serverMap = new Dictionary <int, List <int> >(); if (!MapMgr.InitServerMap(MapMgr._serverMap)) { bool result = false; return(result); } } catch (Exception exception) { if (MapMgr.log.IsErrorEnabled) { MapMgr.log.Error("MapMgr", exception); } bool result = false; return(result); } return(true); }
public static bool ReLoadMapServer() { try { Dictionary <int, List <int> > dictionary = new Dictionary <int, List <int> >(); if (MapMgr.InitServerMap(dictionary)) { MapMgr.m_lock.AcquireWriterLock(15000); try { MapMgr._serverMap = dictionary; return(true); } catch { } finally { MapMgr.m_lock.ReleaseWriterLock(); } } } catch (Exception exception) { if (MapMgr.log.IsErrorEnabled) { MapMgr.log.Error("ReLoadMapWeek", exception); } } return(false); }
public static bool ReLoadServerMap() { bool result; try { Dictionary <int, List <int> > temServerMapList = new Dictionary <int, List <int> >(); Dictionary <int, List <int> > temSimpleMapList = new Dictionary <int, List <int> >(); Dictionary <int, List <int> > temNormalMapList = new Dictionary <int, List <int> >(); Dictionary <int, List <int> > temDifficultMapList = new Dictionary <int, List <int> >(); Dictionary <int, List <int> > temProfessionalMapList = new Dictionary <int, List <int> >(); if (MapMgr.InitServerMap(temServerMapList, temSimpleMapList, temNormalMapList, temDifficultMapList, temProfessionalMapList)) { MapMgr.m_lock.AcquireWriterLock(-1); try { MapMgr._serverMap = temServerMapList; MapMgr.simpleMapList = temSimpleMapList; MapMgr.normalMapList = temNormalMapList; MapMgr.difficultMapList = temDifficultMapList; MapMgr.professionalMapList = temProfessionalMapList; result = true; return(result); } catch { } finally { MapMgr.m_lock.ReleaseWriterLock(); } } } catch (Exception e) { //if (MapMgr.log.IsErrorEnabled) { MapMgr.log.Error("ReLoadMapWeek", e); } } result = false; return(result); }
public static bool Init() { bool result; try { MapMgr.m_lock = new ReaderWriterLock(); MapMgr._maps = new Dictionary <int, MapPoint>(); MapMgr._mapInfos = new Dictionary <int, Map>(); MapMgr._mapInstancePool = new Dictionary <int, Queue <Map> >(); if (!MapMgr.LoadMap(MapMgr._maps, MapMgr._mapInfos)) { result = false; return(result); } MapMgr._serverMap = new Dictionary <int, List <int> >(); MapMgr.simpleMapList = new Dictionary <int, List <int> >(); MapMgr.normalMapList = new Dictionary <int, List <int> >(); MapMgr.difficultMapList = new Dictionary <int, List <int> >(); MapMgr.professionalMapList = new Dictionary <int, List <int> >(); if (!MapMgr.InitServerMap(MapMgr._serverMap, MapMgr.simpleMapList, MapMgr.normalMapList, MapMgr.difficultMapList, MapMgr.professionalMapList)) { result = false; return(result); } } catch (Exception e) { //if (MapMgr.log.IsErrorEnabled) { MapMgr.log.Error("MapMgr", e); } result = false; return(result); } result = true; return(result); }