public override void onClick(MapViewWindow view, Location loc, Point ab) { JunctionRailRoad jrr = JunctionRailRoad.get(loc); if (jrr != null) { Form dialog = new JunctionConfigDialog(controller.getOrCreateJunction(loc)); dialog.ShowDialog(MainWindow.mainWindow); return; } Voxel v = World.world[loc]; if (v == null) { return; } TrainHarbor harbor = (TrainHarbor)v.queryInterface(typeof(TrainHarbor)); if (harbor != null) { StationHandler handler = controller.getStationHandler(harbor); StationConfigDialog dialog = new StationConfigDialog(handler); dialog.ShowDialog(MainWindow.mainWindow); controller.setStationHandler(harbor, dialog.currentHandler); return; } }
public override TimeLength getStopTimeSpan(Train train, TrainHarbor harbor, int callCount) { StationHandler handler = getStationHandler(harbor); if (handler != null) { return(handler.getStopTimeSpan(callCount)); } else { return(StationHandler.defaultHandler.getStopTimeSpan(callCount)); } }
public override TimeLength getStopTimeSpan(Train train, TrainHarbor harbor, int callCount) { // stop 1 hour and go if (!(harbor is Station)) { return(TimeLength.ZERO); // ignore everything but a station } if (callCount == 0) { return(TimeLength.fromMinutes(30)); } else { return(TimeLength.ZERO); } }
public override TimeLength getStopTimeSpan(Train train, TrainHarbor harbor, int callCount) { return(getStopTimeSpan(callCount)); }
internal void setStationHandler(TrainHarbor harbor, StationHandler handler) { stations[harbor.location] = handler; }
internal StationHandler getStationHandler(TrainHarbor harbor) { return((StationHandler)stations[harbor.location]); }
public override TimeLength getStopTimeSpan(Train train, TrainHarbor harbor, int callCount) { return(findController(train).getStopTimeSpan(train, harbor, callCount)); }
/// <summary> /// This method is called when a train hits the stop position /// of a platform (or other train harbors.) /// </summary> /// <param name="callCount"> /// This value is 0 when this method is called /// first time (when a train stops at a station.) /// After the given time is elapsed, the onStop method will be /// called again but this time with callCount==1. The value /// keeps increasing as this process repeats. /// </param> /// <returns> /// returns the amount of time the train should stop. /// after this time span, the train will call this same method /// so the train controller still has a chance to postpone the /// departure. Return 0 to make the train proceed, or return /// -1 to make the train turn around. /// /// Returning 0 when callCount==0 means the train will not stop /// at the specified platform. /// </returns> public abstract TimeLength getStopTimeSpan(Train train, TrainHarbor platform, int callCount);