Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AddWorldDifficultyOptions()

void Terraria.GameContent.UI.States.UIWorldCreation.AddWorldDifficultyOptions ( UIElement container,
float accumualtedHeight,
MouseEvent clickEvent,
string tagGroup,
float usableWidthPercent )
inlineprivate

Definition at line 331 of file UIWorldCreation.cs.

332 {
333 WorldDifficultyId[] array = new WorldDifficultyId[4]
334 {
335 WorldDifficultyId.Creative,
336 WorldDifficultyId.Normal,
337 WorldDifficultyId.Expert,
338 WorldDifficultyId.Master
339 };
341 {
342 Language.GetText("UI.Creative"),
343 Language.GetText("UI.Normal"),
344 Language.GetText("UI.Expert"),
345 Language.GetText("UI.Master")
346 };
348 {
349 Language.GetText("UI.WorldDescriptionCreative"),
350 Language.GetText("UI.WorldDescriptionNormal"),
351 Language.GetText("UI.WorldDescriptionExpert"),
352 Language.GetText("UI.WorldDescriptionMaster")
353 };
354 Color[] array4 = new Color[4]
355 {
356 Main.creativeModeColor,
357 Color.White,
358 Main.mcColor,
359 Main.hcColor
360 };
361 string[] array5 = new string[4] { "Images/UI/WorldCreation/IconDifficultyCreative", "Images/UI/WorldCreation/IconDifficultyNormal", "Images/UI/WorldCreation/IconDifficultyExpert", "Images/UI/WorldCreation/IconDifficultyMaster" };
363 for (int i = 0; i < array6.Length; i++)
364 {
366 groupOptionButton.Width = StyleDimension.FromPixelsAndPercent(-1 * (array6.Length - 1), 1f / (float)array6.Length * usableWidthPercent);
367 groupOptionButton.Left = StyleDimension.FromPercent(1f - usableWidthPercent);
368 groupOptionButton.HAlign = (float)i / (float)(array6.Length - 1);
370 groupOptionButton.OnLeftMouseDown += clickEvent;
371 groupOptionButton.OnMouseOver += ShowOptionDescription;
372 groupOptionButton.OnMouseOut += ClearOptionDescription;
373 groupOptionButton.SetSnapPoint(tagGroup, i);
374 container.Append(groupOptionButton);
376 }
378 }
void ClearOptionDescription(UIMouseEvent evt, UIElement listeningElement)
GroupOptionButton< WorldDifficultyId >[] _difficultyButtons
void ShowOptionDescription(UIMouseEvent evt, UIElement listeningElement)
static LocalizedText GetText(string key)
Definition Language.cs:10
void Append(UIElement element)
Definition UIElement.cs:166
static StyleDimension FromPercent(float percent)
static StyleDimension FromPixelsAndPercent(float pixels, float percent)

References Terraria.GameContent.UI.States.UIWorldCreation._difficultyButtons, Terraria.UI.UIElement.Append(), System.array, Terraria.GameContent.UI.States.UIWorldCreation.ClearOptionDescription(), Terraria.Main.creativeModeColor, Terraria.UI.StyleDimension.FromPercent(), Terraria.UI.StyleDimension.FromPixelsAndPercent(), Terraria.Localization.Language.GetText(), Terraria.Main.mcColor, Terraria.GameContent.UI.States.UIWorldCreation.ShowOptionDescription(), and Microsoft.Xna.Framework.Color.White.

Referenced by Terraria.GameContent.UI.States.UIWorldCreation.MakeInfoMenu().