Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UIWorldLoad.cs
Go to the documentation of this file.
1using System;
7using Terraria.UI;
10
12
13public class UIWorldLoad : UIState
14{
16
18
20
21 public UIWorldLoad()
22 {
23 _progressBar.Top.Pixels = 270f;
24 _progressBar.HAlign = 0.5f;
25 _progressBar.VAlign = 0f;
28 _progressMessage.Top.Pixels -= 70f;
32 }
33
34 public override void OnActivate()
35 {
37 {
38 UILinkPointNavigator.Points[3000].Unlink();
40 }
41 }
42
43 public override void Update(GameTime gameTime)
44 {
45 _progressBar.Top.Pixels = MathHelper.Lerp(270f, 370f, Utils.GetLerpValue(600f, 700f, Main.screenHeight, clamped: true));
46 _progressMessage.Top.Pixels = _progressBar.Top.Pixels - 70f;
49 base.Update(gameTime);
50 }
51
52 public override void Draw(SpriteBatch spriteBatch)
53 {
55 if (_progress != null)
56 {
57 base.Draw(spriteBatch);
58 }
59 }
60
61 protected override void DrawSelf(SpriteBatch spriteBatch)
62 {
63 float overallProgress = 0f;
64 float currentProgress = 0f;
65 string text = string.Empty;
66 if (_progress != null)
67 {
68 overallProgress = (float)_progress.TotalProgress;
69 currentProgress = (float)_progress.Value;
71 }
72 _progressBar.SetProgress(overallProgress, currentProgress);
73 _progressMessage.Text = text;
75 {
76 _progressMessage.Text = string.Concat(Main.rand.Next(999999999));
77 for (int i = 0; i < 3; i++)
78 {
79 if (Main.rand.Next(2) == 0)
80 {
81 _progressMessage.Text += Main.rand.Next(999999999);
82 }
83 }
84 }
86 {
88 {
89 string text2 = "";
90 for (int num = _progressMessage.Text.Length - 1; num >= 0; num--)
91 {
92 text2 += _progressMessage.Text.Substring(num, 1);
93 }
94 _progressMessage.Text = text2;
95 }
96 }
97 else if (WorldGen.notTheBees)
98 {
99 _progressMessage.Text = Language.GetTextValue("UI.WorldGenEasterEgg_GeneratingBees");
100 }
101 Main.gameTips.Update();
102 Main.gameTips.Draw();
104 }
105
107 {
108 Vector2 vector = new Vector2((float)Math.Cos(Main.GlobalTimeWrappedHourly * ((float)Math.PI * 2f)), (float)Math.Sin(Main.GlobalTimeWrappedHourly * ((float)Math.PI * 2f) * 2f)) * new Vector2(30f, 15f) + Vector2.UnitY * 20f;
109 UILinkPointNavigator.Points[3000].Unlink();
111 }
112
113 public string GetStatusText()
114 {
115 if (_progress == null)
116 {
117 return $"{0:0.0%} - ... - {0:0.0%}";
118 }
119 return string.Format("{0:0.0%} - " + _progress.Message + " - {1:0.0%}", _progress.TotalProgress, _progress.Value);
120 }
121}
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static double Cos(double d)
static double Sin(double a)
const double PI
Definition Math.cs:16
void SetProgress(float overallProgress, float currentProgress)
override void Draw(SpriteBatch spriteBatch)
override void DrawSelf(SpriteBatch spriteBatch)
override void Update(GameTime gameTime)
static string GetTextValue(string key)
Definition Language.cs:15
static GameTipsDisplay gameTips
Definition Main.cs:2343
static int screenHeight
Definition Main.cs:1721
static UnifiedRandom rand
Definition Main.cs:1387
static int screenWidth
Definition Main.cs:1719
static float GlobalTimeWrappedHourly
Definition Main.cs:405
static Dictionary< int, UILinkPoint > Points
static void SetPosition(int ID, Vector2 Position)
void Append(UIElement element)
Definition UIElement.cs:166
virtual void Recalculate()
Definition UIElement.cs:281
void CopyStyle(UIElement element)
Definition UIElement.cs:392
static float GetLerpValue(float from, float to, float t, bool clamped=false)
Definition Utils.cs:203
static GenerationProgress CurrentGenerationProgress
static bool noTrapsWorldGen
Definition WorldGen.cs:1152
static bool placingTraps
Definition WorldGen.cs:1168
static bool drunkWorldGenText
Definition WorldGen.cs:1166
static bool notTheBees
Definition WorldGen.cs:1164
static bool getGoodWorldGen
Definition WorldGen.cs:1156