// Use this for initialization void Start() { if (pathtofollow == null) { pathtofollow = GameObject.Find(pathName).GetComponent <PathEditor> (); } }
/// <summary> /// Once a path has been selected, do the necessary loading. /// </summary> /// <param name="path">Path (with FilePath) that has to be loaded</param> internal void SetPath(Path path) { if (!CanDiscardModifiedPath()) { return; } if (path == null) { DrawPATfile = null; PathEditor = null; drawPathChart.Close(); } else { DrawLoadingMessage(catalog.GetString("Loading .pat file ...")); DrawPATfile = new DrawPATfile(path); DrawLoadingMessage(catalog.GetString("Processing .pat file ...")); PathEditor = new PathEditor(this.RouteData, this.DrawTrackDB, path); drawPathChart.SetPathEditor(this.RouteData, this.PathEditor); DrawLoadingMessage(" ..."); } }
private void toolStripButtonEditPaths_Click(object sender, EventArgs e) { PathEditor pathEditor = new PathEditor(Project); pathEditor.ShowDialog(); RefreshTrainProperties(); }
private void newPathBt_Click(object sender, EventArgs e) { PathEditor childForm = new PathEditor(); childForm.MdiParent = this; childForm.Text = "Path"; childForm.Show(); }
private void Start() { _anim = GetComponent <Animator>(); _pathToFollow = _paths[_pathId]; _lastPosition = transform.position; GameManager.GetManager()._player = this; _anim.SetFloat("Speed", 1); }
// Use this for initialization void Start() { theplayer = FindObjectOfType <PlayerController> (); initialHealth = Health; pathtofollow = GameObject.Find(pathName).GetComponent <PathEditor>(); mid = pathtofollow.pathsObject.Count + 1; mid = mid / 2; }
protected override void Awake() { base.Awake(); editor = GameObject.FindObjectOfType <PathEditor>(); trace = GameObject.FindObjectOfType <BossTraceCheck> (); FindNearestDestination(); transform.LookAt(destination.transform); }
public void Setup() { m_GUIState = new TestGUIState(); m_GUISystem = new GUISystem(m_GUIState); m_Drawer = new TestDrawer(); m_EditablePath = new EditablePath(); m_Controller = new EditablePathController(); m_Controller.editablePath = m_EditablePath; m_PathEditor = new PathEditor(m_GUISystem); m_PathEditor.drawerOverride = m_Drawer; m_PathEditor.controller = m_Controller; }
private void BrowseExec(object sender, ExecutedRoutedEventArgs e) { BrowseDialog.FileName = PathPattern; if (BrowseDialog.ShowDialog().GetValueOrDefault(false)) { PathPattern = BrowseDialog.FileName; } if (PathEditor != null) { PathEditor.Focus(); } }
protected override void OnGotFocus(RoutedEventArgs e) { base.OnGotFocus(e); if ((!e.Handled) && (PathEditor != null)) { if (e.OriginalSource == this) { PathEditor.Focus(); e.Handled = true; } } }
void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } Initialize(); }
private void InsertPlaceholderExec(object sender, ExecutedRoutedEventArgs e) { if (PathEditor == null) { PathPattern += (string)e.Parameter; //Fallback position, just append the placeholder to the path text } else { //If there is a path editor text box, put the placeholder at the insertion point PathEditor.SelectedText = (string)e.Parameter; PathEditor.Select(PathEditor.SelectionStart + PathEditor.SelectionLength, 0); PathEditor.Focus(); } }
internal void NewPath() { if (!CanDiscardModifiedPath()) { return; } string pathsDirectory = System.IO.Path.Combine(CurrentRoute.Path, "PATHS"); PathEditor = new PathEditor(this.RouteData, this.DrawTrackDB, pathsDirectory); drawPathChart.SetPathEditor(this.RouteData, this.PathEditor); DrawPATfile = null; PathEditor.EditingIsActive = true; PathEditor.EditMetaData(); }
public static void EditCollectionAsset(PathAsset pathAsset) { PathEditor pathEditor; if (PathLibrary.Editor.Instance == null) { pathEditor = new PathEditor(); PathLibrary.Editor.Init(pathEditor); pathEditor.Init(); } PathLibrary.Editor.Instance.Asset = pathAsset; ShowBrowser(); }
public PathEditor() { if (instance != null) { Debug.LogError("Trying to create two instances of singleton. Self destruction in 3..."); Destroy(this); return; } if (this.Editor == null) { Debug.LogError("Failed to link with library implementation"); Destroy(this); return; } instance = this; }
// private Quaternion quat = new Quaternion( 0, 0, 0, 0 ); // private Vector3 vect = new Vector3( 0, 0, 0 ); public PathEditor() { if( instance != null ) { Debug.LogError( "Trying to create two instances of singleton. Self destruction in 3..." ); Destroy( this ); return; } if( this.Editor == null ) { Debug.LogError( "Failed to link with library implementation" ); Destroy( this ); return; } instance = this; }
/// <summary> /// Set the route and path-specifics. /// </summary> /// <param name="routeData">The route information from which we need the track database and the tsectiondat</param> /// <param name="pathEditor"></param> public void SetPathEditor(ORTS.TrackViewer.Drawing.RouteData routeData, PathEditor pathEditor) { this.routeData = routeData; this.pathEditor = pathEditor; this.pathEditor.ChangedPath += new ChangedPathHandler(OnPathChanged); if (pathEditor == null || pathEditor.CurrentTrainPath == null || pathEditor.CurrentTrainPath.FirstNode == null) { pathData = null; return; } if (ChartWindowIsOpen) { InitChartData(); OnPathChanged(); // To make sure we have an initial update } else { pathData = null; } }
/// <summary> /// Initializes a new instance of the <see cref="UpdatePathForm"/> class. /// </summary> /// <param name="update">The update command that's driving things (not null).</param> /// <exception cref="ArgumentNullException">If the supplied update command is null.</exception> internal UpdatePathForm(UpdateUI update) { InitializeComponent(); Owner = EditingController.Current.MainForm; if (update == null) { throw new ArgumentNullException(); } m_UpdCmd = update; m_CurFaceIndex = -1; m_pop = null; // Get the object that was selected for update. m_pop = (m_UpdCmd.GetOp() as PathOperation); if (m_pop == null) { throw new ArgumentException("Cannot obtain original connection path for update"); } // Get a working copy of the connection path legs // TODO - This will not be suitable in a situation where staggered legs have been created Leg[] legs = PathParser.CreateLegs(m_pop.EntryString, m_pop.EntryUnit); m_Faces = new List <LegFace>(); foreach (Leg leg in legs) { m_Faces.Add(leg.PrimaryFace); if (leg.AlternateFace != null) { m_Faces.Add(leg.AlternateFace); } } m_Edits = new PathEditor(legs); }
private void Move() { _pathToFollow = _paths[_pathId]; float distance = Vector3.Distance(_pathToFollow._wayPoints[m_currentWayPointId].position, transform.position); transform.position = Vector3.MoveTowards(transform.position, _pathToFollow._wayPoints[m_currentWayPointId].position, Time.deltaTime * (_moveSpeed + accelerationValue)); var rotation = Quaternion.LookRotation(_pathToFollow._wayPoints[m_currentWayPointId].position - transform.position); transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * _rotationSpeed); if (distance <= _reachDistance) { m_currentWayPointId++; } if (m_currentWayPointId >= _pathToFollow._wayPoints.Count) { m_currentWayPointId = 0; GameManager.GetManager()._bossManager._turn += 1; GameManager.GetManager()._bossManager._turnCounter += 1; } }
/// <summary> /// Initializes a new instance of the <see cref="UpdatePathForm"/> class. /// </summary> /// <param name="update">The update command that's driving things (not null).</param> /// <exception cref="ArgumentNullException">If the supplied update command is null.</exception> internal UpdatePathForm(UpdateUI update) { InitializeComponent(); Owner = EditingController.Current.MainForm; if (update == null) throw new ArgumentNullException(); m_UpdCmd = update; m_CurFaceIndex = -1; m_pop = null; // Get the object that was selected for update. m_pop = (m_UpdCmd.GetOp() as PathOperation); if (m_pop == null) throw new ArgumentException("Cannot obtain original connection path for update"); // Get a working copy of the connection path legs // TODO - This will not be suitable in a situation where staggered legs have been created Leg[] legs = PathParser.CreateLegs(m_pop.EntryString, m_pop.EntryUnit); m_Faces = new List<LegFace>(); foreach (Leg leg in legs) { m_Faces.Add(leg.PrimaryFace); if (leg.AlternateFace != null) m_Faces.Add(leg.AlternateFace); } m_Edits = new PathEditor(legs); }
public static void EditCollectionAsset( PathAsset pathAsset ) { PathEditor pathEditor; if( PathLibrary.Editor.Instance == null ) { pathEditor = new PathEditor(); PathLibrary.Editor.Init( pathEditor ); pathEditor.Init(); } PathLibrary.Editor.Instance.Asset = pathAsset; ShowBrowser(); }
public GraphNode(IFilter filter) { InitializeComponent(); _filter = filter; _filter.OnPinsChanged += OnPinsChanged; _filter.OnProcessingProgressChanged += OnProcessingProgressChanged; _filter.OnProcessingStateChanged += OnProcessingStateChanged; UpdateSize(_filter); var table = new TableLayoutPanel { Size = new Size(Width - 2, _filter.Properties.Count * PropertyHeight), Location = new Point(1, HeaderHeight + 2) }; table.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); for (int i = 0; i < _filter.Properties.Count; i++) { IFilterProperty property = _filter.Properties.Skip(i).First().Value; BasePropertyEditor editor; switch (property.Type) { case FilterPropertyType.String: editor = new PathEditor { Value = property.Value }; break; case FilterPropertyType.Float: case FilterPropertyType.Integer: editor = new NumericEditor((INumericProperty)property) { Value = Convert.ToDecimal(property.Value) }; break; case FilterPropertyType.Size: case FilterPropertyType.Point: editor = new PointEditor((IPointProperty)property) { Value = property.Value }; break; case FilterPropertyType.Enum: editor = new EnumEditor((IEnumProperty)property) { Value = property.Value }; break; default: throw new ArgumentOutOfRangeException(); } editor.Dock = DockStyle.Fill; editor.Margin = new Padding(0); editor.OnValueChanged += newValue => { property.Value = newValue; }; table.RowStyles.Add(new RowStyle(SizeType.AutoSize)); table.SetRow(editor, i); table.SetColumn(editor, 1); var label = new Label { Text = property.Name, Margin = new Padding(0), Dock = DockStyle.Right, AutoSize = true, Anchor = AnchorStyles.Right }; table.SetRow(label, i); table.SetColumn(label, 0); table.Controls.Add(label); table.Controls.Add(editor); } Controls.Add(table); }
public void DrawEditor() { UnityEngine.GUI.color = Color.cyan; if (GUILayout.Button("\nLoad Paths\n")) { foreach (PathEditor pathEditor in PathEditors) { GameObject.DestroyImmediate(pathEditor.gameObject); } PathEditors.Clear(); LoadedPaths.Clear(); ChunkTransforms.Clear(); if (!Manager.IsAwake <Mods> ()) { Manager.WakeUp <Mods> ("__MODS"); } Mods.Get.Editor.InitializeEditor(true); ChunkParentTransform = gameObject.FindOrCreateChild("Chunks"); PathParentTransform = gameObject.FindOrCreateChild("Paths"); List <string> chunkNames = Mods.Get.ModDataNames("Chunk"); foreach (string chunkName in chunkNames) { ChunkState chunkState = null; if (Mods.Get.Runtime.LoadMod <ChunkState> (ref chunkState, "Chunk", chunkName)) { GameObject newChunkGameObject = ChunkParentTransform.gameObject.FindOrCreateChild(chunkState.ID.ToString()).gameObject; //look up the chunk terrain data and apply the offset Vector3 chunkPosition = chunkState.TileOffset; //chunkPosition.y = chunkState.YOffset; newChunkGameObject.transform.position = chunkPosition; //we'll use the ID for looking up path chunks later ChunkTransforms.Add(newChunkGameObject.transform); //now look for any terrain GameObject terrainObject = GameObject.Find(chunkState.XTilePosition.ToString() + " " + chunkState.ZTilePosition.ToString()); if (terrainObject != null) { terrainObject.transform.parent = newChunkGameObject.transform; terrainObject.transform.ResetLocal(); Terrain terrain = terrainObject.GetComponent <Terrain> (); terrain.heightmapPixelError = 50; } } } Mods.Get.Editor.LoadAvailableMods <Path> (LoadedPaths, "Path"); foreach (Path path in LoadedPaths) { GameObject pathEditorGameObject = PathParentTransform.gameObject.FindOrCreateChild(path.Name).gameObject; PathEditor pathEditor = pathEditorGameObject.GetOrAdd <PathEditor> (); pathEditor.DoNotRefreshOrSave = false; pathEditor.Name = path.Name; pathEditor.State = path; pathEditor.EditorRefresh(); pathEditor.BuildSpline(); } MergeOverlappingTemplates(); } if (GUILayout.Button("\nSnap Nearby Templates\n")) { SnapNearbyTemplates(); MergeOverlappingTemplates(); } if (GUILayout.Button("\nMinimum Height\n")) { AdjustMinimumHeight(); } if (GUILayout.Button("\nRefreshAll\n")) { foreach (PathEditor pe in PathEditors) { Debug.Log(pe.Name); pe.EditorRefresh(); } } if (GUILayout.Button("\nSave Paths\n")) { PathEditors.Clear(); PathEditors.AddRange(PathParentTransform.GetComponentsInChildren <PathEditor> ()); foreach (PathEditor editor in PathEditors) { editor.EditorSave(); } } }
public void ProducePath(PathEditor pe) { Enemy e = GenerateTestEnemy(); EnemyMover mover; if (moveString.Equals("Linear")) { mover = new LinearMover(e); } else if (moveString.Equals("Linear_Right")) { mover = new LinearMover(e); mover.PutInRightLane(); } else if (moveString.Equals("Linear_Left")) { mover = new LinearMover(e); mover.PutInLeftLane(); } else if (moveString.Equals("Slowing_Linear")) { mover = new SlowingLinearMover(e); } else if (moveString.Equals("Slowing_Linear_Right")) { mover = new SlowingLinearMover(e); mover.PutInRightLane(); } else if (moveString.Equals("Slowing_Linear_Left")) { mover = new SlowingLinearMover(e); mover.PutInLeftLane(); } else if (moveString.Equals("Zigzag")) { mover = new ZigzagMover(e); } else if (moveString.Equals("Zigzag_Mirror")) { ZigzagMover zm = new ZigzagMover(e); zm.Mirror(); mover = zm; } else if (moveString.Equals("Strafing")) { mover = new StrafingMover(e); } else if (moveString.Equals("Strafing_Mirror")) { StrafingMover sm = new StrafingMover(e); sm.Mirror(); mover = sm; } else if (moveString.Equals("Sine")) { mover = new SineMover(e); } else if (moveString.Equals("Sine_Mirror")) { SineMover sm = new SineMover(e); sm.Mirror(); mover = sm; } else if (moveString.Equals("Swerve_Right")) { mover = new SwerveMover(e); } else if (moveString.Equals("Swerve_Left")) { SwerveMover sm = new SwerveMover(e); sm.Mirror(); mover = sm; } else if (moveString.Equals("Swerve_In_Left")) { SwerveMover sm = new SwerveMover(e); sm.PutInLeftLane(); mover = sm; } else if (moveString.Equals("Swerve_In_Right")) { SwerveMover sm = new SwerveMover(e); sm.PutInRightLane(); sm.Mirror(); mover = sm; } else if (moveString.Equals("Semicircle")) { mover = new SemicircleMover(e); } else if (moveString.Equals("Semicircle_Mirror")) { SemicircleMover sm = new SemicircleMover(e); sm.Mirror(); mover = sm; } else if (moveString.Equals("Sidestep")) { mover = new SidestepMover(e); } else if (moveString.Equals("Sidestep_Mirror")) { SidestepMover sm = new SidestepMover(e); sm.Mirror(); mover = sm; } else { Debug.Log("Invalid mover type!"); Destroy(e.gameObject); return; } mover.LeftOffset(30f); Vector2[] pointset = new Vector2[pointResolution]; for (int i = 0; i < pointResolution; i++) { float prog = ((float)i) / ((float)(pointResolution - 1)); pointset[i] = mover.PositionFromProgress(prog); } Destroy(e.gameObject); //convert vector set to point-based path pe.GeneratePathFromVectorArray(pointset); }
private void OnPathEditorHistoryDropDownClosed(object sender, EventArgs e) { PathEditor.Focus(); }
private void OnPathEditorHistoryGotFocus(object sender, RoutedEventArgs e) { PathEditor.Focus(); }
static void Init() { PathEditor window = (PathEditor)EditorWindow.GetWindow(typeof(PathEditor)); }
public void setpathManager(GameObject pathmanager) { this.mypathmanager = pathmanager.GetComponent <PathEditor>(); }
// Use this for initialization void Start( ) { pathtofollow = GameObject.Find(pathName).GetComponent <PathEditor> (); sp = GetComponent <SpriteRenderer> (); }
public void OnDestroy() { Editor.OnDestroy(); instance = null; }
// Use this for initialization void Start() { //level_controller_script = GameObject.FindGameObjectWithTag("LevelController").GetComponent<LevelController>(); mypathmanager = GameObject.Find(pathname).GetComponent <PathEditor>(); last_position = transform.position; }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { // Even if there is nothing new to draw for main window, we might still need to draw for the shadow textures. if (DrawTrackDB != null && Properties.Settings.Default.showInset) { drawAreaInset.DrawShadowTextures(DrawTrackDB.DrawTracks, DrawColors.colorsNormal.ClearWindowInset); } // if there is nothing to draw, be done. if (--skipDrawAmount > 0) { return; } GraphicsDevice.Clear(DrawColors.colorsNormal.ClearWindow); if (DrawTrackDB == null) { return; } spriteBatch.Begin(); if (drawTerrain != null) { drawTerrain.Draw(DrawArea); } drawWorldTiles.Draw(DrawArea); DrawArea.DrawTileGrid(); if (drawTerrain != null) { drawTerrain.DrawPatchLines(DrawArea); } DrawTrackDB.DrawRoads(DrawArea); DrawTrackDB.DrawTracks(DrawArea); DrawTrackDB.DrawTrackHighlights(DrawArea, true); DrawTrackDB.DrawJunctionAndEndNodes(DrawArea); if (Properties.Settings.Default.showInset) { drawAreaInset.DrawBackground(DrawColors.colorsNormal.ClearWindowInset); //drawTrackDB.DrawTracks(drawAreaInset); //replaced by next line drawAreaInset.DrawShadowedTextures(); DrawTrackDB.DrawTrackHighlights(drawAreaInset, false); drawAreaInset.DrawBorder(Color.Red, DrawArea); drawAreaInset.DrawBorder(Color.Black); } if (DrawMultiplePaths != null) { DrawMultiplePaths.Draw(DrawArea); } if (DrawPATfile != null && Properties.Settings.Default.showPATfile) { DrawPATfile.Draw(DrawArea); } if (PathEditor != null && Properties.Settings.Default.showTrainpath) { PathEditor.Draw(DrawArea); } DrawTrackDB.DrawRoadTrackItems(DrawArea); DrawTrackDB.DrawTrackItems(DrawArea); DrawTrackDB.DrawItemHighlights(DrawArea); CalculateFPS(gameTime); statusBarControl.Update(this, DrawArea.MouseLocation); drawScaleRuler.Draw(); drawLongitudeLatitude.Draw(DrawArea.MouseLocation); DebugWindow.DrawAll(); spriteBatch.End(); base.Draw(gameTime); skipDrawAmount = maxSkipDrawAmount; }
public void ProducePath(PathEditor pe) { Enemy e = GenerateTestEnemy(); EnemyMover mover; if(moveString.Equals("Linear")){ mover = new LinearMover(e); }else if(moveString.Equals("Linear_Right")){ mover = new LinearMover(e); mover.PutInRightLane(); }else if(moveString.Equals("Linear_Left")){ mover = new LinearMover(e); mover.PutInLeftLane(); }else if(moveString.Equals("Slowing_Linear")){ mover = new SlowingLinearMover(e); }else if(moveString.Equals("Slowing_Linear_Right")){ mover = new SlowingLinearMover(e); mover.PutInRightLane(); }else if(moveString.Equals("Slowing_Linear_Left")){ mover = new SlowingLinearMover(e); mover.PutInLeftLane(); }else if(moveString.Equals ("Zigzag")){ mover = new ZigzagMover(e); }else if(moveString.Equals ("Zigzag_Mirror")){ ZigzagMover zm = new ZigzagMover(e); zm.Mirror(); mover = zm; }else if(moveString.Equals ("Strafing")){ mover = new StrafingMover(e); }else if(moveString.Equals ("Strafing_Mirror")){ StrafingMover sm = new StrafingMover(e); sm.Mirror(); mover = sm; }else if(moveString.Equals ("Sine")){ mover = new SineMover(e); }else if(moveString.Equals ("Sine_Mirror")){ SineMover sm = new SineMover(e); sm.Mirror(); mover = sm; }else if(moveString.Equals ("Swerve_Right")){ mover = new SwerveMover(e); }else if(moveString.Equals ("Swerve_Left")){ SwerveMover sm = new SwerveMover(e); sm.Mirror(); mover = sm; }else if(moveString.Equals ("Swerve_In_Left")){ SwerveMover sm = new SwerveMover(e); sm.PutInLeftLane(); mover = sm; }else if(moveString.Equals ("Swerve_In_Right")){ SwerveMover sm = new SwerveMover(e); sm.PutInRightLane(); sm.Mirror(); mover = sm; }else if(moveString.Equals ("Semicircle")){ mover = new SemicircleMover(e); }else if(moveString.Equals ("Semicircle_Mirror")){ SemicircleMover sm = new SemicircleMover(e); sm.Mirror(); mover = sm; }else if(moveString.Equals ("Sidestep")){ mover = new SidestepMover(e); }else if(moveString.Equals ("Sidestep_Mirror")){ SidestepMover sm = new SidestepMover(e); sm.Mirror(); mover = sm; }else{ Debug.Log ("Invalid mover type!"); Destroy(e.gameObject); return; } mover.LeftOffset(30f); Vector2[] pointset = new Vector2[pointResolution]; for(int i = 0; i < pointResolution; i++){ float prog = ((float)i)/((float)(pointResolution-1)); pointset[i] = mover.PositionFromProgress(prog); } Destroy (e.gameObject); //convert vector set to point-based path pe.GeneratePathFromVectorArray(pointset); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (!this.IsActive) { lostFocus = true; return; } TVUserInput.Update(); if (lostFocus) { // if the previous call was in inactive mode, we do want TVUserInput to be updated, but we will only // act on it the next round. To make sure moving the mouse to other locations and back is influencing // the location visible in trackviewer. lostFocus = false; return; } fontManager.Update(GraphicsDevice); if (DrawTrackDB != null) { // when update is called, we are not searching via menu DrawTrackDB.ClearHighlightOverrides(); } // First check all the buttons that can be kept down. if (this.drawPathChart.IsActived) { if (TVUserInput.IsDown(TVUserCommands.ShiftLeft)) { drawPathChart.Shift(-1); skipDrawAmount = 0; } if (TVUserInput.IsDown(TVUserCommands.ShiftRight)) { drawPathChart.Shift(1); skipDrawAmount = 0; } if (TVUserInput.IsDown(TVUserCommands.ZoomIn)) { drawPathChart.Zoom(-1); skipDrawAmount = 0; } if (TVUserInput.IsDown(TVUserCommands.ZoomOut)) { drawPathChart.Zoom(1); skipDrawAmount = 0; } } else { if (TVUserInput.IsDown(TVUserCommands.ShiftLeft)) { DrawArea.ShiftLeft(); skipDrawAmount = 0; } if (TVUserInput.IsDown(TVUserCommands.ShiftRight)) { DrawArea.ShiftRight(); skipDrawAmount = 0; } if (TVUserInput.IsDown(TVUserCommands.ShiftUp)) { DrawArea.ShiftUp(); skipDrawAmount = 0; } if (TVUserInput.IsDown(TVUserCommands.ShiftDown)) { DrawArea.ShiftDown(); skipDrawAmount = 0; } if (TVUserInput.IsDown(TVUserCommands.ZoomIn)) { DrawArea.Zoom(-1); skipDrawAmount = 0; } if (TVUserInput.IsDown(TVUserCommands.ZoomOut)) { DrawArea.Zoom(1); skipDrawAmount = 0; } } if (TVUserInput.Changed) { skipDrawAmount = 0; } if (TVUserInput.IsPressed(TVUserCommands.Quit)) { this.Quit(); } if (TVUserInput.IsPressed(TVUserCommands.ReloadRoute)) { this.ReloadRoute(); } if (TVUserInput.IsPressed(TVUserCommands.ShiftToMouseLocation)) { DrawArea.ShiftToLocation(DrawArea.MouseLocation); } if (TVUserInput.IsPressed(TVUserCommands.ZoomInSlow)) { DrawArea.Zoom(-1); } if (TVUserInput.IsPressed(TVUserCommands.ZoomOutSlow)) { DrawArea.Zoom(1); } if (TVUserInput.IsPressed(TVUserCommands.ZoomToTile)) { DrawArea.ZoomToTile(); } if (TVUserInput.IsPressed(TVUserCommands.ZoomReset)) { DrawArea.ZoomReset(DrawTrackDB); drawAreaInset.ZoomReset(DrawTrackDB); // needed in case window was resized } if (DrawPATfile != null && Properties.Settings.Default.showPATfile) { if (TVUserInput.IsPressed(TVUserCommands.ExtendPath)) { DrawPATfile.ExtendPath(); } if (TVUserInput.IsPressed(TVUserCommands.ExtendPathFull)) { DrawPATfile.ExtendPathFull(); } if (TVUserInput.IsPressed(TVUserCommands.ReducePath)) { DrawPATfile.ReducePath(); } if (TVUserInput.IsPressed(TVUserCommands.ReducePathFull)) { DrawPATfile.ReducePathFull(); } if (TVUserInput.IsDown(TVUserCommands.ShiftToPathLocation)) { DrawArea.ShiftToLocation(DrawPATfile.CurrentLocation); } } if (PathEditor != null && Properties.Settings.Default.showTrainpath) { if (TVUserInput.IsPressed(TVUserCommands.ExtendPath)) { PathEditor.ExtendPath(); } if (TVUserInput.IsPressed(TVUserCommands.ExtendPathFull)) { PathEditor.ExtendPathFull(); } if (TVUserInput.IsPressed(TVUserCommands.ReducePath)) { PathEditor.ReducePath(); } if (TVUserInput.IsPressed(TVUserCommands.ReducePathFull)) { PathEditor.ReducePathFull(); } if (TVUserInput.IsDown(TVUserCommands.ShiftToPathLocation)) { DrawArea.ShiftToLocation(PathEditor.CurrentLocation); } if (TVUserInput.IsPressed(TVUserCommands.EditorUndo)) { PathEditor.Undo(); } if (TVUserInput.IsPressed(TVUserCommands.EditorRedo)) { PathEditor.Redo(); } if (TVUserInput.IsMouseXButton1Pressed()) { PathEditor.Undo(); } if (TVUserInput.IsMouseXButton2Pressed()) { PathEditor.Redo(); } } if (PathEditor != null && PathEditor.EditingIsActive) { if (TVUserInput.IsMouseRightButtonPressed()) { PathEditor.OnLeftMouseRelease(); // any action done with left mouse is cancelled now PathEditor.PopupContextMenu(TVUserInput.MouseLocationX, TVUserInput.MouseLocationY); } if (TVUserInput.IsDown(TVUserCommands.EditorTakesMouseClick)) { if (TVUserInput.IsMouseLeftButtonPressed()) { PathEditor.OnLeftMouseClick(TVUserInput.MouseLocationX, TVUserInput.MouseLocationY); } if (TVUserInput.IsMouseLeftButtonDown()) { PathEditor.OnLeftMouseMoved(); // to make sure it is reactive enough, don't even care if mouse is really moved } if (TVUserInput.IsMouseLeftButtonReleased()) { PathEditor.OnLeftMouseRelease(); } } if (TVUserInput.IsReleased(TVUserCommands.EditorTakesMouseClick)) { PathEditor.OnLeftMouseCancel(); } drawPathChart.DrawDynamics(); } if (!TVUserInput.IsDown(TVUserCommands.EditorTakesMouseClick) && !this.MenuHasMouse && !this.drawPathChart.IsActived) { if (TVUserInput.IsMouseMoved() && TVUserInput.IsMouseLeftButtonDown()) { DrawArea.ShiftArea(TVUserInput.MouseMoveX(), TVUserInput.MouseMoveY()); } } if (TVUserInput.IsMouseWheelChanged()) { int mouseWheelChange = TVUserInput.MouseWheelChange(); if (!this.drawPathChart.IsActived) { if (TVUserInput.IsDown(TVUserCommands.MouseZoomSlow)) { DrawArea.Zoom(mouseWheelChange > 0 ? -1 : 1); } else { DrawArea.Zoom(-mouseWheelChange / 40); } } } DrawArea.Update(); drawAreaInset.Update(); drawAreaInset.Follow(DrawArea, 10f); if (TVUserInput.IsPressed(TVUserCommands.ToggleZoomAroundMouse)) { menuControl.MenuToggleZoomingAroundMouse(); } if (TVUserInput.IsPressed(TVUserCommands.ToggleShowTerrain)) { menuControl.MenuToggleShowTerrain(); } if (TVUserInput.IsPressed(TVUserCommands.ToggleShowDMTerrain)) { menuControl.MenuToggleShowDMTerrain(); } if (TVUserInput.IsPressed(TVUserCommands.ToggleShowPatchLines)) { menuControl.MenuToggleShowPatchLines(); } if (TVUserInput.IsPressed(TVUserCommands.ToggleShowSignals)) { menuControl.MenuToggleShowSignals(); } if (TVUserInput.IsPressed(TVUserCommands.ToggleShowSidings)) { menuControl.MenuToggleShowSidings(); } if (TVUserInput.IsPressed(TVUserCommands.ToggleShowSidingNames)) { menuControl.MenuToggleShowSidingNames(); } if (TVUserInput.IsPressed(TVUserCommands.ToggleShowPlatforms)) { menuControl.MenuToggleShowPlatforms(); } if (TVUserInput.IsPressed(TVUserCommands.ToggleShowPlatformNames)) { menuControl.MenuCirculatePlatformStationNames(); } if (TVUserInput.IsPressed(TVUserCommands.ToggleShowSpeedLimits)) { menuControl.MenuToggleShowSpeedLimits(); } if (TVUserInput.IsPressed(TVUserCommands.ToggleShowMilePosts)) { menuControl.MenuToggleShowMilePosts(); } if (TVUserInput.IsPressed(TVUserCommands.ToggleShowTrainpath)) { menuControl.MenuToggleShowTrainpath(); } if (TVUserInput.IsPressed(TVUserCommands.ToggleShowPatFile)) { menuControl.MenuToggleShowPatFile(); } if (TVUserInput.IsPressed(TVUserCommands.ToggleHighlightTracks)) { menuControl.MenuToggleHighlightTracks(); } if (TVUserInput.IsPressed(TVUserCommands.ToggleHighlightItems)) { menuControl.MenuToggleHighlightItems(); } if (TVUserInput.IsPressed(TVUserCommands.Debug)) { runDebug(); } base.Update(gameTime); }
public void Awake () { pathEditor = (PathEditor)target; }