private void Main_DrawMenu(On.Terraria.Main.orig_DrawMenu orig, Main self, GameTime gameTime) { AmbienceHandler.StopAllAmbientSounds(); MenuHelper.DrawSlenderMenuUI505(); MenuHelper.DrawChangeLogs(); if (volRaisedNotifTimer >= 0) { ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontDeathText, "Volume Adjusted Automatically.", new Vector2(Main.screenWidth / 2, Main.screenHeight - 10), Color.Gray * volRaisedNotifTimer, 0f, Main.fontDeathText.MeasureString("Volume Adjusted Automatically.") / 2, new Vector2(0.3f, 0.3f)); } if (Main.menuMode == SlenderMenuModeID.SlenderExtras) { MenuHelper.DrawSocials(); } volRaisedNotifTimer--; orig(self, gameTime); }
public override void PostUpdateMiscEffects() { if (Main.worldName == SpookyTerrariaUtils.slenderWorldName) { Main.bgStyle = (int)SpookyTerrariaUtils.BGStyleID.DefaultForest; player.ZoneJungle = false; player.ZoneDungeon = false; player.ZoneCorrupt = false; player.ZoneCrimson = false; player.ZoneHoly = false; player.ZoneSnow = false; player.ZoneUndergroundDesert = false; player.ZoneGlowshroom = false; player.ZoneMeteor = false; player.ZoneBeach = false; player.ZoneDesert = false; } AmbienceHandler.Play(); AmbienceHandler.HandleSoundInstancing(); }
private void Main_DrawMenu(On.Terraria.Main.orig_DrawMenu orig, Main self, GameTime gameTime) { ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontDeathText, $"{DiscordInfo.userName}", new Vector2(Main.screenWidth / 2, Main.screenHeight - 8), Color.LightGray, 0f, Main.fontDeathText.MeasureString("Added a world to your worlds!") / 2, new Vector2(0.275f, 0.275f)); UIHelper.ClickHandling(); if (Main.menuMode == MenuModeID.HowToPlay) { MenuHelper.DrawHTP(); } fileAddedNoticeTimer--; if (fileAddedNoticeTimer >= 0) { ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontDeathText, "Added a world to your worlds!", new Vector2(Main.screenWidth / 2, Main.screenHeight - 8), Color.LightGray, 0f, Main.fontDeathText.MeasureString("Added a world to your worlds!") / 2, new Vector2(0.275f, 0.275f)); } // UIHelper.CreateSimpleUIButton(Main.fontDeathText, new Vector2(300, 100), $"{Environment.OSVersion.Platform} {Environment.OSVersion.Version}", null, ref scaleTimer_BasedOnSineWave); if (Main.menuMode == 0) { ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontDeathText, $"Authenticated as: {SteamUser.GetSteamID().GetAccountID()} ({SteamFriends.GetPersonaName()})", new Vector2(6, 6), Color.LightGray, 0f, Vector2.Zero, new Vector2(0.275f, 0.275f)); } MenuHelper.DrawUserStatistics(); AmbienceHandler.StopAllAmbientSounds(); MenuHelper.DrawSlenderMenuUI(); MenuHelper.DrawChangeLogs(); if (volRaisedNotifTimer >= 0) { ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontDeathText, "Volume Adjusted Automatically.", new Vector2(Main.screenWidth / 2, Main.screenHeight - 10), Color.Gray * volRaisedNotifTimer, 0f, Main.fontDeathText.MeasureString("Volume Adjusted Automatically.") / 2, new Vector2(0.3f, 0.3f)); } if (Main.menuMode == MenuModeID.SlenderExtras) { MenuHelper.DrawSocials(); } volRaisedNotifTimer--; SpookyTerrariaUtils.HandleKeyboardInputs(); SpookyTerrariaUtils.oldKeyboardState = SpookyTerrariaUtils.newKeyboardState; UIHelper.MSOld = UIHelper.MSNew; orig(self, gameTime); }
private void Main_DrawPlayers(On.Terraria.Main.orig_DrawPlayers orig, Main self) { orig(self); Mod mod = this; var player = Main.player[Main.myPlayer]; if (player.dead) { Main.hideUI = true; fadeScale = 0f; } if (!Main.hasFocus) { timerToLightStatic = 0; timerToMediumStatic = 0; timerToSevereStatic = 0; } for (var ll = 0; ll < Main.maxNPCs; ll++) { var npc = Main.npc[ll]; var distance = npc.Distance(Main.player[Main.myPlayer].Center); if (npc.active && distance <= 1000f) { if (npc.type == ModContent.NPCType <Slenderman>()) { var noLight = Lighting.GetSubLight(npc.Top).X < 0.05f; if (Main.GameUpdateCount % 3 == 0) { staticFrame.Y += 650; } if (staticFrame.Y >= 1950) { staticFrame.Y = 0; } var facingTowardsSlendermanLeft = npc.Center.X < player.Center.X && player.direction == -1; var facingTowardsSlendermanRight = npc.Center.X > player.Center.X && player.direction == 1; Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); Main.spriteBatch.Draw(mod.GetTexture("Assets/Static"), new Vector2(Main.screenWidth / 2, Main.screenHeight / 2), staticFrame, Color.White * fadeScale, 0f, new Vector2(Main.screenWidth / 2, Main.screenHeight / 2), 5f, SpriteEffects.None, 1f); Main.spriteBatch.End(); if (facingTowardsSlendermanLeft || facingTowardsSlendermanRight && !noLight) { if (fadeScale > 0f && fadeScale < 0.4f) { timerToMediumStatic = 0; timerToSevereStatic = 0; timerToLightStatic++; if (Main.hasFocus) { AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticMedium"); AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticSevere"); } if (timerToLightStatic == 2) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticLight")); } if (timerToLightStatic >= 480) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticLight")); timerToLightStatic = 0; } } if (fadeScale >= 0.4 && fadeScale < 0.8f) { timerToLightStatic = 0; timerToSevereStatic = 0; timerToMediumStatic++; if (Main.hasFocus) { AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticLight"); AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticSevere"); } if (timerToMediumStatic == 2) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticMedium")); } if (timerToMediumStatic >= 480) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticMedium")); timerToMediumStatic = 0; } } if (fadeScale >= 0.8f) { timerToMediumStatic = 0; timerToLightStatic = 0; timerToSevereStatic++; if (Main.hasFocus) { AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticLight"); AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticMedium"); } if (timerToSevereStatic == 2) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticSevere")); } if (timerToSevereStatic >= 132) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Slender/StaticSevere")); timerToSevereStatic = 0; } } // MAJOR TODO: MAKE STATIC if (!Collision.SolidCollision(npc.position, npc.width, 20) && distance <= 1000 && Collision.CanHitLine(player.Top, player.width, 10, npc.Top, npc.width, 20)) { if (!noLight) { if (Main.GameUpdateCount % 3 == 0) { fadeScale += 0.005f; } } else { if (Main.GameUpdateCount % 10 == 0) { fadeScale += 0.005f; } } } } else if (!facingTowardsSlendermanLeft && !facingTowardsSlendermanRight) { timerToLightStatic = 0; timerToMediumStatic = 0; timerToSevereStatic = 0; if (!noLight) { if (Main.GameUpdateCount % 3 == 0) { fadeScale -= 0.005f; } } else { if (Main.GameUpdateCount % 10 == 0) { fadeScale -= 0.005f; } } } else if (distance > 1000f) { if (Main.GameUpdateCount % 3 == 0) { fadeScale -= 0.005f; } } if (fadeScale > 1f) { fadeScale = 1f; } if (fadeScale < 0f) { fadeScale = 0f; } if (fadeScale >= 1f) { player.KillMe( PlayerDeathReason.ByCustomReason( $"{player.name} stared at death for too long."), player.statLife + 50, 0); } if (fadeScale == 0f) { if (Main.hasFocus) { AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticMedium"); AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticLight"); AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticSevere"); } } } if (npc.type == ModContent.NPCType <Slenderman>() && !npc.active) { AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticMedium"); AmbienceHandler.StopAmbientSound("Sounds/Custom/Slender/StaticLight"); timerToLightStatic = 0; timerToMediumStatic = 0; timerToSevereStatic = 0; fadeScale -= 0.005f; } } // Main.NewText($"L: {timerToLightStatic} | M: {timerToMediumStatic} | S: {timerToSevereStatic}"); } }