public static void TriggerClickDownEvent(InputManager self, string eventName, ref List<ClickDownInfo> clickInfosContainer) { DynData<InputManager> d = new DynData<InputManager>(self); d.Set<bool>("stopClickEventPropagation", false); LayerMask mask = (!d.Get<IGameCameraService>("gameCameraManager").IsTacticalMapActive()) ? d.Get<LayerMask>("gameMouseClickLayerMask") : d.Get<LayerMask>("tacticalMapClickLayerMask"); RaycastHit[] array = Physics.RaycastAll(d.Get<IGameCameraService>("gameCameraManager").ScreenPointToRay(TASInputPlayer.GetMousePos()), float.PositiveInfinity, mask); Array.Sort<RaycastHit>(array, (RaycastHit hitInfo1, RaycastHit hitInfo2) => hitInfo1.distance.CompareTo(hitInfo2.distance)); if (d.Get<bool>("debug")) { Diagnostics.LogWarning(string.Concat(new object[] { eventName, " > ", array.Length, " hits" }), new object[0]); } clickInfosContainer = new List<ClickDownInfo>(); int num = 0; foreach (RaycastHit raycastHit in array) { ClickDownInfo item = new ClickDownInfo(raycastHit.collider, raycastHit.point, num, array.Length); clickInfosContainer.Add(item); } foreach (ClickDownInfo clickDownInfo in clickInfosContainer) { if (d.Get<bool>("debug")) { Diagnostics.Log(string.Concat(new object[] { eventName, "@", num, "=", clickDownInfo.HitCollider.name, " @", clickDownInfo.WorldPosition }), new object[0]); } clickDownInfo.HitCollider.SendMessage(eventName, clickDownInfo, SendMessageOptions.DontRequireReceiver); num++; if (d.Get<bool>("stopClickEventPropagation")) { break; } } }
private void RoomTacticalMapElement_OnRightClickDown(On.RoomTacticalMapElement.orig_OnRightClickDown orig, RoomTacticalMapElement self, ClickDownInfo clickInfo) { // If the shift key is down, instead of doing it right away, add it to a queue. if (ConditionalAddToQueue(new QueueData(new DynData <RoomTacticalMapElement>(self).Get <Room>("room"), clickInfo))) { return; } orig(self, clickInfo); }
private void MajorModule_OnRightClickDown(On.MajorModule.orig_OnRightClickDown orig, MajorModule self, ClickDownInfo clickInfo) { // If the shift key is down, instead of doing it right away, add it to a queue. // Need to make sure that if it is a crystal, the orig is still called. // Only call this if it isn't a crystal! if (!self.IsCrystal) { if (ConditionalAddToQueue(new QueueData(self.RoomElement.ParentRoom, clickInfo))) { return; } } orig(self, clickInfo); }
private void Door_OnRightClickDown(On.Door.orig_OnRightClickDown orig, Door self, ClickDownInfo clickInfo) { // If the shift key is down, instead of doing it right away, add it to a queue. if (ConditionalAddToQueue(new QueueData(self, clickInfo))) { return; } orig(self, clickInfo); }
public QueueData(Door door, ClickDownInfo info) { this.door = door; Setup(info); }
public QueueData(Room room, ClickDownInfo info) { this.room = room; Setup(info); }
public QueueData(NPCMerchant merch, ClickDownInfo info) { this.merch = merch; Setup(info); }
public QueueData(Hero hero, ClickDownInfo info) { this.hero = hero; Setup(info); }
public void Setup(ClickDownInfo info) { this.info = info; }