Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
IssueReportsIndicator.cs
Go to the documentation of this file.
5using Terraria.ID;
7
9
11{
12 private float _displayUpPercent;
13
14 private bool _shouldBeShowing;
15
17
19
26
27 public void Hide()
28 {
29 _shouldBeShowing = false;
31 }
32
33 private void OpenUI()
34 {
35 Setup();
37 }
38
39 private void Setup()
40 {
41 _buttonTexture = Main.Assets.Request<Texture2D>("Images/UI/Workshop/IssueButton", (AssetRequestMode)1);
42 _buttonOutlineTexture = Main.Assets.Request<Texture2D>("Images/UI/Workshop/IssueButton_Outline", (AssetRequestMode)1);
43 }
44
45 public void Draw(SpriteBatch spriteBatch)
46 {
47 bool shouldBeShowing = _shouldBeShowing;
48 _displayUpPercent = MathHelper.Clamp(_displayUpPercent + (float)shouldBeShowing.ToDirectionInt(), 0f, 1f);
49 if (_displayUpPercent == 0f)
50 {
51 return;
52 }
54 Vector2 vector = Main.ScreenSize.ToVector2() + new Vector2(40f, -80f);
55 Vector2 value2 = vector + new Vector2(-80f, 0f);
56 Vector2 vector2 = Vector2.Lerp(vector, value2, _displayUpPercent);
57 Rectangle rectangle = value.Frame();
58 Vector2 origin = rectangle.Size() / 2f;
59 bool flag = false;
60 if (Utils.CenteredRectangle(vector2, rectangle.Size()).Contains(Main.MouseScreen.ToPoint()))
61 {
62 flag = true;
63 string textValue = Language.GetTextValue("UI.IssueReporterHasThingsToShow");
64 Main.instance.MouseText(textValue, 0, 0);
65 if (Main.mouseLeft)
66 {
67 OpenUI();
68 Hide();
69 return;
70 }
71 }
72 float scale = 1f;
73 spriteBatch.Draw(value, vector2, rectangle, Color.White, 0f, origin, scale, SpriteEffects.None, 0f);
74 if (flag)
75 {
77 Rectangle rectangle2 = value3.Frame();
78 spriteBatch.Draw(value3, vector2, rectangle2, Color.White, 0f, rectangle2.Size() / 2f, scale, SpriteEffects.None, 0f);
79 }
80 }
81}
void Draw(Texture2D texture, Vector2 position, Color color)
static float Clamp(float value, float min, float max)
Definition MathHelper.cs:46
static void PlaySound(int type, Vector2 position, int style=1)
static readonly LegacySoundStyle DD2_ExplosiveTrapExplode
Definition SoundID.cs:790
static string GetTextValue(string key)
Definition Language.cs:15
static Main instance
Definition Main.cs:283
static Vector2 MouseScreen
Definition Main.cs:2773
static void OpenReportsMenu()
Definition Main.cs:49242
static Microsoft.Xna.Framework.Point ScreenSize
Definition Main.cs:2925
static IAssetRepository Assets
Definition Main.cs:209
static bool mouseLeft
Definition Main.cs:614
static Rectangle CenteredRectangle(Vector2 center, Vector2 size)
Definition Utils.cs:604
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:227