public void SetFriendlyHeroTargetingMode(bool enable) { if (!enable && (this.m_hiddenStandIn != null)) { this.m_hiddenStandIn.gameObject.SetActive(true); } if (this.m_targetingMode != enable) { this.m_targetingMode = enable; this.m_heroHitbox.SetActive(enable); if (this.m_handEnlarged) { if (enable) { this.m_hiddenStandIn = this.CurrentStandIn; if (this.m_hiddenStandIn != null) { this.m_hiddenStandIn.gameObject.SetActive(false); } Vector3 enlargedHandPosition = this.m_enlargedHandPosition; enlargedHandPosition.z -= this.m_handHidingDistance; base.gameObject.transform.localPosition = enlargedHandPosition; } else { base.gameObject.transform.localPosition = this.m_enlargedHandPosition; } this.UpdateCenterAndWidth(); } } }
public bool TouchReceived() { RaycastHit hit; if (!UniversalInputManager.Get().GetInputHitInfo(GameLayer.CardRaycast.LayerBit(), out hit)) { this.m_touchedSlot = -1; } CardStandIn @in = SceneUtils.FindComponentInParents <CardStandIn>(hit.transform); if (@in != null) { this.m_touchedSlot = @in.slot - 1; return(true); } this.m_touchedSlot = -1; return(false); }
private void CardColliderLoadedCallback(string name, GameObject go, object callbackData) { Card card = (Card)callbackData; Actor actor = card.GetActor(); if (actor != null) { actor.GetMeshRenderer().gameObject.layer = 0; } go.transform.localEulerAngles = this.GetCardRotation(card); go.transform.position = this.GetCardPosition(card); go.transform.localScale = this.GetCardScale(card); CardStandIn component = go.GetComponent <CardStandIn>(); component.slot = card.GetZonePosition(); component.linkedCard = card; this.standIns.Add(component); if (!component.linkedCard.CardStandInIsInteractive()) { component.DisableStandIn(); } }
private void UpdateLayoutImpl(int slotMousedOver, int overrideCardCount) { int num = 0; if ((((this.lastMousedOver != slotMousedOver) && (this.lastMousedOver != -1)) && ((this.lastMousedOver < base.m_cards.Count) && (base.m_cards[this.lastMousedOver] != null))) && this.CanAnimateCard(base.m_cards[this.lastMousedOver])) { Card card = base.m_cards[this.lastMousedOver]; iTween.Stop(card.gameObject); if (!this.enemyHand) { Vector3 mouseOverCardPosition = this.GetMouseOverCardPosition(card); Vector3 cardPosition = this.GetCardPosition(card, overrideCardCount); card.transform.position = new Vector3(mouseOverCardPosition.x, this.centerOfHand.y, cardPosition.z + 0.5f); card.transform.localScale = this.GetCardScale(card); card.transform.localEulerAngles = this.GetCardRotation(card); } card.NotifyMousedOut(); GameLayer cardRaycast = GameLayer.Default; if ((base.m_Side == Player.Side.OPPOSING) && SpectatorManager.Get().IsSpectatingOpposingSide()) { cardRaycast = GameLayer.CardRaycast; } SceneUtils.SetLayer(card.gameObject, cardRaycast); } float delaySec = 0f; for (int i = 0; i < base.m_cards.Count; i++) { Vector3 vector3; Card card2 = base.m_cards[i]; if (!this.CanAnimateCard(card2)) { continue; } num++; float z = !this.m_flipHandCards ? 354.5f : 534.5f; card2.transform.rotation = Quaternion.Euler(new Vector3(card2.transform.localEulerAngles.x, card2.transform.localEulerAngles.y, z)); float num5 = 0.5f; if (this.m_handMoving) { num5 = 0.25f; } if (this.enemyHand) { num5 = 1.5f; } float num6 = 0.25f; iTween.EaseType easeOutExpo = iTween.EaseType.easeOutExpo; float transitionDelay = card2.GetTransitionDelay(); card2.SetTransitionDelay(0f); ZoneTransitionStyle transitionStyle = card2.GetTransitionStyle(); card2.SetTransitionStyle(ZoneTransitionStyle.NORMAL); switch (transitionStyle) { case ZoneTransitionStyle.SLOW: easeOutExpo = iTween.EaseType.easeInExpo; num6 = num5; break; case ZoneTransitionStyle.VERY_SLOW: easeOutExpo = iTween.EaseType.easeInOutCubic; num6 = 1f; num5 = 1f; break; case ZoneTransitionStyle.NORMAL: goto Label_0265; } card2.GetActor().TurnOnCollider(); Label_0265: vector3 = this.GetCardPosition(card2, overrideCardCount); Vector3 cardRotation = this.GetCardRotation(card2, overrideCardCount); Vector3 cardScale = this.GetCardScale(card2); if (i == slotMousedOver) { easeOutExpo = iTween.EaseType.easeOutExpo; if (this.enemyHand) { num6 = 0.15f; float num8 = 0.3f; vector3 = new Vector3(vector3.x, vector3.y, vector3.z - num8); } else { float num9 = 0.5f * i; num9 -= (0.5f * base.m_cards.Count) / 2f; float selectCardScale = (float)this.m_SelectCardScale; float num11 = (float)this.m_SelectCardScale; cardRotation = new Vector3(0f, 0f, 0f); cardScale = new Vector3(selectCardScale, cardScale.y, num11); card2.transform.localScale = cardScale; num5 = 4f; float num12 = 0.1f; vector3 = this.GetMouseOverCardPosition(card2); float x = vector3.x; if (this.m_handEnlarged) { vector3.x = Mathf.Max(vector3.x, this.m_enlargedHandCardMinX); vector3.x = Mathf.Min(vector3.x, this.m_enlargedHandCardMaxX); } card2.transform.position = new Vector3((x == vector3.x) ? card2.transform.position.x : vector3.x, vector3.y, vector3.z - num12); card2.transform.localEulerAngles = new Vector3(0f, 0f, 0f); iTween.Stop(card2.gameObject); easeOutExpo = iTween.EaseType.easeOutExpo; if (CardTypeBanner.Get() != null) { CardTypeBanner.Get().Show(card2.GetActor()); } InputManager.Get().SetMousedOverCard(card2); bool showOnRight = card2.GetActor().GetMeshRenderer().bounds.center.x < base.GetComponent <BoxCollider>().bounds.center.x; float? overrideScale = null; Vector3?overrideOffset = null; KeywordHelpPanelManager.Get().UpdateKeywordHelp(card2, card2.GetActor(), showOnRight, overrideScale, overrideOffset); SceneUtils.SetLayer(card2.gameObject, GameLayer.Tooltip); } } else if (this.GetStandIn(card2) != null) { CardStandIn standIn = this.GetStandIn(card2); iTween.Stop(standIn.gameObject); standIn.transform.position = vector3; if (!card2.CardStandInIsInteractive()) { standIn.DisableStandIn(); } else { standIn.EnableStandIn(); } } card2.EnableTransitioningZones(true); string tweenName = ZoneMgr.Get().GetTweenName <ZoneHand>(); object[] args = new object[] { "scale", cardScale, "delay", transitionDelay, "time", num6, "easeType", easeOutExpo, "name", tweenName }; Hashtable hashtable = iTween.Hash(args); iTween.ScaleTo(card2.gameObject, hashtable); object[] objArray2 = new object[] { "rotation", cardRotation, "delay", transitionDelay, "time", num6, "easeType", easeOutExpo, "name", tweenName }; Hashtable hashtable2 = iTween.Hash(objArray2); iTween.RotateTo(card2.gameObject, hashtable2); object[] objArray3 = new object[] { "position", vector3, "delay", transitionDelay, "time", num5, "easeType", easeOutExpo, "name", tweenName }; Hashtable hashtable3 = iTween.Hash(objArray3); iTween.MoveTo(card2.gameObject, hashtable3); float[] values = new float[] { delaySec, transitionDelay + num5, transitionDelay + num6 }; delaySec = Mathf.Max(values); } this.lastMousedOver = slotMousedOver; if (num > 0) { base.StartFinishLayoutTimer(delaySec); } else { base.UpdateLayoutFinished(); } }
public void HandleInput() { Card item = null; if ((RemoteActionHandler.Get() != null) && (RemoteActionHandler.Get().GetFriendlyHoverCard() != null)) { Card friendlyHoverCard = RemoteActionHandler.Get().GetFriendlyHoverCard(); if (friendlyHoverCard.GetController().IsFriendlySide() && (friendlyHoverCard.GetZone() is ZoneHand)) { item = friendlyHoverCard; } } int slotMousedOver = -1; if (item != null) { slotMousedOver = base.m_cards.IndexOf(item); } if (UniversalInputManager.Get().IsTouchMode()) { if (!InputManager.Get().LeftMouseButtonDown || (this.m_touchedSlot < 0)) { this.m_touchedSlot = -1; if (slotMousedOver < 0) { this.UpdateLayout(-1); } else { this.UpdateLayout(slotMousedOver); } } else { float num2 = UniversalInputManager.Get().GetMousePosition().x - InputManager.Get().LastMouseDownPosition.x; float num3 = Mathf.Max((float)0f, (float)(UniversalInputManager.Get().GetMousePosition().y - InputManager.Get().LastMouseDownPosition.y)); float cardWidth = this.GetCardWidth(base.m_cards.Count); float a = (this.lastMousedOver - this.m_touchedSlot) * cardWidth; float num6 = 10f + (num3 * this.m_TouchDragResistanceFactorY); if (num2 < a) { num2 = Mathf.Min(a, num2 + num6); } else { num2 = Mathf.Max(a, num2 - num6); } int num7 = this.m_touchedSlot + ((int)Mathf.Round(num2 / cardWidth)); this.UpdateLayout(num7); } } else { RaycastHit hit; CardStandIn @in = null; int num8 = -1; if (!UniversalInputManager.Get().InputHitAnyObject(Camera.main, GameLayer.InvisibleHitBox1) || !UniversalInputManager.Get().GetInputHitInfo(Camera.main, GameLayer.CardRaycast, out hit)) { if (slotMousedOver < 0) { this.UpdateLayout(-1); return; } } else { @in = SceneUtils.FindComponentInParents <CardStandIn>(hit.transform); } if (@in == null) { if (slotMousedOver < 0) { this.UpdateLayout(-1); return; } } else { num8 = @in.slot - 1; } if (num8 != this.lastMousedOver) { bool flag = num8 != -1; if (flag || (slotMousedOver < 0)) { this.UpdateLayout(num8); } else if (!flag && (slotMousedOver >= 0)) { this.UpdateLayout(slotMousedOver); } } } }