Пример #1
0
 public void SetActivatedLayout(StandardLayout layout)
 {
     ActivatedLayout?.Deactivate();
     ActivatedLayout = layout;
     ActivatedLayout.Activate();
     PaintAgent.CurrentLayout = ActivatedLayout;
     PaintingTexture.CopyTo(PaintingTextureBackup);
     ActivatedLayoutChanged?.Invoke();
 }
Пример #2
0
 public void SetActivatedLayout(int layoutIndex)
 {
     ActivatedLayout?.Deactivate();
     if (layoutIndex == -1)
     {
         ActivatedLayout          = null;
         PaintAgent.CurrentLayout = null;
         return;
     }
     ActivatedLayout = (StandardLayout)Layouts[layoutIndex];
     ActivatedLayout.Activate();
     PaintAgent.CurrentLayout = ActivatedLayout;
     PaintingTexture.CopyTo(PaintingTextureBackup);
     ActivatedLayoutChanged?.Invoke();
 }
Пример #3
0
        public bool DrawEnd(Vector2 position, Windows.UI.Input.PointerPoint pointerPoint, out List <Vector2Int> _coveredTiles, out TileRect _tileRect)
        {
            _coveredTiles = null;
            _tileRect     = new TileRect();
            if (CurrentLayout == null || currentBrush == null)
            {
                return(false);
            }
            UpdateBrushData(position, pointerPoint);
            List <Vector2Int> tilesCovered = GetPaintingTiles(drawPrevPos, position, out TileRect coveredRect);

            if (tilesCovered.Count != 0)
            {
                ComputeBrush(currentBrush.cEnd, tilesCovered);
                _coveredTiles = tilesCovered;
                _tileRect     = coveredRect;
            }
            #region generateUndoData
            List <Vector2Int> paintCoveredTiles = new List <Vector2Int>();
            for (int i = 0; i < _mapForUndoCount; i++)
            {
                if (mapForUndo[i])
                {
                    paintCoveredTiles.Add(new Vector2Int()
                    {
                        x = (i % _mapForUndoStride) * 8, y = (i / _mapForUndoStride) * 8
                    });
                }
            }
            if (paintCoveredTiles.Count != 0)
            {
                UndoManager.AddUndoData(new Undo.CMD_TileReplace(CurrentLayout, new TiledTexture(PaintingTextureBackup, paintCoveredTiles), CanvasCase));
            }
            mapForUndo.SetAll(false);
            #endregion
            drawPrevPos = Vector2.Zero;
            PaintingTexture.CopyTo(PaintingTextureBackup);
            return(true);
        }