public override void Unload()
        {
            DiscordRPCInfo.Terminate();
            Main.logoTexture              = storedLogo;
            Main.logo2Texture             = storedLogo2;
            Main.soundMenuTick            = tick;
            Main.soundMenuClose           = close;
            Main.soundMenuOpen            = open;
            Main.logoTexture              = storedLogo;
            IL.Terraria.Main.UpdateAudio -= ChangeMenuMusic;
            customTitleMusicSlot          = 6;
            var evt = titleMusicStopped;

            if (evt != null)
            {
                evt.Set();
            }

            titleMusicStopped = null;
            // Wtf...
            Main.versionNumber = "v1.3.5.3";
            SpookyTerrariaUtils.ReturnTexturesToDefaults();

            /*for (int texIteration = 0; texIteration < _texturesDisposable.Length - 1; texIteration++)
             * {
             *  if (_texturesDisposable[texIteration] != null)
             *  {
             *      lock (_texturesDisposable[texIteration])
             *      {
             *          _texturesDisposable[texIteration] = null;
             *      }
             *  }
             * }*/
            Sprint = null;
        }
 private void Main_OnTick()
 {
     if (DiscordRPCInfo.rpcClient != null && !DiscordRPCInfo.rpcClient.IsDisposed)
     {
         DiscordRPCInfo.Update();
     }
 }
Ejemplo n.º 3
0
 public override void PostUpdate()
 {
     if (DiscordRPCInfo.rpcClient != null)
     {
         DiscordRPCInfo.Update();
     }
 }
        public override void Load()
        {
            Logger.Info(Environment.OSVersion.ToString());
            ContentInstance.Register(new UIHelper());
            ContentInstance.Register(new DiscordRPCInfo());
            DiscordRPCInfo.Load();
            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");
            Main.versionNumber  = $"Terraria {Main.versionNumber}\n{Name} v{Version}";

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

            Hooks.On_AddMenuButtons += Hooks_On_AddMenuButtons;
            Hooks.On_ModLoaderMenus += Hooks_On_ModLoaderMenus;
            if (!Main.dedServ)
            {
                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;
            Main.OnTick += Main_OnTick;
            On.Terraria.Main.DrawInterface_35_YouDied += nothing => { };

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

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

            if (!Main.dedServ)
            {
                // Shaders
                var 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();*/
        }