コード例 #1
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();
                    }
                }
            }
        }
    }
コード例 #2
0
ファイル: API.cs プロジェクト: zanzo420/HearthstoneBot
        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);
        }