Пример #1
0
        public static bool MoveChunk(IconSource source, Chunk existing)
        {
            var region = existing.Region;
            var window = new EditChunkWindow(source, existing, region, ChunkEditPurpose.Move);

            return(window.ShowDialog() == DialogResult.OK); // window moves the chunk by itself
        }
Пример #2
0
        public static Chunk CreateChunk(IconSource source, RegionFile parent, bool bypass_window = false, NbtCompound data = null)
        {
            var chunk = Chunk.EmptyChunk(data);

            if (bypass_window)
            {
                // find first available slot
                var available = parent.GetAvailableCoords();
                if (!available.Any())
                {
                    return(null);
                }
                var(x, y) = available.First();
                chunk.Move(x, y);
                return(chunk);
            }
            else
            {
                var window = new EditChunkWindow(source, chunk, parent, ChunkEditPurpose.Create);
                return(window.ShowDialog() == DialogResult.OK ? chunk : null);
            }
        }