Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
GamepadMainMenuHandler.cs
Go to the documentation of this file.
1using System;
5
7
9{
10 public static int LastMainMenu = -1;
11
13
14 public static int LastDrew = -1;
15
16 public static bool CanRun = false;
17
18 public static bool MoveCursorOnNextRun = false;
19
20 public static void Update()
21 {
22 if (!CanRun)
23 {
25 uILinkPage.CurrentPoint = uILinkPage.DefaultPoint;
26 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;
28 }
29 else
30 {
31 if (!Main.gameMenu || Main.MenuUI.IsVisible || LastDrew != Main.menuMode)
32 {
33 return;
34 }
37 switch (Main.menuMode)
38 {
39 case 17:
40 case 18:
41 case 19:
42 case 21:
43 case 22:
44 case 23:
45 case 24:
46 case 26:
47 if (MenuItemPositions.Count >= 4)
48 {
50 MenuItemPositions.RemoveAt(3);
51 if (Main.menuMode == 17)
52 {
53 MenuItemPositions.Insert(0, item);
54 }
55 }
56 break;
57 case 28:
58 if (MenuItemPositions.Count >= 3)
59 {
60 MenuItemPositions.RemoveAt(1);
61 }
62 break;
63 }
66 {
67 uILinkPage2.CurrentPoint = uILinkPage2.DefaultPoint;
68 }
69 for (int i = 0; i < MenuItemPositions.Count; i++)
70 {
71 Vector2 position = MenuItemPositions[i] * Main.UIScale;
73 {
74 Main.mouseX = (PlayerInput.MouseX = (int)position.X);
75 Main.mouseY = (PlayerInput.MouseY = (int)position.Y);
76 Main.menuFocus = -1;
77 }
78 UILinkPoint uILinkPoint = uILinkPage2.LinkMap[2000 + i];
79 uILinkPoint.Position = position;
80 if (i == 0)
81 {
82 uILinkPoint.Up = -1;
83 }
84 else
85 {
86 uILinkPoint.Up = 2000 + i - 1;
87 }
88 uILinkPoint.Left = -3;
89 uILinkPoint.Right = -4;
90 if (i == MenuItemPositions.Count - 1)
91 {
92 uILinkPoint.Down = -2;
93 }
94 else
95 {
96 uILinkPoint.Down = 2000 + i + 1;
97 }
99 {
100 MoveCursorOnNextRun = false;
102 }
103 }
104 MenuItemPositions.Clear();
105 }
106 }
107}
static double Cos(double d)
static double Sin(double a)
const double PI
Definition Math.cs:16
static bool InvisibleCursorForGamepad
Definition Main.cs:267
static UserInterface MenuUI
Definition Main.cs:381
static float UIScale
Definition Main.cs:2624
static int screenHeight
Definition Main.cs:1721
static int screenWidth
Definition Main.cs:1719
static int menuMode
Definition Main.cs:2379
static bool gameMenu
Definition Main.cs:1926
static float GlobalTimeWrappedHourly
Definition Main.cs:405
static void SetPosition(int ID, Vector2 Position)
static Dictionary< int, UILinkPage > Pages