예제 #1
0
 /// <summary>
 /// Dispose of unmanaged resources
 /// </summary>
 public override void Dispose(bool disposing)
 {
     ColorBrush.Dispose();
     if (ExtraColorBrush != null)
     {
         ExtraColorBrush.Dispose();
     }
     Bitmap.Dispose();
 }
예제 #2
0
파일: Tag.cs 프로젝트: nicoawalker/Filer
        public override string this[int index]
        {
            get
            {
                switch (index)
                {
                case 0:
                    return(ID.ToString());

                case 1:
                    return(Label);

                case 2:
                    return(ColorBrush.ToString());

                case 3:
                    return(String.Join(",", Children));

                default: throw new IndexOutOfRangeException($"Tag does not have {index} parameters");
                }
            }
        }
예제 #3
0
        public async Task SaveAsync(string path)
        {
            var editor = await TerrainEditor.OpenEmptyAsync(new TerrainSettings
            {
                Size          = Size,
                DefaultHeight = DefaultHeight
            });

            editor.Load();

            var heightBrush = new HeightBrush(editor);

            if (Heights != default)
            {
                foreach (var height in Heights)
                {
                    heightBrush.Size = height.Size;

                    heightBrush.Power = height.Power;

                    heightBrush.Apply(height.Position);
                }
            }

            if (Colors != default)
            {
                var colorBrush = new ColorBrush(editor);

                foreach (var color in Colors)
                {
                    colorBrush.Size = color.Size;

                    colorBrush.Color = color.Color;

                    colorBrush.Apply(color.Position);
                }
            }

            editor.Apply();

            if (File.Exists(LightMap))
            {
                Console.WriteLine($"Applying light map.");

                var data = await File.ReadAllBytesAsync(LightMap);

                foreach (var chunk in editor.Source.Chunks)
                {
                    chunk.Lightmap.Data = data;
                }
            }

            if (File.Exists(BlendMap))
            {
                Console.WriteLine($"Applying blend map.");

                var data = await File.ReadAllBytesAsync(BlendMap);

                foreach (var chunk in editor.Source.Chunks)
                {
                    chunk.Blendmap.Data = data;
                }
            }

            await editor.SaveAsync(Path.Combine(path, FileName));
        }