public void SetActive(TileIndex rTileIndex, bool bActive) { SceneTileWrapper rSceneTileWrapper = this.Get(rTileIndex); if (rSceneTileWrapper != null) { rSceneTileWrapper.SetActive(bActive); } }
/// <summary> /// 加载单个场景块 /// </summary> public IEnumerator HandleRequest(SceneTileRequest rSceneTileRequest) { TileIndex rTileIndex = rSceneTileRequest.CurIndex; SceneTileWrapper rSceneTileWrapper = mSceneBlockBuffer.Get(rTileIndex); if (rSceneTileWrapper != null) { rSceneTileRequest.SceneTileWrapper = rSceneTileWrapper; rSceneTileWrapper.SetActive(true); rSceneTileRequest.IsRunning = false; rSceneTileRequest.IsCompleted = true; mSceneBlockBuffer.SetActive(rTileIndex, true); yield break; } string rSceneTileConfigPath = string.Format("{0}/tile_{1}_{2}_config", MultiSceneManager.CurrentTestSceneName, rTileIndex.Row, rTileIndex.Col); string rSceneTilePath = string.Format("{0}/tile_{1}_{2}", MultiSceneManager.CurrentTestSceneName, rTileIndex.Row, rTileIndex.Col); ResourceRequest rRequest = Resources.LoadAsync <SceneTile>(rSceneTileConfigPath); yield return(rRequest); SceneTile rSceneTile = rRequest.asset as SceneTile; ResourceRequest rDataRequest = Resources.LoadAsync <TerrainData>(rSceneTilePath); yield return(rDataRequest); TerrainData rTerrainData = rDataRequest.asset as TerrainData; rSceneTileWrapper = mSceneBlockBuffer.Alloc(rTileIndex, rSceneTile, rTerrainData); rSceneTileRequest.SceneTileWrapper = rSceneTileWrapper; rSceneTileRequest.IsRunning = false; rSceneTileRequest.IsCompleted = true; }