Terraria 1.3.5.3 Source Code
This commit is contained in:
commit
4b21dac4b6
503 changed files with 409032 additions and 0 deletions
88
UI/Gamepad/GamepadMainMenuHandler.cs
Normal file
88
UI/Gamepad/GamepadMainMenuHandler.cs
Normal file
|
@ -0,0 +1,88 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.UI.Gamepad.GamepadMainMenuHandler
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.GameInput;
|
||||
|
||||
namespace Terraria.UI.Gamepad
|
||||
{
|
||||
public class GamepadMainMenuHandler
|
||||
{
|
||||
public static int LastMainMenu = -1;
|
||||
public static List<Vector2> MenuItemPositions = new List<Vector2>(20);
|
||||
public static int LastDrew = -1;
|
||||
public static bool CanRun = false;
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
if (!GamepadMainMenuHandler.CanRun)
|
||||
{
|
||||
UILinkPage page = UILinkPointNavigator.Pages[1000];
|
||||
page.CurrentPoint = page.DefaultPoint;
|
||||
Vector2 vector2 = new Vector2((float) Math.Cos((double) Main.GlobalTime * 6.28318548202515), (float) Math.Sin((double) Main.GlobalTime * 6.28318548202515 * 2.0)) * new Vector2(30f, 15f) + Vector2.UnitY * 20f;
|
||||
UILinkPointNavigator.SetPosition(2000, new Vector2((float) Main.screenWidth, (float) Main.screenHeight) / 2f + vector2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Main.gameMenu || Main.MenuUI.IsVisible || GamepadMainMenuHandler.LastDrew != Main.menuMode)
|
||||
return;
|
||||
int lastMainMenu = GamepadMainMenuHandler.LastMainMenu;
|
||||
GamepadMainMenuHandler.LastMainMenu = Main.menuMode;
|
||||
switch (Main.menuMode)
|
||||
{
|
||||
case 17:
|
||||
case 18:
|
||||
case 19:
|
||||
case 21:
|
||||
case 22:
|
||||
case 23:
|
||||
case 24:
|
||||
case 26:
|
||||
if (GamepadMainMenuHandler.MenuItemPositions.Count >= 4)
|
||||
{
|
||||
Vector2 menuItemPosition = GamepadMainMenuHandler.MenuItemPositions[3];
|
||||
GamepadMainMenuHandler.MenuItemPositions.RemoveAt(3);
|
||||
if (Main.menuMode == 17)
|
||||
{
|
||||
GamepadMainMenuHandler.MenuItemPositions.Insert(0, menuItemPosition);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 28:
|
||||
if (GamepadMainMenuHandler.MenuItemPositions.Count >= 3)
|
||||
{
|
||||
GamepadMainMenuHandler.MenuItemPositions.RemoveAt(1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
UILinkPage page = UILinkPointNavigator.Pages[1000];
|
||||
if (lastMainMenu != Main.menuMode)
|
||||
page.CurrentPoint = page.DefaultPoint;
|
||||
for (int index = 0; index < GamepadMainMenuHandler.MenuItemPositions.Count; ++index)
|
||||
{
|
||||
if (index == 0 && lastMainMenu != GamepadMainMenuHandler.LastMainMenu && PlayerInput.UsingGamepad && Main.InvisibleCursorForGamepad)
|
||||
{
|
||||
Main.mouseX = PlayerInput.MouseX = (int) GamepadMainMenuHandler.MenuItemPositions[index].X;
|
||||
Main.mouseY = PlayerInput.MouseY = (int) GamepadMainMenuHandler.MenuItemPositions[index].Y;
|
||||
Main.menuFocus = -1;
|
||||
}
|
||||
UILinkPoint link = page.LinkMap[2000 + index];
|
||||
link.Position = GamepadMainMenuHandler.MenuItemPositions[index];
|
||||
link.Up = index != 0 ? 2000 + index - 1 : -1;
|
||||
link.Left = -3;
|
||||
link.Right = -4;
|
||||
link.Down = index != GamepadMainMenuHandler.MenuItemPositions.Count - 1 ? 2000 + index + 1 : -2;
|
||||
}
|
||||
GamepadMainMenuHandler.MenuItemPositions.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
38
UI/Gamepad/GamepadPageID.cs
Normal file
38
UI/Gamepad/GamepadPageID.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.UI.Gamepad.GamepadPageID
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
namespace Terraria.UI.Gamepad
|
||||
{
|
||||
public static class GamepadPageID
|
||||
{
|
||||
public const int None = -1;
|
||||
public const int Inventory = 0;
|
||||
public const int Coins = 1;
|
||||
public const int Ammo = 2;
|
||||
public const int Armor = 3;
|
||||
public const int Chest = 4;
|
||||
public const int Reforge = 5;
|
||||
public const int NPCHousing = 6;
|
||||
public const int Equipment = 7;
|
||||
public const int Tabs = 8;
|
||||
public const int CraftSmall = 9;
|
||||
public const int CraftBig = 10;
|
||||
public const int HairCustomizationStyle = 11;
|
||||
public const int HairCustomizationColor = 12;
|
||||
public const int NPCShop = 13;
|
||||
public const int ClothCustomizationStyle = 14;
|
||||
public const int ClothCustomizationColor = 15;
|
||||
public const int PVP = 16;
|
||||
public const int InfoAccs = 17;
|
||||
public const int BuilderAccs = 18;
|
||||
public const int BuffsOnEquipment = 19;
|
||||
public const int MainMenu = 1000;
|
||||
public const int IngameOptionsLeft = 1001;
|
||||
public const int IngameOptionsRight = 1002;
|
||||
public const int NPCChat = 1003;
|
||||
public const int FancyUI = 1004;
|
||||
}
|
||||
}
|
219
UI/Gamepad/GamepadPointID.cs
Normal file
219
UI/Gamepad/GamepadPointID.cs
Normal file
|
@ -0,0 +1,219 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.UI.Gamepad.GamepadPointID
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
namespace Terraria.UI.Gamepad
|
||||
{
|
||||
public static class GamepadPointID
|
||||
{
|
||||
public const int EndUp = -1;
|
||||
public const int EndDown = -2;
|
||||
public const int EndLeft = -3;
|
||||
public const int EndRight = -4;
|
||||
public const int Inventory0 = 0;
|
||||
public const int Inventory1 = 1;
|
||||
public const int Inventory2 = 2;
|
||||
public const int Inventory3 = 3;
|
||||
public const int Inventory4 = 4;
|
||||
public const int Inventory5 = 5;
|
||||
public const int Inventory6 = 6;
|
||||
public const int Inventory7 = 7;
|
||||
public const int Inventory8 = 8;
|
||||
public const int Inventory9 = 9;
|
||||
public const int Inventory10 = 10;
|
||||
public const int Inventory11 = 11;
|
||||
public const int Inventory12 = 12;
|
||||
public const int Inventory13 = 13;
|
||||
public const int Inventory14 = 14;
|
||||
public const int Inventory15 = 15;
|
||||
public const int Inventory16 = 16;
|
||||
public const int Inventory17 = 17;
|
||||
public const int Inventory18 = 18;
|
||||
public const int Inventory19 = 19;
|
||||
public const int Inventory20 = 20;
|
||||
public const int Inventory21 = 21;
|
||||
public const int Inventory22 = 22;
|
||||
public const int Inventory23 = 23;
|
||||
public const int Inventory24 = 24;
|
||||
public const int Inventory25 = 25;
|
||||
public const int Inventory26 = 26;
|
||||
public const int Inventory27 = 27;
|
||||
public const int Inventory28 = 28;
|
||||
public const int Inventory29 = 29;
|
||||
public const int Inventory30 = 30;
|
||||
public const int Inventory31 = 31;
|
||||
public const int Inventory32 = 32;
|
||||
public const int Inventory33 = 33;
|
||||
public const int Inventory34 = 34;
|
||||
public const int Inventory35 = 35;
|
||||
public const int Inventory36 = 36;
|
||||
public const int Inventory37 = 37;
|
||||
public const int Inventory38 = 38;
|
||||
public const int Inventory39 = 39;
|
||||
public const int Inventory40 = 40;
|
||||
public const int Inventory41 = 41;
|
||||
public const int Inventory42 = 42;
|
||||
public const int Inventory43 = 43;
|
||||
public const int Inventory44 = 44;
|
||||
public const int Inventory45 = 45;
|
||||
public const int Inventory46 = 46;
|
||||
public const int Inventory47 = 47;
|
||||
public const int Inventory48 = 48;
|
||||
public const int Inventory49 = 49;
|
||||
public const int Coins0 = 50;
|
||||
public const int Coins1 = 51;
|
||||
public const int Coins2 = 52;
|
||||
public const int Coins3 = 53;
|
||||
public const int Ammo0 = 54;
|
||||
public const int Ammo1 = 55;
|
||||
public const int Ammo2 = 56;
|
||||
public const int Ammo3 = 57;
|
||||
public const int Armor0 = 100;
|
||||
public const int Armor1 = 101;
|
||||
public const int Armor2 = 102;
|
||||
public const int Armor3 = 103;
|
||||
public const int Armor4 = 104;
|
||||
public const int Armor5 = 105;
|
||||
public const int Armor6 = 106;
|
||||
public const int Armor7 = 107;
|
||||
public const int Armor8 = 108;
|
||||
public const int Armor9 = 109;
|
||||
public const int Armor10 = 110;
|
||||
public const int Armor11 = 111;
|
||||
public const int Armor12 = 112;
|
||||
public const int Armor13 = 113;
|
||||
public const int Armor14 = 114;
|
||||
public const int Armor15 = 115;
|
||||
public const int Armor16 = 116;
|
||||
public const int Armor17 = 117;
|
||||
public const int Armor18 = 118;
|
||||
public const int Armor19 = 119;
|
||||
public const int DyeArmor0 = 120;
|
||||
public const int DyeArmor1 = 121;
|
||||
public const int DyeArmor2 = 122;
|
||||
public const int DyeArmor3 = 123;
|
||||
public const int DyeArmor4 = 124;
|
||||
public const int DyeArmor5 = 125;
|
||||
public const int DyeArmor6 = 126;
|
||||
public const int DyeArmor7 = 127;
|
||||
public const int DyeArmor8 = 128;
|
||||
public const int DyeArmor9 = 129;
|
||||
public const int Equips0 = 180;
|
||||
public const int Equips1 = 181;
|
||||
public const int Equips2 = 182;
|
||||
public const int Equips3 = 183;
|
||||
public const int Equips4 = 184;
|
||||
public const int DyeEquips0 = 185;
|
||||
public const int DyeEquips1 = 186;
|
||||
public const int DyeEquips2 = 187;
|
||||
public const int DyeEquips3 = 188;
|
||||
public const int DyeEquips4 = 189;
|
||||
public const int TrashItem = 300;
|
||||
public const int QuickStackToNearbyChests = 301;
|
||||
public const int SortInventory = 302;
|
||||
public const int ReforgeSlot = 303;
|
||||
public const int ReforgeButton = 304;
|
||||
public const int TabEquips = 305;
|
||||
public const int TabNPCs = 306;
|
||||
public const int TabCamera = 307;
|
||||
public const int TabSettings = 308;
|
||||
public const int Chest0 = 400;
|
||||
public const int Chest1 = 401;
|
||||
public const int Chest2 = 402;
|
||||
public const int Chest3 = 403;
|
||||
public const int Chest4 = 404;
|
||||
public const int Chest5 = 405;
|
||||
public const int Chest6 = 406;
|
||||
public const int Chest7 = 407;
|
||||
public const int Chest8 = 408;
|
||||
public const int Chest9 = 409;
|
||||
public const int Chest10 = 410;
|
||||
public const int Chest11 = 411;
|
||||
public const int Chest12 = 412;
|
||||
public const int Chest13 = 413;
|
||||
public const int Chest14 = 414;
|
||||
public const int Chest15 = 415;
|
||||
public const int Chest16 = 416;
|
||||
public const int Chest17 = 417;
|
||||
public const int Chest18 = 418;
|
||||
public const int Chest19 = 419;
|
||||
public const int Chest20 = 420;
|
||||
public const int Chest21 = 421;
|
||||
public const int Chest22 = 422;
|
||||
public const int Chest23 = 423;
|
||||
public const int Chest24 = 424;
|
||||
public const int Chest25 = 425;
|
||||
public const int Chest26 = 426;
|
||||
public const int Chest27 = 427;
|
||||
public const int Chest28 = 428;
|
||||
public const int Chest29 = 429;
|
||||
public const int Chest30 = 430;
|
||||
public const int Chest31 = 431;
|
||||
public const int Chest32 = 432;
|
||||
public const int Chest33 = 433;
|
||||
public const int Chest34 = 434;
|
||||
public const int Chest35 = 435;
|
||||
public const int Chest36 = 436;
|
||||
public const int Chest37 = 437;
|
||||
public const int Chest38 = 438;
|
||||
public const int Chest39 = 439;
|
||||
public const int ChestActLootAll = 500;
|
||||
public const int ChestActDepositAll = 501;
|
||||
public const int ChestActQuickStack = 502;
|
||||
public const int ChestActRestock = 503;
|
||||
public const int ChestActRenameChest = 504;
|
||||
public const int ChestSort = 505;
|
||||
public const int NPCHousing0 = 600;
|
||||
public const int CraftsBig = 700;
|
||||
public const int CraftsSmall = 1500;
|
||||
public const int PVP0 = 1550;
|
||||
public const int MainMenu = 2000;
|
||||
public const int MenuHack1 = 2001;
|
||||
public const int MenuHack2 = 2002;
|
||||
public const int MenuHack3 = 2003;
|
||||
public const int MenuHack4 = 2004;
|
||||
public const int MenuHack5 = 2005;
|
||||
public const int MenuHack6 = 2006;
|
||||
public const int MenuHack7 = 2007;
|
||||
public const int MenuHack8 = 2008;
|
||||
public const int MenuHack9 = 2009;
|
||||
public const int MenuHack10 = 2010;
|
||||
public const int MenuHack11 = 2011;
|
||||
public const int MenuHack12 = 2012;
|
||||
public const int MenuHack13 = 2013;
|
||||
public const int MenuHack14 = 2014;
|
||||
public const int MenuHack15 = 2015;
|
||||
public const int MenuHack16 = 2016;
|
||||
public const int MenuHack17 = 2017;
|
||||
public const int MenuHack18 = 2018;
|
||||
public const int MenuHack19 = 2019;
|
||||
public const int NPCChat0 = 2500;
|
||||
public const int NPCChat1 = 2501;
|
||||
public const int NPCChat2 = 2502;
|
||||
public const int StylistColorH = 2600;
|
||||
public const int StylistColorS = 2601;
|
||||
public const int StylistColorL = 2602;
|
||||
public const int StylistColorOk = 2603;
|
||||
public const int StylistColorClose = 2604;
|
||||
public const int StylistStyle0 = 2605;
|
||||
public const int NPCShop0 = 2700;
|
||||
public const int NPCShop39 = 2739;
|
||||
public const int ClothColorH = 2800;
|
||||
public const int ClothColorS = 2801;
|
||||
public const int ClothColorL = 2802;
|
||||
public const int ClothColorOk = 2803;
|
||||
public const int ClothColorClose = 2804;
|
||||
public const int ClothStyle = 2805;
|
||||
public const int ClothPicker0 = 2806;
|
||||
public const int ClothPicker1 = 2807;
|
||||
public const int ClothPicker2 = 2808;
|
||||
public const int ClothPicker3 = 2809;
|
||||
public const int IngameOptionsLeft0 = 2900;
|
||||
public const int IngameOptionsRight0 = 2930;
|
||||
public const int FancyUI0 = 3000;
|
||||
public const int BuilderAccs = 4000;
|
||||
public const int BuffsForEquips = 9000;
|
||||
}
|
||||
}
|
102
UI/Gamepad/UILinkPage.cs
Normal file
102
UI/Gamepad/UILinkPage.cs
Normal file
|
@ -0,0 +1,102 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.UI.Gamepad.UILinkPage
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Terraria.UI.Gamepad
|
||||
{
|
||||
public class UILinkPage
|
||||
{
|
||||
public int ID;
|
||||
public int PageOnLeft = -1;
|
||||
public int PageOnRight = -1;
|
||||
public int DefaultPoint;
|
||||
public int CurrentPoint;
|
||||
public Dictionary<int, UILinkPoint> LinkMap = new Dictionary<int, UILinkPoint>();
|
||||
|
||||
public event Action<int, int> ReachEndEvent;
|
||||
|
||||
public event Action TravelEvent;
|
||||
|
||||
public event Action LeaveEvent;
|
||||
|
||||
public event Action EnterEvent;
|
||||
|
||||
public event Action UpdateEvent;
|
||||
|
||||
public event Func<bool> IsValidEvent;
|
||||
|
||||
public event Func<bool> CanEnterEvent;
|
||||
|
||||
public UILinkPage()
|
||||
{
|
||||
}
|
||||
|
||||
public UILinkPage(int id) => this.ID = id;
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (this.UpdateEvent == null)
|
||||
return;
|
||||
this.UpdateEvent();
|
||||
}
|
||||
|
||||
public void Leave()
|
||||
{
|
||||
if (this.LeaveEvent == null)
|
||||
return;
|
||||
this.LeaveEvent();
|
||||
}
|
||||
|
||||
public void Enter()
|
||||
{
|
||||
if (this.EnterEvent == null)
|
||||
return;
|
||||
this.EnterEvent();
|
||||
}
|
||||
|
||||
public bool IsValid() => this.IsValidEvent == null || this.IsValidEvent();
|
||||
|
||||
public bool CanEnter() => this.CanEnterEvent == null || this.CanEnterEvent();
|
||||
|
||||
public void TravelUp() => this.Travel(this.LinkMap[this.CurrentPoint].Up);
|
||||
|
||||
public void TravelDown() => this.Travel(this.LinkMap[this.CurrentPoint].Down);
|
||||
|
||||
public void TravelLeft() => this.Travel(this.LinkMap[this.CurrentPoint].Left);
|
||||
|
||||
public void TravelRight() => this.Travel(this.LinkMap[this.CurrentPoint].Right);
|
||||
|
||||
public void SwapPageLeft() => UILinkPointNavigator.ChangePage(this.PageOnLeft);
|
||||
|
||||
public void SwapPageRight() => UILinkPointNavigator.ChangePage(this.PageOnRight);
|
||||
|
||||
private void Travel(int next)
|
||||
{
|
||||
if (next < 0)
|
||||
{
|
||||
if (this.ReachEndEvent == null)
|
||||
return;
|
||||
this.ReachEndEvent(this.CurrentPoint, next);
|
||||
if (this.TravelEvent == null)
|
||||
return;
|
||||
this.TravelEvent();
|
||||
}
|
||||
else
|
||||
{
|
||||
UILinkPointNavigator.ChangePoint(next);
|
||||
if (this.TravelEvent == null)
|
||||
return;
|
||||
this.TravelEvent();
|
||||
}
|
||||
}
|
||||
|
||||
public event Func<string> OnSpecialInteracts;
|
||||
|
||||
public string SpecialInteractions() => this.OnSpecialInteracts != null ? this.OnSpecialInteracts() : string.Empty;
|
||||
}
|
||||
}
|
48
UI/Gamepad/UILinkPoint.cs
Normal file
48
UI/Gamepad/UILinkPoint.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.UI.Gamepad.UILinkPoint
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
|
||||
namespace Terraria.UI.Gamepad
|
||||
{
|
||||
public class UILinkPoint
|
||||
{
|
||||
public int ID;
|
||||
public bool Enabled;
|
||||
public Vector2 Position;
|
||||
public int Left;
|
||||
public int Right;
|
||||
public int Up;
|
||||
public int Down;
|
||||
|
||||
public int Page { get; private set; }
|
||||
|
||||
public UILinkPoint(int id, bool enabled, int left, int right, int up, int down)
|
||||
{
|
||||
this.ID = id;
|
||||
this.Enabled = enabled;
|
||||
this.Left = left;
|
||||
this.Right = right;
|
||||
this.Up = up;
|
||||
this.Down = down;
|
||||
}
|
||||
|
||||
public void SetPage(int page) => this.Page = page;
|
||||
|
||||
public void Unlink()
|
||||
{
|
||||
this.Left = -3;
|
||||
this.Right = -4;
|
||||
this.Up = -1;
|
||||
this.Down = -2;
|
||||
}
|
||||
|
||||
public event Func<string> OnSpecialInteracts;
|
||||
|
||||
public string SpecialInteractions() => this.OnSpecialInteracts != null ? this.OnSpecialInteracts() : string.Empty;
|
||||
}
|
||||
}
|
315
UI/Gamepad/UILinkPointNavigator.cs
Normal file
315
UI/Gamepad/UILinkPointNavigator.cs
Normal file
|
@ -0,0 +1,315 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.UI.Gamepad.UILinkPointNavigator
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Terraria.GameInput;
|
||||
|
||||
namespace Terraria.UI.Gamepad
|
||||
{
|
||||
public class UILinkPointNavigator
|
||||
{
|
||||
public static Dictionary<int, UILinkPage> Pages = new Dictionary<int, UILinkPage>();
|
||||
public static Dictionary<int, UILinkPoint> Points = new Dictionary<int, UILinkPoint>();
|
||||
public static int CurrentPage = 1000;
|
||||
public static int OldPage = 1000;
|
||||
private static int XCooldown = 0;
|
||||
private static int YCooldown = 0;
|
||||
private static Vector2 LastInput;
|
||||
private static int PageLeftCD = 0;
|
||||
private static int PageRightCD = 0;
|
||||
public static bool InUse;
|
||||
public static int OverridePoint = -1;
|
||||
|
||||
public static int CurrentPoint => UILinkPointNavigator.Pages[UILinkPointNavigator.CurrentPage].CurrentPoint;
|
||||
|
||||
public static bool Available => Main.playerInventory || Main.ingameOptionsWindow || Main.player[Main.myPlayer].talkNPC != -1 || Main.player[Main.myPlayer].sign != -1 || Main.mapFullscreen || Main.clothesWindow || Main.MenuUI.IsVisible || Main.InGameUI.IsVisible;
|
||||
|
||||
public static void GoToDefaultPage(int specialFlag = 0)
|
||||
{
|
||||
if (Main.MenuUI.IsVisible)
|
||||
UILinkPointNavigator.CurrentPage = 1004;
|
||||
else if (Main.InGameUI.IsVisible || specialFlag == 1)
|
||||
UILinkPointNavigator.CurrentPage = 1004;
|
||||
else if (Main.gameMenu)
|
||||
UILinkPointNavigator.CurrentPage = 1000;
|
||||
else if (Main.ingameOptionsWindow)
|
||||
UILinkPointNavigator.CurrentPage = 1001;
|
||||
else if (Main.hairWindow)
|
||||
UILinkPointNavigator.CurrentPage = 12;
|
||||
else if (Main.clothesWindow)
|
||||
UILinkPointNavigator.CurrentPage = 15;
|
||||
else if (Main.npcShop != 0)
|
||||
UILinkPointNavigator.CurrentPage = 13;
|
||||
else if (Main.InGuideCraftMenu)
|
||||
UILinkPointNavigator.CurrentPage = 9;
|
||||
else if (Main.InReforgeMenu)
|
||||
UILinkPointNavigator.CurrentPage = 5;
|
||||
else if (Main.player[Main.myPlayer].chest != -1)
|
||||
UILinkPointNavigator.CurrentPage = 4;
|
||||
else if (Main.player[Main.myPlayer].talkNPC != -1 || Main.player[Main.myPlayer].sign != -1)
|
||||
UILinkPointNavigator.CurrentPage = 1003;
|
||||
else
|
||||
UILinkPointNavigator.CurrentPage = 0;
|
||||
}
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
bool inUse = UILinkPointNavigator.InUse;
|
||||
UILinkPointNavigator.InUse = false;
|
||||
bool flag1 = true;
|
||||
if (flag1)
|
||||
{
|
||||
switch (PlayerInput.CurrentInputMode)
|
||||
{
|
||||
case InputMode.Keyboard:
|
||||
case InputMode.KeyboardUI:
|
||||
case InputMode.Mouse:
|
||||
if (!Main.gameMenu)
|
||||
{
|
||||
flag1 = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag1 && PlayerInput.NavigatorRebindingLock > 0)
|
||||
flag1 = false;
|
||||
if (flag1 && !Main.gameMenu && !PlayerInput.UsingGamepadUI)
|
||||
flag1 = false;
|
||||
if (flag1 && !Main.gameMenu && PlayerInput.InBuildingMode)
|
||||
flag1 = false;
|
||||
if (flag1 && !Main.gameMenu && !UILinkPointNavigator.Available)
|
||||
flag1 = false;
|
||||
bool flag2 = false;
|
||||
UILinkPage uiLinkPage;
|
||||
if (!UILinkPointNavigator.Pages.TryGetValue(UILinkPointNavigator.CurrentPage, out uiLinkPage))
|
||||
flag2 = true;
|
||||
else if (!uiLinkPage.IsValid())
|
||||
flag2 = true;
|
||||
if (flag2)
|
||||
{
|
||||
UILinkPointNavigator.GoToDefaultPage();
|
||||
UILinkPointNavigator.ProcessChanges();
|
||||
flag1 = false;
|
||||
}
|
||||
if (inUse != flag1)
|
||||
{
|
||||
if (!flag1)
|
||||
{
|
||||
uiLinkPage.Leave();
|
||||
UILinkPointNavigator.GoToDefaultPage();
|
||||
UILinkPointNavigator.ProcessChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
UILinkPointNavigator.GoToDefaultPage();
|
||||
UILinkPointNavigator.ProcessChanges();
|
||||
uiLinkPage.Enter();
|
||||
}
|
||||
if (flag1)
|
||||
{
|
||||
Main.player[Main.myPlayer].releaseInventory = false;
|
||||
Main.player[Main.myPlayer].releaseUseTile = false;
|
||||
PlayerInput.LockTileUseButton = true;
|
||||
}
|
||||
if (!Main.gameMenu)
|
||||
{
|
||||
if (flag1)
|
||||
PlayerInput.NavigatorCachePosition();
|
||||
else
|
||||
PlayerInput.NavigatorUnCachePosition();
|
||||
}
|
||||
}
|
||||
if (!flag1)
|
||||
return;
|
||||
UILinkPointNavigator.InUse = true;
|
||||
UILinkPointNavigator.OverridePoint = -1;
|
||||
if (UILinkPointNavigator.PageLeftCD > 0)
|
||||
--UILinkPointNavigator.PageLeftCD;
|
||||
if (UILinkPointNavigator.PageRightCD > 0)
|
||||
--UILinkPointNavigator.PageRightCD;
|
||||
Vector2 navigatorDirections = PlayerInput.Triggers.Current.GetNavigatorDirections();
|
||||
bool flag3 = PlayerInput.Triggers.Current.HotbarMinus && !PlayerInput.Triggers.Current.HotbarPlus;
|
||||
int num1 = !PlayerInput.Triggers.Current.HotbarPlus ? 0 : (!PlayerInput.Triggers.Current.HotbarMinus ? 1 : 0);
|
||||
if (!flag3)
|
||||
UILinkPointNavigator.PageLeftCD = 0;
|
||||
if (num1 == 0)
|
||||
UILinkPointNavigator.PageRightCD = 0;
|
||||
bool flag4 = flag3 && UILinkPointNavigator.PageLeftCD == 0;
|
||||
int num2 = num1 == 0 ? 0 : (UILinkPointNavigator.PageRightCD == 0 ? 1 : 0);
|
||||
if ((double) UILinkPointNavigator.LastInput.X != (double) navigatorDirections.X)
|
||||
UILinkPointNavigator.XCooldown = 0;
|
||||
if ((double) UILinkPointNavigator.LastInput.Y != (double) navigatorDirections.Y)
|
||||
UILinkPointNavigator.YCooldown = 0;
|
||||
if (UILinkPointNavigator.XCooldown > 0)
|
||||
--UILinkPointNavigator.XCooldown;
|
||||
if (UILinkPointNavigator.YCooldown > 0)
|
||||
--UILinkPointNavigator.YCooldown;
|
||||
UILinkPointNavigator.LastInput = navigatorDirections;
|
||||
if (flag4)
|
||||
UILinkPointNavigator.PageLeftCD = 16;
|
||||
if (num2 != 0)
|
||||
UILinkPointNavigator.PageRightCD = 16;
|
||||
UILinkPointNavigator.Pages[UILinkPointNavigator.CurrentPage].Update();
|
||||
int num3 = 10;
|
||||
if (!Main.gameMenu && Main.playerInventory && !Main.ingameOptionsWindow && !Main.inFancyUI && (UILinkPointNavigator.CurrentPage == 0 || UILinkPointNavigator.CurrentPage == 4 || UILinkPointNavigator.CurrentPage == 2 || UILinkPointNavigator.CurrentPage == 1))
|
||||
num3 = PlayerInput.CurrentProfile.InventoryMoveCD;
|
||||
if ((double) navigatorDirections.X == -1.0 && UILinkPointNavigator.XCooldown == 0)
|
||||
{
|
||||
UILinkPointNavigator.XCooldown = num3;
|
||||
UILinkPointNavigator.Pages[UILinkPointNavigator.CurrentPage].TravelLeft();
|
||||
}
|
||||
if ((double) navigatorDirections.X == 1.0 && UILinkPointNavigator.XCooldown == 0)
|
||||
{
|
||||
UILinkPointNavigator.XCooldown = num3;
|
||||
UILinkPointNavigator.Pages[UILinkPointNavigator.CurrentPage].TravelRight();
|
||||
}
|
||||
if ((double) navigatorDirections.Y == -1.0 && UILinkPointNavigator.YCooldown == 0)
|
||||
{
|
||||
UILinkPointNavigator.YCooldown = num3;
|
||||
UILinkPointNavigator.Pages[UILinkPointNavigator.CurrentPage].TravelUp();
|
||||
}
|
||||
if ((double) navigatorDirections.Y == 1.0 && UILinkPointNavigator.YCooldown == 0)
|
||||
{
|
||||
UILinkPointNavigator.YCooldown = num3;
|
||||
UILinkPointNavigator.Pages[UILinkPointNavigator.CurrentPage].TravelDown();
|
||||
}
|
||||
UILinkPointNavigator.XCooldown = UILinkPointNavigator.YCooldown = Math.Max(UILinkPointNavigator.XCooldown, UILinkPointNavigator.YCooldown);
|
||||
if (flag4)
|
||||
UILinkPointNavigator.Pages[UILinkPointNavigator.CurrentPage].SwapPageLeft();
|
||||
if (num2 != 0)
|
||||
UILinkPointNavigator.Pages[UILinkPointNavigator.CurrentPage].SwapPageRight();
|
||||
if (PlayerInput.Triggers.Current.UsedMovementKey)
|
||||
{
|
||||
Vector2 position = UILinkPointNavigator.Points[UILinkPointNavigator.CurrentPoint].Position;
|
||||
Vector2 vector2_1 = new Vector2((float) PlayerInput.MouseX, (float) PlayerInput.MouseY);
|
||||
float num4 = 0.3f;
|
||||
if (PlayerInput.InvisibleGamepadInMenus)
|
||||
num4 = 1f;
|
||||
Vector2 vector2_2 = position;
|
||||
double num5 = (double) num4;
|
||||
Vector2 vector2_3 = Vector2.Lerp(vector2_1, vector2_2, (float) num5);
|
||||
if (Main.gameMenu)
|
||||
{
|
||||
if ((double) Math.Abs(vector2_3.X - position.X) <= 5.0)
|
||||
vector2_3.X = position.X;
|
||||
if ((double) Math.Abs(vector2_3.Y - position.Y) <= 5.0)
|
||||
vector2_3.Y = position.Y;
|
||||
}
|
||||
PlayerInput.MouseX = (int) vector2_3.X;
|
||||
PlayerInput.MouseY = (int) vector2_3.Y;
|
||||
}
|
||||
UILinkPointNavigator.ResetFlagsEnd();
|
||||
}
|
||||
|
||||
public static void ResetFlagsEnd()
|
||||
{
|
||||
UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 0;
|
||||
UILinkPointNavigator.Shortcuts.BackButtonLock = false;
|
||||
UILinkPointNavigator.Shortcuts.BackButtonCommand = 0;
|
||||
}
|
||||
|
||||
public static string GetInstructions()
|
||||
{
|
||||
string str1 = UILinkPointNavigator.Pages[UILinkPointNavigator.CurrentPage].SpecialInteractions();
|
||||
string str2 = UILinkPointNavigator.Points[UILinkPointNavigator.CurrentPoint].SpecialInteractions();
|
||||
if (!string.IsNullOrEmpty(str2))
|
||||
{
|
||||
if (string.IsNullOrEmpty(str1))
|
||||
return str2;
|
||||
str1 = str1 + " " + str2;
|
||||
}
|
||||
return str1;
|
||||
}
|
||||
|
||||
public static void SetPosition(int ID, Vector2 Position) => UILinkPointNavigator.Points[ID].Position = Position * Main.UIScale;
|
||||
|
||||
public static void RegisterPage(UILinkPage page, int ID, bool automatedDefault = true)
|
||||
{
|
||||
if (automatedDefault)
|
||||
page.DefaultPoint = page.LinkMap.Keys.First<int>();
|
||||
page.CurrentPoint = page.DefaultPoint;
|
||||
page.ID = ID;
|
||||
UILinkPointNavigator.Pages.Add(page.ID, page);
|
||||
foreach (KeyValuePair<int, UILinkPoint> link in page.LinkMap)
|
||||
{
|
||||
link.Value.SetPage(ID);
|
||||
UILinkPointNavigator.Points.Add(link.Key, link.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ChangePage(int PageID)
|
||||
{
|
||||
if (!UILinkPointNavigator.Pages.ContainsKey(PageID) || !UILinkPointNavigator.Pages[PageID].CanEnter())
|
||||
return;
|
||||
UILinkPointNavigator.CurrentPage = PageID;
|
||||
UILinkPointNavigator.ProcessChanges();
|
||||
}
|
||||
|
||||
public static void ChangePoint(int PointID)
|
||||
{
|
||||
if (!UILinkPointNavigator.Points.ContainsKey(PointID))
|
||||
return;
|
||||
UILinkPointNavigator.CurrentPage = UILinkPointNavigator.Points[PointID].Page;
|
||||
UILinkPointNavigator.OverridePoint = PointID;
|
||||
UILinkPointNavigator.ProcessChanges();
|
||||
}
|
||||
|
||||
public static void ProcessChanges()
|
||||
{
|
||||
UILinkPage page = UILinkPointNavigator.Pages[UILinkPointNavigator.OldPage];
|
||||
if (UILinkPointNavigator.OldPage != UILinkPointNavigator.CurrentPage)
|
||||
{
|
||||
page.Leave();
|
||||
if (!UILinkPointNavigator.Pages.TryGetValue(UILinkPointNavigator.CurrentPage, out page))
|
||||
{
|
||||
UILinkPointNavigator.GoToDefaultPage();
|
||||
UILinkPointNavigator.ProcessChanges();
|
||||
UILinkPointNavigator.OverridePoint = -1;
|
||||
}
|
||||
page.CurrentPoint = page.DefaultPoint;
|
||||
page.Enter();
|
||||
page.Update();
|
||||
UILinkPointNavigator.OldPage = UILinkPointNavigator.CurrentPage;
|
||||
}
|
||||
if (UILinkPointNavigator.OverridePoint == -1 || !page.LinkMap.ContainsKey(UILinkPointNavigator.OverridePoint))
|
||||
return;
|
||||
page.CurrentPoint = UILinkPointNavigator.OverridePoint;
|
||||
}
|
||||
|
||||
public static class Shortcuts
|
||||
{
|
||||
public static int NPCS_IconsPerColumn = 100;
|
||||
public static int NPCS_IconsTotal = 0;
|
||||
public static int NPCS_LastHovered = -1;
|
||||
public static bool NPCS_IconsDisplay = false;
|
||||
public static int CRAFT_IconsPerRow = 100;
|
||||
public static int CRAFT_IconsPerColumn = 100;
|
||||
public static int CRAFT_CurrentIngridientsCount = 0;
|
||||
public static int CRAFT_CurrentRecipeBig = 0;
|
||||
public static int CRAFT_CurrentRecipeSmall = 0;
|
||||
public static bool NPCCHAT_ButtonsLeft = false;
|
||||
public static bool NPCCHAT_ButtonsMiddle = false;
|
||||
public static bool NPCCHAT_ButtonsRight = false;
|
||||
public static int INGAMEOPTIONS_BUTTONS_LEFT = 0;
|
||||
public static int INGAMEOPTIONS_BUTTONS_RIGHT = 0;
|
||||
public static int OPTIONS_BUTTON_SPECIALFEATURE = 0;
|
||||
public static int BackButtonCommand = 0;
|
||||
public static bool BackButtonInUse = false;
|
||||
public static bool BackButtonLock = false;
|
||||
public static int FANCYUI_HIGHEST_INDEX = 1;
|
||||
public static int FANCYUI_SPECIAL_INSTRUCTIONS = 0;
|
||||
public static int INFOACCCOUNT = 0;
|
||||
public static int BUILDERACCCOUNT = 0;
|
||||
public static int BUFFS_PER_COLUMN = 0;
|
||||
public static int BUFFS_DRAWN = 0;
|
||||
public static int INV_MOVE_OPTION_CD = 0;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue