Пример #1
0
 public void LoadData()
 {
     { // Driver options
         CMSN.DriverOptionsSection driverOpts = (CMSN.DriverOptionsSection)MissionData.GetSection(CMSN.BaseSection.SectionType.DriverOptions);
         if (driverOpts != null)
         {
             DriverAmount = driverOpts.DriverAmount;
             for (uint i = 0; i < DriverAmount; i++)
             {
                 for (uint j = 0; j < 4; j++)
                 {
                     SetPartsSelection(i, j, driverOpts.DriverChoices[i][j]);
                 }
             }
         }
     }
     { // Mission Flags
         CMSN.MissionFlagsSection  missionFlags = (CMSN.MissionFlagsSection)MissionData.GetSection(CMSN.BaseSection.SectionType.MissionFlags);
         CTGP7CourseList.NameEntry nameEntry    = TranslateTable.NameEntryFromID(missionFlags.CourseID);
         if (nameEntry == null)
         {
             nameEntry = TranslateTable.NameEntryFromID(0);
         }
         if (nameEntry == null)
         {
             throw new InvalidOperationException("CTGP-7 course name data needs to be downloaded.");
         }
         courseSelector.SelectedCourseNameEntry = nameEntry;
         ccComboBox.SelectedIndex  = missionFlags.Class;
         cpuComboBox.SelectedIndex = missionFlags.CPUDifficulty - 1;
     }
     { // Item Options
         CMSN.ItemOptionsSection itemOptions = (CMSN.ItemOptionsSection)MissionData.GetSection(CMSN.BaseSection.SectionType.ItemOptions);
         itemsModeBox.SelectedIndex = (int)itemOptions.Mode;
         spawnBoxCheck.Checked      = itemOptions.SpawnItemBoxes;
         { // Player Config
             probabilityPlayerViewer.PopulateData(GetProbabilityTableRows(itemOptions.PlayerConfig.ConfigMode, true), ItemNames, itemOptions.PlayerConfig.Probabilities);
             modePlayerBox.SelectedIndex = (int)itemOptions.PlayerConfig.ConfigMode;
             giveItemPlayerCheck.Checked = itemOptions.PlayerConfig.GiveItemEach.Frames != 0;
             if (giveItemPlayerCheck.Checked)
             {
                 giveAfterPlayerNum.Value = (decimal)itemOptions.PlayerConfig.GiveItemOffset.TotalSeconds;
                 giveEachPlayerNum.Value  = (decimal)itemOptions.PlayerConfig.GiveItemEach.TotalSeconds;
                 giveIDPlayerNum.Value    = itemOptions.PlayerConfig.GiveItemID;
             }
             roulettePlayerCheck.Checked = itemOptions.PlayerConfig.RouletteSpeed.Frames != 0;
             if (roulettePlayerCheck.Checked)
             {
                 roulettePlayerNum.Value = (decimal)itemOptions.PlayerConfig.RouletteSpeed.TotalSeconds;
             }
         }
         { // CPU Config
             probabilityCPUViewer.PopulateData(GetProbabilityTableRows(itemOptions.CPUConfig.ConfigMode, false), ItemNames, itemOptions.CPUConfig.Probabilities);
             modeCPUBox.SelectedIndex = (int)itemOptions.CPUConfig.ConfigMode;
             giveItemCPUCheck.Checked = itemOptions.CPUConfig.GiveItemEach.Frames != 0;
             if (giveItemCPUCheck.Checked)
             {
                 giveAfterCPUNum.Value = (decimal)itemOptions.CPUConfig.GiveItemOffset.TotalSeconds;
                 giveEachCPUNum.Value  = (decimal)itemOptions.CPUConfig.GiveItemEach.TotalSeconds;
                 giveIDCPUNum.Value    = itemOptions.CPUConfig.GiveItemID;
             }
             rouletteCPUCheck.Checked = itemOptions.CPUConfig.RouletteSpeed.Frames != 0;
             if (rouletteCPUCheck.Checked)
             {
                 rouletteCPUNum.Value = (decimal)itemOptions.CPUConfig.RouletteSpeed.TotalSeconds;
             }
         }
     }
 }