Advertisement
Guest User

Untitled

a guest
May 24th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. using upsector.Tiles;
  2. using Microsoft.Xna.Framework;
  3. using Microsoft.Xna.Framework.Graphics;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.IO;
  7. using Terraria;
  8. using Terraria.GameContent.Dyes;
  9. using Terraria.GameContent.UI;
  10. using Terraria.Graphics.Effects;
  11. using Terraria.Graphics.Shaders;
  12. using Terraria.ID;
  13. using Terraria.Localization;
  14. using Terraria.ModLoader;
  15. using Terraria.UI;
  16.  
  17. namespace upsector.UI
  18. {
  19. class atomicDestabilizerUI
  20. {
  21. public override void OnInitialize()
  22. {
  23.  
  24. }
  25. internal abstract class VisibilityUI : UIState
  26. {
  27. public bool Visible;
  28.  
  29. public virtual void ToggleUI(UserInterface theInterface, UIState uiStateInstance = null)
  30. {
  31. uiStateInstance = uiStateInstance ?? this;
  32.  
  33. // If new state toggled but old visibility state present, that one needs to be toggled first
  34. if (theInterface.CurrentState is VisibilityUI ui
  35. && theInterface.CurrentState != uiStateInstance)
  36. {
  37. ui.ToggleUI(theInterface, ui);
  38. }
  39.  
  40. // Toggle the state
  41. Visible = !Visible;
  42. theInterface.ResetLasts();
  43. theInterface.SetState(Visible ? uiStateInstance : null);
  44.  
  45. Main.PlaySound(SoundID.MenuOpen);
  46. }
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement