private void CountdownSelector_Load(object sender, EventArgs e) { EditorMainPage page = Globals.MainWindow.GetPage <EditorMainPage>("pages:editormain"); int index = page.CampaignGamemode.SelectedIndex; bool adventure_mode = GameModeId.GetIdFromIndex(index) == GameModeId.ConversionTable["Adventure"]; if (!adventure_mode) { if (MessageDialog.Show("The campaign must use the adventure game mode to use the countdown settings!\n\nDo you want to set the campaign mode to adventure?", "Error", Buttons.YesNo) == Result.Yes) { page.CampaignGamemode.SelectedIndex = GameModeId.GetIndexFromId(GameModeId.ConversionTable["Adventure"]); } else { Close(Result.Cancel); } } }
public Campaign UpdateWorkingstate(bool overwrite_date = true) { Campaign campaign = Editor.current_campaign; long build = Editor.current_campaign.build; campaign.build = overwrite_date ? DateTime.UtcNow.ToFileTime() : build; campaign.name = CampaignName.Text; campaign.description = CampaignDescription.Text; campaign.logopath = CampaignLogo.Text; campaign.authors = CampaignAuthors.Text; campaign.lockmode = CampaignUnlockStyle.SelectedIndex; campaign.gamemode = GameModeId.GetIdFromIndex(CampaignGamemode.SelectedIndex); campaign.sprint_playlist = SprintPlaylist.Checked; campaign.use_earlyaccess_levelintro = OldIntro.Checked; campaign.levels = new List <Level>(); Levels.Items.Cast <Level>().ToList().ForEach((level) => campaign.levels.Add(level)); campaign.addons = new List <Addon>(); Addons.Items.Cast <Addon>().ToList().ForEach((addon) => campaign.addons.Add(addon)); return(Editor.current_campaign = campaign); }