Наследование: CanvasLayer
Пример #1
0
        private void BindCurrentLevel()
        {
            if (_controller.Level != null) {
                _root = new GroupLayer(_controller.RootLayer);

                _controller.LevelGeometry = _layerControl.LevelGeometry;

                _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;

                float zoomWidth = (float)_layerControl.Width / _layerControl.ReferenceWidth;
                float zoomHeight = (float)_layerControl.Height / _layerControl.ReferenceHeight;
                _layerControl.Zoom = Math.Min(zoomWidth, zoomHeight);
            }
            else {
                _root = null;
                _layerControl.RootLayer = null;
                _layerControl.TextureCache.SourcePool = null;
            }
        }
Пример #2
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;
            }
        }
Пример #3
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;
            }
        }