Ejemplo n.º 1
0
    private void OnTurnChanged(int oldTurn, int newTurn, object userData)
    {
        Player currentPlayer = GameState.Get().GetCurrentPlayer();

        if ((((currentPlayer == null) || currentPlayer.IsLocalUser()) || GameMgr.Get().IsSpectator()) && (TargetReticleManager.Get() != null))
        {
            UserUI friendlyActualUI;
            if (currentPlayer.IsFriendlySide())
            {
                friendlyActualUI = this.friendlyActualUI;
                if (TargetReticleManager.Get().IsEnemyArrowActive())
                {
                    TargetReticleManager.Get().DestroyEnemyTargetArrow();
                }
            }
            else
            {
                friendlyActualUI = this.enemyActualUI;
                if (TargetReticleManager.Get().IsLocalArrowActive())
                {
                    TargetReticleManager.Get().DestroyFriendlyTargetArrow(false);
                }
            }
            if ((((friendlyActualUI.origin != null) && (friendlyActualUI.origin.entity != null)) && ((friendlyActualUI.origin.card != null) && friendlyActualUI.origin.entity.HasTag(GAME_TAG.IMMUNE_WHILE_ATTACKING))) && !friendlyActualUI.origin.entity.IsImmune())
            {
                friendlyActualUI.origin.card.GetActor().DeactivateSpell(SpellType.IMMUNE);
            }
        }
    }
Ejemplo n.º 2
0
 private void UpdateTargetArrow()
 {
     if ((TargetReticleManager.Get() != null) && TargetReticleManager.Get().IsActive())
     {
         this.SetArrowTarget();
     }
 }
Ejemplo n.º 3
0
 private void MaybeCreateArrow()
 {
     if ((TargetReticleManager.Get() != null) && !TargetReticleManager.Get().IsActive())
     {
         bool   flag = (GameState.Get() != null) && GameState.Get().IsFriendlySidePlayerTurn();
         UserUI rui  = !flag ? this.enemyWantedUI : this.friendlyWantedUI;
         UserUI rui2 = !flag ? this.enemyActualUI : this.friendlyActualUI;
         if (((((rui.origin.card != null) && (rui2.over.card != null)) && (rui2.over.card.GetActor() != null)) && rui2.over.card.GetActor().IsShown()) && (rui2.over.card != rui.origin.card))
         {
             Player currentPlayer = GameState.Get().GetCurrentPlayer();
             if ((currentPlayer != null) && !currentPlayer.IsLocalUser())
             {
                 rui2.origin.card = rui.origin.card;
                 if (flag)
                 {
                     TargetReticleManager.Get().CreateFriendlyTargetArrow(rui2.origin.entity, rui2.origin.entity, false, true, null, false);
                 }
                 else
                 {
                     TargetReticleManager.Get().CreateEnemyTargetArrow(rui2.origin.entity);
                 }
                 if (rui2.origin.entity.HasTag(GAME_TAG.IMMUNE_WHILE_ATTACKING))
                 {
                     rui2.origin.card.ActivateActorSpell(SpellType.IMMUNE);
                 }
                 this.SetArrowTarget();
             }
         }
     }
 }
Ejemplo n.º 4
0
 private void MaybeDestroyArrow()
 {
     if ((TargetReticleManager.Get() != null) && TargetReticleManager.Get().IsActive())
     {
         bool   flag = (GameState.Get() != null) && GameState.Get().IsFriendlySidePlayerTurn();
         UserUI rui  = !flag ? this.enemyWantedUI : this.friendlyWantedUI;
         UserUI rui2 = !flag ? this.enemyActualUI : this.friendlyActualUI;
         if (rui.origin.card != rui2.origin.card)
         {
             if (rui2.origin.entity.HasTag(GAME_TAG.IMMUNE_WHILE_ATTACKING) && !rui2.origin.entity.IsImmune())
             {
                 rui2.origin.card.GetActor().DeactivateSpell(SpellType.IMMUNE);
             }
             rui2.origin.card = null;
             if (flag)
             {
                 TargetReticleManager.Get().DestroyFriendlyTargetArrow(false);
             }
             else
             {
                 TargetReticleManager.Get().DestroyEnemyTargetArrow();
             }
         }
     }
 }
Ejemplo n.º 5
0
 private void Update()
 {
     if (TargetReticleManager.Get() != null)
     {
         TargetReticleManager.Get().UpdateArrowPosition();
     }
     if (!this.myCurrentUI.SameAs(this.myLastUI) && this.CanSendUI())
     {
         Network.Get().SendUserUI(this.myCurrentUI.over.ID, this.myCurrentUI.held.ID, this.myCurrentUI.origin.ID, 0, 0);
         this.myLastUI.CopyFrom(this.myCurrentUI);
     }
 }
 private void OnTargetReticleManagerLoaded(string name, GameObject go, object callbackData)
 {
     if (go == null)
     {
         UnityEngine.Debug.LogError(string.Format("Gameplay.OnTargetReticleManagerLoaded() - FAILED to load \"{0}\"", name));
     }
     else if (this.IsHandlingNetworkProblem())
     {
         UnityEngine.Object.Destroy(go);
     }
     else
     {
         go.transform.parent = base.transform;
         TargetReticleManager.Get().PreloadTargetArrows();
     }
 }
Ejemplo n.º 7
0
        // Called to invoke AI
        private void run_ai()
        {
            // Temporarily disable reticle so mouse doesn't have to stay in window
            TargetReticleManager trm = TargetReticleManager.Get();

            PrivateHacker.set_TargetReticleManager_s_instance(null);

            try
            {
                // Perform queued actions first
                if (queuedActions.Count > 0)
                {
                    // Dequeue first execution and perform it
                    Action action = queuedActions[0];
                    queuedActions.RemoveAt(0);
                    int delay = api.PerformAction(action);

                    // Delay between each action
                    Delay(delay);
                    return;
                }

                // Get hand cards
                var cards = API.getOurPlayer().GetHandZone().GetCards().ToList <Card>();

                // Get initial actions to perform
                var actions = api.turn(cards);

                // Queue up these actions
                queuedActions.AddRange(actions);

                if (queuedActions.Count == 0)
                {
                    // Done with turn actions
                    Log.log("Ending turn");
                    end_turn();
                }
            }
            catch (Exception e)
            {
                Log.error("Exception in run_ai: " + e.Message);
                Log.error(e.ToString());
            }

            // Re-enable TargetReticleManager
            PrivateHacker.set_TargetReticleManager_s_instance(trm);
        }
Ejemplo n.º 8
0
    private void SetArrowTarget()
    {
        bool   flag = (GameState.Get() != null) && GameState.Get().IsFriendlySidePlayerTurn();
        UserUI rui  = !flag ? this.enemyWantedUI : this.friendlyWantedUI;
        UserUI rui2 = !flag ? this.enemyActualUI : this.friendlyActualUI;

        if ((((rui2.over.card != null) && (rui2.over.card.GetActor() != null)) && rui2.over.card.GetActor().IsShown()) && (rui2.over.card != rui.origin.card))
        {
            RaycastHit hit;
            Vector3    position = Camera.main.transform.position;
            Vector3    vector2  = rui2.over.card.transform.position;
            Ray        ray      = new Ray(position, vector2 - position);
            if (Physics.Raycast(ray, out hit, Camera.main.farClipPlane, GameLayer.DragPlane.LayerBit()))
            {
                TargetReticleManager.Get().SetRemotePlayerArrowPosition(hit.point);
            }
        }
    }
Ejemplo n.º 9
0
 public static bool IsPlayMakerMouseInputAllowed(GameObject go)
 {
     if (UniversalInputManager.Get() == null)
     {
         return(false);
     }
     if (ShouldCheckGameplayForPlayMakerMouseInput(go))
     {
         GameState state = GameState.Get();
         if ((state != null) && state.IsMulliganManagerActive())
         {
             return(false);
         }
         TargetReticleManager manager = TargetReticleManager.Get();
         if ((manager != null) && manager.IsLocalArrowActive())
         {
             return(false);
         }
     }
     return(true);
 }
 public void OnSpellPowerEntityMousedOver()
 {
     if (!TargetReticleManager.Get().IsActive())
     {
         foreach (Card card in base.m_cards)
         {
             if (this.CanPlaySpellPowerHint(card))
             {
                 Spell actorSpell = card.GetActorSpell(SpellType.SPELL_POWER_HINT_BURST);
                 if (actorSpell != null)
                 {
                     actorSpell.Reactivate();
                 }
                 Spell spell2 = card.GetActorSpell(SpellType.SPELL_POWER_HINT_IDLE);
                 if (spell2 != null)
                 {
                     spell2.ActivateState(SpellStateType.BIRTH);
                 }
             }
         }
     }
 }
 private void Awake()
 {
     s_instance = this;
 }
 private void OnDestroy()
 {
     s_instance = null;
 }
Ejemplo n.º 13
0
 public static void set_TargetReticleManager_s_instance(TargetReticleManager i)
 {
     FieldInfo myFieldInfo = typeof(TargetReticleManager).GetField("s_instance", BindingFlags.NonPublic | BindingFlags.Static);
     myFieldInfo.SetValue(null, i);
 }
 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);
 }
Ejemplo n.º 15
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);
        }
Ejemplo n.º 16
0
        public static void set_TargetReticleManager_s_instance(TargetReticleManager i)
        {
            FieldInfo myFieldInfo = typeof(TargetReticleManager).GetField("s_instance", BindingFlags.NonPublic | BindingFlags.Static);

            myFieldInfo.SetValue(null, i);
        }