コード例 #1
0
        private RewardData GiftDataToRewardData(GiftData[] giftDatas)
        {
            RewardData rewardData = new RewardData();

            rewardData.Exp        = 0;
            rewardData.Stamina    = 0;
            rewardData.MultiCoin  = 0;
            rewardData.KakeraCoin = 0;
            for (int index = 0; index < giftDatas.Length; ++index)
            {
                GiftData giftData = giftDatas[index];
                rewardData.Coin       += giftData.coin;
                rewardData.Gold       += giftData.gold;
                rewardData.ArenaMedal += giftData.arenacoin;
                rewardData.MultiCoin  += giftData.multicoin;
                rewardData.KakeraCoin += giftData.kakeracoin;
                if (giftData.CheckGiftTypeIncluded(GiftTypes.ConceptCard))
                {
                    ConceptCardParam conceptCardParam = MonoSingleton <GameManager> .Instance.MasterParam.GetConceptCardParam(giftData.ConceptCardIname);

                    rewardData.AddReward(conceptCardParam, giftData.ConceptCardNum);
                    if (giftData.IsGetConceptCardUnit)
                    {
                        ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(giftData.ConceptCardGetUnitIname);

                        rewardData.AddReward(itemParam, 1);
                    }
                }
                if (giftData.iname != null)
                {
                    if (giftData.CheckGiftTypeIncluded(GiftTypes.Artifact))
                    {
                        ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(giftData.iname);

                        rewardData.AddReward(artifactParam, giftData.num);
                    }
                    else if (giftData.CheckGiftTypeIncluded(GiftTypes.Award))
                    {
                        AwardParam awardParam = MonoSingleton <GameManager> .Instance.GetAwardParam(giftData.iname);

                        rewardData.AddReward(awardParam.ToItemParam(), giftData.num);
                    }
                    else
                    {
                        ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(giftData.iname);

                        rewardData.AddReward(itemParam, giftData.num);
                    }
                }
            }
            return(rewardData);
        }
コード例 #2
0
        private void UpdateItems()
        {
            if (Object.op_Equality((Object)this.ItemTemplate, (Object)null) || this.mMailListItems == null)
            {
                return;
            }
            List <MailData> currentMails = MonoSingleton <GameManager> .Instance.Player.CurrentMails;

            if (this.mMailListItems.Count < currentMails.Count)
            {
                Transform transform = ((Component)this).get_transform();
                int       num       = currentMails.Count - this.mMailListItems.Count;
                for (int index = 0; index < num; ++index)
                {
                    GameObject listItem = this.CreateListItem();
                    listItem.get_transform().SetParent(transform, false);
                    this.mMailListItems.Add(listItem);
                }
            }
            for (int index1 = 0; index1 < this.mMailListItems.Count; ++index1)
            {
                GameObject mMailListItem = this.mMailListItems[index1];
                if (index1 >= currentMails.Count)
                {
                    mMailListItem.SetActive(false);
                }
                else
                {
                    mMailListItem.SetActive(true);
                    MailData data1 = currentMails[index1];
                    DataSource.Bind <MailData>(mMailListItem, data1);
                    DataSource.Bind <MailData>(((MailListItem)mMailListItem.GetComponent <MailListItem>()).Button, data1);
                    int num = 0;
                    for (int index2 = 0; index2 < data1.gifts.Length; ++index2)
                    {
                        GiftData gift = data1.gifts[index2];
                        if (gift.CheckGiftTypeIncluded(GiftTypes.Item))
                        {
                            ++num;
                        }
                        if (gift.CheckGiftTypeIncluded(GiftTypes.Unit))
                        {
                            ++num;
                        }
                        if (gift.CheckGiftTypeIncluded(GiftTypes.Coin))
                        {
                            ++num;
                        }
                        if (gift.CheckGiftTypeIncluded(GiftTypes.Gold))
                        {
                            ++num;
                        }
                        if (gift.CheckGiftTypeIncluded(GiftTypes.ArenaCoin))
                        {
                            ++num;
                        }
                        if (gift.CheckGiftTypeIncluded(GiftTypes.MultiCoin))
                        {
                            ++num;
                        }
                        if (gift.CheckGiftTypeIncluded(GiftTypes.KakeraCoin))
                        {
                            ++num;
                        }
                        if (gift.CheckGiftTypeIncluded(GiftTypes.Award))
                        {
                            ++num;
                        }
                        if (num > 1)
                        {
                            break;
                        }
                    }
                    if (num >= 2)
                    {
                        MailIcon component = (MailIcon)mMailListItem.GetComponent <MailIcon>();
                        if (Object.op_Inequality((Object)component, (Object)null))
                        {
                            if (Object.op_Inequality((Object)component.CurrentIcon, (Object)null))
                            {
                                component.CurrentIcon.SetActive(false);
                            }
                            component.CurrentIcon = component.SetIconTemplate;
                            component.CurrentIcon.SetActive(true);
                        }
                    }
                    else
                    {
                        MailIcon component = (MailIcon)mMailListItem.GetComponent <MailIcon>();
                        for (int index2 = 0; index2 < data1.gifts.Length; ++index2)
                        {
                            GiftData gift = data1.gifts[index2];
                            if (!gift.NotSet)
                            {
                                if (gift.CheckGiftTypeIncluded(GiftTypes.Item | GiftTypes.Unit | GiftTypes.SelectUnitItem | GiftTypes.SelectItem | GiftTypes.SelectArtifactItem))
                                {
                                    ItemData data2 = new ItemData();
                                    data2.Setup(0L, gift.iname, gift.num);
                                    DataSource.Bind <ItemData>(mMailListItem, data2);
                                    if (Object.op_Inequality((Object)component, (Object)null))
                                    {
                                        if (Object.op_Inequality((Object)component.CurrentIcon, (Object)null))
                                        {
                                            component.CurrentIcon.SetActive(false);
                                        }
                                        component.CurrentIcon = component.ItemIconTemplate;
                                        component.CurrentIcon.SetActive(true);
                                        break;
                                    }
                                    break;
                                }
                                if (gift.CheckGiftTypeIncluded(GiftTypes.Artifact))
                                {
                                    ArtifactData artifactData = this.CreateArtifactData(gift.iname);
                                    if (artifactData != null)
                                    {
                                        DataSource.Bind <ArtifactData>(mMailListItem, artifactData);
                                    }
                                    if (Object.op_Inequality((Object)component, (Object)null))
                                    {
                                        if (Object.op_Inequality((Object)component.CurrentIcon, (Object)null))
                                        {
                                            component.CurrentIcon.SetActive(false);
                                        }
                                        component.CurrentIcon = component.ArtifactIconTemplate;
                                        component.CurrentIcon.SetActive(true);
                                        break;
                                    }
                                    break;
                                }
                                if (gift.CheckGiftTypeIncluded(GiftTypes.Award))
                                {
                                    AwardParam awardParam = MonoSingleton <GameManager> .Instance.GetAwardParam(gift.iname);

                                    ItemData data2 = new ItemData();
                                    data2.Setup(0L, awardParam.ToItemParam(), gift.num);
                                    DataSource.Bind <ItemData>(mMailListItem, data2);
                                    if (Object.op_Inequality((Object)component, (Object)null))
                                    {
                                        if (Object.op_Inequality((Object)component.CurrentIcon, (Object)null))
                                        {
                                            component.CurrentIcon.SetActive(false);
                                        }
                                        component.CurrentIcon = component.ItemIconTemplate;
                                        component.CurrentIcon.SetActive(true);
                                        break;
                                    }
                                    break;
                                }
                                if (gift.CheckGiftTypeIncluded(GiftTypes.Coin))
                                {
                                    if (Object.op_Inequality((Object)component, (Object)null))
                                    {
                                        if (Object.op_Inequality((Object)component.CurrentIcon, (Object)null))
                                        {
                                            component.CurrentIcon.SetActive(false);
                                        }
                                        component.CurrentIcon = component.CoinIconTemplate;
                                        component.CurrentIcon.SetActive(true);
                                        break;
                                    }
                                    break;
                                }
                                if (gift.CheckGiftTypeIncluded(GiftTypes.Gold))
                                {
                                    if (Object.op_Inequality((Object)component, (Object)null))
                                    {
                                        if (Object.op_Inequality((Object)component.CurrentIcon, (Object)null))
                                        {
                                            component.CurrentIcon.SetActive(false);
                                        }
                                        component.CurrentIcon = component.GoldIconTemplate;
                                        component.CurrentIcon.SetActive(true);
                                        break;
                                    }
                                    break;
                                }
                                if (gift.CheckGiftTypeIncluded(GiftTypes.ArenaCoin))
                                {
                                    if (Object.op_Inequality((Object)component, (Object)null))
                                    {
                                        if (Object.op_Inequality((Object)component.CurrentIcon, (Object)null))
                                        {
                                            component.CurrentIcon.SetActive(false);
                                        }
                                        component.CurrentIcon = component.ArenaCoinIconTemplate;
                                        component.CurrentIcon.SetActive(true);
                                    }
                                }
                                else
                                {
                                    if (gift.CheckGiftTypeIncluded(GiftTypes.MultiCoin))
                                    {
                                        if (Object.op_Inequality((Object)component, (Object)null))
                                        {
                                            if (Object.op_Inequality((Object)component.CurrentIcon, (Object)null))
                                            {
                                                component.CurrentIcon.SetActive(false);
                                            }
                                            component.CurrentIcon = component.MultiCoinIconTemplate;
                                            component.CurrentIcon.SetActive(true);
                                            break;
                                        }
                                        break;
                                    }
                                    if (gift.CheckGiftTypeIncluded(GiftTypes.KakeraCoin))
                                    {
                                        if (Object.op_Inequality((Object)component, (Object)null))
                                        {
                                            if (Object.op_Inequality((Object)component.CurrentIcon, (Object)null))
                                            {
                                                component.CurrentIcon.SetActive(false);
                                            }
                                            component.CurrentIcon = component.KakeraCoinIconTemplate;
                                            component.CurrentIcon.SetActive(true);
                                            break;
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    MailListItem component1 = (MailListItem)mMailListItem.GetComponent <MailListItem>();
                    if (Object.op_Inequality((Object)component1, (Object)null))
                    {
                        component1.Set(data1.IsPeriod, data1.IsReadMail(), data1.post_at, data1.read);
                    }
                }
            }
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }