Esempio n. 1
0
        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);
                }
            }
        }
Esempio n. 2
0
        public void LoadCampaign(string path)
        {
            #region File loading
            FileInfo file = new FileInfo(path);
            if (!file.Exists)
            {
                throw new FileNotFoundException($"The file \"{path}\" does not exist!");
            }

            Config.AppendRecentFile(file.FullName);

            Serializer <Campaign> serializer = new Serializer <Campaign>(SerializerType.Json, path, true);
            Editor.current_campaign = serializer.Data;
            Editor.current_path     = file.DirectoryName;
            #endregion

            #region Filling the user interface with the data
            Levels.Items.Clear();
            Addons.Items.Clear();

            CampaignName.Text        = Editor.current_campaign.name;
            CampaignDescription.Text = Editor.current_campaign.description;
            CampaignLogo.Text        = Editor.current_campaign.logopath;
            CampaignAuthors.Text     = Editor.current_campaign.authors;
            SprintPlaylist.Checked   = Editor.current_campaign.sprint_playlist;
            OldIntro.Checked         = Editor.current_campaign.use_earlyaccess_levelintro;

            CampaignUnlockStyle.SelectedIndex = Editor.current_campaign.lockmode;
            CampaignGamemode.SelectedIndex    = GameModeId.GetIndexFromId(Editor.current_campaign.gamemode);

            Editor.current_campaign.levels.ForEach((level) => Levels.Items.Add(level));
            Editor.current_campaign.addons.ForEach((addon) => Addons.Items.Add(addon));

            UpdateOverviewList();
            #endregion

            Levels.SelectedIndex = -1;
            Addons.SelectedIndex = -1;
            Levels_SelectedIndexChanged(Levels, EventArgs.Empty);
            Addons_SelectedIndexChanged(Levels, EventArgs.Empty);
        }
Esempio n. 3
0
        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);
        }