예제 #1
0
    private void UpdateCardHeld()
    {
        Card card  = this.enemyActualUI.held.card;
        Card card2 = this.enemyWantedUI.held.card;

        if (card != card2)
        {
            this.enemyActualUI.held.card = card2;
            if (card != null)
            {
                card.MarkAsGrabbedByEnemyActionHandler(false);
            }
            if (this.IsCardInHand(card))
            {
                card.GetZone().UpdateLayout();
            }
            if (this.CanAnimateHeldCard(card2))
            {
                card2.MarkAsGrabbedByEnemyActionHandler(true);
                if (SpectatorManager.Get().IsSpectatingOpposingSide())
                {
                    this.StandUpright(false);
                }
                object[]  args      = new object[] { "name", "RemoteActionHandler", "position", Board.Get().FindBone("OpponentCardPlayingSpot").position, "time", 1f, "oncomplete", o => this.StartDrift(false), "oncompletetarget", base.gameObject };
                Hashtable hashtable = iTween.Hash(args);
                iTween.MoveTo(card2.gameObject, hashtable);
            }
        }
        if (GameMgr.Get().IsSpectator())
        {
            Card card3 = this.friendlyActualUI.held.card;
            Card card4 = this.friendlyWantedUI.held.card;
            if (card3 != card4)
            {
                this.friendlyActualUI.held.card = card4;
                if (card3 != null)
                {
                    card3.MarkAsGrabbedByEnemyActionHandler(false);
                }
                if (this.IsCardInHand(card3))
                {
                    card3.GetZone().UpdateLayout();
                }
                if (this.CanAnimateHeldCard(card4))
                {
                    Hashtable hashtable2;
                    card4.MarkAsGrabbedByEnemyActionHandler(true);
                    if (card4 == this.GetFriendlyHoverCard())
                    {
                        ZoneHand zone = card4.GetZone() as ZoneHand;
                        if (zone != null)
                        {
                            card4.NotifyMousedOut();
                            Vector3  cardScale = zone.GetCardScale(card4);
                            object[] objArray2 = new object[] { "scale", cardScale, "time", 0.15f, "easeType", iTween.EaseType.easeOutExpo, "name", "RemoteActionHandler" };
                            hashtable2 = iTween.Hash(objArray2);
                            iTween.ScaleTo(card4.gameObject, hashtable2);
                        }
                    }
                    object[] objArray3 = new object[] { "name", "RemoteActionHandler", "position", Board.Get().FindBone("FriendlyCardPlayingSpot").position, "time", 1f, "oncomplete", o => this.StartDrift(true), "oncompletetarget", base.gameObject };
                    hashtable2 = iTween.Hash(objArray3);
                    iTween.MoveTo(card4.gameObject, hashtable2);
                }
            }
        }
    }
예제 #2
0
    private void UpdateCardOver()
    {
        Card card  = this.enemyActualUI.over.card;
        Card card2 = this.enemyWantedUI.over.card;

        if (card != card2)
        {
            this.enemyActualUI.over.card = card2;
            if (card != null)
            {
                card.NotifyOpponentMousedOffThisCard();
            }
            if (card2 != null)
            {
                card2.NotifyOpponentMousedOverThisCard();
            }
            ZoneMgr.Get().FindZoneOfType <ZoneHand>(Player.Side.OPPOSING).UpdateLayout(this.GetOpponentHandHoverSlot());
        }
        if (GameMgr.Get().IsSpectator())
        {
            Card card3 = this.friendlyActualUI.over.card;
            Card card4 = this.friendlyWantedUI.over.card;
            if (card3 != card4)
            {
                this.friendlyActualUI.over.card = card4;
                if (card3 != null)
                {
                    ZoneHand zone = card3.GetZone() as ZoneHand;
                    if (zone != null)
                    {
                        if (zone.CurrentStandIn == null)
                        {
                            zone.UpdateLayout(-1);
                        }
                    }
                    else
                    {
                        card3.NotifyMousedOut();
                    }
                }
                if (card4 != null)
                {
                    ZoneHand hand2 = card4.GetZone() as ZoneHand;
                    if (hand2 != null)
                    {
                        if (hand2.CurrentStandIn == null)
                        {
                            int num = hand2.FindCardPos(card4);
                            if (num >= 1)
                            {
                                hand2.UpdateLayout(num - 1);
                            }
                        }
                    }
                    else
                    {
                        card4.NotifyMousedOver();
                    }
                }
            }
        }
    }
예제 #3
0
        public bool drop_held_card_worker(int requested_zone_position)
        {
            PegCursor.Get().SetMode(PegCursor.Mode.STOPDRAG);

            InputManager input_man = InputManager.Get();

            if (input_man.heldObject == null)
            {
                Log.log("Nothing held, when trying to drop");
                return(false);
            }
            Card component = input_man.heldObject.GetComponent <Card>();

            ZonePlay m_myPlayZone = PrivateHacker.get_m_myPlayZone();
            ZoneHand m_myHandZone = PrivateHacker.get_m_myHandZone();

            component.SetDoNotSort(false);
            iTween.Stop(input_man.heldObject);
            Entity entity = component.GetEntity();

            component.NotifyLeftPlayfield();
            GameState.Get().GetGameEntity().NotifyOfCardDropped(entity);
            m_myPlayZone.UnHighlightBattlefield();
            DragCardSoundEffects component2 = component.GetComponent <DragCardSoundEffects>();

            if (component2)
            {
                component2.Disable();
            }
            UnityEngine.Object.Destroy(input_man.heldObject.GetComponent <DragRotator>());
            input_man.heldObject = null;
            ProjectedShadow componentInChildren = component.GetActor().GetComponentInChildren <ProjectedShadow>();

            if (componentInChildren != null)
            {
                componentInChildren.DisableShadow();
            }

            // Check that the card is on the hand
            Zone card_zone = component.GetZone();

            if ((card_zone == null) || card_zone.m_ServerTag != TAG_ZONE.HAND)
            {
                return(false);
            }

            bool does_target = false;

            bool is_minion = entity.IsMinion();
            bool is_weapon = entity.IsWeapon();

            if (is_minion || is_weapon)
            {
                Zone zone = (!is_weapon) ? (Zone)m_myPlayZone : (Zone)PrivateHacker.get_m_myWeaponZone();
                if (zone)
                {
                    GameState gameState     = GameState.Get();
                    int       card_position = Network.NoPosition;
                    if (is_minion)
                    {
                        card_position = ZoneMgr.Get().PredictZonePosition(zone, requested_zone_position);
                        gameState.SetSelectedOptionPosition(card_position);
                    }
                    if (input_man.DoNetworkResponse(entity))
                    {
                        if (is_weapon)
                        {
                            PrivateHacker.set_m_lastZoneChangeList(ZoneMgr.Get().AddLocalZoneChange(component, zone, zone.GetLastPos()));
                        }
                        else
                        {
                            PrivateHacker.set_m_lastZoneChangeList(ZoneMgr.Get().AddPredictedLocalZoneChange(component, zone, requested_zone_position, card_position));
                        }
                        PrivateHacker.ForceManaUpdate(entity);
                        if (is_minion && gameState.EntityHasTargets(entity))
                        {
                            does_target = true;
                            if (TargetReticleManager.Get())
                            {
                                bool showArrow = true;
                                TargetReticleManager.Get().CreateFriendlyTargetArrow(entity, entity, true, showArrow, null);
                            }
                            PrivateHacker.set_m_battlecrySourceCard(component);
                        }
                    }
                    else
                    {
                        gameState.SetSelectedOptionPosition(Network.NoPosition);
                    }
                }
            }
            // Spell support
            else
            {
                if (entity.IsSpell())
                {
                    if (GameState.Get().EntityHasTargets(entity))
                    {
                        input_man.heldObject = null;
                        EnemyActionHandler.Get().NotifyOpponentOfCardDropped();
                        m_myHandZone.UpdateLayout(-1, true);
                        m_myPlayZone.SortWithSpotForHeldCard(-1);

                        return(true);
                    }
                    if (!GameState.Get().HasResponse(entity))
                    {
                        PlayErrors.DisplayPlayError(PlayErrors.GetPlayEntityError(entity), entity);
                    }
                    else
                    {
                        input_man.DoNetworkResponse(entity);
                        if (entity.IsSecret())
                        {
                            ZoneSecret m_mySecretZone = PrivateHacker.get_m_mySecretZone();
                            PrivateHacker.set_m_lastZoneChangeList(ZoneMgr.Get().AddLocalZoneChange(component, m_mySecretZone, m_mySecretZone.GetLastPos()));
                        }
                        else
                        {
                            PrivateHacker.set_m_lastZoneChangeList(ZoneMgr.Get().AddLocalZoneChange(component, TAG_ZONE.PLAY));
                        }
                        PrivateHacker.ForceManaUpdate(entity);
                        PrivateHacker.PlayPowerUpSpell(component);
                        PrivateHacker.PlayPlaySpell(component);
                    }
                }
            }
            m_myHandZone.UpdateLayout(-1, true);
            m_myPlayZone.SortWithSpotForHeldCard(-1);
            if (does_target)
            {
                if (EnemyActionHandler.Get())
                {
                    EnemyActionHandler.Get().NotifyOpponentOfTargetModeBegin(component);
                }
            }
            else
            {
                if (GameState.Get().GetResponseMode() != GameState.ResponseMode.SUB_OPTION)
                {
                    EnemyActionHandler.Get().NotifyOpponentOfCardDropped();
                }
            }
            return(true);
        }