/// <summary>
        /// This is where we inject our custom characters into the new game screen.
        /// </summary>
        public override void PopulatePages()
        {
            this._playerClasses.Clear();
            this._playerStages.Clear();
            this._pages.ClearPages();

            var selections = Data.GetPlayerSelectionsAvailable().ToList();

            selections.AddRange(ContentManagerHook.AdditionalCharacters());

            foreach (ICharacterClass playerClass in selections)
            {
                PlayerStage playerStage = new PlayerStage();
                playerStage.CharacterClass = playerClass;
                playerStage.IsAvailable    = this.IsAvailable(playerClass);
                this._playerClasses.Add(playerClass);
                this._playerStages.Add(playerStage);
                this._pages.AddPage(playerClass.DisplayName, (Page)playerStage, (object)playerClass);
            }
            this.SelectedPlayer = Enumerable.FirstOrDefault <ICharacterClass>((IEnumerable <ICharacterClass>) this._playerClasses, (Func <ICharacterClass, bool>)(x => this.IsAvailable(x)));
            this.ForceResize();
        }
Exemple #2
0
        /// <summary>
        /// This is where we inject our custom characters into the load screen.
        /// </summary>
        public override void OpenLoadDialog()
        {
            OptionsDialog optionsDialog = new OptionsDialog();

            var selections = Data.GetPlayerSelectionsAvailable().ToList();

            selections.AddRange(ContentManagerHook.AdditionalCharacters());

            foreach (ICharacterClass playerClass in selections)
            {
                if (Game1.Instance.SaveGameExists(playerClass))
                {
                    string fileName = Game1.GetSaveGameFileName(playerClass);
                    optionsDialog.AddOption(playerClass.DisplayName, (System.Action)(() => this.Context.GameMessages.Post(Names.GameMessages.LoadGame, (object)fileName)));
                }
                else
                {
                    var btn = optionsDialog.AddOption("Empty", (System.Action)null);
                    btn.Enabled = false;
                }
            }
            optionsDialog.AutoOpen();
        }