示例#1
0
        public void BindController(LevelPresenter controller)
        {
            if (_controller != null) {
                _controller.LevelGeometry = null;
                _controller.PointerEventResponderChanged -= PointerEventResponderChanged;
                _controller.ContextMenuActivated -= ContextMenuActivatedHandler;
            }

            _controller = controller;
            if (_controller != null) {
                _controller.LevelGeometry = _layerControl.LevelGeometry;
                _controller.PointerEventResponderChanged += PointerEventResponderChanged;
                _controller.ContextMenuActivated += ContextMenuActivatedHandler;

                _pointerController.Responder = _controller.PointerEventResponder;

                _root = new GroupLayer(controller.RootLayer);

                _layerControl.RootLayer = _root;
                _layerControl.TextureCache.SourcePool = _controller.TexturePool;

                _layerControl.ReferenceOriginX = _controller.Level.OriginX;
                _layerControl.ReferenceOriginY = _controller.Level.OriginY;
                _layerControl.ReferenceWidth = _controller.Level.Width;
                _layerControl.ReferenceHeight = _controller.Level.Height;
            }
            else {
                _root = null;
                _layerControl.RootLayer = null;
                _layerControl.TextureCache.SourcePool = null;

                _pointerController.Responder = null;
            }
        }
示例#2
0
        private void BindTilePool(TilePoolPresenter tilePool)
        {
            if (_tilePool != null) {
                _tilePool.LevelGeometry = null;
            }
            if (_layerControl.RootLayer != null) {
                _layerControl.RootLayer.Dispose();
                _layerControl.RootLayer = null;
            }

            _tilePool = tilePool;
            if (_tilePool != null) {
                _tilePool.LevelGeometry = _layerControl.LevelGeometry;

                _root = new GroupLayer(tilePool.RootLayer);

                _layerControl.RootLayer = _root;
                //_pointerController.Responder = tilePool.PointerEventResponder;
                _pointerController.Responder = new LocalPointerEventResponder(this, tilePool.PointerEventResponder);
            }
            else {
                _root = null;
                _pointerController.Responder = null;
            }
        }