public void BuildMap() { if (m_MapViewer == null) { m_MapViewer = GetComponent <MapViewer>(); if (m_MapViewer == null) { m_MapViewer = gameObject.AddComponent <MapViewer_Full>(); } m_ArchiveFile = new MapArchiveFile(config); m_MapViewer.InitMapViewer(m_ArchiveFile, map_root); } ClearMap(); map_data = GenerateTileMapData(); for (int y = 0; y < config.tile_size_x; y++) { for (int x = 0; x < config.tile_size_y; x++) { int index = SharedUtil.PointHash(x, y); TilePrefabConfig tpc = config.GetTilePrefabConfig(map_data[index]); if (tpc != null) { m_MapViewer.SpawnTileMapAt(x, y, config.grid_size, map_root, tpc); } } } }
//BuildMap一般只在Editor中运行 public void BuildMap() { ClearMap(); config.theme_config.RebuildTileThemeConfig(); m_ArchiveFile = new MapArchiveFile(config); m_ArchiveFile.GeneratePerinMaze(); m_MapViewer = GetComponent <MapViewer>(); m_MapViewer.InitMapViewer(m_ArchiveFile, m_MapRoot); }
public override void InitMapViewer(MapArchiveFile file, Transform root) { if (file != null) { base.InitMapViewer(file, root); ResetIndex(); TeleportTo(initGazeX, initGazeY); } else { Debug.LogError("Error archive file is null"); } }
virtual public void InitMapViewer(MapArchiveFile file, Transform root) { //如果没有挂在高级资源读取器或对象池化资源管理器,则走默认逻辑。使用最笨的FallBack资源管理器。 m_ResourceLoader = GetComponent <iResourceLoader>(); if (m_ResourceLoader == null) { m_ResourceLoader = new DefaultResourceLoader(); } m_ResourceLoader.Reset(); m_ArchiveFile = file; m_MapRoot = root; if (m_ArchiveFile != null) { m_Config = m_ArchiveFile.GetConfigFile <TileMapBaseConfig>(); } }
public override void InitMapViewer(MapArchiveFile file, Transform root) { base.InitMapViewer(file, root); ShowMapAt(0, 0); }