private void DestroyTargetArrow(bool destroyEnemyArrow, bool isLocallyCanceled)
 {
     if (this.IsActive())
     {
         if (destroyEnemyArrow != this.m_isEnemyArrow)
         {
             Log.Rachelle.Print(string.Format("trying to destroy {0} arrow but the active arrow is {1}", !destroyEnemyArrow ? "friendly" : "enemy", !this.m_isEnemyArrow ? "friendly" : "enemy"), new object[0]);
         }
         else
         {
             if (isLocallyCanceled)
             {
                 Entity entity = GameState.Get().GetEntity(this.m_sourceEntityID);
                 if (entity != null)
                 {
                     entity.GetCard().NotifyTargetingCanceled();
                 }
             }
             this.m_originLocationEntityID = -1;
             this.m_sourceEntityID         = -1;
             if (!this.m_isEnemyArrow)
             {
                 RemoteActionHandler.Get().NotifyOpponentOfTargetEnd();
                 PegCursor.Get().Show();
             }
             this.ActivateArrow(false);
             this.ShowDamageIndicator(false);
         }
     }
 }
 private void OnUserUI()
 {
     if (RemoteActionHandler.Get() != null)
     {
         RemoteActionHandler.Get().HandleAction(Network.GetUserUI());
     }
 }
Example #3
0
        public void Update()
        {
            GameState gs = GameState.Get();

            if (gs == null)
            {
                return;
            }
            var rah = RemoteActionHandler.Get();

            if (gs.IsMulliganManagerActive())
            {
                // TODO: set choices...
                MulliganManager.Get().GetMulliganButton().TriggerRelease();
            }

            if (gs.IsFriendlySidePlayerTurn())
            {
                if (gs.IsTurnStartManagerBlockingInput() == false)
                {
                    if (m_nextChooseOption == null)
                    {
                        return;
                    }
                    SendOption(m_nextChooseOption);
                    m_nextChooseOption = null;
                }
            }
        }
    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);
                }
            }
        }
    }
 private bool CheckCriticalAssetLoads()
 {
     if (!this.m_criticalAssetsLoaded)
     {
         if (Board.Get() == null)
         {
             return(false);
         }
         if (BoardCameras.Get() == null)
         {
             return(false);
         }
         if (BoardStandardGame.Get() == null)
         {
             return(false);
         }
         if (GameMgr.Get().IsTutorial() && (BoardTutorial.Get() == null))
         {
             return(false);
         }
         if (MulliganManager.Get() == null)
         {
             return(false);
         }
         if (TurnStartManager.Get() == null)
         {
             return(false);
         }
         if (TargetReticleManager.Get() == null)
         {
             return(false);
         }
         if (GameplayErrorManager.Get() == null)
         {
             return(false);
         }
         if (EndTurnButton.Get() == null)
         {
             return(false);
         }
         if (BigCard.Get() == null)
         {
             return(false);
         }
         if (CardTypeBanner.Get() == null)
         {
             return(false);
         }
         if (TurnTimer.Get() == null)
         {
             return(false);
         }
         if (CardColorSwitcher.Get() == null)
         {
             return(false);
         }
         if (RemoteActionHandler.Get() == null)
         {
             return(false);
         }
         if (ChoiceCardMgr.Get() == null)
         {
             return(false);
         }
         if (InputManager.Get() == null)
         {
             return(false);
         }
         this.m_criticalAssetsLoaded = true;
         this.ProcessQueuedPowerHistory();
     }
     return(true);
 }