示例#1
0
 internal static void AddBossBarStyle(ModBossBarStyle bossBarStyle)
 {
     lock (bossBarStyles) {
         bossBarStyles.Add(bossBarStyle);
         ModTypeLookup <ModBossBarStyle> .Register(bossBarStyle);
     }
 }
示例#2
0
 internal static void Add(ModMenu modMenu)
 {
     lock (menus) {
         menus.Add(modMenu);
         ModTypeLookup <ModMenu> .Register(modMenu);
     }
 }
示例#3
0
        internal static void Unload()
        {
            ContentInstance.Clear();
            ModTypeLookup.Clear();
            ItemLoader.Unload();
            EquipLoader.Unload();
            ModPrefix.Unload();
            ModDust.Unload();
            TileLoader.Unload();
            ModTileEntity.UnloadAll();
            WallLoader.Unload();
            ProjectileLoader.Unload();
            NPCLoader.Unload();
            NPCHeadLoader.Unload();
            PlayerHooks.Unload();
            BuffLoader.Unload();
            MountLoader.Unload();
            RarityLoader.Unload();
            DamageClassLoader.Unload();
            ModGore.Unload();
            SoundLoader.Unload();
            DisposeMusic();
            BackgroundTextureLoader.Unload();
            UgBgStyleLoader.Unload();
            SurfaceBgStyleLoader.Unload();
            GlobalBgStyleLoader.Unload();
            WaterStyleLoader.Unload();
            WaterfallStyleLoader.Unload();
            WorldHooks.Unload();
            ResizeArrays(true);
            for (int k = 0; k < Recipe.maxRecipes; k++)
            {
                Main.recipe[k] = new Recipe();
            }
            Recipe.numRecipes = 0;
            RecipeGroupHelper.ResetRecipeGroups();
            Recipe.SetupRecipes();
            MapLoader.UnloadModMap();
            ItemSorting.SetupWhiteLists();
            HotKeyLoader.Unload();
            RecipeHooks.Unload();
            CommandManager.Unload();
            TagSerializer.Reload();
            ModNet.Unload();
            Config.ConfigManager.Unload();
            CustomCurrencyManager.Initialize();
            EffectsTracker.RemoveModEffects();

            // ItemID.Search = IdDictionary.Create<ItemID, short>();
            // NPCID.Search = IdDictionary.Create<NPCID, short>();
            // ProjectileID.Search = IdDictionary.Create<ProjectileID, short>();
            // TileID.Search = IdDictionary.Create<TileID, ushort>();
            // WallID.Search = IdDictionary.Create<WallID, ushort>();
            // BuffID.Search = IdDictionary.Create<BuffID, int>();

            ContentSamples.Initialize();

            CleanupModReferences();
        }
示例#4
0
        protected override void Register()
        {
            InfoName = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.InfoDisplayName.{Name}");

            ModTypeLookup <InfoDisplay> .Register(this);

            Type = InfoDisplayLoader.Add(this);
        }
示例#5
0
        protected override sealed void Register()
        {
            Type = (ushort)WallLoader.ReserveWallID();

            ModTypeLookup <ModWall> .Register(this);

            WallLoader.walls.Add(this);
        }
示例#6
0
        protected sealed override void Register()
        {
            Type = WaterfallStyleLoader.ReserveStyle();

            ModTypeLookup <ModWaterfallStyle> .Register(this);

            WaterfallStyleLoader.waterfallStyles.Add(this);
        }
示例#7
0
        protected override sealed void Register()
        {
            Slot = UgBgStyleLoader.ReserveBackgroundSlot();

            ModTypeLookup <ModUgBgStyle> .Register(this);

            UgBgStyleLoader.ugBgStyles.Add(this);
        }
示例#8
0
        protected override sealed void Register()
        {
            Slot = SurfaceBgStyleLoader.ReserveBackgroundSlot();

            ModTypeLookup <ModSurfaceBgStyle> .Register(this);

            SurfaceBgStyleLoader.surfaceBgStyles.Add(this);
        }
示例#9
0
        protected sealed override void Register()
        {
            ModTypeLookup <ModTile> .Register(this);

            Type = (ushort)TileLoader.ReserveTileID();

            TileLoader.tiles.Add(this);
        }
        protected override void Register()
        {
            index = DamageClassLoader.Add(this);

            ClassName = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.DamageClassName.{Name}");

            ModTypeLookup <DamageClass> .Register(this);
        }
示例#11
0
        protected sealed override void Register()
        {
            if (Mount.mounts == null || Mount.mounts.Length == MountID.Count)
            {
                Mount.Initialize();
            }

            Type = MountLoader.ReserveMountID();

            ModTypeLookup <ModMount> .Register(this);

            MountLoader.mountDatas[Type] = this;

            foreach (MountTextureType textureType in Enum.GetValues(typeof(MountTextureType)))
            {
                string extraTexture = GetExtraTexture(textureType);

                if (string.IsNullOrEmpty(extraTexture) || !ModContent.TryGetTexture(extraTexture, out var textureAsset))
                {
                    continue;
                }

                switch (textureType)
                {
                case MountTextureType.Back:
                    MountData.backTexture = textureAsset;
                    break;

                case MountTextureType.BackGlow:
                    MountData.backTextureGlow = textureAsset;
                    break;

                case MountTextureType.BackExtra:
                    MountData.backTextureExtra = textureAsset;
                    break;

                case MountTextureType.BackExtraGlow:
                    MountData.backTextureExtraGlow = textureAsset;
                    break;

                case MountTextureType.Front:
                    MountData.frontTexture = textureAsset;
                    break;

                case MountTextureType.FrontGlow:
                    MountData.frontTextureGlow = textureAsset;
                    break;

                case MountTextureType.FrontExtra:
                    MountData.frontTextureExtra = textureAsset;
                    break;

                case MountTextureType.FrontExtraGlow:
                    MountData.frontTextureExtraGlow = textureAsset;
                    break;
                }
            }
        }
示例#12
0
        protected override sealed void Register()
        {
            Type = ModDust.ReserveDustID();

            ModTypeLookup <ModDust> .Register(this);

            ModDust.dusts.Add(this);
            Texture2D = !string.IsNullOrEmpty(Texture) ? ModContent.GetTexture(Texture).Value : TextureAssets.Dust.Value;
        }
示例#13
0
        protected sealed override void Register()
        {
            ModTypeLookup <ModProjectile> .Register(this);

            projectile.type = ProjectileLoader.ReserveProjectileID();
            DisplayName     = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.ProjectileName.{Name}");

            ProjectileLoader.projectiles.Add(this);
        }
示例#14
0
        protected sealed override void Register()
        {
            NPCLoader.VerifyGlobalNPC(this);

            ModTypeLookup <GlobalNPC> .Register(this);

            index = NPCLoader.globalNPCs.Count;

            NPCLoader.globalNPCs.Add(this);
        }
示例#15
0
        protected sealed override void Register()
        {
            ContainerName = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.Containers.{Name}", true);

            ModTypeLookup <ModTile> .Register(this);

            Type = (ushort)TileLoader.ReserveTileID();

            TileLoader.tiles.Add(this);
        }
示例#16
0
        protected sealed override void Register()
        {
            ItemLoader.VerifyGlobalItem(this);

            ModTypeLookup <GlobalItem> .Register(this);

            index = (ushort)ItemLoader.globalItems.Count;

            ItemLoader.globalItems.Add(this);
        }
示例#17
0
        protected sealed override void Register()
        {
            ProjectileLoader.VerifyGlobalProjectile(this);

            ModTypeLookup <GlobalProjectile> .Register(this);

            index = ProjectileLoader.globalProjectiles.Count;

            ProjectileLoader.globalProjectiles.Add(this);
        }
示例#18
0
        protected override sealed void Register()
        {
            ModTypeLookup <ModBuff> .Register(this);

            Type        = BuffLoader.ReserveBuffID();
            DisplayName = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.BuffName.{Name}");
            Description = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.BuffDescription.{Name}");

            BuffLoader.buffs.Add(this);
        }
示例#19
0
        protected sealed override void Register()
        {
            ModTypeLookup <ModPrefix> .Register(this);

            DisplayName = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.Prefix.{Name}");
            Type        = ModPrefix.ReservePrefixID();

            ModPrefix.prefixes.Add(this);
            ModPrefix.categoryPrefixes[Category].Add(this);
        }
示例#20
0
        internal static void RegisterDefaultClasses()
        {
            int i = 0;

            foreach (var damageClass in DamageClasses)
            {
                damageClass.Type = i++;
                ContentInstance.Register(damageClass);
                ModTypeLookup <DamageClass> .Register(damageClass);
            }
        }
示例#21
0
        internal static void RegisterDefaultDisplays()
        {
            int i = 0;

            foreach (var infoDisplay in InfoDisplays)
            {
                infoDisplay.Type = i++;
                ContentInstance.Register(infoDisplay);
                ModTypeLookup <InfoDisplay> .Register(infoDisplay);
            }
        }
示例#22
0
        public virtual void Load(Mod mod)
        {
            Mod = mod;

            if (!Mod.loading)
            {
                throw new Exception("AddTileEntity can only be called from Mod.Load or Mod.Autoload");
            }

            manager.Register(this);
            ModTypeLookup <ModTileEntity> .Register(this);
        }
示例#23
0
        internal static void AddBossBar(ModBossBar bossBar)
        {
            bossBar.index = bossBars.Count;
            bossBars.Add(bossBar);
            ModTypeLookup <ModBossBar> .Register(bossBar);

            //Texture is optional
            if (ModContent.TextureExists(bossBar.Texture))
            {
                bossBarTextures[bossBar.index] = ModContent.GetTexture(bossBar.Texture);
            }
        }
示例#24
0
        public virtual void Load(Mod mod)
        {
            Mod = mod;

            if (!Mod.loading)
            {
                throw new Exception("AddTileEntity can only be called from Mod.Load or Mod.Autoload");
            }

            //TODO: TileENtityLoader??
            int id = ReserveTileEntityID();

            Type = id;
            type = (byte)id;

            ModTypeLookup <ModTileEntity> .Register(this);

            tileEntities.Add(this);
        }
示例#25
0
        protected sealed override void Register()
        {
            ModTypeLookup <ModNPC> .Register(this);

            npc.type    = NPCLoader.ReserveNPCID();
            DisplayName = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.NPCName.{Name}");

            NPCLoader.npcs.Add(this);

            Type type         = GetType();
            var  autoloadHead = type.GetAttribute <AutoloadHead>();

            if (autoloadHead != null)
            {
                Mod.AddNPCHeadTexture(npc.type, HeadTexture);
            }
            var autoloadBossHead = type.GetAttribute <AutoloadBossHead>();

            if (autoloadBossHead != null)
            {
                Mod.AddBossHeadTexture(BossHeadTexture, npc.type);
            }
        }
示例#26
0
        protected sealed override void Register()
        {
            ModTypeLookup <ModWorld> .Register(this);

            WorldHooks.Add(this);
        }
示例#27
0
        protected sealed override void Register()
        {
            ModTypeLookup <GlobalTile> .Register(this);

            TileLoader.globalTiles.Add(this);
        }
示例#28
0
        protected override sealed void Register()
        {
            ModTypeLookup <GlobalBgStyle> .Register(this);

            GlobalBgStyleLoader.globalBgStyles.Add(this);
        }
        protected sealed override void Register()
        {
            ModTypeLookup <ModPlayer> .Register(this);

            PlayerHooks.Add(this);
        }
示例#30
0
        protected sealed override void Register()
        {
            ModTypeLookup <GlobalWall> .Register(this);

            WallLoader.globalWalls.Add(this);
        }