Exemplo n.º 1
0
 public SaveFile()
 {
     Header         = new FileHeader();
     SaveDataHeader = new SaveDataHeader();
     SaveData       = new WhatIfSaveData();
     NameTable      = new NameTable();
 }
Exemplo n.º 2
0
 public SaveFile()
 {
     Header = new FileHeader();
     SaveDataHeader = new SaveDataHeader();
     SaveData = new WhatIfSaveData();
     NameTable = new NameTable();
 }
Exemplo n.º 3
0
        private WhatIfSaveData FillSaveData()
        {
            var now = DateTime.Now;
            var today = new TimeSpan(now.Hour, now.Minute, now.Second);

            var saveData = new WhatIfSaveData
            {
                SaveId = GetNullableFromTextBox(tbSaveId),
                SaveFileName = GetNullableFromTextBox(tbSaveFileName),
                SaveDetails = GetNullableFromTextBox(tbSaveDetails),
                FriendlyName = GetNullableFromTextBox(tbFriendlyName),
                SaveTime = new DNESaveTime
                {
                    Year = now.Year,
                    Month = now.Month,
                    Day = now.Day,
                    SecondsSinceMidnight = (int) today.TotalSeconds
                },
                Status = EOnlineSaveStatus.EOSS_Writing,
                bIsOwned = GetNullableFromCheckbox(cbIsOwned),
                SlotNumber = (int) nudSlotNumber.Value,

                CheckPointID = GetNullableFromComboBox(cbCheckPointID),
                CheckpointLocation = new Vector
                {
                    X = float.Parse(tbCheckpointLocationX.Text, CultureInfo.InvariantCulture),
                    Y = float.Parse(tbCheckpointLocationY.Text, CultureInfo.InvariantCulture),
                    Z = float.Parse(tbCheckpointLocationZ.Text, CultureInfo.InvariantCulture)
                },
                CheckpointRotation = new Rotator
                {
                    Pitch = int.Parse(tbCheckpointRotationPitch.Text),
                    Yaw = int.Parse(tbCheckpointRotationYaw.Text),
                    Roll = int.Parse(tbCheckpointRotationRoll.Text)
                },
                CurrentEpisode = (int) nudCurrentEpisode.Value,
                bStartNewGame = GetNullableFromCheckbox(cbStartNewGame),
                bGameStarted = GetNullableFromCheckbox(cbGameStarted),
                bNeedToSwitchToNextEpisode = GetNullableFromCheckbox(cbNeedToSwitchToNextEpisode),
                LastSubLevelPlayedIndex = (int) nudLastSubLevelPlayedIndex.Value,
                AlreadySeenLastDiaryPages = new[]
                {
                    (int) nudAlreadySeenLastDiaryPages0.Value,
                    (int) nudAlreadySeenLastDiaryPages1.Value,
                    (int) nudAlreadySeenLastDiaryPages2.Value,
                    (int) nudAlreadySeenLastDiaryPages3.Value,
                    (int) nudAlreadySeenLastDiaryPages4.Value,
                    (int) nudAlreadySeenLastDiaryPages5.Value,
                },
                fTotalGameTimePauseExcluded = (float) nudTotalGameTimePauseExcluded.Value,
                NbEpisodeCompletedSum = (int) nudNbEpisodeCompletedSum.Value,
                NbInteractionDoneSum = (int) nudNbInteractionDoneSum.Value,
                NbChoiceMadeSum = (int) nudNbChoiceMadeSum.Value,
                NbPlaythrough = new[]
                {
                    cbNbPlaythrough0.Checked ? 1 : 0,
                    cbNbPlaythrough1.Checked ? 1 : 0,
                    cbNbPlaythrough2.Checked ? 1 : 0,
                    cbNbPlaythrough3.Checked ? 1 : 0,
                    cbNbPlaythrough4.Checked ? 1 : 0,
                },
                PercentageCompleted = new[]
                {
                    (float) nudPercentageCompleted0.Value,
                    (float) nudPercentageCompleted1.Value,
                    (float) nudPercentageCompleted2.Value,
                    (float) nudPercentageCompleted3.Value,
                    (float) nudPercentageCompleted4.Value,
                },

                CheckpointReached = SaveFile.SaveData.CheckpointReached,

                AlreadySeenCollectibles = dgvAlreadySeenCollectibles.Rows.OfType<DataGridViewRow>()
                    .DropLast()
                    .Select(r => new NameProperty
                    {
                        Name = r.Cells[0].Value.ToString()
                    }).ToList(),

                AlreadySeenCharacters = SaveFile.SaveData.AlreadySeenCharacters,

                CheckpointLevelRecords = dgvCheckpointLevelRecords.Rows.OfType<DataGridViewRow>()
                    .DropLast()
                    .Select(r => new LevelInfos
                    {
                        LevelName = new NameProperty {Name = r.Cells[0].Value.ToString()},
                        bShouldBeLoaded = (bool) r.Cells[1].Value,
                        bShouldBeVisible = (bool) r.Cells[2].Value,
                    }).ToList(),

                Achievements = SaveFile.SaveData.Achievements,
                VisibleLevels = dgvVisibleLevels.Rows.OfType<DataGridViewRow>()
                    .DropLast()
                    .Select(r => new NameProperty
                    {
                        Name = r.Cells[0].Value.ToString()
                    }).ToList(),

                PlayerProgress = new PlayerProgress
                {
                    CurrentObjectiveID = string.IsNullOrEmpty(tbCurrentObjectiveID.Text)
                        ? new NameProperty {Name = tbCurrentObjectiveID.Text}
                        : null,
                    CurrentDay = (int) nudCurrentDay.Value,
                    DiaryAlreadySeen = GetNullableFromCheckbox(cbDiaryAlreadySeen),
                    LastDiaryDaySeen = (int) nudLastDiaryDaySeen.Value,
                    LastDiaryPageSeen = (int) nudLastDiaryPageSeen.Value,
                    MaxReachedContextName = new[]
                    {
                        GetNullableFromTextBox(tbMaxReachedContextName0),
                        GetNullableFromTextBox(tbMaxReachedContextName1),
                        GetNullableFromTextBox(tbMaxReachedContextName2),
                        GetNullableFromTextBox(tbMaxReachedContextName3),
                        GetNullableFromTextBox(tbMaxReachedContextName4)
                    },
                    fEpisodePlayTimePauseExcluded = new[]
                    {
                        (float) nudEpisodePlayTimePauseExcluded0.Value,
                        (float) nudEpisodePlayTimePauseExcluded1.Value,
                        (float) nudEpisodePlayTimePauseExcluded2.Value,
                        (float) nudEpisodePlayTimePauseExcluded3.Value,
                        (float) nudEpisodePlayTimePauseExcluded4.Value,
                    },
                    fEpisodePlayTimePauseIncluded = new[]
                    {
                        (float) nudEpisodePlayTimePauseIncluded0.Value,
                        (float) nudEpisodePlayTimePauseIncluded1.Value,
                        (float) nudEpisodePlayTimePauseIncluded2.Value,
                        (float) nudEpisodePlayTimePauseIncluded3.Value,
                        (float) nudEpisodePlayTimePauseIncluded4.Value,
                    },

                    ActiveFacts = dgvActiveFacts.Rows.OfType<DataGridViewRow>()
                        .DropLast()
                        .Select(r => new ActiveFactLevel
                        {
                            FactName = new NameProperty {Name = r.Cells[2].Value.ToString()},
                            FactLevel = int.Parse(r.Cells[3].Value.ToString())
                        }).ToList(),

                    ActiveTutorials = dgvActiveTutorials.Rows.OfType<DataGridViewRow>()
                        .DropLast()
                        .Select(r => int.Parse(r.Cells[0].Value.ToString())).ToList(),

                    FileSelects = dgvFileSelects.Rows.OfType<DataGridViewRow>()
                        .DropLast()
                        .Select(r => new FileSelect
                        {
                            ObjectName = new NameProperty {Name = r.Cells[0].Value.ToString()},
                            TextureKey = r.Cells[1].Value.ToString(),
                            Pages = r.Cells[2].Value.ToString().Split(';').Select(int.Parse).ToList()
                        }).ToList(),

                    InventoryObjects = dgvInventoryObjects.Rows.OfType<DataGridViewRow>()
                        .DropLast()
                        .Select(r => new ObjectInInventory
                        {
                            ObjectName = new NameProperty {Name = r.Cells[0].Value.ToString()},
                            ObjectInstanceCount = int.Parse(r.Cells[1].Value.ToString())
                        }).ToList(),

                    CollectibleFoundFactNames = dgvCollectibleFoundFactNames.Rows.OfType<DataGridViewRow>()
                        .DropLast()
                        .Select(r => new NameProperty
                        {
                            Name = r.Cells[0].Value.ToString()
                        }).ToList(),

                    EpisodeBoundaryStats = SaveFile.SaveData.PlayerProgress.EpisodeBoundaryStats
                }
            };

            saveData.SLevelStartStates = dgvSubLevelStartStates.Rows.OfType<DataGridViewRow>()
                .Where(r => !r.IsNewRow)
                .Select(r => new SubLevelStartState
                {
                    SubLevelTitle = r.Cells["colSubLevelStartStatesSubLevelName"].Value.ToString(),
                    PlayerProgress = (PlayerProgress) r.Tag
                }).ToList();

            return saveData;
        }