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();
                }
            }
            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();
                }
            }
Exemple #3
0
 protected void Load(SaveableData data)
 {
     base.Load(data);
     SelectedStartType = Game.StartType.Values.GetByIdOrDefault(data.StartType) ?? Game.StartType.Pit;
 }