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 ReLoadMap() { try { Dictionary <int, MapPoint> maps = new Dictionary <int, MapPoint>(); Dictionary <int, Map> mapInfos = new Dictionary <int, Map>(); if (MapMgr.LoadMap(maps, mapInfos)) { MapMgr.m_lock.AcquireWriterLock(15000); try { MapMgr._maps = maps; MapMgr._mapInfos = mapInfos; return(true); } catch { } finally { MapMgr.m_lock.ReleaseWriterLock(); } } } catch (Exception exception) { if (MapMgr.log.IsErrorEnabled) { MapMgr.log.Error("ReLoadMap", exception); } } return(false); }
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); }
public static bool ReLoadMap() { bool result; try { MapMgr._mapInstancePool.Clear(); Dictionary <int, MapPoint> tempMaps = new Dictionary <int, MapPoint>(); Dictionary <int, Map> tempMapInfos = new Dictionary <int, Map>(); if (MapMgr.LoadMap(tempMaps, tempMapInfos)) { MapMgr.m_lock.AcquireWriterLock(-1); try { MapMgr._maps = tempMaps; MapMgr._mapInfos = tempMapInfos; result = true; return(result); } catch { } finally { MapMgr.m_lock.ReleaseWriterLock(); } } } catch (Exception e) { //if (MapMgr.log.IsErrorEnabled) { MapMgr.log.Error("ReLoadMap", e); } } result = false; return(result); }