public ViewModel(bool initialize = true)
            {
                Saveable = new SaveHelper <SaveableData>("__QuickDrive_Hotlap", () => new SaveableData {
                    Penalties         = Penalties,
                    GhostCar          = GhostCar,
                    GhostCarAdvantage = GhostCarAdvantage
                }, o => {
                    Penalties         = o.Penalties;
                    GhostCar          = o.GhostCar;
                    GhostCarAdvantage = o.GhostCarAdvantage;
                }, () => {
                    Penalties         = true;
                    GhostCar          = true;
                    GhostCarAdvantage = 0.0;
                });

                if (initialize)
                {
                    Saveable.Initialize();
                }
                else
                {
                    Saveable.Reset();
                }
            }
            public ViewModel(bool initialize = true) {
                Saveable = new SaveHelper<SaveableData>("__QuickDrive_TimeAttack", () => new SaveableData {
                    Penalties = Penalties,
                }, o => {
                    Penalties = o.Penalties;
                }, () => {
                    Penalties = true;
                });

                if (initialize) {
                    Saveable.Initialize();
                } else {
                    Saveable.Reset();
                }
            }
Esempio n. 3
0
            public ViewModel(bool initialize = true) {
                Saveable = new SaveHelper<SaveableData>("__QuickDrive_Drift", () => new SaveableData {
                    Penalties = Penalties,
                    StartType = SelectedStartType.Value
                }, o => {
                    Penalties = o.Penalties;
                    SelectedStartType = Game.StartType.Values.FirstOrDefault(x => x.Value == o.StartType) ?? Game.StartType.Pit;
                }, () => {
                    Penalties = true;
                    SelectedStartType = Game.StartType.Pit;
                });

                if (initialize) {
                    Saveable.Initialize();
                } else {
                    Saveable.Reset();
                }
            }
Esempio n. 4
0
            public ViewModel(bool initialize = true)
            {
                Saveable = new SaveHelper <SaveableData>("__QuickDrive_TimeAttack", () => new SaveableData {
                    Penalties = Penalties,
                }, o => {
                    Penalties = o.Penalties;
                }, () => {
                    Penalties = true;
                });

                if (initialize)
                {
                    Saveable.Initialize();
                }
                else
                {
                    Saveable.Reset();
                }
            }
Esempio n. 5
0
            public ViewModel(bool initialize = true) {
                Saveable = new SaveHelper<SaveableData>("__QuickDrive_Hotlap", () => new SaveableData {
                    Penalties = Penalties,
                    GhostCar = GhostCar,
                    GhostCarAdvantage = GhostCarAdvantage
                }, o => {
                    Penalties = o.Penalties;
                    GhostCar = o.GhostCar;
                    GhostCarAdvantage = o.GhostCarAdvantage;
                }, () => {
                    Penalties = true;
                    GhostCar = true;
                    GhostCarAdvantage = 0.0;
                });

                if (initialize) {
                    Saveable.Initialize();
                } else {
                    Saveable.Reset();
                }
            }
            public ViewModel(bool initialize = true)
            {
                Saveable = new SaveHelper <SaveableData>("__QuickDrive_Practice", () => new SaveableData {
                    Penalties = Penalties,
                    StartType = SelectedStartType.Value
                }, o => {
                    Penalties         = o.Penalties;
                    SelectedStartType = Game.StartType.Values.FirstOrDefault(x => x.Value == o.StartType) ?? Game.StartType.Pit;
                }, () => {
                    Penalties         = true;
                    SelectedStartType = Game.StartType.Pit;
                });

                if (initialize)
                {
                    Saveable.Initialize();
                }
                else
                {
                    Saveable.Reset();
                }
            }
            public ViewModel(TrackObjectBase track, TrackOutlineRenderer renderer)
            {
                Track    = track;
                Renderer = renderer;

                var layouts = track.MainTrackObject.MultiLayouts?.ApartFrom(track).ToList();

                Layouts = layouts?.Count < 1 ? null : layouts;
                Renderer.SetActiveMaps(new string[0]);

                _perLayoutSave = new SaveHelper <PerLayoutSaveable>(".TrackOutlineRendererTools:l:" + track.IdWithLayout, () => new PerLayoutSaveable {
                    ExtraLayoutIds = ExtraLayoutIds,
                }, Load, storage: CacheStorage.Storage);

                _perTrackSave = new SaveHelper <PerTrackSaveable>(".TrackOutlineRendererTools:" + track.Id, () => new PerTrackSaveable {
                    Rotation   = Renderer.Rotation,
                    Scale      = Renderer.Scale,
                    OffsetX    = Renderer.OffsetX,
                    OffsetY    = Renderer.OffsetY,
                    ExtraWidth = Renderer.ExtraWidth,
                    UseAiLanes = Renderer.UseAiLanes,
                }, Load, storage: CacheStorage.Storage);

                _globalSaveable = new SaveHelper <GlobalSaveable>(".TrackOutlineRendererTools", () => new GlobalSaveable {
                    ShadowOpacity        = Renderer.ShadowOpacity,
                    ShadowDistance       = Renderer.ShadowDistance,
                    DimmedOpacity        = Renderer.DimmedOpacity,
                    DimmedWidthMultipler = Renderer.DimmedWidthMultipler,
                }, Load, storage: ValuesStorage.Storage);

                _perLayoutSave.Initialize();
                _perTrackSave.Initialize();
                _globalSaveable.Initialize();

                Renderer.PropertyChanged += OnRendererPropertyChanged;
            }