public virtual int GetTile(int x, int y, PluginManager manager) { RoomLayout room = manager.GetActiveRoomLayout(); int t = room.GetTile(x, y); if (!tiles.Contains(t) || ignoreTiles.Contains(t)) { return(t); } Func <int, bool> f = a => { return(tiles.Contains(a)); }; return(GetTileBy(x, y, manager, f)); }
public void Apply(PluginManager manager) { if (baseTiles[0, 0] == -1) { return; } AssembleTiles(); RoomLayout room = manager.GetActiveRoomLayout(); for (int y = 0; y < room.Height; y++) { for (int x = 0; x < room.Width; x++) { int t = GetTile(x, y, manager); if (t != room.GetTile(x, y)) { room.SetTile(x, y, t); } } } }
void OnClicked(int posX, int posY, Gdk.Event triggerEvent, uint button) { Cairo.Point p = GetGridPosition(posX, posY, scale: false, offset: false); if (EnableTileEditing && hoveringComponent == null) { if (!IsInBounds(posX, posY, scale: false, offset: false)) { return; } if (button == 1) // Left-click { RoomLayout.SetTile(p.X, p.Y, TilesetViewer.SelectedIndex); draggingTile = true; } else if (button == 3) // Right-click { TilesetViewer.SelectedIndex = RoomLayout.GetTile(p.X, p.Y); } } if (DrawRoomComponents) { if (hoveringComponent != null) { selectedComponent = hoveringComponent; hoveringComponent.Select(); if (button == 1) // Left click { draggingObject = true; } else if (button == 3) // Right click { Gtk.Menu menu = new Gtk.Menu(); foreach (Gtk.MenuItem item in selectedComponent.GetRightClickMenuItems()) { menu.Add(item); } RoomComponent comp = selectedComponent; if (comp.Deletable) { if (menu.Children.Length != 0) { menu.Add(new Gtk.SeparatorMenuItem()); } var deleteButton = new Gtk.MenuItem("Delete"); deleteButton.Activated += (sender, args) => { comp.Delete(); }; menu.Add(deleteButton); } menu.AttachToWidget(this, null); menu.ShowAll(); menu.PopupAtPointer(triggerEvent); } } } QueueDraw(); }