public void CreateLayer() { var newLayer = new RasterLayer(this, "Layer " + Layers.Count); newLayer.UpdateTexture(); Layers.Insert(_SelectedLayer + 1, newLayer); SelectedLayer = newLayer; Pattern.Editor.LayersChanged(); History.AddEvent(new History.LayerCreatedAction("Created: " + newLayer.Name, _SelectedLayer, newLayer)); }
public SubPattern(Pattern pattern, DesignPatternInformation.DesignPatternPart part, bool import = false) { Colors = new SubPatternColors(this); Pattern = pattern; Part = part; Layers = new List <Layer>(); History = new History(this, 50); History.OnHistoryChanged = () => { Pattern.Editor.Tools.HistoryChanged(History); }; if (!import) { var backgroundLayer = new RasterLayer(this, "Background"); backgroundLayer.Colors = new UnityEngine.Color[Width * Height]; for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) { backgroundLayer.Colors[x + y * Width] = Colors[x + y * Width]; } } backgroundLayer.UpdateTexture(); Layers.Add(backgroundLayer); History.AddEvent(new History.LayerCreatedAction("Opened", 0, backgroundLayer)); } }
public SubPattern(Pattern pattern, DesignPatternInformation.DesignPatternPart part, bool import = false) { Bitmap = new TextureBitmap(part.Width, part.Height); Bitmap.Clear(); Bitmap.Texture.filterMode = UnityEngine.FilterMode.Point; Pattern = pattern; Part = part; Layers = new List <Layer>(); History = new History(this, 50); History.OnHistoryChanged = () => { Pattern.Editor.Tools.HistoryChanged(History); }; if (!import) { var backgroundLayer = new RasterLayer(this, "Background"); unsafe { var colors = pattern.Bitmap.GetColors(); var layerColors = backgroundLayer.Texture.GetColors(); for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) { layerColors[x + (Height - 1 - y) * Width] = colors[Part.X + x + (pattern.Height - 1 - (Part.Y + y)) * pattern.Width]; } } //backgroundLayer.Texture.SetPixel(x, y, pattern.Bitmap.GetPixel(Part.X + x, (pattern.Height - 1 - Part.Y) + y)); } Layers.Add(backgroundLayer); History.AddEvent(new History.LayerCreatedAction("Opened", 0, backgroundLayer)); } }
public void CreateLayer() { var newLayer = new RasterLayer(this, "Layer " + Layers.Count) { Colors = new UnityEngine.Color[Width * Height] }; for (int i = 0; i < newLayer.Colors.Length; i++) { newLayer.Colors[i] = new UnityEngine.Color(0f, 0f, 0f, 0f); } newLayer.UpdateTexture(); Layers.Insert(_SelectedLayer + 1, newLayer); SelectedLayer = newLayer; Pattern.Editor.LayersChanged(); History.AddEvent(new History.LayerCreatedAction("Created: " + newLayer.Name, _SelectedLayer, newLayer)); }
public static void Borrowing(Books b, int BookID, int ReaderID) { Book book = b.GetBook(BookID); if (book.isAvailable == true) { book.isAvailable = false; book.readerID = ReaderID; History history = new History(); history.AddEvent(book); } else { Console.WriteLine("The book is already borrowed."); } }