public MultiPositionUndoStep(MapSelection multiSel, MapSelection[] items, Vector3 startpos, WorldForm wf) { Selection = multiSel; Items = items; StartPosition = startpos; EndPosition = multiSel.WidgetPosition; UpdateGraphics(wf); }
// Private methods private void FileClose_Click(object sender, EventArgs e) => WorldForm.Close();
public WorldSearchForm(WorldForm worldForm) { WorldForm = worldForm; InitializeComponent(); }
public UndoStep CreateUndoStep(WidgetMode mode, Vector3 startPos, Quaternion startRot, Vector3 startScale, WorldForm wf, bool editPivot) { if (MultipleSelectionItems != null) { switch (mode) { case WidgetMode.Position: return(new MultiPositionUndoStep(this, startPos, wf)); case WidgetMode.Rotation: return(new MultiRotationUndoStep(this, startRot, wf)); case WidgetMode.Scale: return(new MultiScaleUndoStep(this, startScale, wf)); } } else if (EntityDef != null) { if (editPivot) { switch (mode) { case WidgetMode.Position: return(new EntityPivotPositionUndoStep(EntityDef, startPos)); case WidgetMode.Rotation: return(new EntityPivotRotationUndoStep(EntityDef, startRot)); } } else { switch (mode) { case WidgetMode.Position: return(new EntityPositionUndoStep(EntityDef, startPos)); case WidgetMode.Rotation: return(new EntityRotationUndoStep(EntityDef, startRot)); case WidgetMode.Scale: return(new EntityScaleUndoStep(EntityDef, startScale)); } } } else if (CarGenerator != null) { switch (mode) { case WidgetMode.Position: return(new CarGenPositionUndoStep(CarGenerator, startPos)); case WidgetMode.Rotation: return(new CarGenRotationUndoStep(CarGenerator, startRot)); case WidgetMode.Scale: return(new CarGenScaleUndoStep(CarGenerator, startScale)); } } else if (CollisionVertex != null) { switch (mode) { case WidgetMode.Position: return(new CollisionVertexPositionUndoStep(CollisionVertex, startPos, wf)); } } else if (CollisionPoly != null) { switch (mode) { case WidgetMode.Position: return(new CollisionPolyPositionUndoStep(CollisionPoly, startPos, wf)); case WidgetMode.Rotation: return(new CollisionPolyRotationUndoStep(CollisionPoly, startRot, wf)); case WidgetMode.Scale: return(new CollisionPolyScaleUndoStep(CollisionPoly, startScale, wf)); } } else if (CollisionBounds != null) { switch (mode) { case WidgetMode.Position: return(new CollisionPositionUndoStep(CollisionBounds, startPos, wf)); case WidgetMode.Rotation: return(new CollisionRotationUndoStep(CollisionBounds, startRot, wf)); case WidgetMode.Scale: return(new CollisionScaleUndoStep(CollisionBounds, startScale, wf)); } } else if (PathNode != null) { switch (mode) { case WidgetMode.Position: return(new PathNodePositionUndoStep(PathNode, startPos, wf)); } } else if (NavPoly != null) { //todo... } else if (NavPoint != null) { switch (mode) { case WidgetMode.Position: return(new NavPointPositionUndoStep(NavPoint, startPos, wf)); case WidgetMode.Rotation: return(new NavPointRotationUndoStep(NavPoint, startRot, wf)); } } else if (NavPortal != null) { switch (mode) { case WidgetMode.Position: return(new NavPortalPositionUndoStep(NavPortal, startPos, wf)); case WidgetMode.Rotation: return(new NavPortalRotationUndoStep(NavPortal, startRot, wf)); } } else if (TrainTrackNode != null) { switch (mode) { case WidgetMode.Position: return(new TrainTrackNodePositionUndoStep(TrainTrackNode, startPos, wf)); } } else if (ScenarioNode != null) { switch (mode) { case WidgetMode.Position: return(new ScenarioNodePositionUndoStep(ScenarioNode, startPos, wf)); case WidgetMode.Rotation: return(new ScenarioNodeRotationUndoStep(ScenarioNode, startRot, wf)); } } else if (Audio != null) { switch (mode) { case WidgetMode.Position: return(new AudioPositionUndoStep(Audio, startPos)); case WidgetMode.Rotation: return(new AudioRotationUndoStep(Audio, startRot)); } } return(null); }
private void UpdateGraphics(WorldForm wf) { Dictionary <YndFile, int> pathYnds = new Dictionary <YndFile, int>(); Dictionary <YnvFile, int> navYnvs = new Dictionary <YnvFile, int>(); Dictionary <TrainTrack, int> trainTracks = new Dictionary <TrainTrack, int>(); Dictionary <YmtFile, int> scenarioYmts = new Dictionary <YmtFile, int>(); Dictionary <Bounds, int> bounds = new Dictionary <Bounds, int>(); if (Items != null) { foreach (var item in Items) { if (item.PathNode != null) { pathYnds[item.PathNode.Ynd] = 1; } if (item.NavPoly != null) { navYnvs[item.NavPoly.Ynv] = 1; } if (item.NavPoint != null) { navYnvs[item.NavPoint.Ynv] = 1; } if (item.NavPortal != null) { navYnvs[item.NavPortal.Ynv] = 1; } if (item.TrainTrackNode != null) { trainTracks[item.TrainTrackNode.Track] = 1; } if (item.ScenarioNode != null) { scenarioYmts[item.ScenarioNode.Ymt] = 1; } if (item.CollisionBounds != null) { bounds[item.CollisionBounds] = 1; } if (item.CollisionPoly?.Owner != null) { bounds[item.CollisionPoly.Owner] = 1; } } } foreach (var kvp in bounds) { wf.UpdateCollisionBoundsGraphics(kvp.Key); } foreach (var kvp in pathYnds) { wf.UpdatePathYndGraphics(kvp.Key, true); } foreach (var kvp in navYnvs) { wf.UpdateNavYnvGraphics(kvp.Key, true); } foreach (var kvp in trainTracks) { wf.UpdateTrainTrackGraphics(kvp.Key, false); } foreach (var kvp in scenarioYmts) { wf.UpdateScenarioGraphics(kvp.Key, false); } }
public override void Redo(WorldForm wf, ref MapSelection sel) { Update(wf, ref sel, EndPosition); }
//revert the object to the state marked at the end of this step public abstract void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel);
public CollisionPositionUndoStep(Bounds bounds, YmapEntityDef ent, Vector3 startpos, WorldForm wf) { Bounds = bounds; Entity = ent; StartPosition = startpos; EndPosition = bounds?.Position ?? Vector3.Zero; UpdateGraphics(wf); }
public CollisionRotationUndoStep(Bounds bounds, YmapEntityDef ent, Quaternion startrot, WorldForm wf) { Bounds = bounds; Entity = ent; StartRotation = startrot; EndRotation = bounds?.Orientation ?? Quaternion.Identity; if (ent != null) { EndRotation = EndRotation * ent.Orientation; } UpdateGraphics(wf); }
public override void Redo(WorldForm wf, ref MapSelection sel) { Update(wf, ref sel, EndScale, StartScale); }
protected void UpdateGraphics(WorldForm wf) { Selection.UpdateGraphics(wf); }
public CollisionVertexPositionUndoStep(BoundVertex vertex, YmapEntityDef ent, Vector3 startpos, WorldForm wf) { Vertex = vertex; Entity = ent; StartPosition = startpos; EndPosition = vertex?.Position ?? Vector3.Zero; UpdateGraphics(wf); }
public override void Redo(WorldForm wf, ProjectForm pf, ref MapSelection sel) { Update(wf, pf, ref sel, EndRotation); }
public override void Undo(WorldForm wf, ProjectForm pf, ref MapSelection sel) { Update(wf, pf, ref sel, StartPosition); }
public CutsceneForm(WorldForm worldForm) { WorldForm = worldForm; GameFileCache = WorldForm.GameFileCache; InitializeComponent(); }
public CollisionPolyPositionUndoStep(BoundPolygon poly, YmapEntityDef ent, Vector3 startpos, WorldForm wf) { Polygon = poly; Entity = ent; StartPosition = startpos; EndPosition = poly?.Position ?? Vector3.Zero; UpdateGraphics(wf); }
//revert the object to the state marked at the start of this step public abstract void Undo(WorldForm wf, ref MapSelection sel);
public CollisionPolyRotationUndoStep(BoundPolygon poly, YmapEntityDef ent, Quaternion startrot, WorldForm wf) { Polygon = poly; Entity = ent; StartRotation = startrot; EndRotation = poly?.Orientation ?? Quaternion.Identity; if (ent != null) { EndRotation = EndRotation * ent.Orientation; } UpdateGraphics(wf); }
public override void Undo(WorldForm wf, ref MapSelection sel) { Update(wf, ref sel, StartRotation); }
public StatisticsForm(WorldForm wf) { worldForm = wf; InitializeComponent(); }