Exemplo n.º 1
0
 public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Camera camera)
 {
     GroundLayer?.Draw(gameTime, spriteBatch, TileSet, camera);
     EdgeLayer?.Draw(gameTime, spriteBatch, TileSet, camera);
     BuildingLayer?.Draw(gameTime, spriteBatch, TileSet, camera);
     DecorationLayer?.Draw(gameTime, spriteBatch, TileSet, camera);
 }
Exemplo n.º 2
0
 public void Update(GameTime gameTime)
 {
     GroundLayer?.Update(gameTime);
     EdgeLayer?.Update(gameTime);
     BuildingLayer?.Update(gameTime);
     DecorationLayer?.Update(gameTime);
 }
Exemplo n.º 3
0
 public void FillDecoration()
 {
     for (int y = 0; y < MapHeight; y++)
     {
         for (int x = 0; x < MapWidth; x++)
         {
             DecorationLayer.SetTile(x, y, -1);
         }
     }
 }
Exemplo n.º 4
0
        public CellsPanel(Excel p_excel)
        {
            Excel = p_excel;

            _cachedSelectionLayout       = new List <Rect>();
            _cachedActiveSelectionLayout = Rect.Empty;
            _cachedSelectionFrameLayout  = new Rect();
            _cachedFocusCellLayout       = new Rect();
            _editorBounds       = new Rect();
            _cachedDragFillRect = _rcEmpty;
            _cellCachePool      = new CellCachePool(Excel.ActiveSheet);
            _cachedSpanGraph    = new SpanGraph();

            //--------------已移除 公式编辑层、图形层、数据校验层-------------------
            // 1 行数据层
            _rowsLayer = new RowsLayer(this);
            Children.Add(_rowsLayer);

            // 2 网格层,调整为只用在内容区域,行/列头不再使用
            _borderLayer = new BorderLayer(this);
            Children.Add(_borderLayer);

            // 3 选择状态层
            _selectionLayer = new SelectionLayer(this);
            Children.Add(_selectionLayer);

            // 4 拖拽复制层,点击右下角加号复制格内容
            _dragFillLayer = CreateDragFillLayer();
            Children.Add(_dragFillLayer);

            // 5 新增修饰层,打印时页面边线
            if (p_excel.ShowDecoration)
            {
                _decorationLayer = new DecorationLayer(this);
                Children.Add(_decorationLayer);
            }

            // 6 编辑层
            _editorLayer = new EditingLayer(this);
            Children.Add(_editorLayer);

            // 7 浮动对象层
            _floatingLayer = new FloatingObjectLayer(this);
            Children.Add(_floatingLayer);

            // 8 浮动对象拖拽移动层
            _floatingEditLayer = new FloatingObjectMovingLayer(this);
            Children.Add(_floatingEditLayer);

            HorizontalAlignment = HorizontalAlignment.Left;
            VerticalAlignment   = VerticalAlignment.Top;
        }
Exemplo n.º 5
0
        public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Camera camera)
        {
            if (GroundLayer != null)
            {
                GroundLayer.Draw(gameTime, spriteBatch, TileSet, camera);
            }

            if (EdgeLayer != null)
            {
                EdgeLayer.Draw(gameTime, spriteBatch, TileSet, camera);
            }

            if (BuildingLayer != null)
            {
                BuildingLayer.Draw(gameTime, spriteBatch, TileSet, camera);
            }

            if (DecorationLayer != null)
            {
                DecorationLayer.Draw(gameTime, spriteBatch, TileSet, camera);
            }
        }
Exemplo n.º 6
0
        public void Update(GameTime gameTime)
        {
            if (GroundLayer != null)
            {
                GroundLayer.Update(gameTime);
            }

            if (EdgeLayer != null)
            {
                EdgeLayer.Update(gameTime);
            }

            if (BuildingLayer != null)
            {
                BuildingLayer.Update(gameTime);
            }

            if (DecorationLayer != null)
            {
                DecorationLayer.Update(gameTime);
            }
        }
Exemplo n.º 7
0
 public int GetDecorationTile(int x, int y)
 {
     return(DecorationLayer.GetTile(x, y));
 }
Exemplo n.º 8
0
 public void SetDecorationTile(int x, int y, int index)
 {
     DecorationLayer.SetTile(x, y, index);
 }
Exemplo n.º 9
0
        private void UpdateLayersOnTemplateApplied()
        {
            // ensure the default XamlContentLayer
            if (this.contentLayers.Count == 0)
            {
                this.contentLayers.Add(new XamlContentLayer());
            }
            foreach (var layer in this.contentLayers)
            {
                this.AddLayer(layer, this.cellsPanel);
            }

            this.editRowLayer = new GridEditRowLayer();

            this.AddLayer(this.EditRowLayer, this.ContentLayers[0].VisualElement as Panel);

            // ensure the default XamlDecorator layer
            if (this.decorationLayerCache == null)
            {
                this.DecorationLayer = new XamlDecorationLayer();
            }

            this.AddLayer(this.decorationLayerCache, this.decorationsHost);

            if (this.frozenDecorationLayer == null)
            {
                // ensure the frozen XamlDecorator layer
                this.frozenDecorationLayer = new XamlDecorationLayer();
                this.frozenLineDecorationsPresenter.Owner = this.frozenDecorationLayer;
            }

            this.AddLayer(this.frozenDecorationLayer, this.FrozenDecorationsHost);

            // ensure the default XamlSelection layer
            if (this.selectionLayerCache == null)
            {
                this.selectionLayerCache = new XamlSelectionLayer();
                this.selectionDecorationsPresenter.Owner = this.selectionLayerCache;
            }

            this.AddLayer(this.selectionLayerCache, this.decorationsHost);

            if (this.frozenSelectionLayerCache == null)
            {
                this.frozenSelectionLayerCache = new XamlSelectionLayer();
                this.frozenSelectionDecorationsPresenter.Owner = this.frozenSelectionLayerCache;
            }

            this.AddLayer(this.frozenSelectionLayerCache, this.FrozenDecorationsHost);

            // ensure the default XamlVisualState layer
            if (this.visualStateLayerCache == null)
            {
                this.visualStateLayerCache = new XamlVisualStateLayer();
            }

            this.AddLayer(this.visualStateLayerCache, this.decorationsHost);

            if (this.dragAdornerLayerCache == null)
            {
                this.dragAdornerLayerCache = new XamlDragAdornerLayer();
            }

            if (this.frozenVisualStateLayerCache == null)
            {
                this.frozenVisualStateLayerCache = new XamlVisualStateLayer();
            }

            this.AddLayer(this.frozenVisualStateLayerCache, this.FrozenDecorationsHost);

            this.AddLayer(this.dragAdornerLayerCache, this.adornerHostPanel);

            if (this.overlayAdornerLayerCache == null)
            {
                this.overlayAdornerLayerCache = new XamlOverlayAdornerLayer();

                this.visualStateService.RegisterDataLoadingListener(this.overlayAdornerLayerCache);
            }

            this.AddLayer(this.overlayAdornerLayerCache, this.adornerHostPanel);

            if (this.scrolalbleAdornerLayerCache == null)
            {
                this.scrolalbleAdornerLayerCache = new XamlScrollableAdornerLayer();
            }

            this.AddLayer(this.scrolalbleAdornerLayerCache, this.scrollableAdornerHostPanel);

            if (this.FrozenColumnsContentLayer == null)
            {
                this.FrozenColumnsContentLayer = new XamlContentLayer();
            }

            this.AddLayer(this.FrozenColumnsContentLayer, this.frozenColumnsHost);

            if (this.GroupHeadersContentLayer == null)
            {
                this.GroupHeadersContentLayer = new XamlContentLayer();
            }

            this.AddLayer(this.GroupHeadersContentLayer, this.GroupHeadersHost);

            this.frozenEditRowLayer = new GridEditRowLayer();

            this.AddLayer(this.FrozenEditRowLayer, this.FrozenColumnsContentLayer.VisualElement as Panel);
        }