コード例 #1
0
        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;
        }
コード例 #2
0
        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;
        }