예제 #1
0
        private void OnActiveContextChanged(object obj, EventArgs args)
        {
            GUILayer.EditorSceneManager        sceneMan    = null;
            GUILayer.TerrainManipulatorContext maniContext = null;

            IContextRegistry registry = obj as IContextRegistry;

            if (registry != null)
            {
                var gameExt = registry.GetActiveContext <Game.GameExtensions>();
                if (gameExt != null)
                {
                    sceneMan    = gameExt.SceneManager;
                    maniContext = gameExt.TerrainManipulatorContext;
                }
            }

            if (sceneMan == null || maniContext == null)
            {
                if (_attachedTerrainManiContext != null)
                {
                    _attachedTerrainManiContext.OnActiveLayerChange -= OnActiveLayerChanged;
                }
                _manipContext.ManipulatorSet = null;
                _attachedSceneManager.Target = null;
                _attachedTerrainManiContext  = null;
                return;
            }

            if (sceneMan != _attachedSceneManager.Target || maniContext != _attachedTerrainManiContext)
            {
                if (_attachedTerrainManiContext != null)
                {
                    _attachedTerrainManiContext.OnActiveLayerChange -= OnActiveLayerChanged;
                }
                _manipContext.ManipulatorSet = sceneMan.CreateTerrainManipulators(maniContext);
                _attachedSceneManager.Target = sceneMan;
                _attachedTerrainManiContext  = maniContext;
                if (_attachedTerrainManiContext != null)
                {
                    _attachedTerrainManiContext.OnActiveLayerChange += OnActiveLayerChanged;
                }
            }
        }
예제 #2
0
        private void OnActiveContextChanged(object obj, EventArgs args)
        {
            GUILayer.EditorSceneManager sceneMan = null;

            IContextRegistry registry = obj as IContextRegistry;

            if (registry != null)
            {
                var gameExt = registry.GetActiveContext <Game.GameExtensions>();
                if (gameExt != null)
                {
                    sceneMan = gameExt.SceneManager;
                }
            }

            if (sceneMan != null)
            {
                _manipContext.ManipulatorSet = sceneMan.CreateTerrainManipulators();
            }
            else
            {
                _manipContext.ManipulatorSet = null;
            }
        }