/*** Functions for loading/checking the different pub/map files ***/ //tries to load the map that MainPlayer.ActiveCharacter is hanging out on private bool _tryLoadMap(int mapID = -1) { try { if (mapID < 0) { mapID = MainPlayer.ActiveCharacter.CurrentMap; } string mapFile = Path.Combine("maps", string.Format("{0,5:D5}.emf", mapID)); if (!MapCache.ContainsKey(mapID)) { MapCache.Add(mapID, new MapFile(mapFile)); } else { MapCache[mapID] = new MapFile(mapFile); } //map renderer construction moved to be more closely coupled to loading of the map (m_mapRender ?? (m_mapRender = new EOMapRenderer(EOGame.Instance, m_api))).SetActiveMap(MapCache[mapID]); } catch { return(false); } return(true); }
public void ResetGameElements() { if (m_mapRender != null) { m_mapRender.Dispose(); m_mapRender = null; } if (m_charRender != null) { m_charRender.Dispose(); m_charRender = null; } if (MapCache != null) { MapCache.Clear(); } }
/*** Functions for loading/checking the different pub/map files ***/ //tries to load the map that MainPlayer.ActiveCharacter is hanging out on private bool _tryLoadMap(int mapID = -1) { try { if (mapID < 0) mapID = MainPlayer.ActiveCharacter.CurrentMap; string mapFile = Path.Combine("maps", string.Format("{0,5:D5}.emf", mapID)); if(!MapCache.ContainsKey(mapID)) MapCache.Add(mapID, new MapFile(mapFile)); else MapCache[mapID] = new MapFile(mapFile); //map renderer construction moved to be more closely coupled to loading of the map (m_mapRender ?? (m_mapRender = new EOMapRenderer(EOGame.Instance, m_api))).SetActiveMap(MapCache[mapID]); } catch { return false; } return true; }
public void ResetGameElements() { if (m_mapRender != null) { m_mapRender.Dispose(); m_mapRender = null; } if (m_charRender != null) { m_charRender.Dispose(); m_charRender = null; } if(MapCache != null) MapCache.Clear(); }
public MiniMapRenderer(MapFile mapRef, SpriteBatch spriteBatch, EOMapRenderer parentRenderer) { Map = mapRef; _spriteBatch = spriteBatch; _parentRenderer = parentRenderer; }