예제 #1
0
        public bool DoesChunkMatch(Point point, Stamps.TileChunk CompareChunk, Classes.Scene.EditorLayer EditLayerA, Classes.Scene.EditorLayer EditLayerB, int chunkSize = 8)
        {
            Point TileCoord = new Point(point.X * 128, point.Y * 128);

            for (int x = 0; x < chunkSize; x++)
            {
                for (int y = 0; y < chunkSize; y++)
                {
                    Point p = new Point((TileCoord.X / 16) + x, (TileCoord.Y / 16) + y);
                    if (CompareChunk.TileMapA[x][y] == EditLayerA.GetTileAt(p.X, p.Y))
                    {
                        if (EditLayerB != null)
                        {
                            if (CompareChunk.TileMapB[x][y] == EditLayerB.GetTileAt(p.X, p.Y))
                            {
                                continue;
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
예제 #2
0
        public bool IsChunkEmpty(Point point, Classes.Scene.EditorLayer EditLayer, int chunkSize = 8)
        {
            if (EditLayer == null)
            {
                return(true);
            }
            Point TileCoord = new Point(point.X * 128, point.Y * 128);

            for (int x = 0; x < chunkSize; x++)
            {
                for (int y = 0; y < chunkSize; y++)
                {
                    Point p = new Point((TileCoord.X / 16) + x, (TileCoord.Y / 16) + y);
                    if (EditLayer.GetTileAt(p.X, p.Y) == 0xffff)
                    {
                        continue;
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
예제 #3
0
        private void AddLayer()
        {
            Classes.Scene.EditorLayer newEditorLayer = EditorScene.ProduceLayer();
            CurrentDataContext.Layers.Add(newEditorLayer);
            int newIndex = CurrentDataContext.Layers.IndexOf(newEditorLayer);

            lbLayers.SelectedIndex    = newIndex;
            HasLayerArangementChanged = true;
            UpdateListDetails();
        }
예제 #4
0
        public bool IsChunkEmpty(Point point, Classes.Scene.EditorLayer EditLayerA, Classes.Scene.EditorLayer EditLayerB, int chunkSize = 8)
        {
            bool isEmptyA = IsChunkEmpty(point, EditLayerA, chunkSize);
            bool isEmptyB = IsChunkEmpty(point, EditLayerB, chunkSize);

            if (isEmptyA == false || isEmptyB == false)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #5
0
        public void AutoGenerateChunks(Classes.Scene.EditorLayer LayerA, Classes.Scene.EditorLayer LayerB)
        {
            Methods.Internal.UserInterface.ShowWaitingBox();

            System.Threading.Thread thread = new System.Threading.Thread(() =>
            {
                int width       = (LayerA.Width > LayerB.Width ? LayerA.Width : LayerB.Width);
                int height      = (LayerA.Height > LayerB.Height ? LayerA.Height : LayerB.Height);
                int ChunkWidth  = width / 8;
                int ChunkHeight = height / 8;

                for (int i = 0; i < ChunkHeight; ++i)
                {
                    for (int j = 0; j < ChunkWidth; ++j)
                    {
                        int tileX = j * 8;
                        int tileY = i * 8;

                        int x1 = j * 8;
                        int x2 = x1 + 8;
                        int y1 = i * 8;
                        int y2 = y1 + 8;
                        ushort[][] ChunkMapA = new ushort[8][];
                        ushort[][] ChunkMapB = new ushort[8][];
                        for (int x = 0; x < 8; x++)
                        {
                            ChunkMapA[x] = new ushort[8];
                            ChunkMapB[x] = new ushort[8];
                            for (int y = 0; y < 8; y++)
                            {
                                ChunkMapA[x][y] = LayerA.GetTileAt(tileX + x, tileY + y);
                                ChunkMapB[x][y] = LayerB.GetTileAt(tileX + x, tileY + y);
                            }
                        }
                        var newChunk  = new TexturedStamps.TexturedTileChunk(ChunkMapA, ChunkMapB, 8);
                        var duplicate = StageStamps.StampList.Exists(x => x.TileMapCodeA == newChunk.TileMapCodeA && x.TileMapCodeB == newChunk.TileMapCodeB);
                        if (duplicate == false)
                        {
                            AddChunk(newChunk);
                        }
                    }
                }

                Methods.Internal.UserInterface.CloseWaitingBox();
            })
            {
                IsBackground = true
            };
            thread.Start();
        }
예제 #6
0
        public void PasteStamp(Point ChunkCoord, int index, Classes.Scene.EditorLayer EditLayerA, Classes.Scene.EditorLayer EditLayerB, bool deleteMode = false)
        {
            Point TileCoord = new Point(ChunkCoord.X * 128, ChunkCoord.Y * 128);
            Dictionary <Point, ushort> ConvertedChunkA = new Dictionary <Point, ushort>();
            Dictionary <Point, ushort> ConvertedChunkB = new Dictionary <Point, ushort>();

            if (deleteMode)
            {
                ConvertedChunkA = ConvertChunkSideAtoClipboard(EditorStamps.StampList[0]);
                ConvertedChunkB = ConvertChunkSideBtoClipboard(EditorStamps.StampList[0]);
            }
            else
            {
                ConvertedChunkA = ConvertChunkSideAtoClipboard(StageStamps.StampList[index]);
                ConvertedChunkB = ConvertChunkSideBtoClipboard(StageStamps.StampList[index]);
            }

            EditLayerA?.PasteClipboardData(TileCoord, new Classes.Clipboard.TilesClipboardEntry(ConvertedChunkA));
            EditLayerB?.PasteClipboardData(TileCoord, new Classes.Clipboard.TilesClipboardEntry(ConvertedChunkB));
            Actions.UndoRedoModel.UpdateEditLayersActions();
            EditLayerA?.DeselectAll();
            EditLayerB?.DeselectAll();
        }
 public static void DrawLayer(DevicePanel GraphicPanel, bool ShowLayer, bool EditLayer, Classes.Scene.EditorLayer layer)
 {
     if (layer != null)
     {
         if (ShowLayer || EditLayer)
         {
             layer.Draw(GraphicPanel);
         }
     }
 }
 public LayerClipboardEntry(Classes.Scene.EditorLayer _Content) : base()
 {
     Type    = ContentType.Layers;
     Content = _Content;
 }
예제 #9
0
        private void CopyLayerToClipboard(Classes.Scene.EditorLayer layerToCopy)
        {
            Classes.Scene.EditorLayer copyData = layerToCopy.Clone();

            Methods.Solution.SolutionClipboard.SetLayerClipboard(new Classes.Clipboard.LayerClipboardEntry(copyData));
        }