private void InitCardBacks()
    {
        int cardBackId         = GameState.Get().GetFriendlySidePlayer().GetCardBackId();
        int opponentCardBackID = GameState.Get().GetOpposingSidePlayer().GetCardBackId();

        CardBackManager.Get().SetGameCardBackIDs(cardBackId, opponentCardBackID);
    }
    public void SetEffect()
    {
        if (this.m_CardBackManager == null)
        {
            this.m_CardBackManager = CardBackManager.Get();
            if (this.m_CardBackManager == null)
            {
                Debug.LogError("Failed to get CardBackManager!");
                base.enabled = false;
                return;
            }
        }
        bool   friendlySide = true;
        Entity entity       = this.m_Actor.GetEntity();

        if (entity != null)
        {
            Player controller = entity.GetController();
            if ((controller != null) && (controller.GetSide() == Player.Side.OPPOSING))
            {
                friendlySide = false;
            }
        }
        this.m_CardBackManager.UpdateDragEffect(base.gameObject, friendlySide);
        CardBack cardBack = this.m_CardBackManager.GetCardBack(this.m_Actor);

        if (cardBack != null)
        {
            this.m_Min = cardBack.m_EffectMinVelocity;
            this.m_Max = cardBack.m_EffectMaxVelocity;
        }
    }
Exemplo n.º 3
0
 public void SetCardBack(bool friendlySide)
 {
     if (this.m_CardBackManager == null)
     {
         this.m_CardBackManager = CardBackManager.Get();
     }
     this.m_CardBackManager.UpdateCardBack(base.gameObject, friendlySide);
 }
Exemplo n.º 4
0
 private void Start()
 {
     this.m_CardBackManager = CardBackManager.Get();
     if (this.m_CardBackManager == null)
     {
         Debug.LogError("Failed to get CardBackManager!");
         base.enabled = false;
     }
     this.UpdateDeckCardBacks();
 }
 private void OnCreateGame(GameState.CreateGamePhase phase, object userData)
 {
     if (phase == GameState.CreateGamePhase.CREATING)
     {
         this.InitCardBacks();
         base.StartCoroutine(this.NotifyPlayersOfBoardLoad());
     }
     else if (phase == GameState.CreateGamePhase.CREATED)
     {
         CardBackManager.Get().UpdateAllCardBacks();
     }
 }
Exemplo n.º 6
0
    public void UpdateVisual(bool isOverDeck)
    {
        Actor     activeActor = this.m_activeActor;
        SpellType nONE        = SpellType.NONE;

        if (this.m_visualType == CollectionManagerDisplay.ViewMode.CARDS)
        {
            if ((isOverDeck && (this.m_entityDef != null)) && !this.m_entityDef.IsHero())
            {
                this.m_activeActor = this.m_deckTile;
                nONE = SpellType.SUMMON_IN;
            }
            else
            {
                this.m_activeActor = this.m_cardActor;
                nONE = SpellType.DEATHREVERSE;
            }
        }
        else
        {
            this.m_activeActor = this.m_cardActor;
            nONE = SpellType.DEATHREVERSE;
        }
        if (activeActor != this.m_activeActor)
        {
            if (activeActor != null)
            {
                activeActor.Hide();
                activeActor.gameObject.SetActive(false);
            }
            if (this.m_activeActor != null)
            {
                this.m_activeActor.gameObject.SetActive(true);
                this.m_activeActor.Show();
                if ((this.m_visualType == CollectionManagerDisplay.ViewMode.CARD_BACKS) && (this.m_currentCardBack != null))
                {
                    CardBackManager.Get().UpdateCardBack(this.m_activeActor, this.m_currentCardBack);
                }
                Spell spell = this.m_activeActor.GetSpell(nONE);
                if (spell != null)
                {
                    spell.ActivateState(SpellStateType.BIRTH);
                }
                if ((this.m_entityDef != null) && this.m_entityDef.IsHero())
                {
                    CollectionHeroSkin component = this.m_activeActor.gameObject.GetComponent <CollectionHeroSkin>();
                    component.SetClass(this.m_entityDef.GetClass());
                    component.ShowSocketFX();
                }
            }
        }
    }
 protected override void OnDataSet(bool updateVisuals)
 {
     if (updateVisuals)
     {
         string headline = GameStrings.Get("GLOBAL_REWARD_CARD_BACK_HEADLINE");
         base.SetRewardText(headline, string.Empty, string.Empty);
         CardBackRewardData data = base.Data as CardBackRewardData;
         if (data == null)
         {
             Debug.LogWarning(string.Format("CardBackReward.OnDataSet() - Data {0} is not CardBackRewardData", base.Data));
         }
         else
         {
             base.SetReady(false);
             CardBackManager.Get().LoadCardBackByIndex(data.CardBackID, new CardBackManager.LoadCardBackData.LoadCardBackCallback(this.OnFrontCardBackLoaded), true, "Card_Hidden");
             CardBackManager.Get().LoadCardBackByIndex(data.CardBackID, new CardBackManager.LoadCardBackData.LoadCardBackCallback(this.OnBackCardBackLoaded), true, "Card_Hidden");
         }
     }
 }
Exemplo n.º 8
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;
        }
    }
Exemplo n.º 9
0
    public void SetClass(TAG_CLASS classTag)
    {
        int count = CardBackManager.Get().GetCardBacksOwned().Count;
        int num2  = CollectionManager.Get().GetBestHeroesIOwn(classTag).Count;

        this.SetCardBacksEnabled(count > 1);
        this.SetHeroSkinsEnabled(num2 > 1);
        int index = this.GetIndex(classTag);

        for (int i = 0; i < this.m_classTags.Length; i++)
        {
            TAG_CLASS?nullable = null;
            this.m_classButtons[i].SetClass(nullable, this.m_inactiveMaterial);
            this.m_classButtons[i].SetNewCardCount(0);
        }
        this.m_classButtons[0].SetClass(new TAG_CLASS?(classTag), this.m_classMaterials[index]);
        this.m_classButtons[0].SetNewCardCount(CollectionManagerDisplay.Get().m_pageManager.GetNumNewCardsForClass(classTag));
        this.m_classButtons[1].SetClass(0, this.m_classMaterials[this.m_neutralIndex]);
        this.m_classButtons[1].SetNewCardCount(CollectionManagerDisplay.Get().m_pageManager.GetNumNewCardsForClass(TAG_CLASS.INVALID));
    }
    protected override void ShowReward(bool updateCacheValues)
    {
        CardBackRewardData data = base.Data as CardBackRewardData;

        if (data == null)
        {
            Debug.LogWarning(string.Format("CardBackReward.ShowReward() - Data {0} is not CardBackRewardData", base.Data));
        }
        else
        {
            if (!data.IsDummyReward && updateCacheValues)
            {
                CardBackManager.Get().AddNewCardBack(data.CardBackID);
            }
            base.m_root.SetActive(true);
            this.m_cardbackBone.transform.localEulerAngles = new Vector3(0f, 0f, 180f);
            object[]  args      = new object[] { "amount", new Vector3(0f, 0f, 540f), "time", 1.5f, "easeType", iTween.EaseType.easeOutElastic, "space", Space.Self };
            Hashtable hashtable = iTween.Hash(args);
            iTween.RotateAdd(this.m_cardbackBone.gameObject, hashtable);
        }
    }
 private void Start()
 {
     if ((SceneMgr.Get() == null) || (SceneMgr.Get().GetMode() != SceneMgr.Mode.GAMEPLAY))
     {
         base.enabled = false;
     }
     else
     {
         this.m_LastPosition = base.transform.position;
         if (this.m_CardBackManager == null)
         {
             this.m_CardBackManager = CardBackManager.Get();
             if (this.m_CardBackManager == null)
             {
                 Debug.LogError("Failed to get CardBackManager!");
                 base.enabled = false;
             }
         }
         this.SetEffect();
     }
 }
Exemplo n.º 12
0
 public void LoadCardBack(CardBackRewardData cardbackData, GameLayer layer = 0x13)
 {
     this.m_layer      = layer;
     this.m_CardBackID = cardbackData.CardBackID;
     CardBackManager.Get().LoadCardBackByIndex(this.m_CardBackID, new CardBackManager.LoadCardBackData.LoadCardBackCallback(this.OnCardBackLoaded), "Card_Hidden");
 }
 private void Awake()
 {
     s_instance = this;
     this.InitCardBackData();
     ApplicationMgr.Get().WillReset += new System.Action(this.WillReset);
 }
 private void ShowReward(UIEvent e)
 {
     if (TavernBrawlManager.Get().CurrentMission() != null)
     {
         RewardType rewardType = TavernBrawlManager.Get().CurrentMission().rewardType;
         if (rewardType != RewardType.REWARD_BOOSTER_PACKS)
         {
             if (rewardType != RewardType.REWARD_CARD_BACK)
             {
                 object[] objArray4 = new object[] { TavernBrawlManager.Get().CurrentMission().rewardType };
                 UnityEngine.Debug.LogErrorFormat("Tavern Brawl reward type currently not supported! Add type {0} to TaverBrawlDisplay.ShowReward().", objArray4);
                 return;
             }
             if (this.m_rewardObject == null)
             {
                 int cardBackIdx = (int)TavernBrawlManager.Get().CurrentMission().RewardData1;
                 CardBackManager.LoadCardBackData data = CardBackManager.Get().LoadCardBackByIndex(cardBackIdx, false, "Card_Hidden");
                 if (data == null)
                 {
                     object[] objArray3 = new object[] { cardBackIdx };
                     UnityEngine.Debug.LogErrorFormat("TavernBrawlDisplay.ShowReward() - Could not load cardback ID {0}!", objArray3);
                     return;
                 }
                 this.m_rewardObject = data.m_GameObject;
                 GameUtils.SetParent(this.m_rewardObject, this.m_rewardContainer, false);
                 this.m_rewardObject.transform.localScale = (Vector3)(Vector3.one * 5.92f);
             }
         }
         else if (this.m_rewardObject == null)
         {
             int       id     = (int)TavernBrawlManager.Get().CurrentMission().RewardData1;
             DbfRecord record = GameDbf.Booster.GetRecord(id);
             if (record == null)
             {
                 object[] objArray1 = new object[] { id };
                 UnityEngine.Debug.LogErrorFormat("TavernBrawlDisplay.ShowReward() - no record found for booster {0}!", objArray1);
                 return;
             }
             string assetName = record.GetAssetName("PACK_OPENING_PREFAB");
             if (string.IsNullOrEmpty(assetName))
             {
                 object[] objArray2 = new object[] { id };
                 UnityEngine.Debug.LogErrorFormat("TavernBrawlDisplay.ShowReward() - no prefab found for booster {0}!", objArray2);
                 return;
             }
             GameObject obj2 = AssetLoader.Get().LoadActor(assetName, false, false);
             if (obj2 == null)
             {
                 UnityEngine.Debug.LogError(string.Format("TavernBrawlDisplay.ShowReward() - failed to load prefab {0} for booster {1}!", assetName, id));
                 return;
             }
             this.m_rewardObject = obj2;
             UnopenedPack component = obj2.GetComponent <UnopenedPack>();
             if (component == null)
             {
                 UnityEngine.Debug.LogError(string.Format("TavernBrawlDisplay.ShowReward() - No UnopenedPack script found on prefab {0} for booster {1}!", assetName, id));
                 return;
             }
             GameUtils.SetParent(this.m_rewardObject, this.m_rewardContainer, false);
             component.AddBooster();
         }
         this.m_rewardsPreview.SetActive(true);
         iTween.Stop(this.m_rewardsPreview);
         object[] args = new object[] { "scale", this.m_rewardsScale, "time", 0.15f };
         iTween.ScaleTo(this.m_rewardsPreview, iTween.Hash(args));
     }
 }