private void Start()
 {
     this.m_stateMgr = SceneUtils.FindComponentInParents <ActorStateMgr>(base.gameObject);
     foreach (ActorStateAnimObject obj2 in this.m_ExternalAnimatedObjects)
     {
         obj2.Init();
     }
     this.m_initialized = true;
     if (this.m_playing)
     {
         base.gameObject.SetActive(true);
         this.PlayNow();
     }
 }
예제 #2
0
    private bool IsMousedOverHero(RaycastHit cardHitInfo)
    {
        Actor actor = SceneUtils.FindComponentInParents <Actor>(cardHitInfo.transform);

        if (actor == null)
        {
            return(false);
        }
        Card card = actor.GetCard();

        if (card == null)
        {
            return(false);
        }
        return(card.GetEntity().IsHero());
    }
    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);
    }
예제 #4
0
    private void UpdateEchoTexture()
    {
        if (this.m_CardBackManager == null)
        {
            this.m_CardBackManager = CardBackManager.Get();
            if (this.m_CardBackManager == null)
            {
                Debug.LogError("CardBackSummonIn failed to get CardBackManager!");
                base.enabled = false;
            }
        }
        if (this.m_Actor == null)
        {
            this.m_Actor = SceneUtils.FindComponentInParents <Actor>(base.gameObject);
            if (this.m_Actor == null)
            {
                Debug.LogError("CardBackSummonIn failed to get Actor!");
            }
        }
        Texture mainTexture = base.GetComponent <Renderer>().material.mainTexture;

        if (this.m_CardBackManager.IsActorFriendly(this.m_Actor))
        {
            CardBack friendlyCardBack = this.m_CardBackManager.GetFriendlyCardBack();
            if (friendlyCardBack != null)
            {
                mainTexture = friendlyCardBack.m_HiddenCardEchoTexture;
            }
        }
        else
        {
            CardBack opponentCardBack = this.m_CardBackManager.GetOpponentCardBack();
            if (opponentCardBack != null)
            {
                mainTexture = opponentCardBack.m_HiddenCardEchoTexture;
            }
        }
        if (mainTexture != null)
        {
            base.GetComponent <Renderer>().material.mainTexture = mainTexture;
        }
    }
 public void OnLoad(SpellState state)
 {
     if (this.m_Target == Target.AS_SPECIFIED)
     {
         if (this.m_GameObject == null)
         {
             Debug.LogError("Error: spell state anim target has a null game object after load");
         }
     }
     else if (this.m_Target == Target.ACTOR)
     {
         Actor actor = SceneUtils.FindComponentInParents <Actor>(state.transform);
         if ((actor == null) || (actor.gameObject == null))
         {
             Debug.LogError("Error: spell state anim target has a null game object after load");
         }
         else
         {
             this.m_GameObject = actor.gameObject;
             this.SetupAnimation();
         }
     }
     else if (this.m_Target == Target.ROOT_OBJECT)
     {
         Actor actor2 = SceneUtils.FindComponentInParents <Actor>(state.transform);
         if ((actor2 == null) || (actor2.gameObject == null))
         {
             Debug.LogError("Error: spell state anim target has a null game object after load");
         }
         else
         {
             this.m_GameObject = actor2.GetRootObject();
             this.SetupAnimation();
         }
     }
     else
     {
         Debug.LogWarning("Error: unimplemented spell anim target");
     }
 }
예제 #6
0
    protected override void OnAction(SpellStateType prevStateType)
    {
        base.OnAction(prevStateType);
        Entity     entity = base.GetSourceCard().GetEntity();
        Actor      actor  = SceneUtils.FindComponentInParents <Actor>(this);
        GameObject main   = this.m_minionPieces.m_main;
        bool       flag   = entity.HasTag(GAME_TAG.PREMIUM);

        if (flag)
        {
            main = this.m_minionPieces.m_premium;
            SceneUtils.EnableRenderers(this.m_minionPieces.m_main, false);
        }
        GameObject portraitMesh = actor.GetPortraitMesh();

        main.GetComponent <Renderer>().material = portraitMesh.GetComponent <Renderer>().sharedMaterial;
        main.SetActive(true);
        SceneUtils.EnableRenderers(main, true);
        if (entity.HasTaunt())
        {
            if (flag)
            {
                this.m_minionPieces.m_taunt.GetComponent <Renderer>().material = this.m_premiumTauntMaterial;
            }
            this.m_minionPieces.m_taunt.SetActive(true);
            SceneUtils.EnableRenderers(this.m_minionPieces.m_taunt, true);
        }
        if (entity.IsElite())
        {
            if (flag)
            {
                this.m_minionPieces.m_legendary.GetComponent <Renderer>().material = this.m_premiumEliteMaterial;
            }
            this.m_minionPieces.m_legendary.SetActive(true);
            SceneUtils.EnableRenderers(this.m_minionPieces.m_legendary, true);
        }
        this.m_attack.SetGameStringText(entity.GetATK().ToString());
        this.m_health.SetGameStringText(entity.GetHealth().ToString());
    }
    private void Start()
    {
        Actor actor = SceneUtils.FindComponentInThisOrParents <Actor>(base.gameObject);

        if (actor == null)
        {
            Spell message = SceneUtils.FindComponentInParents <Spell>(base.gameObject);
            if (message != null)
            {
                Debug.Log(message);
                Debug.Log(message.GetSourceCard());
                actor = message.GetSourceCard().GetActor();
            }
        }
        if (actor == null)
        {
            Debug.LogError(string.Format("SnapActorToGameObject on {0} failed to find Actor object!", base.gameObject.name));
            base.enabled = false;
        }
        else
        {
            this.m_actorTransform = actor.transform;
        }
    }
예제 #8
0
    private bool DetermineRarityInfo()
    {
        TAG_RARITY        tag = (this.m_entityDef != null) ? this.m_entityDef.GetRarity() : TAG_RARITY.COMMON;
        PackOpeningRarity packOpeningRarity = GameUtils.GetPackOpeningRarity(tag);

        if (packOpeningRarity == PackOpeningRarity.NONE)
        {
            UnityEngine.Debug.LogError(string.Format("PackOpeningCard.DetermineRarityInfo() - FAILED to determine rarity for {0}", this.GetCardId()));
            return(false);
        }
        GameObject packOpeningCardEffects = SceneUtils.FindComponentInParents <PackOpening>(this).GetPackOpeningCardEffects();

        if (packOpeningCardEffects == null)
        {
            UnityEngine.Debug.LogError("PackOpeningCard.DetermineRarityInfo() - Fail to get card effect from PackOpening");
            return(false);
        }
        this.m_RarityInfos = packOpeningCardEffects.GetComponentsInChildren <PackOpeningCardRarityInfo>();
        if (this.m_RarityInfos == null)
        {
            UnityEngine.Debug.LogError(string.Format("PackOpeningCard.DetermineRarityInfo() - {0} has no rarity info list. cardId={1}", this, this.GetCardId()));
            return(false);
        }
        for (int i = 0; i < this.m_RarityInfos.Length; i++)
        {
            PackOpeningCardRarityInfo info = this.m_RarityInfos[i];
            if (packOpeningRarity == info.m_RarityType)
            {
                this.m_rarityInfo = info;
                this.SetupRarity();
                return(true);
            }
        }
        UnityEngine.Debug.LogError(string.Format("PackOpeningCard.DetermineRarityInfo() - {0} has no rarity info for {1}. cardId={2}", this, packOpeningRarity, this.GetCardId()));
        return(false);
    }
    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);
                }
            }
        }
    }