internal void SetTopLeft(Point NewValue, bool CheckIfChanged) { if (!CheckIfChanged || TopLeftScreenPosition != NewValue) { _TopLeftScreenPosition = NewValue; if (RelativeSlotBounds != null) { this.SlotBounds = new ReadOnlyCollection <Rectangle>(RelativeSlotBounds.Select(x => x.GetOffseted(TopLeftScreenPosition)).ToList()); this.LockedSlotBounds = new ReadOnlyCollection <Rectangle>(RelativeLockedSlotBounds.Select(x => x.GetOffseted(TopLeftScreenPosition)).ToList()); } else { this.SlotBounds = null; this.LockedSlotBounds = null; } this.Bounds = RelativeBounds.GetOffseted(TopLeftScreenPosition); } }
private void SetTopLeft(Point NewValue, bool CheckIfChanged = true) { if (!CheckIfChanged || TopLeftScreenPosition != NewValue) { _TopLeftScreenPosition = NewValue; if (RelativeInventorySlotBounds != null) { List <Rectangle> TranslatedSlots = new List <Rectangle>(); foreach (Rectangle Relative in RelativeInventorySlotBounds) { Rectangle Translated = Relative.GetOffseted(TopLeftScreenPosition); TranslatedSlots.Add(Translated); } this.InventorySlotBounds = new ReadOnlyCollection <Rectangle>(TranslatedSlots); } else { this.InventorySlotBounds = null; } this.Bounds = RelativeBounds.GetOffseted(TopLeftScreenPosition); } }
internal void SetTopLeft(Point NewValue, bool CheckIfChanged) { if (!CheckIfChanged || TopLeftScreenPosition != NewValue) { _TopLeftScreenPosition = NewValue; if (RelativeSlotBounds != null) { // Shift every Rectangle over by the new TopLeft point OrderedDictionary <int, Dictionary <ColumnType, Rectangle> > Temp = new OrderedDictionary <int, Dictionary <ColumnType, Rectangle> >(); foreach (var KVP in RelativeSlotBounds) { int ItemId = KVP.Key; Dictionary <ColumnType, Rectangle> RelativePositions = KVP.Value; Dictionary <ColumnType, Rectangle> TranslatedPositions = new Dictionary <ColumnType, Rectangle>(); foreach (var KVP2 in RelativePositions) { ColumnType Type = KVP2.Key; Rectangle Relative = KVP2.Value; TranslatedPositions.Add(Type, Relative.GetOffseted(TopLeftScreenPosition)); } Temp.Add(ItemId, TranslatedPositions); } this.SlotBounds = Temp; this.ColumnHeaderBounds = new ReadOnlyCollection <Rectangle>(RelativeColumnHeaderBounds.Select(x => x.GetOffseted(TopLeftScreenPosition)).ToList()); } else { this.SlotBounds = null; this.ColumnHeaderBounds = null; } this.Bounds = RelativeBounds.GetOffseted(TopLeftScreenPosition); } }