public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers) { int MouseTextIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (MouseTextIndex != -1) { layers.Insert(MouseTextIndex, new LegacyGameInterfaceLayer( "AlchemistNPC: Shop Selector", delegate { if (ShopChangeUI.visible) { alchemistUI.Draw(Main.spriteBatch); } return(true); }, InterfaceScaleType.UI) ); } int MouseTextIndexA = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (MouseTextIndexA != -1) { layers.Insert(MouseTextIndexA, new LegacyGameInterfaceLayer( "AlchemistNPC: Shop Selector A", delegate { if (ShopChangeUIA.visible) { alchemistUIA.Draw(Main.spriteBatch); } return(true); }, InterfaceScaleType.UI) ); } int MouseTextIndexO = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (MouseTextIndexO != -1) { layers.Insert(MouseTextIndexO, new LegacyGameInterfaceLayer( "AlchemistNPC: Shop Selector O", delegate { if (ShopChangeUIO.visible) { alchemistUIO.Draw(Main.spriteBatch); } return(true); }, InterfaceScaleType.UI) ); } int MouseTextIndexM = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (MouseTextIndexM != -1) { layers.Insert(MouseTextIndexM, new LegacyGameInterfaceLayer( "AlchemistNPC: Shop Selector M", delegate { if (ShopChangeUIM.visible) { alchemistUIM.Draw(Main.spriteBatch); } return(true); }, InterfaceScaleType.UI) ); } }
public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers) { int MouseTextIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (MouseTextIndex != -1) { layers.Insert(MouseTextIndex, new LegacyGameInterfaceLayer( "AlchemistNPC: Shop Selector", delegate { if (ShopChangeUI.visible) { alchemistUI.Draw(Main.spriteBatch); } return(true); }, InterfaceScaleType.UI) ); } int MouseTextIndexA = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (MouseTextIndexA != -1) { layers.Insert(MouseTextIndexA, new LegacyGameInterfaceLayer( "AlchemistNPC: Shop Selector A", delegate { if (ShopChangeUIA.visible) { alchemistUIA.Draw(Main.spriteBatch); } return(true); }, InterfaceScaleType.UI) ); } int MouseTextIndexO = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (MouseTextIndexO != -1) { layers.Insert(MouseTextIndexO, new LegacyGameInterfaceLayer( "AlchemistNPC: Shop Selector O", delegate { if (ShopChangeUIO.visible) { alchemistUIO.Draw(Main.spriteBatch); } return(true); }, InterfaceScaleType.UI) ); } int MouseTextIndexM = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (MouseTextIndexM != -1) { layers.Insert(MouseTextIndexM, new LegacyGameInterfaceLayer( "AlchemistNPC: Shop Selector M", delegate { if (ShopChangeUIM.visible) { alchemistUIM.Draw(Main.spriteBatch); } return(true); }, InterfaceScaleType.UI) ); } int LocatorArrowIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (LocatorArrowIndex != -1) { layers.Insert(LocatorArrowIndex, new LegacyGameInterfaceLayer( "AlchemistNPC: Locator Arrow", delegate { Player player = Main.LocalPlayer; if (player.accCritterGuide && AlchemistNPCLite.modConfiguration.LifeformAnalyzer) { for (int v = 0; v < 200; ++v) { NPC npc = Main.npc[v]; if (npc.active && npc.rarity >= 1 && !AlchemistNPCLite.modConfiguration.DisabledLocatorNpcs.Contains(new NPCDefinition(npc.type))) { // Adapted from Census mod Vector2 playerCenter = Main.LocalPlayer.Center + new Vector2(0, Main.LocalPlayer.gfxOffY); var vector = npc.Center - playerCenter; var distance = vector.Length(); if (distance > 40 && distance <= AlchemistNPCLite.modConfiguration.LocatorRange) { var offset = Vector2.Normalize(vector) * Math.Min(70, distance - 20); float rotation = vector.ToRotation() + (float)(Math.PI / 2); var drawPosition = playerCenter - Main.screenPosition + offset; float fade = Math.Min(1f, (distance - 20) / 70); Main.spriteBatch.Draw(ModContent.Request <Texture2D>("AlchemistNPCLite/Projectiles/LocatorProjectile").Value, drawPosition, null, Color.White * fade, rotation, TextureAssets.Cursors[1].Size() / 2, Vector2.One, SpriteEffects.None, 0); } } } } return(true); }, InterfaceScaleType.Game) ); } }