Remote dveře se renderují na mapě. Opravena chyba v GlobalMapTile.CoordsToId, která způsobovala desynchronizaci id místností

This commit is contained in:
Perry 2026-02-16 21:48:59 +01:00
parent 7e6b3d724b
commit 70b5debb22
7 changed files with 58 additions and 27 deletions

View file

@ -14,7 +14,7 @@ public class UIElement {
public bool Pressable { get; set; } = false;
public bool Visible { get; set; } = true;
private (Point, Point) bounds; // TODO: Change this to support non-rectangular hitboxes
public (Point, Point) Bounds{ get; private set; } // TODO: Change this to support non-rectangular hitboxes
private (Point, Point) screenSpaceBounds;
private List<TextureRegion> textures = new();
private int currentTextureId = 0;
@ -32,22 +32,22 @@ public class UIElement {
private int pixelScaleMultiplier = 1;
private void LoadPixelScaleMultiplier() {
pixelScaleMultiplier = (int)(UIManager.GlobalPixelMultiplier * _scaleMultiplier); // TODO: move GlobalPixelMultiplier somewhere where it would make sense
screenSpaceBounds = (bounds.Item1.MultiplyByScalar(pixelScaleMultiplier), bounds.Item2.MultiplyByScalar(pixelScaleMultiplier));
screenSpaceBounds = (Bounds.Item1.MultiplyByScalar(pixelScaleMultiplier), Bounds.Item2.MultiplyByScalar(pixelScaleMultiplier));
}
public UIElement(TextureRegion texture, Point position) {
textures.Add(texture);
bounds = (position, position + new Point(texture.Width, texture.Height));
Bounds = (position, position + new Point(texture.Width, texture.Height));
LoadPixelScaleMultiplier();
}
public UIElement(TextureRegion[] textures, Point position) {
this.textures.AddRange(textures);
bounds = (position, position + new Point(textures[0].Width, textures[0].Height));
Bounds = (position, position + new Point(textures[0].Width, textures[0].Height));
LoadPixelScaleMultiplier();
}
public UIElement(Point corner1, Point corner2) {
bounds = (corner1, corner2);
Bounds = (corner1, corner2);
Visible = false;
LoadPixelScaleMultiplier();
}