예제 #1
0
    private string GetGoldenHeroCardID()
    {
        int index = 0;

        foreach (Achievement achievement in base.m_completedQuests)
        {
            if (achievement.AchieveGroup == Achievement.Group.UNLOCK_GOLDEN_HERO)
            {
                this.m_goldenHeroAchievement = achievement;
                foreach (RewardData data in achievement.Rewards)
                {
                    if (data.RewardType != Reward.Type.CARD)
                    {
                        index++;
                    }
                    else
                    {
                        CardRewardData cardReward = data as CardRewardData;
                        CollectionManager.Get().AddCardReward(cardReward, false);
                        base.m_completedQuests.RemoveAt(index);
                        return(cardReward.CardID);
                    }
                }
            }
        }
        return("none");
    }
예제 #2
0
 public void LoadCard(CardRewardData cardData, GameLayer layer = 0x13)
 {
     this.m_layer     = layer;
     this.m_CardID    = cardData.CardID;
     this.m_cardFlair = new CardFlair(cardData.Premium);
     DefLoader.Get().LoadFullDef(this.m_CardID, new DefLoader.LoadDefCallback <FullDef>(this.OnFullDefLoaded));
 }
예제 #3
0
 internal RewardData(Triton.Game.Mapping.RewardData reward)
 {
     this.Type  = reward.m_type;
     this.Count = 1;
     if (reward.RewardType == Triton.Game.Mapping.Reward.Type.ARCANE_DUST)
     {
         ArcaneDustRewardData data = new ArcaneDustRewardData(reward.Address);
         this.Count = data.Amount;
     }
     else if (reward.RewardType == Triton.Game.Mapping.Reward.Type.GOLD)
     {
         GoldRewardData data2 = new GoldRewardData(reward.Address);
         this.Count = (int)data2.Amount;
     }
     else if (reward.RewardType == Triton.Game.Mapping.Reward.Type.CARD)
     {
         CardRewardData data3 = new CardRewardData(reward.Address);
         this.Count = data3.Count;
     }
     else if (reward.RewardType == Triton.Game.Mapping.Reward.Type.BOOSTER_PACK)
     {
         BoosterPackRewardData data4 = new BoosterPackRewardData(reward.Address);
         this.Count = data4.Count;
     }
 }
예제 #4
0
    private void AddRewardsToCacheValues()
    {
        bool flag = false;

        foreach (RewardData data in this.m_Rewards)
        {
            switch (data.RewardType)
            {
            case Reward.Type.ARCANE_DUST:
            {
                ArcaneDustRewardData data2 = (ArcaneDustRewardData)data;
                NetCache.Get().OnArcaneDustBalanceChanged((long)data2.Amount);
                break;
            }

            case Reward.Type.CARD:
            {
                CardRewardData data3 = (CardRewardData)data;
                CollectionManager.Get().OnCardRewardOpened(data3.CardID, data3.Premium, data3.Count);
                break;
            }

            case Reward.Type.GOLD:
                flag = true;
                break;
            }
        }
        if (flag)
        {
            NetCache.Get().RefreshNetObject <NetCache.NetCacheGoldBalance>();
        }
    }
예제 #5
0
    private void FinishSettingUpActor(Actor actor, CardDef cardDef)
    {
        CardRewardData data = base.Data as CardRewardData;

        actor.SetCardDef(cardDef);
        actor.SetCardFlair(new CardFlair(data.Premium));
        actor.UpdateAllComponents();
    }
    public override List <RewardData> GetCustomRewards()
    {
        List <RewardData> list = new List <RewardData>();
        CardRewardData    item = new CardRewardData("EX1_015", TAG_PREMIUM.NORMAL, 2);

        item.MarkAsDummyReward();
        list.Add(item);
        return(list);
    }
예제 #7
0
    private void InitRewardText()
    {
        CardRewardData data      = base.Data as CardRewardData;
        EntityDef      entityDef = DefLoader.Get().GetEntityDef(data.CardID);

        if (!entityDef.IsHero())
        {
            string       headline  = GameStrings.Get("GLOBAL_REWARD_CARD_HEADLINE");
            string       details   = string.Empty;
            string       source    = string.Empty;
            TAG_CARD_SET cardSet   = entityDef.GetCardSet();
            TAG_CLASS    tag       = entityDef.GetClass();
            string       className = GameStrings.GetClassName(tag);
            if (GameMgr.Get().IsTutorial())
            {
                details = GameUtils.GetCurrentTutorialCardRewardDetails();
            }
            else if (cardSet == TAG_CARD_SET.CORE)
            {
                int num            = 20;
                int basicCardsIOwn = CollectionManager.Get().GetBasicCardsIOwn(tag);
                if (data.Premium == TAG_PREMIUM.GOLDEN)
                {
                    details = string.Empty;
                }
                else
                {
                    if (num == basicCardsIOwn)
                    {
                        data.InnKeeperLine = CardRewardData.InnKeeperTrigger.CORE_CLASS_SET_COMPLETE;
                    }
                    else if (basicCardsIOwn == 4)
                    {
                        data.InnKeeperLine = CardRewardData.InnKeeperTrigger.SECOND_REWARD_EVER;
                    }
                    object[] args = new object[] { basicCardsIOwn, num, className };
                    details = GameStrings.Format("GLOBAL_REWARD_CORE_CARD_DETAILS", args);
                }
            }
            if (base.Data.Origin == NetCache.ProfileNotice.NoticeOrigin.LEVEL_UP)
            {
                TAG_CLASS          originData = (TAG_CLASS)((int)base.Data.OriginData);
                NetCache.HeroLevel heroLevel  = GameUtils.GetHeroLevel(originData);
                object[]           objArray2  = new object[] { heroLevel.CurrentLevel.Level.ToString(), GameStrings.GetClassName(originData) };
                source = GameStrings.Format("GLOBAL_REWARD_CARD_LEVEL_UP", objArray2);
            }
            else
            {
                source = string.Empty;
            }
            base.SetRewardText(headline, details, source);
        }
    }
예제 #8
0
    public override List <RewardData> GetCustomRewards()
    {
        if (!this.victory)
        {
            return(null);
        }
        List <RewardData> list = new List <RewardData>();
        CardRewardData    item = new CardRewardData("EX1_277", TAG_PREMIUM.NORMAL, 2);

        item.MarkAsDummyReward();
        list.Add(item);
        return(list);
    }
    public static void AddRewardDataToList(RewardData newRewardData, List <RewardData> existingRewardDataList)
    {
        CardRewardData duplicateCardDataReward = GetDuplicateCardDataReward(newRewardData, existingRewardDataList);

        if (duplicateCardDataReward == null)
        {
            existingRewardDataList.Add(newRewardData);
        }
        else
        {
            CardRewardData other = newRewardData as CardRewardData;
            duplicateCardDataReward.Merge(other);
        }
    }
예제 #10
0
    private void OnActorLoaded(string name, GameObject go, object callbackData)
    {
        EntityDef entityDef = (EntityDef)callbackData;
        Actor     component = go.GetComponent <Actor>();

        this.StartSettingUpNonHeroActor(component, entityDef, this.m_cardParent.transform);
        CardRewardData data = base.Data as CardRewardData;

        this.m_cardCount.SetCount(data.Count);
        if (data.Count > 1)
        {
            Actor actor = UnityEngine.Object.Instantiate <Actor>(component);
            this.StartSettingUpNonHeroActor(actor, entityDef, this.m_duplicateCardParent.transform);
        }
        DefLoader.Get().LoadCardDef(entityDef.GetCardId(), new DefLoader.LoadDefCallback <CardDef>(this.OnCardDefLoaded), entityDef, new CardPortraitQuality(3, true));
    }
 public bool Merge(CardRewardData other)
 {
     if (!this.CardID.Equals(other.CardID))
     {
         return(false);
     }
     if (!this.Premium.Equals(other.Premium))
     {
         return(false);
     }
     this.Count += other.Count;
     foreach (long num in other.m_noticeIDs)
     {
         base.AddNoticeID(num);
     }
     return(true);
 }
예제 #12
0
    protected override void ShowReward(bool updateCacheValues)
    {
        CardRewardData cardReward = base.Data as CardRewardData;

        if (!cardReward.IsDummyReward && updateCacheValues)
        {
            CollectionManager.Get().AddCardReward(cardReward, true);
        }
        this.InitRewardText();
        base.m_root.SetActive(true);
        this.m_goToRotate.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_goToRotate.gameObject, hashtable);
        SoundManager.Get().LoadAndPlay("game_end_reward");
        this.PlayHeroEmote();
    }
예제 #13
0
 protected override void OnDataSet(bool updateVisuals)
 {
     if (updateVisuals)
     {
         CardRewardData data = base.Data as CardRewardData;
         if (data == null)
         {
             Debug.LogWarning(string.Format("CardReward.SetData() - data {0} is not CardRewardData", base.Data));
         }
         else if (string.IsNullOrEmpty(data.CardID))
         {
             Debug.LogWarning(string.Format("CardReward.SetData() - data {0} has invalid cardID", data));
         }
         else
         {
             base.SetReady(false);
             EntityDef entityDef = DefLoader.Get().GetEntityDef(data.CardID);
             if (entityDef.IsHero())
             {
                 AssetLoader.Get().LoadActor("Card_Play_Hero", new AssetLoader.GameObjectCallback(this.OnHeroActorLoaded), entityDef, false);
                 this.m_goToRotate = this.m_heroCardRoot;
                 this.m_cardCount.Hide();
                 if (data.Premium == TAG_PREMIUM.GOLDEN)
                 {
                     this.SetUpGoldenHeroAchieves();
                 }
                 else
                 {
                     this.SetupHeroAchieves();
                 }
             }
             else
             {
                 if (UniversalInputManager.UsePhoneUI != null)
                 {
                     this.m_cardCount.Hide();
                 }
                 string handActor = ActorNames.GetHandActor(entityDef, data.Premium);
                 AssetLoader.Get().LoadActor(handActor, new AssetLoader.GameObjectCallback(this.OnActorLoaded), entityDef, false);
                 this.m_goToRotate = this.m_nonHeroCardsRoot;
             }
         }
     }
 }
예제 #14
0
    private void SetupHeroAchieves()
    {
        List <Achievement> achievesInGroup = AchieveManager.Get().GetAchievesInGroup(Achievement.Group.UNLOCK_HERO);
        List <Achievement> list2           = AchieveManager.Get().GetAchievesInGroup(Achievement.Group.UNLOCK_HERO, true);
        int            count     = achievesInGroup.Count;
        int            num2      = list2.Count;
        CardRewardData data      = base.Data as CardRewardData;
        string         className = GameStrings.GetClassName(DefLoader.Get().GetEntityDef(data.CardID).GetClass());

        object[] args     = new object[] { className };
        string   headline = GameStrings.Format("GLOBAL_REWARD_HERO_HEADLINE", args);

        object[] objArray2 = new object[] { num2, count };
        string   details   = GameStrings.Format("GLOBAL_REWARD_HERO_DETAILS", objArray2);

        object[] objArray3 = new object[] { className };
        string   source    = GameStrings.Format("GLOBAL_REWARD_HERO_SOURCE", objArray3);

        base.SetRewardText(headline, details, source);
    }
예제 #15
0
    private GameObject CreateRewardInstance(int rewardIndex, Vector3 rewardPos, bool activeOnStart)
    {
        RewardData data = this.m_Rewards[rewardIndex];
        GameObject go   = null;

        switch (data.RewardType)
        {
        case Reward.Type.ARCANE_DUST:
        {
            go = UnityEngine.Object.Instantiate <GameObject>(this.m_RewardSets.m_RewardDust);
            TransformUtil.AttachAndPreserveLocalTransform(go.transform, this.m_Root.transform);
            go.transform.position = rewardPos;
            go.SetActive(true);
            UberText             componentInChildren = go.GetComponentInChildren <UberText>();
            ArcaneDustRewardData data2 = (ArcaneDustRewardData)data;
            componentInChildren.Text = data2.Amount.ToString();
            go.SetActive(activeOnStart);
            break;
        }

        case Reward.Type.BOOSTER_PACK:
        {
            BoosterPackRewardData data3 = data as BoosterPackRewardData;
            int id = data3.Id;
            if (id == 0)
            {
                id = 1;
                UnityEngine.Debug.LogWarning("RewardBoxesDisplay - booster reward is not valid. ID = 0");
            }
            Log.Kyle.Print(string.Format("Booster DB ID: {0}", id), new object[0]);
            string assetName = GameDbf.Booster.GetRecord(id).GetAssetName("ARENA_PREFAB");
            if (string.IsNullOrEmpty(assetName))
            {
                UnityEngine.Debug.LogError(string.Format("RewardBoxesDisplay - no prefab found for booster {0}!", data3.Id));
            }
            else
            {
                go = AssetLoader.Get().LoadGameObject(assetName, true, false);
                TransformUtil.AttachAndPreserveLocalTransform(go.transform, this.m_Root.transform);
                go.transform.position = rewardPos;
                go.SetActive(activeOnStart);
            }
            break;
        }

        case Reward.Type.CARD:
        {
            go = UnityEngine.Object.Instantiate <GameObject>(this.m_RewardSets.m_RewardCard);
            TransformUtil.AttachAndPreserveLocalTransform(go.transform, this.m_Root.transform);
            go.transform.position = rewardPos;
            go.SetActive(true);
            CardRewardData cardData = (CardRewardData)data;
            go.GetComponentInChildren <RewardCard>().LoadCard(cardData, this.m_layer);
            go.SetActive(activeOnStart);
            break;
        }

        case Reward.Type.CARD_BACK:
        {
            go = UnityEngine.Object.Instantiate <GameObject>(this.m_RewardSets.m_RewardCardBack);
            TransformUtil.AttachAndPreserveLocalTransform(go.transform, this.m_Root.transform);
            go.transform.position = rewardPos;
            go.SetActive(true);
            CardBackRewardData cardbackData = (CardBackRewardData)data;
            go.GetComponentInChildren <RewardCardBack>().LoadCardBack(cardbackData, this.m_layer);
            go.SetActive(activeOnStart);
            break;
        }

        case Reward.Type.GOLD:
        {
            go = UnityEngine.Object.Instantiate <GameObject>(this.m_RewardSets.m_RewardGold);
            TransformUtil.AttachAndPreserveLocalTransform(go.transform, this.m_Root.transform);
            go.transform.position = rewardPos;
            go.SetActive(true);
            UberText       text2 = go.GetComponentInChildren <UberText>();
            GoldRewardData data4 = (GoldRewardData)data;
            text2.Text = data4.Amount.ToString();
            go.SetActive(activeOnStart);
            break;
        }
        }
        if (go == null)
        {
            UnityEngine.Debug.LogWarning("RewardBoxesDisplay: Unable to create reward, object null!");
            return(null);
        }
        if (rewardIndex >= this.m_RewardObjects.Length)
        {
            UnityEngine.Debug.LogWarning("RewardBoxesDisplay: CreateRewardInstance reward index exceeded!");
            return(null);
        }
        SceneUtils.SetLayer(go, this.m_layer);
        this.m_RewardObjects[rewardIndex] = go;
        this.m_InstancedObjects.Add(go);
        return(go);
    }