コード例 #1
0
        public StreamingManager(ISceneResourceRequestHandler requestHandler,
                                IStreamingGoManager streamingGo,
                                StreamingData sceneDescription,
                                ScenesLightmapData.MeshRecords scenesLightmapRecords,
                                ScenesIndoorCullData.IndoorCullRecords scenesIndoorCullRecords,
                                WorldCompositionParam param,
                                int preloadSceneCount)
        {
            _requestHandler          = requestHandler;
            _sceneDescription        = sceneDescription;
            _scenesLightmapRecords   = scenesLightmapRecords;
            _scenesIndoorCullRecords = scenesIndoorCullRecords;
            _concurrentCount         = preloadSceneCount;

            _worldComposition = new WorldCompositionManager(this, param);
            _streamingGo      = streamingGo ?? new StreamingGoByScene();

            _streamingGo.SetResourceHandler(this);
            _triggerObjectManager = SingletonManager.Get <TriggerObjectManager>();
            if (_sceneDescription != null)
            {
                var count = _sceneDescription.Scenes.Count;
                for (int i = 0; i < count; i++)
                {
                    _sceneIndex.Add(_sceneDescription.Scenes[i].SceneName, i);
                }
            }

            _requestHandler.SceneLoaded   += SceneLoaded;
            _requestHandler.SceneUnloaded += SceneUnloaded;
            _requestHandler.GoLoaded      += GoLoaded;
            _requestHandler.GoUnloaded    += GoUnloaded;
        }
コード例 #2
0
        public WorldCompositionManager(IStreamingResourceHandler streamingManager, WorldCompositionParam param)
        {
            _streamingManager = streamingManager;
            _param            = param;

            _sceneNameToScene   = new Dictionary <string, SceneNode>();
            _sceneLoadingStatus = new SceneNode[_param.TerrainDimension, _param.TerrainDimension];

            for (int i = 0; i < _param.TerrainDimension; i++)
            {
                for (int j = 0; j < param.TerrainDimension; j++)
                {
                    var node = new SceneNode
                    {
                        Center    = new Vector2(i + 0.5f, j + 0.5f),
                        Status    = SceneLoadingStatus.Unloaded,
                        SceneName = string.Format(_param.TerrainNamePattern, i, j)
                    };
                    node.Dimension = new Vector4(
                        node.Center.x * _param.TerrainSize + _param.TerrainMin.x,
                        _param.TerrainSize * 0.5f,
                        node.Center.y * _param.TerrainSize + _param.TerrainMin.z,
                        _param.TerrainSize);

                    _sceneLoadingStatus[i, j] = node;
                    _sceneNameToScene.Add(node.SceneName, node);
                }
            }

            // outside parameter measured in grid distance between player and border
            // since center is used, extra 0.5 need to be added
            _param.LoadRadiusInGrid   += 0.5f;
            _param.UnloadRadiusInGrid += 0.5f;
        }
コード例 #3
0
ファイル: StreamingManager.cs プロジェクト: yangfan111/common
        public StreamingManager(ISceneResourceRequestHandler requestHandler,
                                IStreamingGoManager streamingGo,
                                StreamingData sceneDescription,
                                WorldCompositionParam param,
                                int preloadSceneCount)
        {
            _requestHandler   = requestHandler;
            _sceneDescription = sceneDescription;
            _concurrentCount  = preloadSceneCount;

            _worldComposition = new WorldCompositionManager(this, param);
            _streamingGo      = streamingGo ?? new StreamingGoByScene();

            _streamingGo.SetResourceHandler(this);

            if (_sceneDescription != null)
            {
                var count = _sceneDescription.Scenes.Count;
                for (int i = 0; i < count; i++)
                {
                    _sceneIndex.Add(_sceneDescription.Scenes[i].SceneName, i);
                }
            }

            _requestHandler.SceneLoaded   += SceneLoaded;
            _requestHandler.SceneUnloaded += SceneUnloaded;
            _requestHandler.GoLoaded      += GoLoaded;
            _requestHandler.GoUnloaded    += GoUnloaded;
        }