コード例 #1
0
ファイル: Showroom.cs プロジェクト: windygu/actools
        public static void Start(ShowroomProperties properties)
        {
            if (_busy)
            {
                return;
            }
            _busy = true;

            try {
                var filename             = AcPaths.GetCfgShowroomFilename();
                var originalShowroomFile = File.ReadAllText(filename);

                var iniFile = IniFile.Parse(originalShowroomFile);
                iniFile["SHOWROOM"].Set("CAR", (properties.CarId ?? "").ToLowerInvariant());
                iniFile["SHOWROOM"].Set("SKIN", (properties.CarSkinId ?? "").ToLowerInvariant());
                iniFile["SHOWROOM"].Set("TRACK", (properties.ShowroomId ?? "").ToLowerInvariant());
                iniFile["SETTINGS"].Set("CAMERA_FOV", properties.CameraFov);
                iniFile.Save(filename);

                using (properties.UseBmp ? new ScreenshotFormatChange(properties.AcRoot, "BMP") : null)
                    using (properties.DisableWatermark ? new DisableShowroomWatermarkChange(properties.AcRoot) : null)
                        using (properties.DisableSweetFx ? new DisableSweetFxChange(properties.AcRoot) : null)
                            using (properties.Filter != null ? new VideoIniChange(properties.VideoPresetFilename, properties.Filter) : null) {
                                var process = Process.Start(new ProcessStartInfo {
                                    WorkingDirectory = properties.AcRoot,
                                    FileName         = "acShowroom.exe"
                                });

                                process?.WaitForExit();
                            }
            } finally {
                _busy = false;
            }
        }
コード例 #2
0
        public DistanceChange(double value)
        {
            _cfgFile = AcPaths.GetCfgShowroomFilename();
            var iniFile = new IniFile(_cfgFile);

            _originalValue = iniFile["SETTINGS"].GetPossiblyEmpty("CAMERA_DISTANCE");
            iniFile["SETTINGS"].Set("CAMERA_DISTANCE", value);
            iniFile.Save();
        }
コード例 #3
0
ファイル: Showroom.cs プロジェクト: windygu/actools
        private static void PrepareIni(string carId, string carSkinId, string showroomId)
        {
            var filename = AcPaths.GetCfgShowroomFilename();
            var iniFile  = new IniFile(filename);

            iniFile["SHOWROOM"].Set("CAR", (carId ?? "").ToLowerInvariant());
            iniFile["SHOWROOM"].Set("SKIN", (carSkinId ?? "").ToLowerInvariant());
            iniFile["SHOWROOM"].Set("TRACK", (showroomId ?? "").ToLowerInvariant());
            iniFile.Save();
        }
コード例 #4
0
            public override void Dispose()
            {
                base.Dispose();

                if (_process != null && !_process.HasExitedSafe())
                {
                    _process.Kill();
                    _process = null;
                }

                if (_originalShowroomFile != null)
                {
                    File.WriteAllText(AcPaths.GetCfgShowroomFilename(), _originalShowroomFile);
                }
            }
コード例 #5
0
            public void SetCamera(string cameraPosition, string cameraLookAt, double cameraFov, double cameraExposure)
            {
                var iniFilename = AcPaths.GetCfgShowroomFilename();

                _originalShowroomFile = File.ReadAllText(iniFilename);

                new IniFile {
                    ["SHOWROOM"] =
                    {
                        ["ALLOW_SELECT_SKIN"] = true,
                        ["SELECTED_SKIN"]     = 1,
                        ["CAR_ID"]            = 0
                    },
                    ["FADES"] =
                    {
                        ["ENTER_EXIT_MS"] = 0
                    },
                    ["PREVIEW_MODE"] =
                    {
                        ["LOOK_AT"] = cameraLookAt,
                        ["CUSTOM_CAMERA_POSITION"] = cameraPosition,
                        ["USE_CUSTOM_CAMERA"]      = true,
                        ["CUSTOM_CAMERA_ROLL"]     = 0.0,
                        ["CUSTOM_CAMERA_EXPOSURE"] = cameraExposure
                    },
                    ["ANIMATION"] =
                    {
                        ["MUL"] = 0.15
                    },
                    ["SETTINGS"] =
                    {
                        ["ROTATION_SPEED"]  = 0.0,
                        ["CAMERA_DISTANCE"] = 6.0,
                        ["CAMERA_HEIGHT"]   = 1.5,
                        ["CAMERA_FOV"]      = cameraFov,
                        ["CAMERA_EXPOSURE"] = 30.0,
                        ["SUN_ANGLE"]       = -50.0,
                        ["SHADOW_SPLIT0"]   = 2.0,
                        ["SHADOW_SPLIT1"]   = 12.0,
                        ["SHADOW_SPLIT2"]   = 50.0,
                        ["NEAR_PLANE"]      = 0.01,
                        ["FAR_PLANE"]       = 200,
                        ["MIN_EXPOSURE"]    = 0.2,
                        ["MAX_EXPOSURE"]    = 10000
                    }
                }.Save(iniFilename);
            }