Advertisement
Guest User

InputSys

a guest
Feb 20th, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 85.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Runtime.InteropServices;
  5. using UnityEngine;
  6.  
  7. public class InputManager : MonoBehaviourSingleton<InputManager>
  8. {
  9.   public static string Horizontal = "Horizontal";
  10.   public static string Vertical = "Vertical";
  11.   public static string Fire1 = "Fire1";
  12.   public static string Fire2 = "Fire2";
  13.   public static string Fire3 = "Fire3";
  14.   public static string Jump = "Jump";
  15.   public static string MouseX = "Mouse X";
  16.   public static string MouseY = "Mouse Y";
  17.   public static string MouseScrollWheel = "Mouse ScrollWheel";
  18.   public static string WindowShakeX = "Window Shake X";
  19.   public static string WindowShakeY = "Window Shake Y";
  20.   public static string Back = "Back";
  21.   public static string Inventory = "Inventory";
  22.   public static string Character = "Character";
  23.   public static string Journal = "Journal";
  24.   public static string SelectParty = "Select Party";
  25.   public static string GroupMode = "Toggle Group Mode";
  26.   public static string RotateCameraLeft = "Rotate Camera Left";
  27.   public static string RotateCameraRight = "Rotate Camera Right";
  28.   public static string NextMob = "Select Next Mob";
  29.   public static string ShowGrid = "Show Grid";
  30.   public static string SwapWeapons = "Swap Weapons";
  31.   public static string AreaAttack = "Area Attack";
  32.   public static string HighlightAll = "Highlight All";
  33.   public static string ShowAttackRange = "Show Attack Range";
  34.   public static string SpawnTestParty = "Spawn Test Party";
  35.   public static string HotkeyBase = "Hotkey ";
  36.   public static string Hotkey1 = "Hotkey 1";
  37.   public static string Hotkey2 = "Hotkey 2";
  38.   public static string Hotkey3 = "Hotkey 3";
  39.   public static string Hotkey4 = "Hotkey 4";
  40.   public static string Hotkey5 = "Hotkey 5";
  41.   public static string Hotkey6 = "Hotkey 6";
  42.   public static string Hotkey7 = "Hotkey 7";
  43.   public static string Hotkey8 = "Hotkey 8";
  44.   public static string Hotkey9 = "Hotkey 9";
  45.   public static string EndTurn = "End Turn";
  46.   public static string SelectPlayer = "Select Player ";
  47.   public static string SelectPlayer1 = "Select Player 1";
  48.   public static string SelectPlayer2 = "Select Player 2";
  49.   public static string SelectPlayer3 = "Select Player 3";
  50.   public static string SelectPlayer4 = "Select Player 4";
  51.   public static string SelectPlayer5 = "Select Player 5";
  52.   public static string SelectPlayer6 = "Select Player 6";
  53.   public static string SelectPlayer7 = "Select Player 7";
  54.   public static string Map = "Map";
  55.   public static string AttackTarget = "Attack Current Target";
  56.   public static string ChangeMoveMode = "Change Move Mode";
  57.   public static string Reload = "Reload";
  58.   public static string ResetCameraRotation = "Reset Camera Rotation";
  59.   public static string RadioScan = "Radio Scan";
  60.   public static string RadioAcknowledge = "Radio Acknowledge";
  61.   public static string QuickSave = "Quick Save";
  62.   public static string QuickLoad = "Quick Load";
  63.   public bool selectionRectActive = true;
  64.   public List<Mob> selectedMobs = new List<Mob>();
  65.   public List<PC> activePCs = new List<PC>();
  66.   private List<Mob> selectedBackup = new List<Mob>();
  67.   public float distFollowHangBack = 5f;
  68.   public float distToFormationMax = 3f;
  69.   private WSBool wsIsPartyMovementNotGrouped = WSBool.GetRef("UnGroupedMovement");
  70.   private int layerMaskCombatPath = InputManager.layerMask_Terrain | InputManager.layerMask_Floor | InputManager.layerMask_Cover | InputManager.layerMask_DynamicObject | InputManager.layerMask_StaticMeshes | InputManager.layerMask_Mob;
  71.   public float baseMoveStartDelay = 0.3f;
  72.   public float rangeMoveStartDelay = 0.6f;
  73.   public float[] MoveStartDelayScaleOfMoveMode = new float[4]
  74.   {
  75.     1f,
  76.     0.5f,
  77.     1.5f,
  78.     1.5f
  79.   };
  80.   public const float doubleClickTime = 0.3f;
  81.   public static string[] buttonEvents;
  82.   public GameObject movePositionFxPrefab;
  83.   public GameObject moveBlockedFxPrefab;
  84.   private MoveCursor moveCursor;
  85.   private BlockedCursor blockedCursor;
  86.   public GUIStyle selectionRectStyle;
  87.   private bool[] previousSelections;
  88.   public bool holdForCombatPath;
  89.   private CombatAStarNode mouseoverSquare;
  90.   [HideInInspector]
  91.   public bool bEdgeScrolling;
  92.   [HideInInspector]
  93.   public Vector4 cameraMove;
  94.   private Vector3 mouseDownPos;
  95.   private bool wasMouseDownShift;
  96.   private bool wasMouseDownCtrl;
  97.   private PC pcLeaderOnDragStart;
  98.   private float rightClickUpTime;
  99.   private float leftClickUpTime;
  100.   private bool moveClick;
  101.   private bool actionClick;
  102.   private Vector3 clickPosition;
  103.   private Vector3 lastRightClickPosition;
  104.   public FormationTemplate formation;
  105.   public FormationTemplate formationInstigate;
  106.   private NavMeshHit navHit;
  107.   private Vector3 lastMiddleClickPosition;
  108.   public bool ignoreMousePosition;
  109.   private Vector3 ignoredMousePosition;
  110.   private float formationTimer;
  111.   private bool formationSpinning;
  112.   public float formationDelay;
  113.   private CombatAStarNode lastCombatSquare;
  114.   private CombatAStarNode timerCombatSquare;
  115.   private float combatSquareTimer;
  116.   private int cursorTextId;
  117.   public static int layerIndex_Default;
  118.   public static int layerIndex_TransparentFX;
  119.   public static int layerIndex_IgnoreRaycast;
  120.   public static int layerIndex_Water;
  121.   public static int layerIndex_Terrain;
  122.   public static int layerIndex_Mob;
  123.   public static int layerIndex_DynamicObject;
  124.   public static int layerIndex_StaticMeshes;
  125.   public static int layerIndex_InventoryGUI;
  126.   public static int layerIndex_HUD;
  127.   public static int layerIndex_MiniMapIcon;
  128.   public static int layerIndex_Floor;
  129.   public static int layerIndex_Wall;
  130.   public static int layerIndex_FadeOutOnly;
  131.   public static int layerIndex_FadedFloor;
  132.   public static int layerIndex_FadedWall;
  133.   public static int layerIndex_Cover;
  134.   public static int layerIndex_DressingRoom;
  135.   public static int layerIndex_SpeechBubbles;
  136.   public static int layerIndex_MovingObjects;
  137.   public static int layerMask_Default;
  138.   public static int layerMask_TransparentFX;
  139.   public static int layerMask_IgnoreRaycast;
  140.   public static int layerMask_Water;
  141.   public static int layerMask_Terrain;
  142.   public static int layerMask_Mob;
  143.   public static int layerMask_DynamicObject;
  144.   public static int layerMask_StaticMeshes;
  145.   public static int layerMask_InventoryGUI;
  146.   public static int layerMask_HUD;
  147.   public static int layerMask_MiniMapIcon;
  148.   public static int layerMask_Floor;
  149.   public static int layerMask_Wall;
  150.   public static int layerMask_FadeOutOnly;
  151.   public static int layerMask_FadedFloor;
  152.   public static int layerMask_FadedWall;
  153.   public static int layerMask_Cover;
  154.   public static int layerMask_DressingRoom;
  155.   public static int layerMask_SpeechBubbles;
  156.   public static int layerMask_MovingObjects;
  157.   public static int navMeshLayerIndex_Default;
  158.   public static int navMeshLayerIndex_Ladders;
  159.   public static int navMeshLayerIndex_Door;
  160.   private int freezeInputCount;
  161.   private bool hasLostFocus;
  162.  
  163.   private bool isPartyMovementGrouped
  164.   {
  165.     get
  166.     {
  167.       return !(bool) this.wsIsPartyMovementNotGrouped;
  168.     }
  169.     set
  170.     {
  171.       this.wsIsPartyMovementNotGrouped.Set(!value);
  172.     }
  173.   }
  174.  
  175.   public bool isPartyGrouped
  176.   {
  177.     get
  178.     {
  179.       return this.isPartyMovementGrouped;
  180.     }
  181.   }
  182.  
  183.   public int movementPCsCount
  184.   {
  185.     get
  186.     {
  187.       if (this.isPartyGrouped)
  188.         return MonoBehaviourSingleton<Game>.GetInstance(false).party.Count;
  189.       else
  190.         return this.activePCs.Count;
  191.     }
  192.   }
  193.  
  194.   public bool didDoubleRightClick
  195.   {
  196.     get
  197.     {
  198.       return (double) Time.time - (double) this.rightClickUpTime < 0.300000011920929;
  199.     }
  200.   }
  201.  
  202.   public bool didDoubleLeftClick
  203.   {
  204.     get
  205.     {
  206.       return (double) Time.time - (double) this.leftClickUpTime < 0.300000011920929;
  207.     }
  208.   }
  209.  
  210.   private bool freezeInput
  211.   {
  212.     get
  213.     {
  214.       return this.freezeInputCount > 0;
  215.     }
  216.     set
  217.     {
  218.       if (value)
  219.       {
  220.         ++this.freezeInputCount;
  221.       }
  222.       else
  223.       {
  224.         --this.freezeInputCount;
  225.         if (this.freezeInputCount >= 0)
  226.           return;
  227.         this.freezeInputCount = 0;
  228.       }
  229.     }
  230.   }
  231.  
  232.   static InputManager()
  233.   {
  234.     string[] strArray = new string[40];
  235.     int index1 = 0;
  236.     string str1 = InputManager.Fire1;
  237.     strArray[index1] = str1;
  238.     int index2 = 1;
  239.     string str2 = InputManager.Fire2;
  240.     strArray[index2] = str2;
  241.     int index3 = 2;
  242.     string str3 = InputManager.Fire3;
  243.     strArray[index3] = str3;
  244.     int index4 = 3;
  245.     string str4 = InputManager.Back;
  246.     strArray[index4] = str4;
  247.     int index5 = 4;
  248.     string str5 = InputManager.Inventory;
  249.     strArray[index5] = str5;
  250.     int index6 = 5;
  251.     string str6 = InputManager.Character;
  252.     strArray[index6] = str6;
  253.     int index7 = 6;
  254.     string str7 = InputManager.Journal;
  255.     strArray[index7] = str7;
  256.     int index8 = 7;
  257.     string str8 = InputManager.SelectParty;
  258.     strArray[index8] = str8;
  259.     int index9 = 8;
  260.     string str9 = InputManager.GroupMode;
  261.     strArray[index9] = str9;
  262.     int index10 = 9;
  263.     string str10 = InputManager.RotateCameraLeft;
  264.     strArray[index10] = str10;
  265.     int index11 = 10;
  266.     string str11 = InputManager.RotateCameraRight;
  267.     strArray[index11] = str11;
  268.     int index12 = 11;
  269.     string str12 = InputManager.NextMob;
  270.     strArray[index12] = str12;
  271.     int index13 = 12;
  272.     string str13 = InputManager.ShowGrid;
  273.     strArray[index13] = str13;
  274.     int index14 = 13;
  275.     string str14 = InputManager.SwapWeapons;
  276.     strArray[index14] = str14;
  277.     int index15 = 14;
  278.     string str15 = InputManager.AreaAttack;
  279.     strArray[index15] = str15;
  280.     int index16 = 15;
  281.     string str16 = InputManager.HighlightAll;
  282.     strArray[index16] = str16;
  283.     int index17 = 16;
  284.     string str17 = InputManager.ShowAttackRange;
  285.     strArray[index17] = str17;
  286.     int index18 = 17;
  287.     string str18 = InputManager.Hotkey1;
  288.     strArray[index18] = str18;
  289.     int index19 = 18;
  290.     string str19 = InputManager.Hotkey2;
  291.     strArray[index19] = str19;
  292.     int index20 = 19;
  293.     string str20 = InputManager.Hotkey3;
  294.     strArray[index20] = str20;
  295.     int index21 = 20;
  296.     string str21 = InputManager.Hotkey4;
  297.     strArray[index21] = str21;
  298.     int index22 = 21;
  299.     string str22 = InputManager.Hotkey5;
  300.     strArray[index22] = str22;
  301.     int index23 = 22;
  302.     string str23 = InputManager.Hotkey6;
  303.     strArray[index23] = str23;
  304.     int index24 = 23;
  305.     string str24 = InputManager.EndTurn;
  306.     strArray[index24] = str24;
  307.     int index25 = 24;
  308.     string str25 = InputManager.SelectPlayer1;
  309.     strArray[index25] = str25;
  310.     int index26 = 25;
  311.     string str26 = InputManager.SelectPlayer2;
  312.     strArray[index26] = str26;
  313.     int index27 = 26;
  314.     string str27 = InputManager.SelectPlayer3;
  315.     strArray[index27] = str27;
  316.     int index28 = 27;
  317.     string str28 = InputManager.SelectPlayer4;
  318.     strArray[index28] = str28;
  319.     int index29 = 28;
  320.     string str29 = InputManager.SelectPlayer5;
  321.     strArray[index29] = str29;
  322.     int index30 = 29;
  323.     string str30 = InputManager.SelectPlayer6;
  324.     strArray[index30] = str30;
  325.     int index31 = 30;
  326.     string str31 = InputManager.SelectPlayer7;
  327.     strArray[index31] = str31;
  328.     int index32 = 31;
  329.     string str32 = InputManager.Map;
  330.     strArray[index32] = str32;
  331.     int index33 = 32;
  332.     string str33 = InputManager.AttackTarget;
  333.     strArray[index33] = str33;
  334.     int index34 = 33;
  335.     string str34 = InputManager.ChangeMoveMode;
  336.     strArray[index34] = str34;
  337.     int index35 = 34;
  338.     string str35 = InputManager.Reload;
  339.     strArray[index35] = str35;
  340.     int index36 = 35;
  341.     string str36 = InputManager.ResetCameraRotation;
  342.     strArray[index36] = str36;
  343.     int index37 = 36;
  344.     string str37 = InputManager.RadioScan;
  345.     strArray[index37] = str37;
  346.     int index38 = 37;
  347.     string str38 = InputManager.RadioAcknowledge;
  348.     strArray[index38] = str38;
  349.     int index39 = 38;
  350.     string str39 = InputManager.QuickSave;
  351.     strArray[index39] = str39;
  352.     int index40 = 39;
  353.     string str40 = InputManager.QuickLoad;
  354.     strArray[index40] = str40;
  355.     InputManager.buttonEvents = strArray;
  356.     InputManager.layerIndex_Default = LayerMask.NameToLayer("Default");
  357.     InputManager.layerIndex_TransparentFX = LayerMask.NameToLayer("TransparentFX");
  358.     InputManager.layerIndex_IgnoreRaycast = LayerMask.NameToLayer("Ignore Raycast");
  359.     InputManager.layerIndex_Water = LayerMask.NameToLayer("Water");
  360.     InputManager.layerIndex_Terrain = LayerMask.NameToLayer("Terrain");
  361.     InputManager.layerIndex_Mob = LayerMask.NameToLayer("Mob");
  362.     InputManager.layerIndex_DynamicObject = LayerMask.NameToLayer("DynamicObject");
  363.     InputManager.layerIndex_StaticMeshes = LayerMask.NameToLayer("StaticMeshes");
  364.     InputManager.layerIndex_InventoryGUI = LayerMask.NameToLayer("InventoryGUI");
  365.     InputManager.layerIndex_HUD = LayerMask.NameToLayer("HUD");
  366.     InputManager.layerIndex_MiniMapIcon = LayerMask.NameToLayer("MiniMapIcon");
  367.     InputManager.layerIndex_Floor = LayerMask.NameToLayer("Floor");
  368.     InputManager.layerIndex_Wall = LayerMask.NameToLayer("Wall");
  369.     InputManager.layerIndex_FadeOutOnly = LayerMask.NameToLayer("FadeOutOnly");
  370.     InputManager.layerIndex_FadedFloor = LayerMask.NameToLayer("FadedFloor");
  371.     InputManager.layerIndex_FadedWall = LayerMask.NameToLayer("FadedWall");
  372.     InputManager.layerIndex_Cover = LayerMask.NameToLayer("Cover");
  373.     InputManager.layerIndex_DressingRoom = LayerMask.NameToLayer("DressingRoom");
  374.     InputManager.layerIndex_SpeechBubbles = LayerMask.NameToLayer("SpeechBubbles");
  375.     InputManager.layerIndex_MovingObjects = LayerMask.NameToLayer("MovingObjects");
  376.     InputManager.layerMask_Default = 1 << InputManager.layerIndex_Default;
  377.     InputManager.layerMask_TransparentFX = 1 << InputManager.layerIndex_TransparentFX;
  378.     InputManager.layerMask_IgnoreRaycast = 1 << InputManager.layerIndex_IgnoreRaycast;
  379.     InputManager.layerMask_Water = 1 << InputManager.layerIndex_Water;
  380.     InputManager.layerMask_Terrain = 1 << InputManager.layerIndex_Terrain;
  381.     InputManager.layerMask_Mob = 1 << InputManager.layerIndex_Mob;
  382.     InputManager.layerMask_DynamicObject = 1 << InputManager.layerIndex_DynamicObject;
  383.     InputManager.layerMask_StaticMeshes = 1 << InputManager.layerIndex_StaticMeshes;
  384.     InputManager.layerMask_InventoryGUI = 1 << InputManager.layerIndex_InventoryGUI;
  385.     InputManager.layerMask_HUD = 1 << InputManager.layerIndex_HUD;
  386.     InputManager.layerMask_MiniMapIcon = 1 << InputManager.layerIndex_MiniMapIcon;
  387.     InputManager.layerMask_Floor = 1 << InputManager.layerIndex_Floor;
  388.     InputManager.layerMask_Wall = 1 << InputManager.layerIndex_Wall;
  389.     InputManager.layerMask_FadeOutOnly = 1 << InputManager.layerIndex_FadeOutOnly;
  390.     InputManager.layerMask_FadedFloor = 1 << InputManager.layerIndex_FadedFloor;
  391.     InputManager.layerMask_FadedWall = 1 << InputManager.layerIndex_FadedWall;
  392.     InputManager.layerMask_Cover = 1 << InputManager.layerIndex_Cover;
  393.     InputManager.layerMask_DressingRoom = 1 << InputManager.layerIndex_DressingRoom;
  394.     InputManager.layerMask_SpeechBubbles = 1 << InputManager.layerIndex_SpeechBubbles;
  395.     InputManager.layerMask_MovingObjects = 1 << InputManager.layerIndex_MovingObjects;
  396.     InputManager.navMeshLayerIndex_Default = NavMesh.GetNavMeshLayerFromName("Default");
  397.     InputManager.navMeshLayerIndex_Ladders = NavMesh.GetNavMeshLayerFromName("Ladders");
  398.     InputManager.navMeshLayerIndex_Door = NavMesh.GetNavMeshLayerFromName("Door");
  399.   }
  400.  
  401.   public void SetEdgeScrolling(bool scroll)
  402.   {
  403.     this.bEdgeScrolling = scroll;
  404.   }
  405.  
  406.   [DebuggerHidden]
  407.   public IEnumerable<PC> GetMovementPCs(PC pcPoint = null)
  408.   {
  409.     // ISSUE: object of a compiler-generated type is created
  410.     // ISSUE: variable of a compiler-generated type
  411.     InputManager.\u003CGetMovementPCs\u003Ec__Iterator8EE movementPcsCIterator8Ee = new InputManager.\u003CGetMovementPCs\u003Ec__Iterator8EE()
  412.     {
  413.       pcPoint = pcPoint,
  414.       \u003C\u0024\u003EpcPoint = pcPoint,
  415.       \u003C\u003Ef__this = this
  416.     };
  417.     int num = -2;
  418.     // ISSUE: reference to a compiler-generated field
  419.     movementPcsCIterator8Ee.\u0024PC = num;
  420.     return (IEnumerable<PC>) movementPcsCIterator8Ee;
  421.   }
  422.  
  423.   public void TogglePartyIsGrouped()
  424.   {
  425.     this.isPartyMovementGrouped = !this.isPartyMovementGrouped;
  426.     PC pc = MonoBehaviourSingleton<Game>.GetInstance(false).pcLeader;
  427.     using (List<PC>.Enumerator enumerator = MonoBehaviourSingleton<Game>.GetInstance(false).party.GetEnumerator())
  428.     {
  429.       while (enumerator.MoveNext())
  430.       {
  431.         PC current = enumerator.Current;
  432.         if (this.selectedMobs.Contains((Mob) current))
  433.         {
  434.           if (!this.isPartyGrouped && (UnityEngine.Object) current != (UnityEngine.Object) pc)
  435.             this.RemoveFromSelection((Mob) current, true);
  436.         }
  437.         else if (this.isPartyGrouped)
  438.           this.AddToSelection((Mob) current);
  439.         current.isSelected = this.isPartyGrouped || (UnityEngine.Object) current == (UnityEngine.Object) pc;
  440.       }
  441.     }
  442.     MonoBehaviourSingleton<Game>.GetInstance(false).pcLeader.MakeLeader();
  443.     using (List<PC>.Enumerator enumerator = MonoBehaviourSingleton<Game>.GetInstance(false).party.GetEnumerator())
  444.     {
  445.       while (enumerator.MoveNext())
  446.       {
  447.         PC current = enumerator.Current;
  448.         current.ShowSelectedFX(current.isSelected);
  449.       }
  450.     }
  451.     EventInfo_PartyGroupedChanged partyGroupedChanged = ObjectPool.Get<EventInfo_PartyGroupedChanged>();
  452.     partyGroupedChanged.isPartyGrouped = this.isPartyMovementGrouped;
  453.     MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) partyGroupedChanged);
  454.   }
  455.  
  456.   protected override void Init()
  457.   {
  458.     this.useGUILayout = false;
  459.     MonoBehaviourSingleton<CursorManager>.GetInstance(false);
  460.     this.SetCursorClipRect(true);
  461.   }
  462.  
  463.   protected override void SceneStart()
  464.   {
  465.     this.moveClick = false;
  466.     this.actionClick = false;
  467.     this.formationDelay = 0.5f;
  468.     this.navHit = new NavMeshHit();
  469.     this.SetupFormation(ref this.formation, MonoBehaviourSingleton<FormationManager>.GetInstance(false).GetFormationTemplate("VIP"));
  470.     this.SetupFormation(ref this.formationInstigate, MonoBehaviourSingleton<FormationManager>.GetInstance(false).GetFormationTemplate("Wedge"));
  471.     GameObject gameObject1 = (GameObject) UnityEngine.Object.Instantiate((UnityEngine.Object) this.moveBlockedFxPrefab, Vector3.zero, Quaternion.identity);
  472.     this.blockedCursor = gameObject1.GetComponent<BlockedCursor>();
  473.     gameObject1.SetActive(false);
  474.     GameObject gameObject2 = (GameObject) UnityEngine.Object.Instantiate((UnityEngine.Object) this.movePositionFxPrefab, Vector3.zero, Quaternion.identity);
  475.     this.moveCursor = gameObject2.GetComponent<MoveCursor>();
  476.     gameObject2.SetActive(false);
  477.     this.bEdgeScrolling = PlayerPrefs.GetInt(OptionsMenu.EdgeScrolling, 0) == 1;
  478.   }
  479.  
  480.   private void OnApplicationFocus(bool hasFocus)
  481.   {
  482.     if (!hasFocus)
  483.     {
  484.       Screen.showCursor = true;
  485.       this.SetCursorClipRect(false);
  486.     }
  487.     if (!hasFocus)
  488.     {
  489.       if (!this.hasLostFocus)
  490.         this.SetFreezeInput(true, "App Focus Lost");
  491.     }
  492.     else if (this.hasLostFocus)
  493.       this.SetFreezeInput(false, "App Focus Gained");
  494.     this.hasLostFocus = !hasFocus;
  495.   }
  496.  
  497.   protected virtual void UpdateCamera()
  498.   {
  499.     if (Drama.isConversationOn || !this.freezeInput)
  500.     {
  501.       if (cInput.GetButtonDown("Fire3"))
  502.         this.lastMiddleClickPosition = Input.mousePosition;
  503.       if (cInput.GetButton("Fire3"))
  504.       {
  505.         this.cameraMove.z = Input.mousePosition.x - this.lastMiddleClickPosition.x;
  506.         this.lastMiddleClickPosition = Input.mousePosition;
  507.       }
  508.       else
  509.         this.cameraMove.z = 0.0f;
  510.     }
  511.     if (this.freezeInput)
  512.       return;
  513.     this.cameraMove.x = Input.GetAxisRaw("Horizontal");
  514.     this.cameraMove.y = Input.GetAxisRaw("Vertical");
  515.     if (!this.bEdgeScrolling)
  516.       return;
  517.     if ((double) Input.mousePosition.x >= (double) (Screen.width - 10))
  518.       this.cameraMove.x = 1f;
  519.     else if ((double) Input.mousePosition.x <= 10.0)
  520.       this.cameraMove.x = -1f;
  521.     if ((double) Input.mousePosition.y >= (double) (Screen.height - 10))
  522.     {
  523.       this.cameraMove.y = 1f;
  524.     }
  525.     else
  526.     {
  527.       if ((double) Input.mousePosition.y > 10.0)
  528.         return;
  529.       this.cameraMove.y = -1f;
  530.     }
  531.   }
  532.  
  533.   public bool OnButtonDown(string buttonName)
  534.   {
  535.     if (Drama.isConversationOn || !this.IsInputFrozen())
  536.     {
  537.       if (buttonName == InputManager.RotateCameraLeft)
  538.       {
  539.         this.cameraMove.w = -1f;
  540.         return true;
  541.       }
  542.       else if (buttonName == InputManager.RotateCameraRight)
  543.       {
  544.         this.cameraMove.w = 1f;
  545.         return true;
  546.       }
  547.     }
  548.     if (this.IsInputFrozen() || MonoBehaviourSingleton<Game>.GetInstance(false).state != GameState.Gameplay && MonoBehaviourSingleton<Game>.GetInstance(false).state != GameState.RandomEncounter)
  549.       return false;
  550.     if (buttonName == InputManager.NextMob)
  551.     {
  552.       this.SelectNextMob(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift));
  553.       return true;
  554.     }
  555.     else
  556.     {
  557.       if (buttonName == InputManager.ShowGrid)
  558.       {
  559.         if (MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat && MonoBehaviourSingleton<CombatManager>.GetInstance(false).isPlayersTurn)
  560.         {
  561.           MonoBehaviourSingleton<CombatAStar>.GetInstance(false).ShowMap(!MonoBehaviourSingleton<CombatAStar>.GetInstance(false).gridOn);
  562.           return true;
  563.         }
  564.       }
  565.       else if (buttonName == InputManager.SwapWeapons)
  566.       {
  567.         using (List<Mob>.Enumerator enumerator = this.selectedMobs.GetEnumerator())
  568.         {
  569.           while (enumerator.MoveNext())
  570.           {
  571.             Mob current = enumerator.Current;
  572.             if (current is PC)
  573.             {
  574.               EventInfo_CommandSwapWeapons commandSwapWeapons = ObjectPool.Get<EventInfo_CommandSwapWeapons>();
  575.               commandSwapWeapons.mob = current;
  576.               MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) commandSwapWeapons);
  577.             }
  578.           }
  579.         }
  580.         return true;
  581.       }
  582.       else if (buttonName == InputManager.AreaAttack)
  583.       {
  584.         if ((UnityEngine.Object) this.activePCs[0] != (UnityEngine.Object) null && (this.activePCs[0].stats.GetWeaponTemplate().weaponType == WeaponType.Thrown || this.activePCs[0].stats.GetWeaponTemplate().weaponType == WeaponType.RPG))
  585.           UseASIManager.SetActiveASIName("aoeattack");
  586.         else
  587.           UseASIManager.SetActiveASIName("attack");
  588.         return true;
  589.       }
  590.       else if (buttonName == InputManager.HighlightAll)
  591.       {
  592.         EventInfo_HighlightAll infoHighlightAll = ObjectPool.Get<EventInfo_HighlightAll>();
  593.         infoHighlightAll.highlight = true;
  594.         MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) infoHighlightAll);
  595.         return true;
  596.       }
  597.       else if (buttonName == InputManager.ShowAttackRange)
  598.       {
  599.         if (this.activePCs.Count > 0)
  600.           this.activePCs[0].ShowAttackRangeFX(true, 2);
  601.         return true;
  602.       }
  603.       else if (buttonName.StartsWith(InputManager.SelectPlayer))
  604.       {
  605.         string s = buttonName.Substring(InputManager.SelectPlayer.Length);
  606.         int result = -1;
  607.         if (int.TryParse(s, out result))
  608.         {
  609.           --result;
  610.           if (result >= 0 && result < MonoBehaviourSingleton<Game>.GetInstance(false).party.Count)
  611.           {
  612.             PC pc1 = MonoBehaviourSingleton<Game>.GetInstance(false).party[result];
  613.             bool flag = pc1.isSelected;
  614.             if (!Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift) && (!Input.GetKey(KeyCode.LeftControl) && !Input.GetKey(KeyCode.RightControl)))
  615.               this.ClearSelection(false);
  616.             if (!pc1.isSelected)
  617.             {
  618.               PC pc2 = MonoBehaviourSingleton<Game>.GetInstance(false).pcLeader;
  619.               pc1.MakeLeader();
  620.               this.AddToSelection((Mob) pc1);
  621.               pc2.ShowSelectedFX(pc2.isSelected);
  622.               if (flag && MonoBehaviourSingleton<HUD_Controller>.HasInstance())
  623.                 MonoBehaviourSingleton<HUD_Controller>.GetInstance(false).PartyMemberCenterCamera(pc1);
  624.             }
  625.             else
  626.               this.RemoveFromSelection((Mob) pc1, true);
  627.           }
  628.         }
  629.         return true;
  630.       }
  631.       else if (MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat && MonoBehaviourSingleton<CombatManager>.GetInstance(false).isPlayersTurn && (buttonName == InputManager.EndTurn && this.activePCs.Count > 0) && this.activePCs[0].combatActionState == Mob.CombatActionState.THINKING)
  632.         this.activePCs[0].combatActionState = Mob.CombatActionState.FINISHED;
  633.       if (MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat && MonoBehaviourSingleton<CombatManager>.GetInstance(false).isPlayersTurn && buttonName == InputManager.AttackTarget)
  634.       {
  635.         NPC selectedNpc = this.GetSelectedNPC();
  636.         if (MonoBehaviourSingleton<CombatManager>.GetInstance(false).GetCurrentMob() is PC && (UnityEngine.Object) selectedNpc != (UnityEngine.Object) null && selectedNpc.HatesParty())
  637.         {
  638.           PC pc = MonoBehaviourSingleton<CombatManager>.GetInstance(false).GetCurrentMob() as PC;
  639.           bool flag = UseASIManager.GetActiveASIName() == "aoeattack";
  640.           if (pc.inventory.equipment[7].template is ItemTemplate_WeaponAoe)
  641.             flag = true;
  642.           if (flag)
  643.           {
  644.             UseASIManager.SetActiveASIName((string) null);
  645.             pc.UseAOEWeapon(MonoBehaviourSingleton<CursorManager>.GetInstance(false).arcAimPosition, MonoBehaviourSingleton<CursorManager>.GetInstance(false).spherePosition);
  646.           }
  647.           else
  648.           {
  649.             UseASIManager.SetActiveASIName((string) null);
  650.             EventInfo_CommandAttack infoCommandAttack = ObjectPool.Get<EventInfo_CommandAttack>();
  651.             infoCommandAttack.pc = pc;
  652.             infoCommandAttack.target = (Targetable) selectedNpc;
  653.             MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) infoCommandAttack);
  654.             MonoBehaviourSingleton<Game>.GetInstance(false).cameraController.FollowPC(pc);
  655.           }
  656.         }
  657.       }
  658.       else if (buttonName == InputManager.SpawnTestParty)
  659.       {
  660.         Game instance = MonoBehaviourSingleton<Game>.GetInstance(false);
  661.         LevelInfo levelInfo = instance.GetLevelInfo();
  662.         if (levelInfo.partyTemplates == null || levelInfo.partyTemplates.Length == 0)
  663.         {
  664.           InXile.LogWarning(LogChannel.Default, "No custom party to spawn.  Add custom party templates to the level info.");
  665.           return true;
  666.         }
  667.         else
  668.         {
  669.           for (int index = instance.party.Count - 1; index >= 0; --index)
  670.           {
  671.             PC pc = instance.party[index];
  672.             pc.ai.Shutdown();
  673.             UnityEngine.Object.Destroy((UnityEngine.Object) pc.gameObject);
  674.           }
  675.           instance.party.Clear();
  676.           instance.partyTemplates = levelInfo.partyTemplates;
  677.           instance.SpawnParty();
  678.         }
  679.       }
  680.       return false;
  681.     }
  682.   }
  683.  
  684.   public bool OnButtonUp(string buttonName)
  685.   {
  686.     if (buttonName == InputManager.RotateCameraLeft && (double) this.cameraMove.w == -1.0)
  687.     {
  688.       this.cameraMove.w = 0.0f;
  689.       return true;
  690.     }
  691.     else if (buttonName == InputManager.RotateCameraRight && (double) this.cameraMove.w == 1.0)
  692.     {
  693.       this.cameraMove.w = 0.0f;
  694.       return true;
  695.     }
  696.     else
  697.     {
  698.       if (MonoBehaviourSingleton<Game>.GetInstance(false).state == GameState.Gameplay || MonoBehaviourSingleton<Game>.GetInstance(false).state == GameState.RandomEncounter)
  699.       {
  700.         if (buttonName == InputManager.HighlightAll)
  701.         {
  702.           EventInfo_HighlightAll infoHighlightAll = ObjectPool.Get<EventInfo_HighlightAll>();
  703.           infoHighlightAll.highlight = false;
  704.           MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) infoHighlightAll);
  705.           return true;
  706.         }
  707.         else if (buttonName == InputManager.ShowAttackRange)
  708.         {
  709.           if (this.activePCs.Count > 0 && PlayerPrefs.GetInt(OptionsMenu.DrawWeaponRanges) != 1)
  710.             this.activePCs[0].ShowAttackRangeFX(false, 2);
  711.           return true;
  712.         }
  713.       }
  714.       return false;
  715.     }
  716.   }
  717.  
  718.   private void CheckInstigateDrama(RaycastHit hit, bool doubleClick)
  719.   {
  720.     Drama drama = (Drama) null;
  721.     if ((bool) ((UnityEngine.Object) hit.transform.GetComponent<RaycastPropagate>()))
  722.     {
  723.       if ((UnityEngine.Object) hit.transform.GetComponent<RaycastPropagate>().target != (UnityEngine.Object) null)
  724.         drama = hit.transform.GetComponent<RaycastPropagate>().target.GetComponent<Drama>();
  725.     }
  726.     else
  727.       drama = hit.transform.GetComponent<Drama>();
  728.     if ((UnityEngine.Object) drama != (UnityEngine.Object) null)
  729.     {
  730.       if (UseASIManager.IsSkillASI(UseASIManager.GetActiveASIName()) && CursorManager.ASIMatchesObject(drama.transform, MonoBehaviourSingleton<CursorManager>.GetInstance(false).GetCurrentCursor(), UseASIManager.GetActiveASIItem()))
  731.         AudioManager.Play("Skill_Click_Matching");
  732.       Drama.CheckInstigate(drama, this.GetFirstSelectedPlayer(), doubleClick);
  733.     }
  734.     else
  735.     {
  736.       SkillObject_Examine component = hit.transform.GetComponent<SkillObject_Examine>();
  737.       if (!((UnityEngine.Object) component != (UnityEngine.Object) null) || component.difficulty != SkillLevelCategory.None)
  738.         return;
  739.       this.CheckExamineDrama(hit);
  740.     }
  741.   }
  742.  
  743.   private void CheckExamineDrama(RaycastHit hit)
  744.   {
  745.     Drama drama = (Drama) null;
  746.     if ((bool) ((UnityEngine.Object) hit.transform.GetComponent<RaycastPropagate>()))
  747.     {
  748.       if ((UnityEngine.Object) hit.transform.GetComponent<RaycastPropagate>().target != (UnityEngine.Object) null)
  749.         drama = hit.transform.GetComponent<RaycastPropagate>().target.GetComponent<Drama>();
  750.     }
  751.     else
  752.       drama = hit.transform.GetComponent<Drama>();
  753.     if ((UnityEngine.Object) drama != (UnityEngine.Object) null)
  754.     {
  755.       Drama.ExamineDrama(drama, MonoBehaviourSingleton<Game>.GetInstance(false).GetFirstSelectedPC(), hit);
  756.     }
  757.     else
  758.     {
  759.       GameObject gameObject = hit.transform.gameObject;
  760.       if ((bool) ((UnityEngine.Object) hit.transform.GetComponent<RaycastPropagate>()) && (UnityEngine.Object) hit.transform.GetComponent<RaycastPropagate>().target != (UnityEngine.Object) null)
  761.         gameObject = hit.transform.GetComponent<RaycastPropagate>().target.gameObject;
  762.       Drama.ExamineDescriptionObject(gameObject, this.ClosestSelectedPC(hit.point));
  763.     }
  764.   }
  765.  
  766.   private void UpdateSelection()
  767.   {
  768.     if (cInput.GetButtonDown("Fire1") && !Drama.isConversationOn)
  769.     {
  770.       if (UseASIManager.GetActiveASIName() == "aoeattack")
  771.       {
  772.         InXile.Log(LogChannel.Input, "Blow that shit up! " + this.selectedMobs[0].name);
  773.         UseASIManager.SetActiveASIName((string) null);
  774.         (this.selectedMobs[0] as PC).UseAOEWeapon(MonoBehaviourSingleton<CursorManager>.GetInstance(false).arcAimPosition, MonoBehaviourSingleton<CursorManager>.GetInstance(false).spherePosition);
  775.       }
  776.       this.mouseDownPos = Input.mousePosition;
  777.       this.wasMouseDownShift = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
  778.       this.wasMouseDownCtrl = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
  779.       this.pcLeaderOnDragStart = MonoBehaviourSingleton<Game>.GetInstance(false).pcLeader;
  780.     }
  781.     else if (cInput.GetButtonUp("Fire1") && (UnityEngine.Object) Camera.main != (UnityEngine.Object) null)
  782.     {
  783.       if (this.actionClick)
  784.         this.actionClick = false;
  785.       else if ((double) (this.mouseDownPos - Input.mousePosition).sqrMagnitude > 16.0)
  786.       {
  787.         if ((UnityEngine.Object) this.pcLeaderOnDragStart != (UnityEngine.Object) null && !this.selectedMobs.Contains((Mob) this.pcLeaderOnDragStart))
  788.         {
  789.           float num = float.PositiveInfinity;
  790.           PC pc = (PC) null;
  791.           using (List<PC>.Enumerator enumerator = MonoBehaviourSingleton<Game>.GetInstance(false).party.GetEnumerator())
  792.           {
  793.             while (enumerator.MoveNext())
  794.             {
  795.               PC current = enumerator.Current;
  796.               if (this.selectedMobs.Contains((Mob) current))
  797.               {
  798.                 Vector3 vector3 = Camera.main.WorldToViewportPoint(current.transform.position);
  799.                 vector3.x *= (float) Screen.width;
  800.                 vector3.y *= (float) Screen.height;
  801.                 float sqrMagnitude = (vector3 - this.mouseDownPos).sqrMagnitude;
  802.                 if ((double) sqrMagnitude < (double) num)
  803.                 {
  804.                   num = sqrMagnitude;
  805.                   pc = current;
  806.                 }
  807.               }
  808.             }
  809.           }
  810.           if ((UnityEngine.Object) pc != (UnityEngine.Object) null)
  811.           {
  812.             pc.MakeLeader();
  813.             this.pcLeaderOnDragStart.ShowSelectedFX(this.pcLeaderOnDragStart.isSelected);
  814.           }
  815.         }
  816.         this.pcLeaderOnDragStart = (PC) null;
  817.       }
  818.       else
  819.       {
  820.         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  821.         RaycastHit hitInfo = new RaycastHit();
  822.         int layerMask = ~(InputManager.layerMask_Terrain | InputManager.layerMask_FadeOutOnly | InputManager.layerMask_FadedFloor | InputManager.layerMask_FadedWall | InputManager.layerMask_IgnoreRaycast | InputManager.layerMask_TransparentFX | InputManager.layerMask_HUD | InputManager.layerMask_InventoryGUI);
  823.         if (Physics.Raycast(ray, out hitInfo, float.PositiveInfinity, layerMask))
  824.         {
  825.           Mob component = hitInfo.transform.GetComponent<Mob>();
  826.           if (!Drama.isConversationOn || Drama.IsPCInConversation(!(bool) ((UnityEngine.Object) component) ? (PC) null : component.asPartyPC))
  827.           {
  828.             if ((bool) ((UnityEngine.Object) component) && component.mobState != Mob.MobState.DEAD)
  829.             {
  830.               if (MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat)
  831.               {
  832.                 if (MonoBehaviourSingleton<CombatManager>.GetInstance(false).isPlayersTurn)
  833.                 {
  834.                   this.ClearSelection(true);
  835.                   if (component is PC)
  836.                     MonoBehaviourSingleton<Game>.GetInstance(false).cameraController.Snap(component.transform.position, false);
  837.                   else
  838.                     this.AddToSelection(component);
  839.                 }
  840.               }
  841.               else if (component is PC)
  842.               {
  843.                 if (this.isPartyGrouped)
  844.                 {
  845.                   this.ClearSelection(false);
  846.                   (component as PC).MakeLeader();
  847.                 }
  848.                 else if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt) || (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) || (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)))
  849.                 {
  850.                   if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
  851.                   {
  852.                     PC pc = MonoBehaviourSingleton<Game>.GetInstance(false).pcLeader;
  853.                     (component as PC).MakeLeader();
  854.                     this.AddToSelection(component);
  855.                     pc.ShowSelectedFX(pc.isSelected);
  856.                   }
  857.                   else if ((component as PC).isSelected)
  858.                   {
  859.                     if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
  860.                       this.RemoveFromSelection(component, true);
  861.                   }
  862.                   else
  863.                     this.AddToSelection(component);
  864.                 }
  865.                 else
  866.                 {
  867.                   this.ClearSelection(false);
  868.                   (component as PC).MakeLeader();
  869.                 }
  870.               }
  871.               else
  872.               {
  873.                 this.ClearSelection(true);
  874.                 this.AddToSelection(component);
  875.               }
  876.             }
  877.             else
  878.               this.ClearSelection(true);
  879.           }
  880.         }
  881.         if (MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat || this.isPCSelected() || MonoBehaviourSingleton<Game>.GetInstance(false).party.Count <= 0)
  882.           return;
  883.         this.AddToSelection((Mob) MonoBehaviourSingleton<Game>.GetInstance(false).pcLeader);
  884.       }
  885.     }
  886.     else
  887.     {
  888.       if (!cInput.GetButton("Fire1") || Drama.isConversationOn || MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat || ((double) (this.mouseDownPos - Input.mousePosition).sqrMagnitude <= 16.0 || !this.selectionRectActive))
  889.         return;
  890.       this.ClearSelection(true);
  891.       bool flag1 = false;
  892.       Game instance = MonoBehaviourSingleton<Game>.GetInstance(false);
  893.       Rect rect = this.MakeSelectionRect(this.mouseDownPos, Input.mousePosition);
  894.       for (int index = 0; index < instance.party.Count; ++index)
  895.       {
  896.         PC pc = instance.party[index];
  897.         Vector3 point = Camera.main.WorldToViewportPoint(pc.transform.position);
  898.         point.x *= (float) Screen.width;
  899.         point.y *= (float) Screen.height;
  900.         if (rect.Contains(point))
  901.         {
  902.           bool flag2 = !this.wasMouseDownCtrl || pc.isLeader;
  903.           flag1 = flag1 | pc.isSelected != flag2;
  904.           pc.isSelected = flag2;
  905.           if (flag2)
  906.           {
  907.             this.AddToSelection((Mob) pc);
  908.             if (!this.activePCs.Contains(pc))
  909.               this.activePCs.Add(pc);
  910.           }
  911.           else
  912.           {
  913.             this.RemoveFromSelection((Mob) pc, false);
  914.             if (this.activePCs.Contains(pc))
  915.               this.activePCs.Remove(pc);
  916.           }
  917.         }
  918.         else if (!this.wasMouseDownShift && !this.wasMouseDownCtrl)
  919.         {
  920.           flag1 = flag1 | pc.isSelected;
  921.           this.RemoveFromSelection((Mob) pc, false);
  922.           if (this.activePCs.Contains(pc))
  923.             this.activePCs.Remove(pc);
  924.         }
  925.       }
  926.       if (!flag1)
  927.         return;
  928.       MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) ObjectPool.Get<EventInfo_CharacterSelectionChanged>());
  929.     }
  930.   }
  931.  
  932.   private void Update()
  933.   {
  934.     if ((Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)) && (double) Input.mousePosition.x >= 0.0 && ((double) Input.mousePosition.y >= 0.0 && (double) Input.mousePosition.x <= (double) Screen.width) && (double) Input.mousePosition.y <= (double) Screen.height)
  935.       this.SetCursorClipRect(true);
  936.     CombatManager instance1 = MonoBehaviourSingleton<CombatManager>.GetInstance(false);
  937.     if (this.ignoreMousePosition && Input.mousePosition != this.ignoredMousePosition)
  938.       this.ignoreMousePosition = false;
  939.     if (MonoBehaviourSingleton<Game>.GetInstance(false).state != GameState.Gameplay && MonoBehaviourSingleton<Game>.GetInstance(false).state != GameState.RandomEncounter)
  940.       return;
  941.     this.UpdateCamera();
  942.     if (this.freezeInput)
  943.     {
  944.       if (MonoBehaviourSingleton<GUIManager>.GetInstance(false).WillUseMouseClick())
  945.         return;
  946.       this.UpdateSelection();
  947.     }
  948.     else
  949.     {
  950.       bool flag1 = false;
  951.       if (!MonoBehaviourSingleton<GUIManager>.GetInstance(false).WillUseMouseClick())
  952.       {
  953.         this.UpdateSelection();
  954.         this.activePCs.Clear();
  955.         if (instance1.inCombat)
  956.         {
  957.           Mob currentMob = instance1.GetCurrentMob();
  958.           if ((bool) ((UnityEngine.Object) currentMob))
  959.           {
  960.             PC asPartyPc = currentMob.asPartyPC;
  961.             if ((bool) ((UnityEngine.Object) asPartyPc))
  962.               this.activePCs.Add(asPartyPc);
  963.           }
  964.         }
  965.         else
  966.         {
  967.           using (List<Mob>.Enumerator enumerator = this.selectedMobs.GetEnumerator())
  968.           {
  969.             while (enumerator.MoveNext())
  970.             {
  971.               PC asPartyPc = enumerator.Current.asPartyPC;
  972.               if ((UnityEngine.Object) asPartyPc != (UnityEngine.Object) null)
  973.                 this.activePCs.Add(asPartyPc);
  974.             }
  975.           }
  976.           if (this.activePCs.Count == 0)
  977.             this.activePCs.Add(MonoBehaviourSingleton<Game>.GetInstance(false).pcLeader);
  978.         }
  979.         if (cInput.GetButtonDown("Fire1") && (UnityEngine.Object) Camera.main != (UnityEngine.Object) null)
  980.         {
  981.           int layerMask = InputManager.layerMask_Terrain | InputManager.layerMask_Floor | InputManager.layerMask_Mob | InputManager.layerMask_DynamicObject | InputManager.layerMask_Wall | InputManager.layerMask_Cover;
  982.           Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  983.           RaycastHit hitInfo = new RaycastHit();
  984.           if (Physics.Raycast(ray, out hitInfo, 100f, layerMask) && (bool) ((UnityEngine.Object) hitInfo.transform))
  985.           {
  986.             AnalyticsManager instance2 = MonoBehaviourSingleton<AnalyticsManager>.GetInstance(false);
  987.             string evt = !this.didDoubleLeftClick ? "Left Click" : " Left Double-Click";
  988.             string levelNameCurrent = MonoBehaviourSingleton<Game>.GetInstance(false).levelNameCurrent;
  989.             string[] strArray = new string[3];
  990.             int index1 = 0;
  991.             string str1 = hitInfo.transform.position.x.ToString();
  992.             strArray[index1] = str1;
  993.             int index2 = 1;
  994.             string str2 = hitInfo.transform.position.y.ToString();
  995.             strArray[index2] = str2;
  996.             int index3 = 2;
  997.             string str3 = this.clickPosition.z.ToString();
  998.             strArray[index3] = str3;
  999.             instance2.LogApTrak(evt, levelNameCurrent, strArray);
  1000.             bool flag2 = false;
  1001.             string activeAsiName = UseASIManager.GetActiveASIName();
  1002.             if (MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat)
  1003.             {
  1004.               PC pc = MonoBehaviourSingleton<CombatManager>.GetInstance(false).GetCurrentMob() as PC;
  1005.               if (MonoBehaviourSingleton<CombatManager>.GetInstance(false).isPlayersTurn && (UnityEngine.Object) pc != (UnityEngine.Object) null)
  1006.                 flag2 = pc.combatActionState == Mob.CombatActionState.THINKING;
  1007.             }
  1008.             else if (activeAsiName == "attack")
  1009.               flag2 = true;
  1010.             bool flag3 = MonoBehaviourSingleton<CursorManager>.GetInstance(false).GetCurrentCursor() == CursorManager.Cursors.Reload || MonoBehaviourSingleton<CursorManager>.GetInstance(false).GetCurrentCursor() == CursorManager.Cursors.CantReload;
  1011.             if ((!MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat || flag2) && (activeAsiName == "attack" || flag3))
  1012.             {
  1013.               UseASIManager.SetActiveASIName((string) null);
  1014.               Targetable targetable = !(bool) ((UnityEngine.Object) hitInfo.transform.GetComponent<RaycastPropagate>()) ? hitInfo.transform.GetComponent<Targetable>() : hitInfo.transform.GetComponent<RaycastPropagate>().target.GetComponent<Targetable>();
  1015.               if ((UnityEngine.Object) targetable != (UnityEngine.Object) null && (double) targetable.curHP > 0.0 && !(targetable is PC))
  1016.               {
  1017.                 foreach (PC pc in this.GetMovementPCs((PC) null))
  1018.                 {
  1019.                   if (pc.IsOutOfAmmo())
  1020.                   {
  1021.                     if (pc.CanReload())
  1022.                     {
  1023.                       EventInfo_CommandReload infoCommandReload = ObjectPool.Get<EventInfo_CommandReload>();
  1024.                       infoCommandReload.mob = (Mob) pc;
  1025.                       MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) infoCommandReload);
  1026.                     }
  1027.                   }
  1028.                   else if ((UnityEngine.Object) pc != (UnityEngine.Object) targetable)
  1029.                   {
  1030.                     bool flag4 = false;
  1031.                     if ((UnityEngine.Object) this.SelectedLeaderPC() == (UnityEngine.Object) pc)
  1032.                       flag4 = true;
  1033.                     EventInfo_CommandAttack infoCommandAttack = ObjectPool.Get<EventInfo_CommandAttack>();
  1034.                     infoCommandAttack.pc = pc;
  1035.                     infoCommandAttack.target = targetable;
  1036.                     infoCommandAttack.meleeMoveToRange = flag4;
  1037.                     MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) infoCommandAttack);
  1038.                     MonoBehaviourSingleton<Game>.GetInstance(false).cameraController.FollowPC(pc);
  1039.                     this.actionClick = true;
  1040.                   }
  1041.                 }
  1042.               }
  1043.             }
  1044.             else if (UseASIManager.GetActiveASIName() == "useItem" && (UnityEngine.Object) UseASIManager.GetActiveASIItem() != (UnityEngine.Object) null && UseASIManager.GetActiveASIItem() is ItemInstance_Usable)
  1045.             {
  1046.               Transform t = hitInfo.transform;
  1047.               RaycastPropagate component1 = hitInfo.transform.GetComponent<RaycastPropagate>();
  1048.               if ((UnityEngine.Object) component1 != (UnityEngine.Object) null)
  1049.                 t = component1.target;
  1050.               Targetable component2 = t.GetComponent<Targetable>();
  1051.               Drama component3 = t.GetComponent<Drama>();
  1052.               Vector3 position = t.position;
  1053.               Vector3 vector3 = t.position;
  1054.               float num = 1.6f;
  1055.               if ((UnityEngine.Object) component3 != (UnityEngine.Object) null)
  1056.                 num = component3.instigateDistance;
  1057.               List<Transform> list = new List<Transform>();
  1058.               Drama.FindInstigatePointChildren(t, ref list);
  1059.               Transform transform = Drama.PickBestInstigatePoint(ref list, UseASIManager.GetActiveASIItemOwner().transform);
  1060.               if ((UnityEngine.Object) transform != (UnityEngine.Object) null)
  1061.               {
  1062.                 position = transform.position;
  1063.                 num = 0.5f;
  1064.                 vector3 = position + transform.forward * 10f;
  1065.               }
  1066.               EventInfo_CommandUseItem infoCommandUseItem = ObjectPool.Get<EventInfo_CommandUseItem>();
  1067.               infoCommandUseItem.destination = position;
  1068.               infoCommandUseItem.mob = (Mob) UseASIManager.GetActiveASIItemOwner();
  1069.               infoCommandUseItem.item = UseASIManager.GetActiveASIItem() as ItemInstance_Usable;
  1070.               infoCommandUseItem.lookAt = vector3;
  1071.               infoCommandUseItem.doubleClicked = this.didDoubleLeftClick;
  1072.               Vector3 nearestEdge;
  1073.               if ((UnityEngine.Object) component2 != (UnityEngine.Object) null)
  1074.               {
  1075.                 if ((bool) ((UnityEngine.Object) t.GetComponent<TargetableObject>()) && (UnityEngine.Object) transform == (UnityEngine.Object) null)
  1076.                   nearestEdge = t.GetComponent<TargetableObject>().GetNearestEdge(UseASIManager.GetActiveASIItemOwner().transform.position);
  1077.                 infoCommandUseItem.target = component2;
  1078.                 infoCommandUseItem.targetDrama = (Drama) null;
  1079.                 infoCommandUseItem.distance = num;
  1080.                 MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) infoCommandUseItem);
  1081.                 UseASIManager.SetActiveASIName((string) null);
  1082.                 UseASIManager.SetActiveASIItem((ItemInstance) null, (PC) null);
  1083.               }
  1084.               else if ((bool) ((UnityEngine.Object) component3))
  1085.               {
  1086.                 if ((bool) ((UnityEngine.Object) t.GetComponent<TargetableObject>()) && (UnityEngine.Object) transform == (UnityEngine.Object) null)
  1087.                   nearestEdge = t.GetComponent<TargetableObject>().GetNearestEdge(UseASIManager.GetActiveASIItemOwner().transform.position);
  1088.                 infoCommandUseItem.target = (Targetable) null;
  1089.                 infoCommandUseItem.targetDrama = component3;
  1090.                 infoCommandUseItem.distance = num;
  1091.                 MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) infoCommandUseItem);
  1092.                 UseASIManager.SetActiveASIName((string) null);
  1093.                 UseASIManager.SetActiveASIItem((ItemInstance) null, (PC) null);
  1094.               }
  1095.               else if ((UseASIManager.GetActiveASIItem().template as ItemTemplate_Usable).usableOnWorld)
  1096.               {
  1097.                 infoCommandUseItem.target = (Targetable) null;
  1098.                 infoCommandUseItem.distance = num;
  1099.                 MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) infoCommandUseItem);
  1100.                 UseASIManager.SetActiveASIName((string) null);
  1101.                 UseASIManager.SetActiveASIItem((ItemInstance) null, (PC) null);
  1102.               }
  1103.               MonoBehaviourSingleton<GlobalFxHandler>.GetInstance(false).InventoryItemOnSelectTarget();
  1104.               this.actionClick = true;
  1105.             }
  1106.             else if (UseASIManager.GetActiveASIName() != null)
  1107.             {
  1108.               this.CheckInstigateDrama(hitInfo, this.didDoubleLeftClick);
  1109.               this.actionClick = true;
  1110.             }
  1111.             else if (!(bool) ((UnityEngine.Object) hitInfo.transform.GetComponent<PC>()) || hitInfo.transform.GetComponent<PC>().mobState == Mob.MobState.DEAD)
  1112.               this.CheckInstigateDrama(hitInfo, this.didDoubleLeftClick);
  1113.           }
  1114.         }
  1115.         else if (cInput.GetButton("Fire2"))
  1116.         {
  1117.           if (cInput.GetButtonDown("Fire2") && MonoBehaviourSingleton<CursorManager>.GetInstance(false).UsingASI && UseASIManager.GetActiveASIName() != "attack")
  1118.           {
  1119.             this.moveClick = false;
  1120.             UseASIManager.SetActiveASIName((string) null);
  1121.           }
  1122.           else if (cInput.GetButtonDown("Fire2") && (bool) ((UnityEngine.Object) Camera.main))
  1123.           {
  1124.             this.moveClick = false;
  1125.             if (this.activePCs.Count > 0)
  1126.             {
  1127.               int layerMask = InputManager.layerMask_Terrain | InputManager.layerMask_Floor | InputManager.layerMask_Mob | InputManager.layerMask_DynamicObject | InputManager.layerMask_Wall;
  1128.               Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  1129.               RaycastHit hitInfo = new RaycastHit();
  1130.               if (Physics.Raycast(ray, out hitInfo, 100f, layerMask) && (bool) ((UnityEngine.Object) hitInfo.transform))
  1131.               {
  1132.                 this.clickPosition = hitInfo.point;
  1133.                 if (hitInfo.collider.transform.gameObject.layer == InputManager.layerIndex_Terrain || hitInfo.collider.transform.gameObject.layer == InputManager.layerIndex_Floor)
  1134.                 {
  1135.                   if (MonoBehaviourSingleton<CursorManager>.GetInstance(false).UsingASI)
  1136.                   {
  1137.                     this.moveClick = false;
  1138.                     UseASIManager.SetActiveASIName((string) null);
  1139.                   }
  1140.                   else
  1141.                   {
  1142.                     this.moveClick = true;
  1143.                     if (!MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat)
  1144.                     {
  1145.                       this.formationTimer = Time.time;
  1146.                       this.formation.Rotate(this.clickPosition + this.clickPosition - this.activePCs[0].transform.position, this.clickPosition);
  1147.                       this.formation.transform.position = this.clickPosition + new Vector3(0.0f, 0.1f, 0.0f);
  1148.                     }
  1149.                   }
  1150.                 }
  1151.                 else if (hitInfo.transform.gameObject.layer == InputManager.layerIndex_Mob)
  1152.                 {
  1153.                   if (!MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat || MonoBehaviourSingleton<CombatManager>.GetInstance(false).isPlayersTurn)
  1154.                   {
  1155.                     Mob component = hitInfo.transform.gameObject.GetComponent<Mob>();
  1156.                     if (component is NPC)
  1157.                     {
  1158.                       if (!this.IsSelected(component))
  1159.                       {
  1160.                         this.ClearSelection(true);
  1161.                         this.AddToSelection(component);
  1162.                       }
  1163.                       else
  1164.                         this.RemoveFromSelection(component, true);
  1165.                       this.CheckExamineDrama(hitInfo);
  1166.                     }
  1167.                     else if (this.IsSelected(component) && this.GetNumSelectedPCs() > 1 && (UnityEngine.Object) MonoBehaviourSingleton<Game>.GetInstance(false).pcLeader != (UnityEngine.Object) component)
  1168.                       this.RemoveFromSelection(component, true);
  1169.                   }
  1170.                 }
  1171.                 else if (hitInfo.transform.gameObject.layer == InputManager.layerIndex_DynamicObject)
  1172.                   this.CheckExamineDrama(hitInfo);
  1173.               }
  1174.             }
  1175.           }
  1176.           RaycastHit hitInfo1;
  1177.           if (this.formationSpinning && Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo1) && (double) Vector3.Distance(hitInfo1.point, this.clickPosition) > 0.5)
  1178.             this.formation.Rotate(hitInfo1.point, this.clickPosition);
  1179.           if (this.activePCs.Count > 1 && (double) this.formationTimer != -1.0 && (!this.formationSpinning && (double) Time.time - (double) this.formationTimer > (double) this.formationDelay))
  1180.           {
  1181.             if (!this.formationSpinning)
  1182.               this.formationTimer = -1f;
  1183.             RaycastHit hitInfo2;
  1184.             if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo2))
  1185.             {
  1186.               this.formationSpinning = true;
  1187.               this.formation.gameObject.SetActive(true);
  1188.               this.formation.ActivatePositions(this.activePCs.Count);
  1189.             }
  1190.           }
  1191.         }
  1192.         if (this.moveClick && cInput.GetButtonUp("Fire2") && ((bool) ((UnityEngine.Object) Camera.main) && UseASIManager.GetActiveASIName() == null))
  1193.         {
  1194.           this.moveClick = false;
  1195.           if (this.activePCs.Count > 0)
  1196.           {
  1197.             if (MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat && this.lastCombatSquare != null && (MonoBehaviourSingleton<CombatManager>.GetInstance(false).isPlayersTurn && this.activePCs[0].combatActionState == Mob.CombatActionState.THINKING))
  1198.             {
  1199.               if (MonoBehaviourSingleton<CombatAStar>.GetInstance(false).Search(this.activePCs[0].currentSquare, this.lastCombatSquare, true, this.activePCs[0].combatActionPointsRemaining, this.activePCs[0].stats.GetCombatSpeed()).Count > 0)
  1200.               {
  1201.                 int pathCost = MonoBehaviourSingleton<CombatAStar>.GetInstance(false).GetPathCost(this.activePCs[0].stats.GetCombatSpeed());
  1202.                 if (pathCost > 0)
  1203.                 {
  1204.                   MonoBehaviourSingleton<CombatAStar>.GetInstance(false).DrawSmoothPath(this.activePCs[0].pathOrigin.transform, this.activePCs[0].stats.GetCombatSpeed());
  1205.                   MonoBehaviourSingleton<GlobalFxHandler>.GetInstance(false).Combat_OnMove();
  1206.                   EventInfo_CommandMove eventInfoCommandMove = ObjectPool.Get<EventInfo_CommandMove>();
  1207.                   eventInfoCommandMove.mob = (Mob) this.activePCs[0];
  1208.                   eventInfoCommandMove.path = MonoBehaviourSingleton<CombatAStar>.GetInstance(false).VectorSmoothPath();
  1209.                   eventInfoCommandMove.actionPointCost = pathCost;
  1210.                   MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) eventInfoCommandMove);
  1211.                   MonoBehaviourSingleton<Game>.GetInstance(false).cameraController.FollowPC(this.activePCs[0]);
  1212.                   this.lastCombatSquare = (CombatAStarNode) null;
  1213.                   this.timerCombatSquare = (CombatAStarNode) null;
  1214.                 }
  1215.                 else
  1216.                   MonoBehaviourSingleton<CombatAStar>.GetInstance(false).ClearPath(this.activePCs[0].pathOrigin.transform);
  1217.               }
  1218.               else
  1219.                 MonoBehaviourSingleton<CombatAStar>.GetInstance(false).ClearPath(this.activePCs[0].pathOrigin.transform);
  1220.               MonoBehaviourSingleton<CursorManager>.GetInstance(false).RemoveText(this.cursorTextId);
  1221.               this.cursorTextId = -1;
  1222.             }
  1223.             else if (!MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat && this.activePCs.Count > 0)
  1224.             {
  1225.               bool flag2 = !NavMesh.SamplePosition(this.clickPosition, out this.navHit, 10f, 1 << NavMesh.GetNavMeshLayerFromName("Default") | 1 << NavMesh.GetNavMeshLayerFromName("Terrain"));
  1226.               if (!flag2 && (double) Vector2.Distance(new Vector2(this.navHit.position.x, this.navHit.position.z), new Vector2(this.clickPosition.x, this.clickPosition.z)) > 0.800000011920929)
  1227.                 flag2 = true;
  1228.               if (flag2)
  1229.               {
  1230.                 this.blockedCursor.ShowAt(this.clickPosition + Vector3.up * 0.05f);
  1231.               }
  1232.               else
  1233.               {
  1234.                 AnalyticsManager instance2 = MonoBehaviourSingleton<AnalyticsManager>.GetInstance(false);
  1235.                 string evt = !this.didDoubleLeftClick ? "Move Click" : " Move Double-Click";
  1236.                 string levelNameCurrent = MonoBehaviourSingleton<Game>.GetInstance(false).levelNameCurrent;
  1237.                 string[] strArray = new string[3];
  1238.                 int index1 = 0;
  1239.                 string str1 = this.clickPosition.x.ToString();
  1240.                 strArray[index1] = str1;
  1241.                 int index2 = 1;
  1242.                 string str2 = this.clickPosition.y.ToString();
  1243.                 strArray[index2] = str2;
  1244.                 int index3 = 2;
  1245.                 string str3 = this.clickPosition.z.ToString();
  1246.                 strArray[index3] = str3;
  1247.                 instance2.LogApTrak(evt, levelNameCurrent, strArray);
  1248.                 this.moveCursor.ShowAt(this.clickPosition + Vector3.up * 0.05f);
  1249.                 MonoBehaviourSingleton<Game>.GetInstance(false).cameraController.FollowPC(this.activePCs[0]);
  1250.                 if (this.movementPCsCount > 1)
  1251.                 {
  1252.                   this.MoveInFormation(this.formation, this.clickPosition, this.didDoubleRightClick, (PC) null, 0.0f);
  1253.                 }
  1254.                 else
  1255.                 {
  1256.                   EventInfo_CommandMove eventInfoCommandMove = ObjectPool.Get<EventInfo_CommandMove>();
  1257.                   eventInfoCommandMove.mob = (Mob) this.activePCs[0];
  1258.                   eventInfoCommandMove.destination = this.clickPosition;
  1259.                   eventInfoCommandMove.sprint = this.didDoubleRightClick;
  1260.                   MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) eventInfoCommandMove);
  1261.                 }
  1262.               }
  1263.             }
  1264.             this.formationTimer = -1f;
  1265.             this.formationSpinning = false;
  1266.             if ((UnityEngine.Object) this.formation != (UnityEngine.Object) null)
  1267.               this.formation.gameObject.SetActive(false);
  1268.           }
  1269.         }
  1270.         if (cInput.GetButtonUp("Fire2"))
  1271.           this.rightClickUpTime = Time.time;
  1272.         if (cInput.GetButtonUp("Fire1"))
  1273.           this.leftClickUpTime = Time.time;
  1274.         if ((!this.holdForCombatPath || cInput.GetButton("Fire2")) && (!this.ignoreMousePosition && MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat) && (MonoBehaviourSingleton<CombatManager>.GetInstance(false).isPlayersTurn && this.activePCs.Count > 0 && (this.activePCs[0].combatActionState == Mob.CombatActionState.THINKING && UseASIManager.GetActiveASIName() == null)))
  1275.         {
  1276.           PC pc = this.activePCs[0];
  1277.           Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  1278.           RaycastHit hitInfo = new RaycastHit();
  1279.           if (Physics.Raycast(ray, out hitInfo, 1000f, this.layerMaskCombatPath) && (bool) ((UnityEngine.Object) hitInfo.transform) && (hitInfo.transform.gameObject.layer == InputManager.layerIndex_Terrain || hitInfo.transform.gameObject.layer == InputManager.layerIndex_Floor))
  1280.           {
  1281.             this.mouseoverSquare = MonoBehaviourSingleton<CombatAStar>.GetInstance(false).GetNode(hitInfo.point, hitInfo.transform.gameObject);
  1282.             if (this.mouseoverSquare != null && MonoBehaviourSingleton<CombatAStar>.GetInstance(false).IsNodeOpen(this.mouseoverSquare))
  1283.             {
  1284.               flag1 = true;
  1285.               if (this.timerCombatSquare != this.mouseoverSquare)
  1286.               {
  1287.                 this.timerCombatSquare = this.mouseoverSquare;
  1288.                 this.combatSquareTimer = Time.time;
  1289.               }
  1290.               if ((double) Time.time - (double) this.combatSquareTimer > 0.200000002980232 && this.lastCombatSquare != this.mouseoverSquare)
  1291.               {
  1292.                 this.lastCombatSquare = this.mouseoverSquare;
  1293.                 if (MonoBehaviourSingleton<CombatAStar>.GetInstance(false).Search(pc.transform.position, hitInfo.point, true, pc.combatActionPointsRemaining, pc.stats.GetCombatSpeed()).Count > 0)
  1294.                 {
  1295.                   MonoBehaviourSingleton<CombatAStar>.GetInstance(false).DrawSmoothPath(pc.pathOrigin.transform, pc.stats.GetCombatSpeed());
  1296.                   pc.pathOrigin.SetActive(true);
  1297.                   int pathCost = MonoBehaviourSingleton<CombatAStar>.GetInstance(false).GetPathCost(pc.stats.GetCombatSpeed());
  1298.                   if (pathCost != -1 && pathCost <= pc.combatActionPointsRemaining)
  1299.                   {
  1300.                     MonoBehaviourSingleton<CursorManager>.GetInstance(false).ClearCursor((Transform) null);
  1301.                     MonoBehaviourSingleton<CursorManager>.GetInstance(false).RemoveText(this.cursorTextId);
  1302.                     this.cursorTextId = MonoBehaviourSingleton<CursorManager>.GetInstance(false).AddText(this.cursorTextId, (string) (object) pathCost + (object) " " + Language.Localize("<@>AP"), MonoBehaviourSingleton<GUIManager>.GetInstance(false).largeText, Color.green, false);
  1303.                   }
  1304.                 }
  1305.                 else
  1306.                 {
  1307.                   MonoBehaviourSingleton<CombatAStar>.GetInstance(false).DrawInvalidPath(this.mouseoverSquare, pc.pathOrigin.transform);
  1308.                   MonoBehaviourSingleton<CursorManager>.GetInstance(false).RemoveText(this.cursorTextId);
  1309.                   this.cursorTextId = -1;
  1310.                 }
  1311.               }
  1312.             }
  1313.           }
  1314.         }
  1315.         else if (!MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat && !this.moveClick && (bool) ((UnityEngine.Object) Camera.main))
  1316.         {
  1317.           bool flag2 = true;
  1318.           Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  1319.           RaycastHit hitInfo = new RaycastHit();
  1320.           if (Physics.Raycast(ray, out hitInfo, 1000f, InputManager.layerMask_Terrain | InputManager.layerMask_Floor) && (bool) ((UnityEngine.Object) hitInfo.transform))
  1321.           {
  1322.             NavMeshHit hit;
  1323.             NavMesh.SamplePosition(hitInfo.point, out hit, 1f, 1);
  1324.             if ((double) Vector3.Distance(hitInfo.point, hit.position) > 1.0)
  1325.               flag2 = false;
  1326.           }
  1327.           else
  1328.             flag2 = false;
  1329.           if (!flag2 && MonoBehaviourSingleton<CursorManager>.GetInstance(false).GetCurrentCursor() == CursorManager.Cursors.Default)
  1330.             MonoBehaviourSingleton<CursorManager>.GetInstance(false).SetCursor(CursorManager.Cursors.InvalidTerrain, false);
  1331.           else if (flag2 && MonoBehaviourSingleton<CursorManager>.GetInstance(false).GetCurrentCursor() == CursorManager.Cursors.InvalidTerrain)
  1332.             MonoBehaviourSingleton<CursorManager>.GetInstance(false).SetCursor(CursorManager.Cursors.Default, false);
  1333.         }
  1334.       }
  1335.       else if (MonoBehaviourSingleton<CursorManager>.GetInstance(false).GetCurrentCursor() == CursorManager.Cursors.InvalidTerrain)
  1336.         MonoBehaviourSingleton<CursorManager>.GetInstance(false).SetCursor(CursorManager.Cursors.Default, false);
  1337.       if (flag1 || this.lastCombatSquare == null)
  1338.         return;
  1339.       this.lastCombatSquare = (CombatAStarNode) null;
  1340.       if (this.activePCs.Count > 0)
  1341.         MonoBehaviourSingleton<CombatAStar>.GetInstance(false).ClearPath(this.activePCs[0].pathOrigin.transform);
  1342.       MonoBehaviourSingleton<CursorManager>.GetInstance(false).RemoveText(this.cursorTextId);
  1343.       this.cursorTextId = -1;
  1344.       if (!this.ignoreMousePosition || !MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat || !MonoBehaviourSingleton<CombatManager>.GetInstance(false).isPlayersTurn)
  1345.         return;
  1346.       PC pc1 = MonoBehaviourSingleton<CombatManager>.GetInstance(false).GetCurrentMob() as PC;
  1347.       NPC selectedNpc = this.GetSelectedNPC();
  1348.       if (!((ItemTemplate) (pc1.stats.GetWeaponTemplate() as ItemTemplate_WeaponAoe) != (ItemTemplate) null) || !((UnityEngine.Object) selectedNpc != (UnityEngine.Object) null))
  1349.         return;
  1350.       MonoBehaviourSingleton<CursorManager>.GetInstance(false).ShowSphere();
  1351.       MonoBehaviourSingleton<CursorManager>.GetInstance(false).SetSpherePosition(selectedNpc.transform.position);
  1352.     }
  1353.   }
  1354.  
  1355.   public void MoveInFormation(FormationTemplate formation, Vector3 destination, bool sprint = false, PC pcPoint = null, float distCloseEnough = 0.0f)
  1356.   {
  1357.     float num1 = this.distFollowHangBack * this.distFollowHangBack;
  1358.     float num2 = this.distToFormationMax * this.distToFormationMax;
  1359.     List<Mob> mobs = new List<Mob>();
  1360.     int i = 0;
  1361.     PC pc1 = !((UnityEngine.Object) pcPoint != (UnityEngine.Object) null) ? this.activePCs[0] : pcPoint;
  1362.     formation.Rotate(destination + destination - pc1.transform.position, destination);
  1363.     if ((double) distCloseEnough > 0.0)
  1364.       destination += (pc1.transform.position - destination).normalized * distCloseEnough;
  1365.     Vector3 dest = destination;
  1366.     if ((UnityEngine.Object) pcPoint != (UnityEngine.Object) null)
  1367.     {
  1368.       Vector3 vector3_1 = new Vector3(0.0f, 0.0f, 0.0f);
  1369.       int num3 = 0;
  1370.       foreach (PC pc2 in this.GetMovementPCs(pcPoint))
  1371.       {
  1372.         if ((UnityEngine.Object) pc2 != (UnityEngine.Object) pcPoint)
  1373.         {
  1374.           vector3_1 += pc2.transform.position;
  1375.           ++num3;
  1376.         }
  1377.       }
  1378.       if (num3 > 0)
  1379.       {
  1380.         Vector3 vector3_2 = vector3_1 / (float) num3;
  1381.         dest = (double) (destination - vector3_2).sqrMagnitude <= (double) num1 ? vector3_2 : destination - (destination - vector3_2).normalized * this.distFollowHangBack;
  1382.         formation.transform.position = vector3_2;
  1383.         formation.Rotate(destination, dest);
  1384.       }
  1385.     }
  1386.     formation.transform.position = dest + new Vector3(0.0f, 0.1f, 0.0f);
  1387.     foreach (PC pc2 in this.GetMovementPCs(MonoBehaviourSingleton<Game>.GetInstance(false).pcLeader))
  1388.     {
  1389.       if (!((UnityEngine.Object) pcPoint != (UnityEngine.Object) null) || !((UnityEngine.Object) pc2 != (UnityEngine.Object) pcPoint) || (double) (formation.Pos(i) - pc2.transform.position).sqrMagnitude >= (double) num2)
  1390.       {
  1391.         pc2.sortKey = (MonoBehaviourSingleton<Game>.GetInstance(false).pcLeader.transform.position - pc2.transform.position).sqrMagnitude;
  1392.         pc2.indexSorted = i;
  1393.         mobs.Add((Mob) pc2);
  1394.         if ((UnityEngine.Object) pcPoint != (UnityEngine.Object) pc2)
  1395.           ++i;
  1396.       }
  1397.     }
  1398.     Mob.SortBySortKey(mobs, false);
  1399.     float time = Time.time;
  1400.     float num4 = time;
  1401.     int index = (int) MonoBehaviourSingleton<Game>.GetInstance(false).pcLeader.moveMode;
  1402.     float max = this.rangeMoveStartDelay;
  1403.     using (List<Mob>.Enumerator enumerator = mobs.GetEnumerator())
  1404.     {
  1405.       while (enumerator.MoveNext())
  1406.       {
  1407.         Mob current = enumerator.Current;
  1408.         EventInfo_CommandMove eventInfoCommandMove = ObjectPool.Get<EventInfo_CommandMove>();
  1409.         eventInfoCommandMove.mob = current;
  1410.         eventInfoCommandMove.destination = !((UnityEngine.Object) current == (UnityEngine.Object) pcPoint) ? formation.Pos(current.indexSorted) : destination;
  1411.         eventInfoCommandMove.sprint = sprint;
  1412.         eventInfoCommandMove.timeActivate = num4;
  1413.         eventInfoCommandMove.dontClearStack = (UnityEngine.Object) pcPoint == (UnityEngine.Object) current;
  1414.         MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) eventInfoCommandMove);
  1415.         if ((double) current.navMeshAgent.velocity.magnitude <= 0.300000011920929)
  1416.           num4 = time + (this.baseMoveStartDelay + UnityEngine.Random.Range(0.0f, max)) * this.MoveStartDelayScaleOfMoveMode[index];
  1417.       }
  1418.     }
  1419.   }
  1420.  
  1421.   public void OnGUI()
  1422.   {
  1423.     if (MonoBehaviourSingleton<Game>.GetInstance(false).state != GameState.Gameplay && MonoBehaviourSingleton<Game>.GetInstance(false).state != GameState.RandomEncounter || (MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat || MonoBehaviourSingleton<GUIManager>.GetInstance(false).WillUseMouseClick()) || (this.freezeInput || !Input.GetMouseButton(0) || (Input.GetMouseButtonDown(0) || cInput.GetButtonDown(InputManager.Fire1))) || ((double) (this.mouseDownPos - Input.mousePosition).sqrMagnitude <= 16.0 || !this.selectionRectActive))
  1424.       return;
  1425.     Rect rect = this.MakeSelectionRect(this.mouseDownPos, Input.mousePosition);
  1426.     Rect position = rect;
  1427.     position.yMin = (float) Screen.height - rect.yMax;
  1428.     position.yMax = (float) Screen.height - rect.yMin;
  1429.     GUI.color = new Color(1f, 1f, 1f, 0.5f);
  1430.     GUI.Box(position, string.Empty, this.selectionRectStyle);
  1431.   }
  1432.  
  1433.   public void ClearSelectedMobs()
  1434.   {
  1435.     this.selectedMobs.Clear();
  1436.   }
  1437.  
  1438.   public void ClearSelection(bool DontClearPCs = false)
  1439.   {
  1440.     bool flag1 = false;
  1441.     bool flag2 = false;
  1442.     for (int index = this.selectedMobs.Count - 1; index >= 0; --index)
  1443.     {
  1444.       Mob mob = this.selectedMobs[index];
  1445.       if (!(mob is PC) || !DontClearPCs)
  1446.       {
  1447.         mob.ShowSelectedFX(0 != 0 || mob is PC && (mob as PC).shouldShowAsLeader);
  1448.         this.selectedMobs.RemoveAt(index);
  1449.         if ((UnityEngine.Object) mob.asPartyPC != (UnityEngine.Object) null)
  1450.         {
  1451.           ((PC) mob).isSelected = false;
  1452.           flag2 = true;
  1453.         }
  1454.         else if (mob.GetType() == typeof (NPC))
  1455.           flag1 = true;
  1456.       }
  1457.     }
  1458.     if (flag2)
  1459.     {
  1460.       using (List<PC>.Enumerator enumerator = MonoBehaviourSingleton<Game>.GetInstance(false).party.GetEnumerator())
  1461.       {
  1462.         while (enumerator.MoveNext())
  1463.         {
  1464.           PC current = enumerator.Current;
  1465.           current.ShowSelectedFX(current.isSelected);
  1466.         }
  1467.       }
  1468.       MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) ObjectPool.Get<EventInfo_CharacterSelectionChanged>());
  1469.     }
  1470.     if (!flag1)
  1471.       return;
  1472.     MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) ObjectPool.Get<EventInfo_NPCSelectedRemoved>());
  1473.   }
  1474.  
  1475.   public void AddToSelection(Mob m)
  1476.   {
  1477.     m.ShowSelectedFX(true);
  1478.     if (!this.selectedMobs.Contains(m))
  1479.       this.selectedMobs.Add(m);
  1480.     if (m is PC)
  1481.     {
  1482.       ((PC) m).isSelected = true;
  1483.       using (List<PC>.Enumerator enumerator = MonoBehaviourSingleton<Game>.GetInstance(false).party.GetEnumerator())
  1484.       {
  1485.         while (enumerator.MoveNext())
  1486.         {
  1487.           PC current = enumerator.Current;
  1488.           current.ShowSelectedFX(current.isSelected || current.shouldShowAsLeader);
  1489.         }
  1490.       }
  1491.       MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) ObjectPool.Get<EventInfo_CharacterSelectionChanged>());
  1492.     }
  1493.     else
  1494.     {
  1495.       EventInfo_NPCSelected eventInfoNpcSelected = ObjectPool.Get<EventInfo_NPCSelected>();
  1496.       eventInfoNpcSelected.target = m;
  1497.       MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) eventInfoNpcSelected);
  1498.     }
  1499.   }
  1500.  
  1501.   public void RemoveFromSelection(Mob m, bool publishEvents = true)
  1502.   {
  1503.     m.ShowSelectedFX(false);
  1504.     this.selectedMobs.Remove(m);
  1505.     if ((UnityEngine.Object) m.asPartyPC != (UnityEngine.Object) null)
  1506.     {
  1507.       ((PC) m).isSelected = this.isPartyGrouped;
  1508.       using (List<PC>.Enumerator enumerator = MonoBehaviourSingleton<Game>.GetInstance(false).party.GetEnumerator())
  1509.       {
  1510.         while (enumerator.MoveNext())
  1511.         {
  1512.           PC current = enumerator.Current;
  1513.           current.ShowSelectedFX(current.isSelected || current.shouldShowAsLeader);
  1514.         }
  1515.       }
  1516.       if (!publishEvents)
  1517.         return;
  1518.       MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) ObjectPool.Get<EventInfo_CharacterSelectionChanged>());
  1519.     }
  1520.     else
  1521.     {
  1522.       if (!publishEvents)
  1523.         return;
  1524.       MonoBehaviourSingleton<EventManager>.GetInstance(false).Publish((EventInfoBase) ObjectPool.Get<EventInfo_NPCSelectedRemoved>());
  1525.     }
  1526.   }
  1527.  
  1528.   public bool IsSelected(Mob m)
  1529.   {
  1530.     // ISSUE: object of a compiler-generated type is created
  1531.     // ISSUE: reference to a compiler-generated method
  1532.     return (UnityEngine.Object) null != (UnityEngine.Object) this.selectedMobs.Find(new Predicate<Mob>(new InputManager.\u003CIsSelected\u003Ec__AnonStorey9BA()
  1533.     {
  1534.       m = m
  1535.     }.\u003C\u003Em__218));
  1536.   }
  1537.  
  1538.   public bool isPCSelected()
  1539.   {
  1540.     using (List<Mob>.Enumerator enumerator = this.selectedMobs.GetEnumerator())
  1541.     {
  1542.       while (enumerator.MoveNext())
  1543.       {
  1544.         if ((bool) ((UnityEngine.Object) (enumerator.Current as PC)))
  1545.           return true;
  1546.       }
  1547.     }
  1548.     return false;
  1549.   }
  1550.  
  1551.   public int GetNumSelectedPCs()
  1552.   {
  1553.     int num = 0;
  1554.     using (List<Mob>.Enumerator enumerator = this.selectedMobs.GetEnumerator())
  1555.     {
  1556.       while (enumerator.MoveNext())
  1557.       {
  1558.         if (enumerator.Current is PC)
  1559.           ++num;
  1560.       }
  1561.     }
  1562.     return num;
  1563.   }
  1564.  
  1565.   public bool isNPCSelected()
  1566.   {
  1567.     for (int index = 0; index < this.selectedMobs.Count; ++index)
  1568.     {
  1569.       if (this.selectedMobs[index] is NPC)
  1570.         return true;
  1571.     }
  1572.     return false;
  1573.   }
  1574.  
  1575.   public NPC GetSelectedNPC()
  1576.   {
  1577.     for (int index = 0; index < this.selectedMobs.Count; ++index)
  1578.     {
  1579.       if (this.selectedMobs[index] is NPC)
  1580.         return this.selectedMobs[index] as NPC;
  1581.     }
  1582.     return (NPC) null;
  1583.   }
  1584.  
  1585.   private void SelectNextMob(bool reverse = false)
  1586.   {
  1587.     bool flag = false;
  1588.     Mob m = (Mob) null;
  1589.     if (MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat && MonoBehaviourSingleton<CombatManager>.GetInstance(false).isPlayersTurn)
  1590.     {
  1591.       List<NPC> list = new List<NPC>();
  1592.       using (List<Mob>.Enumerator enumerator = MonoBehaviourSingleton<CombatManager>.GetInstance(false).mobs.GetEnumerator())
  1593.       {
  1594.         while (enumerator.MoveNext())
  1595.         {
  1596.           Mob current = enumerator.Current;
  1597.           if (current is NPC && current.mobState != Mob.MobState.DEAD && (current.HatesParty() && MonoBehaviourSingleton<CombatManager>.GetInstance(false).GetCurrentMob().IsPositionVisible(current.transform.position, true, true)))
  1598.             list.Add(current as NPC);
  1599.         }
  1600.       }
  1601.       if (reverse)
  1602.         list.Reverse();
  1603.       NPC selectedNpc1 = this.GetSelectedNPC();
  1604.       using (List<NPC>.Enumerator enumerator = list.GetEnumerator())
  1605.       {
  1606.         while (enumerator.MoveNext())
  1607.         {
  1608.           NPC current = enumerator.Current;
  1609.           if ((UnityEngine.Object) m == (UnityEngine.Object) null)
  1610.             m = (Mob) current;
  1611.           if (flag || (UnityEngine.Object) selectedNpc1 == (UnityEngine.Object) null)
  1612.           {
  1613.             this.AddToSelection((Mob) current);
  1614.             flag = false;
  1615.             break;
  1616.           }
  1617.           else if ((UnityEngine.Object) selectedNpc1 == (UnityEngine.Object) current)
  1618.           {
  1619.             this.RemoveFromSelection((Mob) current, true);
  1620.             flag = true;
  1621.           }
  1622.         }
  1623.       }
  1624.       if ((flag || this.selectedMobs.Count == 0) && (UnityEngine.Object) m != (UnityEngine.Object) null)
  1625.         this.AddToSelection(m);
  1626.       NPC selectedNpc2 = this.GetSelectedNPC();
  1627.       if ((UnityEngine.Object) selectedNpc2 != (UnityEngine.Object) null && (UnityEngine.Object) this.GetFirstSelectedPlayer() != (UnityEngine.Object) null && this.GetFirstSelectedPlayer().stats.GetWeaponTemplate() is ItemTemplate_WeaponAoe)
  1628.       {
  1629.         MonoBehaviourSingleton<CursorManager>.GetInstance(false).ShowSphere();
  1630.         MonoBehaviourSingleton<CursorManager>.GetInstance(false).SetSpherePosition(selectedNpc2.transform.position);
  1631.       }
  1632.     }
  1633.     else if (!MonoBehaviourSingleton<CombatManager>.GetInstance(false).inCombat)
  1634.     {
  1635.       if ((UnityEngine.Object) this.GetFirstSelectedPlayer() == (UnityEngine.Object) null && MonoBehaviourSingleton<Game>.GetInstance(false).party.Count > 0)
  1636.       {
  1637.         PC pc = MonoBehaviourSingleton<Game>.GetInstance(false).party[0];
  1638.       }
  1639.       if (this.selectedMobs.Count == 0)
  1640.       {
  1641.         this.ClearSelection(false);
  1642.         using (List<PC>.Enumerator enumerator = MonoBehaviourSingleton<Game>.GetInstance(false).party.GetEnumerator())
  1643.         {
  1644.           while (enumerator.MoveNext())
  1645.           {
  1646.             PC current = enumerator.Current;
  1647.             if ((double) current.curHP > 0.0)
  1648.             {
  1649.               current.ShowSelectedFX(true);
  1650.               this.selectedMobs.Add((Mob) current);
  1651.               break;
  1652.             }
  1653.           }
  1654.         }
  1655.       }
  1656.       else
  1657.       {
  1658.         List<PC> list = new List<PC>((IEnumerable<PC>) MonoBehaviourSingleton<Game>.GetInstance(false).party);
  1659.         if (Input.GetKey(KeyCode.LeftShift))
  1660.           list.Reverse();
  1661.         using (List<PC>.Enumerator enumerator = list.GetEnumerator())
  1662.         {
  1663.           while (enumerator.MoveNext())
  1664.           {
  1665.             PC current = enumerator.Current;
  1666.             if ((double) current.curHP > 0.0)
  1667.             {
  1668.               if ((UnityEngine.Object) m == (UnityEngine.Object) null || m is NPC)
  1669.                 m = (Mob) current;
  1670.               if (flag)
  1671.               {
  1672.                 current.MakeLeader();
  1673.                 this.AddToSelection((Mob) current);
  1674.                 flag = false;
  1675.                 break;
  1676.               }
  1677.               else if (this.selectedMobs.Count > 0 && this.selectedMobs.Contains((Mob) current))
  1678.               {
  1679.                 this.RemoveFromSelection((Mob) current, true);
  1680.                 flag = true;
  1681.               }
  1682.             }
  1683.           }
  1684.         }
  1685.         if ((flag || this.selectedMobs.Count == 0) && (UnityEngine.Object) m != (UnityEngine.Object) null)
  1686.         {
  1687.           if (m is PC)
  1688.             (m as PC).MakeLeader();
  1689.           this.AddToSelection(m);
  1690.         }
  1691.       }
  1692.     }
  1693.     if (this.selectedMobs.Count > 2 || this.selectedMobs.Count <= 0)
  1694.       return;
  1695.     this.ignoreMousePosition = true;
  1696.     this.ignoredMousePosition = Input.mousePosition;
  1697.     MonoBehaviourSingleton<Game>.GetInstance(false).cameraController.Snap(this.selectedMobs[this.selectedMobs.Count - 1].transform.position, false);
  1698.   }
  1699.  
  1700.   private bool IsOnScreen(GameObject g)
  1701.   {
  1702.     Vector3 vector3 = Camera.main.WorldToViewportPoint(g.transform.position);
  1703.     if ((double) vector3.x > 0.0 && (double) vector3.x < 1.0 && ((double) vector3.y > 0.0 && (double) vector3.y < 1.0))
  1704.       return (double) vector3.z > 0.0;
  1705.     else
  1706.       return false;
  1707.   }
  1708.  
  1709.   private Rect MakeSelectionRect(Vector3 minP, Vector3 maxP)
  1710.   {
  1711.     return new Rect()
  1712.     {
  1713.       xMin = Mathf.Min(minP.x, maxP.x),
  1714.       yMin = Mathf.Min(minP.y, maxP.y),
  1715.       xMax = Mathf.Max(minP.x, maxP.x),
  1716.       yMax = Mathf.Max(minP.y, maxP.y)
  1717.     };
  1718.   }
  1719.  
  1720.   private void SetupFormation(ref FormationTemplate formation, FormationTemplate formationTemplate)
  1721.   {
  1722.     if ((UnityEngine.Object) formation != (UnityEngine.Object) null && (bool) ((UnityEngine.Object) formation.gameObject))
  1723.       UnityEngine.Object.Destroy((UnityEngine.Object) formation.gameObject);
  1724.     formation = UnityEngine.Object.Instantiate((UnityEngine.Object) formationTemplate) as FormationTemplate;
  1725.     foreach (Transform transform in formation.GetComponentsInChildren<Transform>())
  1726.     {
  1727.       GameObject primitive = GameObject.CreatePrimitive(PrimitiveType.Sphere);
  1728.       primitive.transform.parent = transform;
  1729.       primitive.renderer.material.color = Color.yellow;
  1730.       primitive.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
  1731.       primitive.transform.localPosition = Vector3.zero;
  1732.     }
  1733.     formation.transform.localScale *= 1.2f;
  1734.     formation.gameObject.SetActive(false);
  1735.   }
  1736.  
  1737.   public PC ClosestSelectedPC(Vector3 pos)
  1738.   {
  1739.     float num = float.PositiveInfinity;
  1740.     PC pc = (PC) null;
  1741.     using (List<PC>.Enumerator enumerator = this.activePCs.GetEnumerator())
  1742.     {
  1743.       while (enumerator.MoveNext())
  1744.       {
  1745.         PC current = enumerator.Current;
  1746.         float sqrMagnitude = (current.transform.position - pos).sqrMagnitude;
  1747.         if ((double) sqrMagnitude < (double) num)
  1748.         {
  1749.           num = sqrMagnitude;
  1750.           pc = current;
  1751.         }
  1752.       }
  1753.     }
  1754.     return pc;
  1755.   }
  1756.  
  1757.   public PC SelectedLeaderPC()
  1758.   {
  1759.     return MonoBehaviourSingleton<Game>.GetInstance(false).pcLeader;
  1760.   }
  1761.  
  1762.   public void SetFreezeInput(bool freeze, string reason = "<none>")
  1763.   {
  1764.     this.cameraMove = (Vector4) Vector3.zero;
  1765.     this.freezeInput = freeze;
  1766.   }
  1767.  
  1768.   public bool IsInputFrozen()
  1769.   {
  1770.     return this.freezeInput;
  1771.   }
  1772.  
  1773.   public bool IsZoomInputFrozen()
  1774.   {
  1775.     return this.freezeInput && !Drama.isConversationOn || MonoBehaviourSingleton<GUIManager>.GetInstance(false).IsModalMenuActive() || (!MonoBehaviourSingleton<HUD_Controller>.HasInstance() || !((UnityEngine.Object) UICamera.selectedObject == (UnityEngine.Object) MonoBehaviourSingleton<HUD_Controller>.GetInstance(false).gameObject) || MonoBehaviourSingleton<GUIManager>.GetInstance(false).WillUseMouseClick()) && (!MonoBehaviourSingleton<ConversationHUD>.HasInstance() || !((UnityEngine.Object) UICamera.selectedObject == (UnityEngine.Object) MonoBehaviourSingleton<ConversationHUD>.GetInstance(false).gameObject));
  1776.   }
  1777.  
  1778.   public PC GetFirstSelectedPlayer()
  1779.   {
  1780.     return MonoBehaviourSingleton<Game>.GetInstance(false).GetFirstSelectedPC();
  1781.   }
  1782.  
  1783.   public void SelectEntireParty()
  1784.   {
  1785.     for (int index = 0; index < MonoBehaviourSingleton<Game>.GetInstance(false).party.Count; ++index)
  1786.       this.AddToSelection((Mob) MonoBehaviourSingleton<Game>.GetInstance(false).party[index]);
  1787.   }
  1788.  
  1789.   public bool IsPartySelected()
  1790.   {
  1791.     for (int index = 0; index < MonoBehaviourSingleton<Game>.GetInstance(false).party.Count; ++index)
  1792.     {
  1793.       if (!MonoBehaviourSingleton<Game>.GetInstance(false).party[index].isSelected)
  1794.         return false;
  1795.     }
  1796.     return true;
  1797.   }
  1798.  
  1799.   private void RevertToPreviousSelection()
  1800.   {
  1801.     if (this.previousSelections != null)
  1802.     {
  1803.       this.ClearSelection(false);
  1804.       for (int index = 0; index < Mathf.Min(this.previousSelections.Length, MonoBehaviourSingleton<Game>.GetInstance(false).party.Count); ++index)
  1805.       {
  1806.         if (this.previousSelections[index])
  1807.           this.AddToSelection((Mob) MonoBehaviourSingleton<Game>.GetInstance(false).party[index]);
  1808.       }
  1809.     }
  1810.     else
  1811.       this.AddToSelection((Mob) MonoBehaviourSingleton<Game>.GetInstance(false).party[0]);
  1812.   }
  1813.  
  1814.   public void TogglePartySelected()
  1815.   {
  1816.     if (this.IsPartySelected())
  1817.     {
  1818.       this.RevertToPreviousSelection();
  1819.     }
  1820.     else
  1821.     {
  1822.       this.previousSelections = new bool[MonoBehaviourSingleton<Game>.GetInstance(false).party.Count];
  1823.       for (int index = 0; index < this.previousSelections.Length; ++index)
  1824.         this.previousSelections[index] = MonoBehaviourSingleton<Game>.GetInstance(false).party[index].isSelected;
  1825.       this.SelectEntireParty();
  1826.     }
  1827.   }
  1828.  
  1829.   public CombatAStarNode GetCurrentSquare()
  1830.   {
  1831.     return this.mouseoverSquare;
  1832.   }
  1833.  
  1834.   public void SaveSelectedToBackup()
  1835.   {
  1836.     this.selectedBackup = new List<Mob>((IEnumerable<Mob>) this.selectedMobs);
  1837.   }
  1838.  
  1839.   public void RestoreSelectedFromBackup()
  1840.   {
  1841.     this.ClearSelection(false);
  1842.     using (List<Mob>.Enumerator enumerator = this.selectedBackup.GetEnumerator())
  1843.     {
  1844.       while (enumerator.MoveNext())
  1845.       {
  1846.         Mob current = enumerator.Current;
  1847.         if ((UnityEngine.Object) current != (UnityEngine.Object) null && (UnityEngine.Object) current.gameObject != (UnityEngine.Object) null && current.mobState != Mob.MobState.DEAD)
  1848.           this.AddToSelection(current);
  1849.       }
  1850.     }
  1851.   }
  1852.  
  1853.   public void RemoveSelectedFromBackup(Mob mob)
  1854.   {
  1855.     this.selectedBackup.Remove(mob);
  1856.   }
  1857.  
  1858.   public void AddToSelectedBackup(Mob mob)
  1859.   {
  1860.     if (this.selectedBackup.Contains(mob))
  1861.       return;
  1862.     this.selectedBackup.Add(mob);
  1863.   }
  1864.  
  1865.   public bool IsKeyBound(string keyCode, ref string boundCommandName)
  1866.   {
  1867.     for (int index = 0; index < InputManager.buttonEvents.Length; ++index)
  1868.     {
  1869.       if (cInput.GetText(InputManager.buttonEvents[index]).Equals(keyCode, StringComparison.CurrentCultureIgnoreCase))
  1870.       {
  1871.         boundCommandName = InputManager.buttonEvents[index];
  1872.         return true;
  1873.       }
  1874.     }
  1875.     return false;
  1876.   }
  1877.  
  1878.   [DllImport("user32.dll", CharSet = CharSet.Auto)]
  1879.   [return: MarshalAs(UnmanagedType.Bool)]
  1880.   private static bool ClipCursor(ref InputManager.RECT rcClip);
  1881.  
  1882.   [DllImport("user32.dll", CharSet = CharSet.Auto)]
  1883.   [return: MarshalAs(UnmanagedType.Bool)]
  1884.   private static bool ClipCursor(IntPtr rcClip);
  1885.  
  1886.   [DllImport("user32.dll")]
  1887.   private static int GetForegroundWindow();
  1888.  
  1889.   [DllImport("user32.dll")]
  1890.   [return: MarshalAs(UnmanagedType.Bool)]
  1891.   private static bool GetClientRect(int hWnd, ref InputManager.RECT lpRect);
  1892.  
  1893.   [DllImport("user32.dll")]
  1894.   [return: MarshalAs(UnmanagedType.Bool)]
  1895.   private static bool ClientToScreen(int hWnd, ref InputManager.POINT lpPoint);
  1896.  
  1897.   private void ClientRectToScreenRect(int hWnd, ref InputManager.RECT rect)
  1898.   {
  1899.     InputManager.POINT lpPoint1 = new InputManager.POINT(rect.Left, rect.Bottom);
  1900.     InputManager.POINT lpPoint2 = new InputManager.POINT(rect.Right, rect.Top);
  1901.     InputManager.ClientToScreen(hWnd, ref lpPoint1);
  1902.     InputManager.ClientToScreen(hWnd, ref lpPoint2);
  1903.     rect.Left = lpPoint1.x;
  1904.     rect.Bottom = lpPoint1.y;
  1905.     rect.Right = lpPoint2.x;
  1906.     rect.Top = lpPoint2.y;
  1907.   }
  1908.  
  1909.   private void SetCursorClipRect(bool focus)
  1910.   {
  1911.     if (focus)
  1912.     {
  1913.       InputManager.RECT rect = new InputManager.RECT();
  1914.       int foregroundWindow = InputManager.GetForegroundWindow();
  1915.       InputManager.GetClientRect(foregroundWindow, ref rect);
  1916.       this.ClientRectToScreenRect(foregroundWindow, ref rect);
  1917.       InputManager.ClipCursor(ref rect);
  1918.     }
  1919.     else
  1920.       InputManager.ClipCursor(IntPtr.Zero);
  1921.   }
  1922.  
  1923.   public struct RECT
  1924.   {
  1925.     public int Left;
  1926.     public int Top;
  1927.     public int Right;
  1928.     public int Bottom;
  1929.  
  1930.     public RECT(int left, int top, int right, int bottom)
  1931.     {
  1932.       this.Left = left;
  1933.       this.Top = top;
  1934.       this.Right = right;
  1935.       this.Bottom = bottom;
  1936.     }
  1937.   }
  1938.  
  1939.   public struct POINT
  1940.   {
  1941.     public int x;
  1942.     public int y;
  1943.  
  1944.     public POINT(int X, int Y)
  1945.     {
  1946.       this.x = X;
  1947.       this.y = Y;
  1948.     }
  1949.   }
  1950. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement