Exemple #1
0
        private RewardData GiftDataToRewardData(GiftData[] giftDatas)
        {
            RewardData rewardData = new RewardData();

            rewardData.Exp        = 0;
            rewardData.Stamina    = 0;
            rewardData.MultiCoin  = 0;
            rewardData.KakeraCoin = 0;
            GameManager instance = MonoSingleton <GameManager> .Instance;

            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.iname != null)
                {
                    if (giftData.CheckGiftTypeIncluded(GiftTypes.Artifact))
                    {
                        ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(giftData.iname);

                        if (artifactParam != null)
                        {
                            if (rewardData.GiftRecieveItemDataDic.ContainsKey(giftData.iname))
                            {
                                rewardData.GiftRecieveItemDataDic[giftData.iname].num += giftData.num;
                            }
                            else
                            {
                                GiftRecieveItemData giftRecieveItemData = new GiftRecieveItemData();
                                giftRecieveItemData.Set(giftData.iname, GiftTypes.Artifact, artifactParam.rareini, giftData.num);
                                rewardData.GiftRecieveItemDataDic.Add(giftData.iname, giftRecieveItemData);
                            }
                        }
                    }
                    else
                    {
                        ItemData itemData = new ItemData();
                        if (itemData.Setup(0L, giftData.iname, giftData.num))
                        {
                            rewardData.Items.Add(itemData);
                            ItemData itemDataByItemId = instance.Player.FindItemDataByItemID(itemData.Param.iname);
                            int      num = itemDataByItemId == null ? 0 : itemDataByItemId.Num;
                            rewardData.ItemsBeforeAmount.Add(num);
                        }
                    }
                }
            }
            return(rewardData);
        }
Exemple #2
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);
        }
Exemple #3
0
        private void Start()
        {
            if (Network.Mode == Network.EConnectMode.Offline)
            {
                List <MailData> mails = MonoSingleton <GameManager> .Instance.Player.Mails;
                mails.Clear();
                for (int index = 0; index < 50; ++index)
                {
                    MailData mailData = new MailData();
                    GiftData giftData = new GiftData();
                    switch (index % 3)
                    {
                    case 0:
                        giftData.iname = "IT_US_POTION";
                        giftData.num   = 3;
                        break;

                    case 1:
                        giftData.gold = 1000;
                        break;

                    case 2:
                        giftData.coin = 10;
                        break;
                    }
                    mailData.gifts = new GiftData[1] {
                        giftData
                    };
                    mailData.mid     = (long)index;
                    mailData.msg     = "てすと" + index.ToString();
                    mailData.msg    += index % 2 != 0 ? "既読" : "未読";
                    mailData.read    = index % 2 != 0 ? 1L : 0L;
                    mailData.post_at = (long)(10000 + index);
                    mails.Add(mailData);
                }
            }
            this.OnRefresh();
        }
Exemple #4
0
        private void UpdateItems()
        {
            if (Object.op_Equality((Object)this.ItemTemplate, (Object)null))
            {
                return;
            }
            if (this.mItems != null)
            {
                for (int index = 0; index < this.mReadMails.Count; ++index)
                {
                    this.mReadMails[index].SetActive(false);
                }
                for (int index = 0; index < this.mUnreadMails.Count; ++index)
                {
                    this.mUnreadMails[index].SetActive(false);
                }
                this.mReadMails.Clear();
                this.mUnreadMails.Clear();
                for (int index = 0; index < this.mItems.Count; ++index)
                {
                    Object.Destroy((Object)this.mItems[index].get_gameObject());
                }
            }
            List <MailData> mails     = MonoSingleton <GameManager> .Instance.Player.Mails;
            Transform       transform = ((Component)this).get_transform();

            this.mItems       = new List <GameObject>(mails.Count);
            this.mReadMails   = new List <GameObject>();
            this.mUnreadMails = new List <GameObject>();
            for (int index1 = mails.Count - 1; index1 >= 0; --index1)
            {
                MailData   data1       = mails[index1];
                GameObject gameObject1 = this.ItemTemplate;
                if (data1.IsPeriod)
                {
                    gameObject1 = this.ItemTemplate;
                }
                else if (Object.op_Inequality((Object)this.ItemForeverTemplate, (Object)null))
                {
                    gameObject1 = this.ItemForeverTemplate;
                }
                GameObject gameObject2 = (GameObject)Object.Instantiate <GameObject>((M0)gameObject1);
                gameObject2.get_transform().SetParent(transform, false);
                int num = 0;
                for (int index2 = 0; index2 < data1.gifts.Length; ++index2)
                {
                    GiftData gift = data1.gifts[index2];
                    if (gift.num > 0)
                    {
                        ++num;
                    }
                    if (gift.coin > 0)
                    {
                        ++num;
                    }
                    if (gift.gold > 0)
                    {
                        ++num;
                    }
                    if (gift.arenacoin > 0)
                    {
                        ++num;
                    }
                    if (gift.multicoin > 0)
                    {
                        ++num;
                    }
                    if (gift.kakeracoin > 0)
                    {
                        ++num;
                    }
                }
                if (num >= 2)
                {
                    MailIcon component = (MailIcon)gameObject2.GetComponent <MailIcon>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        component.CurrentIcon = component.SetIconTemplate;
                        component.CurrentIcon.SetActive(true);
                    }
                }
                else
                {
                    for (int index2 = 0; index2 < data1.gifts.Length; ++index2)
                    {
                        GiftData gift = data1.gifts[index2];
                        if (gift.num > 0)
                        {
                            if (gift.CheckGiftTypeIncluded(GiftTypes.Artifact))
                            {
                                ArtifactData artifactData = this.CreateArtifactData(gift.iname);
                                if (artifactData != null)
                                {
                                    DataSource.Bind <ArtifactData>(gameObject2, artifactData);
                                }
                                MailIcon component = (MailIcon)gameObject2.GetComponent <MailIcon>();
                                if (Object.op_Inequality((Object)component, (Object)null))
                                {
                                    component.CurrentIcon = component.ArtifactIconTemplate;
                                    component.CurrentIcon.SetActive(true);
                                    break;
                                }
                                break;
                            }
                            if (gift.CheckGiftTypeIncluded(GiftTypes.Item))
                            {
                                ItemData data2 = new ItemData();
                                data2.Setup(0L, gift.iname, gift.num);
                                DataSource.Bind <ItemData>(gameObject2, data2);
                                MailIcon component = (MailIcon)gameObject2.GetComponent <MailIcon>();
                                if (Object.op_Inequality((Object)component, (Object)null))
                                {
                                    component.CurrentIcon = component.ItemIconTemplate;
                                    component.CurrentIcon.SetActive(true);
                                    break;
                                }
                                break;
                            }
                            break;
                        }
                        if (gift.coin > 0)
                        {
                            MailIcon component = (MailIcon)gameObject2.GetComponent <MailIcon>();
                            if (Object.op_Inequality((Object)component, (Object)null))
                            {
                                component.CurrentIcon = component.CoinIconTemplate;
                                component.CurrentIcon.SetActive(true);
                                break;
                            }
                            break;
                        }
                        if (gift.gold > 0)
                        {
                            MailIcon component = (MailIcon)gameObject2.GetComponent <MailIcon>();
                            if (Object.op_Inequality((Object)component, (Object)null))
                            {
                                component.CurrentIcon = component.GoldIconTemplate;
                                component.CurrentIcon.SetActive(true);
                            }
                        }
                        else if (gift.arenacoin > 0)
                        {
                            MailIcon component = (MailIcon)gameObject2.GetComponent <MailIcon>();
                            if (Object.op_Inequality((Object)component, (Object)null))
                            {
                                component.CurrentIcon = component.ArenaCoinIconTemplate;
                                component.CurrentIcon.SetActive(true);
                            }
                        }
                        else if (gift.multicoin > 0)
                        {
                            MailIcon component = (MailIcon)gameObject2.GetComponent <MailIcon>();
                            if (Object.op_Inequality((Object)component, (Object)null))
                            {
                                component.CurrentIcon = component.MultiCoinIconTemplate;
                                component.CurrentIcon.SetActive(true);
                            }
                        }
                        else if (gift.kakeracoin > 0)
                        {
                            MailIcon component = (MailIcon)gameObject2.GetComponent <MailIcon>();
                            if (Object.op_Inequality((Object)component, (Object)null))
                            {
                                component.CurrentIcon = component.KakeraCoinIconTemplate;
                                component.CurrentIcon.SetActive(true);
                            }
                        }
                    }
                }
                DataSource.Bind <MailData>(gameObject2, data1);
                GameObject gameObject3 = ((Component)gameObject2.get_transform().FindChild("btn_read")).get_gameObject();
                if (Object.op_Inequality((Object)gameObject3, (Object)null))
                {
                    DataSource.Bind <MailData>(gameObject3, data1);
                    Button component1 = (Button)gameObject3.GetComponent <Button>();
                    if (Object.op_Inequality((Object)component1, (Object)null))
                    {
                        ListItemEvents component2 = (ListItemEvents)((Component)component1).GetComponent <ListItemEvents>();
                        if (Object.op_Inequality((Object)component2, (Object)null))
                        {
                            component2.OnSelect = new ListItemEvents.ListItemEvent(this.OnSelect);
                        }
                    }
                }
                if (data1.read > 0L)
                {
                    this.mReadMails.Add(gameObject2);
                    gameObject2.SetActive(false);
                }
                else
                {
                    this.mUnreadMails.Add(gameObject2);
                    gameObject2.SetActive(true);
                }
                this.mItems.Add(gameObject2);
            }
        }
Exemple #5
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());
        }
Exemple #6
0
        public bool Deserialize(Json_Mail json)
        {
            this.mid = json.mid;
            this.msg = json.msg;
            if (this.msg.Contains("{"))
            {
                LocMailMsg jsonObject = JSONParser.parseJSONObject <LocMailMsg>(this.msg);
                if (jsonObject != null)
                {
                    string configLanguage = GameUtility.Config_Language;
                    if (configLanguage != null)
                    {
                        // ISSUE: reference to a compiler-generated field
                        if (MailData.\u003C\u003Ef__switch\u0024mapA == null)
                        {
                            // ISSUE: reference to a compiler-generated field
                            MailData.\u003C\u003Ef__switch\u0024mapA = new Dictionary <string, int>(3)
                            {
                                {
                                    "french",
                                    0
                                },
                                {
                                    "german",
                                    1
                                },
                                {
                                    "spanish",
                                    2
                                }
                            };
                        }
                        int num;
                        // ISSUE: reference to a compiler-generated field
                        if (MailData.\u003C\u003Ef__switch\u0024mapA.TryGetValue(configLanguage, out num))
                        {
                            switch (num)
                            {
                            case 0:
                                this.msg = jsonObject.fr;
                                goto label_11;

                            case 1:
                                this.msg = jsonObject.de;
                                goto label_11;

                            case 2:
                                this.msg = jsonObject.es;
                                goto label_11;
                            }
                        }
                    }
                    this.msg = jsonObject.en;
                }
            }
label_11:
            this.gifts = new GiftData[json.gifts.Length];
            for (int index = 0; index < json.gifts.Length; ++index)
            {
                GiftData giftData = new GiftData();
                giftData.iname      = json.gifts[index].iname;
                giftData.num        = json.gifts[index].num;
                giftData.gold       = json.gifts[index].gold;
                giftData.coin       = json.gifts[index].coin;
                giftData.arenacoin  = json.gifts[index].arenacoin;
                giftData.multicoin  = json.gifts[index].multicoin;
                giftData.kakeracoin = json.gifts[index].kakeracoin;
                giftData.UpdateGiftTypes();
                this.gifts[index] = giftData;
            }
            this.read    = (long)json.read;
            this.post_at = json.post_at;
            this.period  = json.period;
            this.type    = json.type;
            return(true);
        }