コード例 #1
0
        public override void Load()
        {
            ContentInstance.Register(new UIHelper());
            blackPixel        = GetTexture("Assets/BlackPixel");
            slenderLogo       = GetTexture("Assets/Slender");
            chad              = GetTexture("Assets/THE_CHAD");
            storedLogo        = Main.logoTexture;
            storedLogo2       = Main.logo2Texture;
            Main.logoTexture  = GetTexture("Assets/Invisible");
            Main.logo2Texture = GetTexture("Assets/Invisible");

            MenuHelper.msgOfTheDay = ChooseRandomMessage(rand);
            rand  = Main.rand.Next(0, 20);
            tick  = Main.soundMenuTick;
            open  = Main.soundMenuOpen;
            close = Main.soundMenuClose;

            Main.soundMenuTick  = GetSound("Sounds/Custom/Other/Nothingness");
            Main.soundMenuOpen  = GetSound("Sounds/Custom/Other/Nothingness");
            Main.soundMenuClose = GetSound("Sounds/Custom/Other/Nothingness");
            Mod spooky = ModLoader.GetMod("SpookyTerraria");

            Main.versionNumber = $"Terraria {Main.versionNumber}\n{spooky.Name} v{spooky.Version}";

            Sprint = RegisterHotKey("Sprint", "LeftShift");

            Hooks.On_AddMenuButtons += Hooks_On_AddMenuButtons;
            Hooks.On_ModLoaderMenus += Hooks_On_ModLoaderMenus;;
            if (!Main.dedServ)
            {
                On.Terraria.Lang.GetRandomGameTitle += Lang_GetRandomGameTitle;
                Main.chTitle = true;
            }
            // MaxMenuItems = 16
            On.Terraria.Main.DrawInterface_30_Hotbar += Main_DrawInterface_30_Hotbar;
            On.Terraria.Main.DrawPlayers             += Main_DrawPlayers;
            On.Terraria.Main.DrawBG   += Main_DrawBG;
            On.Terraria.Main.DrawMenu += Main_DrawMenu;
            On.Terraria.Main.DrawInterface_35_YouDied += nothing => { };
            On.Terraria.Main.Draw += Main_Draw;

            On.Terraria.IngameOptions.DrawLeftSide += IngameOptions_DrawLeftSide;
            On.Terraria.IngameOptions.Draw         += IngameOptions_Draw;

            // IL.Terraria.Main.DrawMenu += MoveOptionUI;
            // Shader initialization

            if (!Main.dedServ)
            {
                // Shaders
                Ref <Effect> Darkness = new Ref <Effect>(GetEffect("Effects/Darkness"));
                Filters.Scene["Darkness"] = new Filter(new ScreenShaderData(Darkness, "Darkness"), EffectPriority.VeryHigh);
                // Skies
                Filters.Scene["SpookyTerraria:BlackSky"]       = new Filter(new ScreenShaderData("FilterTower").UseColor(0.0f, 0.0f, 0.0f).UseOpacity(0f), EffectPriority.Medium);
                SkyManager.Instance["SpookyTerraria:BlackSky"] = new BlackSky();
            }

            /*ContentInstance.Register(new AmbienceHelper());
             * ModContent.GetInstance<AmbienceHelper>().InitializeSoundInstances();*/
        }
コード例 #2
0
        void ILoadable.Load(Mod mod)
        {
            ContentInstance.Register(this);

            vanillaPlayerTextures        = PlayerTextures;
            vanillaPlayerHairTextures    = PlayerHairTextures;
            vanillaPlayerHairAltTextures = PlayerHairAltTextures;
        }
コード例 #3
0
        public static void Init()
        {
            ContentInstance.Register(new SoundChanges());
            var mod = ModContent.GetInstance <TerrariaAmbience>();

            var changes = Instance;
            var loader  = Ambience.Instance;

            #region SFX Changes

            changes.runSFX_Cashe = Main.soundRun;
            changes.drip_Cashe   = Main.soundDrip;
            changes.liquid_Cashe = Main.soundLiquid;

            changes.liquidInstance_Cashe = Main.soundInstanceLiquid;
            changes.dripInstance_Cashe   = Main.soundInstanceDrip;

            changes.splashCashe = Main.soundSplash;

            changes.zombieCashe = Main.soundZombie;


            // loader.splashCashe = Main.soundSplash;

            // Now change the sound (Main.soundX = y)

            // NOTE: drip.Len = 3 (0, 1 ,2) (3 different variants)
            // NOTE: liquid.Len = 2 (0, 1) (0 == Water | 1 == Lava)
            if (!Main.dedServ)
            {
                Main.soundRun = mod.GetSound("Sounds/Custom/nothingness");

                Main.soundDrip[0] = Ambience.Drip1;
                Main.soundDrip[1] = Ambience.Drip2;
                Main.soundDrip[2] = Ambience.Drip3;

                Main.soundLiquid[0] = Ambience.WaterStream;
                Main.soundLiquid[1] = Ambience.LavaStream;

                Main.soundInstanceDrip[0] = Ambience.Drip1Instance;
                Main.soundInstanceDrip[1] = Ambience.Drip2Instance;
                Main.soundInstanceDrip[2] = Ambience.Drip3Instance;

                Main.soundInstanceLiquid[0] = Ambience.WaterStreamInstance;
                Main.soundInstanceLiquid[1] = Ambience.LavaStreamInstance;

                Main.soundZombie[0] = mod.GetSound($"{Ambience.AmbientPath}/npcs/zombie1");
                Main.soundZombie[1] = mod.GetSound($"{Ambience.AmbientPath}/npcs/zombie2");
                Main.soundZombie[2] = mod.GetSound($"{Ambience.AmbientPath}/npcs/zombie3");
            }
            #endregion
        }
コード例 #4
0
        public void Import(LdstrFile file, IMod mod, CultureInfo culture)
        {
            ContentInstance.Register(Utils.GetModByName(mod.Name));
            var module = mod.Code.ManifestModule;

            var entryDict = file.LdstrEntries;

            foreach (var entryPair in entryDict)
            {
                var method = module.FindMethod(entryPair.Key);
                if (method == null)
                {
                    continue;
                }

                var e = entryPair.Value;

                if (!HaveTranslation(e))
                {
                    continue;
                }

                var modification = new ILContext.Manipulator(il =>
                {
                    foreach (var instruction in il.Instrs)
                    {
                        var ins = e.Instructions.FirstOrDefault(i => instruction.MatchLdstr(i.Origin));
                        if (ins == null || string.IsNullOrEmpty(ins.Translation))
                        {
                            continue;
                        }

                        instruction.Operand = ins.Translation;

                        foreach (var label in il.Labels)
                        {
                            if (label.Target.MatchLdstr(ins.Origin))
                            {
                                label.Target = instruction;
                            }
                        }
                    }
                });

                if (!modifications.ContainsKey(method))
                {
                    HookEndpointManager.Modify(method, modification);
                    modifications.Add(method, modification);
                }
            }
        }
コード例 #5
0
        ////////////////

        private ILoadable LoadLoadableSingleton(Type loadableClassType)
        {
            MethodInfo method        = typeof(ModContent).GetMethod("GetInstance");
            MethodInfo genericMethod = method.MakeGenericMethod(loadableClassType);
            object     rawInstance   = genericMethod?.Invoke(null, new object[] { });

            if (rawInstance != null)
            {
                return((ILoadable)rawInstance);
            }

            var loadable = (ILoadable)Activator.CreateInstance(loadableClassType, ReflectionHelpers.MostAccess);

            ContentInstance.Register(loadable);

            return(loadable);
        }
コード例 #6
0
        public override void Load()
        {
            ContentInstance.Register(new Ambience());
            string path = Path.Combine(ModLoader.ModPath, "Cache//ta_secretconfig.txt");

            string replacePath = Path.Combine(ModLoader.ModPath, "TASoundReplace");

            if (!Directory.Exists(replacePath))
            {
                Directory.CreateDirectory(replacePath);
            }
            File.WriteAllText(Path.Combine(replacePath, "README.txt"), "If you are replacing sounds, please read the index/key below for the sounds you might want to replace." +
                              "\nThese replacements will ONLY work if you put it in here word-for-word.\n"
                              + "\nforest_morning\nforest_day\nforest_evening\nforest_night\ndesert_crickets\nsnowfall_day\nsnowfall_night\njungle_day\njungle_night\ncorruption_roars"
                              + "\ncrimson_rumbles\nug_drip\nhell_rumble\nbeach_waves\nbreeze\nrain_new\n\nPlease, do note that these files must be in the WAVE format (.wav)!");

            if (File.Exists(path) && File.ReadAllLines(path)[0] != null)
            {
                string[] lines = File.ReadAllLines(path);

                Ambience.TAAmbient = float.Parse(lines[0]);
            }
            else
            {
                Ambience.TAAmbient = 100f;
            }
            if (File.Exists(path) && File.ReadAllLines(path)[1] != null)
            {
                string[] lines = File.ReadAllLines(path);

                Ambience.fStepsVol = float.Parse(lines[1]);
            }
            else
            {
                Ambience.fStepsVol = 100f;
            }

            Ambience.Initialize();
            On.Terraria.Main.DoUpdate += Main_DoUpdate;
            MethodDetours.DetourAll();

            Ambience.PlayAllAmbience();
            var aLoader = Ambience.Instance;

            aLoader.dayCricketsVolume     = 0f;
            aLoader.nightCricketsVolume   = 0f;
            aLoader.eveningCricketsVolume = 0f;
            aLoader.desertCricketsVolume  = 0f;
            aLoader.crackleVolume         = 0f;
            aLoader.ugAmbienceVolume      = 0f;
            aLoader.crimsonRumblesVolume  = 0f;
            aLoader.snowDayVolume         = 0f;
            aLoader.snowNightVolume       = 0f;
            aLoader.corruptionRoarsVolume = 0f;
            aLoader.dayJungleVolume       = 0f;
            aLoader.nightJungleVolume     = 0f;
            aLoader.beachWavesVolume      = 0f;
            aLoader.hellRumbleVolume      = 0f;
            aLoader.rainVolume            = 0f;
            aLoader.morningCricketsVolume = 0f;
            aLoader.breezeVolume          = 0f;
        }
コード例 #7
0
ファイル: Race.cs プロジェクト: Mr-Plauge/MrPlagueRaces
 protected override void Register()
 {
     RaceLoader.AddRace(this);
     ContentInstance.Register(this);
 }