示例#1
0
        /// <summary>
        ///   <para>Initializes a new instance of the <see cref="CustomScrollingMenu"/> class with the specified <paramref name="menu"/> and <paramref name="unlocks"/> list.</para>
        /// </summary>
        /// <param name="menu">The <see cref="ScrollingMenu"/> instance.</param>
        /// <param name="unlocks">The list of unlocks displayed in the menu.</param>
        public CustomScrollingMenu(ScrollingMenu menu, List <DisplayedUnlock> unlocks)
            : base(unlocks)
        {
            Menu = menu;
            string type = menu.menuType;

            Type = type == "Challenges" ? UnlocksMenuType.MutatorMenu
                                : type == "Floors" ? UnlocksMenuType.FloorsMenu
                                : type == "Traits" ? UnlocksMenuType.NewLevelTraits
                                : type == "Items" ? UnlocksMenuType.RewardsMenu
                                : type == "FreeItems" ? UnlocksMenuType.ItemTeleporter
#pragma warning disable CS0618 // Type or member is obsolete
                                : type == "CharacterSelect" ? UnlocksMenuType.CharacterSelect
#pragma warning restore CS0618 // Type or member is obsolete
                                : type == "Loadouts" ? UnlocksMenuType.Loadouts
                                : type == "TraitUnlocks" ? UnlocksMenuType.TraitsMenu
                                : type == "Rewards" ? UnlocksMenuType.TwitchRewards
                                : type == "LevelFeelings" ? UnlocksMenuType.TwitchDisasters
                                : type == "UpgradeTrait" ? UnlocksMenuType.AB_UpgradeTrait
                                : type == "RemoveTrait" ? UnlocksMenuType.AB_RemoveTrait
                                : type == "ChangeTraitRandom" ? UnlocksMenuType.AB_SwapTrait
                                : type == "RewardConfigs" ? UnlocksMenuType.RewardConfigs
                                : type == "TraitConfigs" ? UnlocksMenuType.TraitConfigs
                                : type == "MutatorConfigs" ? UnlocksMenuType.MutatorConfigs
                                : UnlocksMenuType.Unknown;
            if (Type == UnlocksMenuType.Unknown)
            {
                RogueFramework.LogWarning($"Unknown ScrollingMenu type: \"{type}\"!");
            }
        }
示例#2
0
        /// <summary>
        ///   <para>Adds the specified <typeparamref name="TEffect"/> type to the factory.</para>
        /// </summary>
        /// <typeparam name="TEffect">The <see cref="CustomEffect"/> type to add.</typeparam>
        /// <returns>The added effect's metadata.</returns>
        public EffectInfo AddEffect <TEffect>() where TEffect : CustomEffect, new()
        {
            EffectInfo info = EffectInfo.Get <TEffect>();

            if (RogueFramework.IsDebugEnabled(DebugFlags.Effects))
            {
                RogueFramework.LogDebug($"Created custom effect {typeof(TEffect)} ({info.Name}).");
            }
            effectsDict.Add(info.Name, new EffectEntry {
                Initializer = () => new TEffect(), EffectInfo = info
            });
            return(info);
        }