// Thisvirtuals the secotr and neightbours if needed public void UpdateSectorGeometry(bool includeneighbours) { // Rebuild sector this.Changed = true; // Go for all things in this sector foreach (Thing t in General.Map.Map.Things) { if (t.Sector == this.Sector) { if (mode.VisualThingExists(t)) { // Update thing BaseVisualThing vt = (mode.GetVisualSprite(t) as BaseVisualThing); vt.Changed = true; } } } if (includeneighbours) { // Also rebuild surrounding sectors, because outside sidedefs may need to be adjusted foreach (Sidedef sd in this.Sector.Sidedefs) { if (sd.Other != null) { if (mode.VisualSectorExists(sd.Other.Sector)) { BaseVisualSector bvs = (BaseVisualSector)mode.GetVisualSector(sd.Other.Sector); bvs.Changed = true; } } } } }
// This updates the VisualSectors and VisualThings that have their Changed property set private void UpdateChangedObjects() { foreach (KeyValuePair <Sector, VisualSector> vs in allsectors) { if (vs.Value != null) { BaseVisualSector bvs = (BaseVisualSector)vs.Value; if (bvs.Changed) { bvs.Rebuild(); } } } foreach (KeyValuePair <Thing, VisualThing> vt in allthings) { if (vt.Value != null) { BaseVisualThing bvt = (BaseVisualThing)vt.Value; if (bvt.Changed) { bvt.Rebuild(); } } } }
// This makes a list of the selected object private void RebuildSelectedObjectsList() { // Make list of selected objects selectedobjects = new List <IVisualEventReceiver>(); foreach (KeyValuePair <Sector, VisualSector> vs in allsectors) { if (vs.Value != null) { BaseVisualSector bvs = (BaseVisualSector)vs.Value; if ((bvs.Floor != null) && bvs.Floor.Selected) { selectedobjects.Add(bvs.Floor); } if ((bvs.Ceiling != null) && bvs.Ceiling.Selected) { selectedobjects.Add(bvs.Ceiling); } foreach (Sidedef sd in vs.Key.Sidedefs) { List <VisualGeometry> sidedefgeos = bvs.GetSidedefGeometry(sd); foreach (VisualGeometry sdg in sidedefgeos) { if (sdg.Selected) { selectedobjects.Add((sdg as IVisualEventReceiver)); } } } } } foreach (KeyValuePair <Thing, VisualThing> vt in allthings) { if (vt.Value != null) { BaseVisualThing bvt = (BaseVisualThing)vt.Value; if (bvt.Selected) { selectedobjects.Add(bvt); } } } }
public void ClearSelection() { selectedobjects = new List <IVisualEventReceiver>(); foreach (KeyValuePair <Sector, VisualSector> vs in allsectors) { if (vs.Value != null) { BaseVisualSector bvs = (BaseVisualSector)vs.Value; if (bvs.Floor != null) { bvs.Floor.Selected = false; } if (bvs.Ceiling != null) { bvs.Ceiling.Selected = false; } foreach (Sidedef sd in vs.Key.Sidedefs) { List <VisualGeometry> sidedefgeos = bvs.GetSidedefGeometry(sd); foreach (VisualGeometry sdg in sidedefgeos) { sdg.Selected = false; } } } } foreach (KeyValuePair <Thing, VisualThing> vt in allthings) { if (vt.Value != null) { BaseVisualThing bvt = (BaseVisualThing)vt.Value; bvt.Selected = false; } } }
// This creates a visual thing protected override VisualThing CreateVisualThing(Thing t) { BaseVisualThing vt = new BaseVisualThing(this, t); return(vt.Setup() ? vt : null); }