public void AddToLayout(DMIWindow window, Point position) { window.Position = position; window.Parent = ActiveWindow; ActiveWindow = window; Windows.Add(window); }
public DriverMachineInterface(float height, float width, MSTSLocomotive locomotive, Viewer viewer, CabViewControl control) { if (control is CVCScreen) { CurrentDMIMode = DMIMode.FullSize; if ((control as CVCScreen).CustomParameters.TryGetValue("mode", out string mode)) { if (mode == "planningarea") { CurrentDMIMode = DMIMode.PlanningArea; } else if (mode == "speedarea") { CurrentDMIMode = DMIMode.SpeedArea; } } } else { CurrentDMIMode = DMIMode.GaugeOnly; } switch (CurrentDMIMode) { case DMIMode.GaugeOnly: Width = 280; Height = 300; break; case DMIMode.FullSize: Width = 640; Height = 480; break; case DMIMode.PlanningArea: case DMIMode.SpeedArea: Width = 334; Height = 480; break; } Viewer = viewer; Locomotive = locomotive; Scale = Math.Min(width / Width, height / Height); if (Scale < 0.5) { MipMapScale = 2; } else { MipMapScale = 1; } Shader = new DriverMachineInterfaceShader(Viewer.GraphicsDevice); ETCSDefaultWindow = new ETCSDefaultWindow(this, control); ETCSDefaultWindow.Visible = true; AddToLayout(ETCSDefaultWindow, Point.Zero); ActiveWindow = ETCSDefaultWindow; }
public void ExitWindow(DMIWindow window) { var windows = new List <DMIWindow>(Windows); windows.Remove(window); Windows = windows; if (window.Parent == null) { ActiveWindow = ETCSDefaultWindow; } else { ActiveWindow = window.Parent; } }
public DriverMachineInterface(float height, float width, MSTSLocomotive locomotive, Viewer viewer, CabViewControl control) { Viewer = viewer; Locomotive = locomotive; Scale = Math.Min(width / Width, height / Height); if (Scale < 0.5) { MipMapScale = 2; } else { MipMapScale = 1; } GaugeOnly = control is CVCDigital; Shader = new DriverMachineInterfaceShader(Viewer.GraphicsDevice); ETCSDefaultWindow = new ETCSDefaultWindow(this, control); ETCSDefaultWindow.Visible = true; AddToLayout(ETCSDefaultWindow, Point.Zero); ActiveWindow = ETCSDefaultWindow; }