Exemplo n.º 1
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 0 || ((Behaviour)this).get_enabled())
            {
                return;
            }
            if (Network.Mode == Network.EConnectMode.Online)
            {
                MailData mail = MonoSingleton <GameManager> .Instance.FindMail((long)GlobalVars.SelectedMailUniqueID);

                if (mail == null)
                {
                    ((Behaviour)this).set_enabled(false);
                }
                else
                {
                    ((Behaviour)this).set_enabled(true);
                    this.ExecRequest((WebAPI) new ReqMailSelect(mail.Find(GiftTypes.SelectArtifactItem).iname, ReqMailSelect.type.artifact, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                }
            }
            else
            {
                this.Deserialize(this.DummyResponse());
                this.Success();
            }
        }
Exemplo n.º 2
0
        private void SetRewordData(MailData[] mail_datas)
        {
            if (mail_datas == null || mail_datas.Length <= 0)
            {
                return;
            }
            RewardData rewardData1 = new RewardData();

            for (int index = 0; index < mail_datas.Length; ++index)
            {
                MailData mailData = mail_datas[index];
                if (mailData != null)
                {
                    RewardData rewardData2 = this.GiftDataToRewardData(mailData.gifts);
                    using (Dictionary <string, GiftRecieveItemData> .ValueCollection.Enumerator enumerator = rewardData2.GiftRecieveItemDataDic.Values.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            GiftRecieveItemData current = enumerator.Current;
                            rewardData1.AddReward(current);
                        }
                    }
                    rewardData1.Exp        += rewardData2.Exp;
                    rewardData1.Stamina    += rewardData2.Stamina;
                    rewardData1.Coin       += rewardData2.Coin;
                    rewardData1.Gold       += rewardData2.Gold;
                    rewardData1.ArenaMedal += rewardData2.ArenaMedal;
                    rewardData1.MultiCoin  += rewardData2.MultiCoin;
                    rewardData1.KakeraCoin += rewardData2.KakeraCoin;
                }
            }
            GlobalVars.LastReward.Set(rewardData1);
        }
Exemplo n.º 3
0
        private int CalcConvertedGold(MailData mail)
        {
            int num1 = 0;

            if (mail == null)
            {
                return(num1);
            }
            GameManager instance = MonoSingleton <GameManager> .Instance;

            for (int index = 0; index < mail.gifts.Length; ++index)
            {
                if (!string.IsNullOrEmpty(mail.gifts[index].iname))
                {
                    ItemParam itemParam = instance.GetItemParam(mail.gifts[index].iname);
                    if (itemParam != null)
                    {
                        ItemData itemDataByItemId = instance.Player.FindItemDataByItemID(itemParam.iname);
                        if (itemDataByItemId != null)
                        {
                            int num2 = itemDataByItemId.Num + mail.gifts[index].num - (int)itemParam.cap;
                            if (num2 > 0)
                            {
                                num1 += num2 * (int)itemParam.sell;
                            }
                        }
                    }
                }
            }
            return(num1);
        }
Exemplo n.º 4
0
            public bool CheckReceivable(MailData mailData)
            {
                int  num1 = 0;
                int  num2 = 0;
                bool flag = true;

                if (mailData.gifts != null)
                {
                    foreach (GiftData gift in mailData.gifts)
                    {
                        if (gift.CheckGiftTypeIncluded(GiftTypes.Artifact))
                        {
                            num1 += this.currentNums[GiftTypes.Artifact] + gift.num;
                        }
                        if (gift.CheckGiftTypeIncluded(GiftTypes.ConceptCard))
                        {
                            num2 += this.currentNums[GiftTypes.ConceptCard] + gift.ConceptCardNum;
                            if (gift.conceptCard != null)
                            {
                                ConceptCardParam conceptCardParam = MonoSingleton <GameManager> .Instance.MasterParam.GetConceptCardParam(gift.conceptCard.iname);

                                if (conceptCardParam != null && conceptCardParam.type != eCardType.Equipment)
                                {
                                    flag = false;
                                }
                            }
                        }
                    }
                    if (num1 > (int)MonoSingleton <GameManager> .Instance.MasterParam.FixParam.ArtifactBoxCap || num2 > (int)MonoSingleton <GameManager> .Instance.MasterParam.FixParam.CardMax && flag)
                    {
                        return(false);
                    }
                }
                return(true);
            }
Exemplo n.º 5
0
 public void AddCurrentNum(MailData mailData)
 {
     if (mailData.gifts == null)
     {
         return;
     }
     foreach (GiftData gift in mailData.gifts)
     {
         if (gift.CheckGiftTypeIncluded(GiftTypes.Artifact))
         {
             Dictionary <GiftTypes, int> currentNums;
             GiftTypes index;
             (currentNums = this.currentNums)[index = GiftTypes.Artifact] = currentNums[index] + gift.num;
         }
     }
 }
Exemplo n.º 6
0
 public void Deserialize(Json_Mail[] mailArray)
 {
     if (this.mails == null)
     {
         this.mails = new List <MailData>();
     }
     if (mailArray == null)
     {
         return;
     }
     foreach (Json_Mail mail in mailArray)
     {
         MailData mailData = new MailData();
         mailData.Deserialize(mail);
         this.mails.Add(mailData);
     }
 }
        public override void OnActivate(int pinID)
        {
            if (pinID != 0)
            {
                return;
            }
            MailData mail = MonoSingleton <GameManager> .Instance.FindMail((long)GlobalVars.SelectedMailUniqueID);

            if (mail == null)
            {
                ((Behaviour)this).set_enabled(false);
            }
            else
            {
                ((Behaviour)this).set_enabled(true);
                this.ExecRequest((WebAPI) new ReqMailSelect(mail.Find(GiftTypes.SelectConceptCardItem).iname, ReqMailSelect.type.conceptcard, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
            }
        }
Exemplo n.º 8
0
            public bool CheckReceivable(MailData mailData)
            {
                int num = 0;

                if (mailData.gifts != null)
                {
                    foreach (GiftData gift in mailData.gifts)
                    {
                        if (gift.CheckGiftTypeIncluded(GiftTypes.Artifact) && gift.CheckGiftTypeIncluded(GiftTypes.Artifact))
                        {
                            num += this.currentNums[GiftTypes.Artifact] + gift.num;
                        }
                    }
                    if (num > (int)MonoSingleton <GameManager> .Instance.MasterParam.FixParam.ArtifactBoxCap)
                    {
                        return(false);
                    }
                }
                return(true);
            }
Exemplo n.º 9
0
        private void OnSelect(GameObject go)
        {
            MailData dataOfClass = DataSource.FindDataOfClass <MailData>(go, (MailData)null);

            if (dataOfClass != null)
            {
                GlobalVars.SelectedMailUniqueID.Set(dataOfClass.mid);
                GlobalVars.SelectedMailPeriod.Set(dataOfClass.period);
                FlowNode_OnMailSelect nodeOnMailSelect = (FlowNode_OnMailSelect)((Component)this).GetComponentInParent <FlowNode_OnMailSelect>();
                if (Object.op_Equality((Object)nodeOnMailSelect, (Object)null))
                {
                    nodeOnMailSelect = (FlowNode_OnMailSelect)Object.FindObjectOfType <FlowNode_OnMailSelect>();
                }
                if (Object.op_Inequality((Object)nodeOnMailSelect, (Object)null))
                {
                    nodeOnMailSelect.Selected();
                }
            }
            this.UpdateItems();
        }
Exemplo n.º 10
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();
        }
Exemplo n.º 11
0
        private void OnAllReadAccept()
        {
            if (this.mUnreadMails.Count < 1)
            {
                return;
            }
            this.RefreshCurrentNums();
            RewardData rewardData1 = new RewardData();
            List <MailList.ItemListEntity> itemListEntityList = new List <MailList.ItemListEntity>();
            int num1 = 0;

            for (int index1 = 0; index1 < this.mUnreadMails.Count && num1 < this.MaxReadCount; ++index1)
            {
                MailData dataOfClass = DataSource.FindDataOfClass <MailData>(this.mUnreadMails[index1], (MailData)null);
                if (dataOfClass != null)
                {
                    RewardData rewardData2 = this.GiftDataToRewardData(dataOfClass.gifts);
                    if (this.CheckRecievable(rewardData2))
                    {
                        ++num1;
                        using (Dictionary <string, GiftRecieveItemData> .ValueCollection.Enumerator enumerator = rewardData2.GiftRecieveItemDataDic.Values.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                GiftRecieveItemData current = enumerator.Current;
                                if (rewardData1.GiftRecieveItemDataDic.ContainsKey(current.iname))
                                {
                                    rewardData1.GiftRecieveItemDataDic[current.iname].num += current.num;
                                }
                                else
                                {
                                    rewardData1.GiftRecieveItemDataDic.Add(current.iname, current);
                                }
                                this.AddCurrentNum(current);
                            }
                        }
                        rewardData1.Exp        += rewardData2.Exp;
                        rewardData1.Stamina    += rewardData2.Stamina;
                        rewardData1.Coin       += rewardData2.Coin;
                        rewardData1.Gold       += rewardData2.Gold;
                        rewardData1.ArenaMedal += rewardData2.ArenaMedal;
                        rewardData1.MultiCoin  += rewardData2.MultiCoin;
                        rewardData1.KakeraCoin += rewardData2.KakeraCoin;
                        for (int index2 = 0; index2 < rewardData2.Items.Count; ++index2)
                        {
                            ItemData itemData = rewardData2.Items[index2];
                            if (itemListEntityList.Count > 0)
                            {
                                bool flag = false;
                                for (int index3 = 0; index3 < itemListEntityList.Count; ++index3)
                                {
                                    if (itemListEntityList[index3].Item.ItemID == itemData.ItemID)
                                    {
                                        itemListEntityList[index3].Num += itemData.Num;
                                        flag = true;
                                        break;
                                    }
                                }
                                if (!flag)
                                {
                                    itemListEntityList.Add(new MailList.ItemListEntity(itemData.Num, itemData));
                                }
                            }
                            else
                            {
                                itemListEntityList.Add(new MailList.ItemListEntity(itemData.Num, itemData));
                            }
                        }
                    }
                }
            }
            GameManager instance = MonoSingleton <GameManager> .Instance;

            for (int index = 0; index < itemListEntityList.Count; ++index)
            {
                MailList.ItemListEntity itemListEntity = itemListEntityList[index];
                ItemData itemDataByItemId = instance.Player.FindItemDataByItemID(itemListEntity.Item.Param.iname);
                int      num2             = itemDataByItemId == null ? 0 : itemDataByItemId.Num;
                rewardData1.ItemsBeforeAmount.Add(num2);
                if (itemListEntity.Item.HaveCap < itemListEntity.Num)
                {
                    itemListEntity.Item.Gain(itemListEntity.Item.HaveCap);
                    rewardData1.Items.Add(itemListEntity.Item);
                    int      num3     = itemListEntity.Num - itemListEntity.Item.HaveCap;
                    ItemData itemData = new ItemData();
                    if (itemData.Setup(itemListEntity.Item.UniqueID, itemListEntity.Item.Param, num3))
                    {
                        rewardData1.Items.Add(itemData);
                        rewardData1.ItemsBeforeAmount.Add(itemData.HaveCap);
                    }
                }
                else
                {
                    itemListEntity.Item.Gain(itemListEntity.Num - itemListEntity.Item.Num);
                    rewardData1.Items.Add(itemListEntity.Item);
                }
            }
            GlobalVars.LastReward.Set(rewardData1);
            this.UpdateItems();
        }
Exemplo n.º 12
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);
            }
        }
Exemplo n.º 13
0
        public override void OnActivate(int pinID)
        {
            switch (pinID)
            {
            case 0:
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                FlowNode_ReadMail2.\u003COnActivate\u003Ec__AnonStorey212 activateCAnonStorey212 = new FlowNode_ReadMail2.\u003COnActivate\u003Ec__AnonStorey212();
                MailWindow.MailReadRequestData dataOfClass = DataSource.FindDataOfClass <MailWindow.MailReadRequestData>(((Component)this).get_gameObject(), (MailWindow.MailReadRequestData)null);
                if (Network.Mode == Network.EConnectMode.Offline)
                {
                    this.ActivateOutputLinks(21);
                    ((Behaviour)this).set_enabled(false);
                    break;
                }
                List <MailData> currentMails = MonoSingleton <GameManager> .Instance.Player.CurrentMails;
                List <MailData> mailDataList = new List <MailData>();
                // ISSUE: reference to a compiler-generated field
                activateCAnonStorey212.ids = new List <long>((IEnumerable <long>)dataOfClass.mailIDs);
                // ISSUE: reference to a compiler-generated method
                List <MailData> all = currentMails.FindAll(new Predicate <MailData>(activateCAnonStorey212.\u003C\u003Em__202));
                if (all.Count < 1)
                {
                    this.ActivateOutputLinks(21);
                    ((Behaviour)this).set_enabled(false);
                    break;
                }
                List <GiftData> giftDataList = new List <GiftData>();
                using (FlowNode_ReadMail2.HaveCheckScope haveCheckScope = new FlowNode_ReadMail2.HaveCheckScope())
                {
                    using (List <MailData> .Enumerator enumerator = all.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            MailData current = enumerator.Current;
                            if (haveCheckScope.CheckReceivable(current))
                            {
                                mailDataList.Add(current);
                                if (current.gifts != null)
                                {
                                    for (int index = 0; index < current.gifts.Length; ++index)
                                    {
                                        if (current.gifts[index] != null)
                                        {
                                            giftDataList.Add(current.gifts[index]);
                                        }
                                    }
                                }
                                haveCheckScope.AddCurrentNum(current);
                            }
                        }
                    }
                }
                if (giftDataList.Count >= 1)
                {
                    GlobalVars.UnitGetReward = new UnitGetParam(giftDataList.ToArray());
                }
                if (mailDataList.Count < 1)
                {
                    this.ActivateOutputLinks(23);
                    ((Behaviour)this).set_enabled(false);
                    break;
                }
                this.mReceiveStatus = mailDataList.Count >= all.Count ? FlowNode_ReadMail2.ReceiveStatus.Recieve : FlowNode_ReadMail2.ReceiveStatus.NotReceiveSome;
                long[] mailids = new long[mailDataList.Count];
                for (int index = 0; index < mailDataList.Count; ++index)
                {
                    mailids[index] = mailDataList[index].mid;
                }
                this.ExecRequest((WebAPI) new ReqMailRead(mailids, dataOfClass.isPeriod, dataOfClass.page, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 5:
            case 6:
            case 7:
                string str = GlobalVars.UnlockUnitID;
                switch (pinID - 5)
                {
                case 0:
                    str = GlobalVars.UnlockUnitID;
                    break;

                case 1:
                    str = GlobalVars.ItemSelectListItemData.iiname;
                    this.AnalyticsTrackItemReceived(str, 1);
                    break;

                case 2:
                    str = GlobalVars.ArtifactListItem.iname;
                    this.AnalyticsTrackItemReceived(str, 1);
                    break;
                }
                if (!string.IsNullOrEmpty(str) && pinID == 5)
                {
                    GlobalVars.UnitGetReward = new UnitGetParam(MonoSingleton <GameManager> .Instance.GetItemParam(str));
                }
                this.mReceiveStatus = FlowNode_ReadMail2.ReceiveStatus.Recieve;
                if (Network.Mode == Network.EConnectMode.Offline)
                {
                    ((Behaviour)this).set_enabled(false);
                    this.Success();
                    break;
                }
                this.ExecRequest((WebAPI) new ReqMailRead((long)GlobalVars.SelectedMailUniqueID, (int)GlobalVars.SelectedMailPeriod == 1, (int)GlobalVars.SelectedMailPage, str, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;
            }
        }
Exemplo n.º 14
0
        public void Activated(int pinID)
        {
            int num = pinID;

            switch (num)
            {
            case 1:
                this.currentTab = this.startTab;
                this.Refresh();
                bool flag1 = false;
                bool flag2 = false;
                switch (this.startTab)
                {
                case MailWindow.TabType.NotPeriod:
                    flag1 = MonoSingleton <GameManager> .Instance.Player.UnreadMail;
                    flag2 = MonoSingleton <GameManager> .Instance.Player.UnreadMailPeriod;
                    break;

                case MailWindow.TabType.Period:
                    flag1 = MonoSingleton <GameManager> .Instance.Player.UnreadMailPeriod;
                    flag2 = MonoSingleton <GameManager> .Instance.Player.UnreadMail;
                    break;

                case MailWindow.TabType.Read:
                    flag1 = true;
                    break;
                }
                if (flag1)
                {
                    this.LateActivateOutputLinks(50);
                    break;
                }
                if (flag2)
                {
                    this.LateActivateOutputLinks(51);
                    break;
                }
                this.LateActivateOutputLinks(50);
                break;

            case 2:
                this.TabChange(MailWindow.TabType.NotPeriod);
                if (this.currentTabData.currentPageIsReady)
                {
                    this.UpdateUI();
                    this.ActivateOutputLinks(52);
                    break;
                }
                this.RequestCurrentMails();
                this.ActivateOutputLinks(200);
                break;

            case 3:
                this.TabChange(MailWindow.TabType.Period);
                if (this.currentTabData.currentPageIsReady)
                {
                    this.UpdateUI();
                    this.ActivateOutputLinks(52);
                    break;
                }
                this.RequestCurrentMails();
                this.ActivateOutputLinks(200);
                break;

            case 4:
                this.TabChange(MailWindow.TabType.Read);
                if (this.currentTabData.currentPageIsReady)
                {
                    this.UpdateUI();
                    this.ActivateOutputLinks(52);
                    break;
                }
                this.RequestCurrentMails();
                this.ActivateOutputLinks(200);
                break;

            case 11:
                if (this.currentTabData.SetPage(MonoSingleton <GameManager> .Instance.Player.MailPage))
                {
                    this.UpdateUI();
                    MonoSingleton <GameManager> .Instance.Player.CurrentMails = this.currentTabData.currentPageData.mails;
                }
                this.ActivateOutputLinks(52);
                break;

            case 12:
                if (!this.currentTabData.HasPrev())
                {
                    break;
                }
                if (this.PrevPage())
                {
                    this.UpdateUI();
                    this.ActivateOutputLinks(52);
                    break;
                }
                this.RequestPrevMails();
                this.ActivateOutputLinks(200);
                break;

            case 13:
                if (!this.currentTabData.HasNext())
                {
                    break;
                }
                if (this.NexePage())
                {
                    this.UpdateUI();
                    this.ActivateOutputLinks(52);
                    break;
                }
                this.RequestNextMails();
                this.ActivateOutputLinks(200);
                break;

            case 14:
                this.Refresh();
                if (this.currentTabData.SetPage(MonoSingleton <GameManager> .Instance.Player.MailPage))
                {
                    this.UpdateUI();
                    MonoSingleton <GameManager> .Instance.Player.CurrentMails = this.currentTabData.currentPageData.mails;
                }
                this.ActivateOutputLinks(52);
                break;

            default:
                if (num != 30)
                {
                    if (num != 31)
                    {
                        break;
                    }
                    this.RequestRead(this.currentTabData.currentPageData.mails.FindAll((Predicate <MailData>)(md => !md.Contains(GiftTypes.IgnoreReceiveAll))).ConvertAll <long>((Converter <MailData, long>)(md => md.mid)).ToArray());
                    this.ActivateOutputLinks(60);
                    break;
                }
                long[] mailIDs = new long[1]
                {
                    (long)GlobalVars.SelectedMailUniqueID
                };
                MailData mailData = this.currentTabData.currentPageData.mails.Find((Predicate <MailData>)(md => md.mid == (long)GlobalVars.SelectedMailUniqueID));
                if (mailData == null)
                {
                    break;
                }
                if (mailData.Contains(GiftTypes.SelectSummonTickets))
                {
                    GlobalVars.SelectedMailPeriod.Set(mailData.period);
                    GlobalVars.SelectedMailPage.Set(this.currentTabData.currentPage);
                }
                if (mailData.Contains(GiftTypes.SelectArtifactItem))
                {
                    if (MonoSingleton <GameManager> .Instance.Player.ArtifactNum + 1 > (int)MonoSingleton <GameManager> .Instance.MasterParam.FixParam.ArtifactBoxCap)
                    {
                        this.ActivateOutputLinks(500);
                        break;
                    }
                    this.ActivateOutputLinks(302);
                    break;
                }
                if (mailData.Contains(GiftTypes.SelectItem))
                {
                    this.ActivateOutputLinks(301);
                    break;
                }
                if (mailData.Contains(GiftTypes.SelectUnitItem))
                {
                    this.ActivateOutputLinks(300);
                    break;
                }
                if (mailData.Contains(GiftTypes.SelectConceptCardItem))
                {
                    if ((int)GlobalVars.ConceptCardNum + 1 > (int)MonoSingleton <GameManager> .Instance.MasterParam.FixParam.CardMax)
                    {
                        this.ActivateOutputLinks(501);
                        break;
                    }
                    this.ActivateOutputLinks(303);
                    break;
                }
                this.RequestRead(mailIDs);
                this.ActivateOutputLinks(60);
                break;
            }
        }
Exemplo n.º 15
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                GlobalVars.UnitGetReward = (UnitGetParam)null;
                switch (Network.ErrCode)
                {
                case Network.EErrCode.NoMail:
                    this.OnBack();
                    break;

                case Network.EErrCode.MailReadable:
                    this.OnBack();
                    break;

                case Network.EErrCode.Gift_ConceptCardBoxLimit:
                    this.OnBack();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <FlowNode_ReadMail2.Json_MailRead> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReadMail2.Json_MailRead> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                Network.RemoveAPI();
                try
                {
                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.player);

                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.items);

                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.units);

                    MonoSingleton <GameManager> .Instance.Player.Deserialize(jsonObject.body.mails);

                    if (jsonObject.body.artifacts != null)
                    {
                        MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.artifacts, true);
                    }
                    if (jsonObject.body.mails != null)
                    {
                        GlobalVars.ConceptCardNum.Set(jsonObject.body.mails.concept_count);
                    }
                    if (jsonObject.body.processed != null)
                    {
                        if (jsonObject.body.processed.Length > 0)
                        {
                            MailData[] mail_datas = new MailData[jsonObject.body.processed.Length];
                            for (int index1 = 0; index1 < mail_datas.Length; ++index1)
                            {
                                mail_datas[index1] = new MailData();
                                mail_datas[index1].Deserialize(jsonObject.body.processed[index1]);
                                if (mail_datas[index1].Contains(GiftTypes.ConceptCard))
                                {
                                    GlobalVars.IsDirtyConceptCardData.Set(true);
                                    for (int index2 = 0; index2 < mail_datas[index1].gifts.Length; ++index2)
                                    {
                                        string conceptCardIname = mail_datas[index1].gifts[index2].ConceptCardIname;
                                        if (mail_datas[index1].gifts[index2].IsGetConceptCardUnit)
                                        {
                                            FlowNode_ConceptCardGetUnit.AddConceptCardData(ConceptCardData.CreateConceptCardDataForDisplay(conceptCardIname));
                                        }
                                    }
                                }
                            }
                            this.SetRewordData(mail_datas);
                        }
                    }
                }
                catch (Exception ex)
                {
                    GlobalVars.UnitGetReward = (UnitGetParam)null;
                    DebugUtility.LogException(ex);
                    return;
                }
                if (GlobalVars.LastReward != null && GlobalVars.LastReward.Get() != null)
                {
                    MonoSingleton <GameManager> .Instance.Player.OnGoldChange(GlobalVars.LastReward.Get().Gold);
                }
                ((Behaviour)this).set_enabled(false);
                this.Success();
            }
        }
Exemplo n.º 16
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());
        }
Exemplo n.º 17
0
        public override void OnActivate(int pinID)
        {
            switch (pinID)
            {
            case 10:
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                FlowNode_ReadMail.\u003COnActivate\u003Ec__AnonStorey211 activateCAnonStorey211 = new FlowNode_ReadMail.\u003COnActivate\u003Ec__AnonStorey211();
                if (((Behaviour)this).get_enabled())
                {
                    break;
                }
                if (Network.Mode == Network.EConnectMode.Offline)
                {
                    this.ActivateOutputLinks(20);
                    ((Behaviour)this).set_enabled(false);
                    break;
                }
                // ISSUE: reference to a compiler-generated field
                activateCAnonStorey211.mailid = (long)GlobalVars.SelectedMailUniqueID;
                int selectedMailPeriod = (int)GlobalVars.SelectedMailPeriod;
                // ISSUE: reference to a compiler-generated method
                MailData mailData = MonoSingleton <GameManager> .Instance.Player.Mails.Find(new Predicate <MailData>(activateCAnonStorey211.\u003C\u003Em__201));

                this.RefreshCurrentNums();
                if (!this.CheckRecievable(mailData))
                {
                    this.ActivateOutputLinks(23);
                    ((Behaviour)this).set_enabled(false);
                    break;
                }
                this.mRecieveStatus = FlowNode_ReadMail.RecieveStatus.Recieve;
                // ISSUE: reference to a compiler-generated field
                this.ExecRequest((WebAPI) new ReqMailRead(new long[1]
                {
                    activateCAnonStorey211.mailid
                }, new int[1] {
                    selectedMailPeriod
                }, 0, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                ((Behaviour)this).set_enabled(true);
                break;

            case 11:
                if (((Behaviour)this).get_enabled())
                {
                    break;
                }
                if (Network.Mode == Network.EConnectMode.Offline)
                {
                    this.ActivateOutputLinks(21);
                    ((Behaviour)this).set_enabled(false);
                    break;
                }
                List <MailData> mails         = MonoSingleton <GameManager> .Instance.Player.Mails;
                List <MailData> mailDataList1 = new List <MailData>();
                List <MailData> mailDataList2 = new List <MailData>();
                for (int index = mails.Count - 1; index >= 0; --index)
                {
                    if (mails[index] != null && mails[index].read <= 0L)
                    {
                        mailDataList1.Add(mails[index]);
                    }
                }
                if (mailDataList1.Count < 1)
                {
                    this.ActivateOutputLinks(21);
                    ((Behaviour)this).set_enabled(false);
                    break;
                }
                this.RefreshCurrentNums();
                using (List <MailData> .Enumerator enumerator = mailDataList1.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        MailData current = enumerator.Current;
                        if (this.CheckRecievable(current))
                        {
                            mailDataList2.Add(current);
                            this.AddCurrentNum(current);
                            if (mailDataList2.Count >= 10)
                            {
                                break;
                            }
                        }
                    }
                }
                if (mailDataList2.Count < 1)
                {
                    this.ActivateOutputLinks(23);
                    ((Behaviour)this).set_enabled(false);
                    break;
                }
                this.mRecieveStatus = mailDataList2.Count >= 10 || mailDataList2.Count >= mailDataList1.Count ? FlowNode_ReadMail.RecieveStatus.Recieve : FlowNode_ReadMail.RecieveStatus.NotRecieveSome;
                long[] mailids = new long[mailDataList2.Count];
                int[]  periods = new int[mailDataList2.Count];
                for (int index = 0; index < mailDataList2.Count; ++index)
                {
                    mailids[index] = mailDataList2[index].mid;
                    periods[index] = mailDataList2[index].period;
                }
                this.ExecRequest((WebAPI) new ReqMailRead(mailids, periods, 0, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                ((Behaviour)this).set_enabled(true);
                break;
            }
        }
Exemplo n.º 18
0
        public override void OnActivate(int pinID)
        {
            switch (pinID)
            {
            case 0:
                MailWindow.MailReadRequestData dataOfClass = DataSource.FindDataOfClass <MailWindow.MailReadRequestData>(((Component)this).get_gameObject(), (MailWindow.MailReadRequestData)null);
                if (Network.Mode == Network.EConnectMode.Offline)
                {
                    this.ActivateOutputLinks(21);
                    ((Behaviour)this).set_enabled(false);
                    break;
                }
                List <MailData> currentMails = MonoSingleton <GameManager> .Instance.Player.CurrentMails;
                List <MailData> mailDataList = new List <MailData>();
                List <long>     ids          = new List <long>((IEnumerable <long>)dataOfClass.mailIDs);
                List <MailData> all          = currentMails.FindAll((Predicate <MailData>)(md =>
                {
                    if (!ids.Contains(md.mid))
                    {
                        return(false);
                    }
                    ids.Remove(md.mid);
                    return(true);
                }));
                if (all.Count < 1)
                {
                    this.ActivateOutputLinks(21);
                    ((Behaviour)this).set_enabled(false);
                    break;
                }
                List <GiftData> giftDataList = new List <GiftData>();
                using (FlowNode_ReadMail2.HaveCheckScope haveCheckScope = new FlowNode_ReadMail2.HaveCheckScope())
                {
                    using (List <MailData> .Enumerator enumerator = all.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            MailData current = enumerator.Current;
                            if (haveCheckScope.CheckReceivable(current))
                            {
                                mailDataList.Add(current);
                                if (current.gifts != null)
                                {
                                    for (int index = 0; index < current.gifts.Length; ++index)
                                    {
                                        if (current.gifts[index] != null)
                                        {
                                            giftDataList.Add(current.gifts[index]);
                                        }
                                    }
                                }
                                haveCheckScope.AddCurrentNum(current);
                            }
                        }
                    }
                }
                if (giftDataList.Count >= 1)
                {
                    GlobalVars.UnitGetReward = new UnitGetParam(giftDataList.ToArray());
                }
                if (mailDataList.Count < 1)
                {
                    this.ActivateOutputLinks(23);
                    ((Behaviour)this).set_enabled(false);
                    break;
                }
                this.mReceiveStatus = mailDataList.Count >= all.Count ? FlowNode_ReadMail2.ReceiveStatus.Recieve : FlowNode_ReadMail2.ReceiveStatus.NotReceiveSome;
                long[] mailids = new long[mailDataList.Count];
                for (int index = 0; index < mailDataList.Count; ++index)
                {
                    mailids[index] = mailDataList[index].mid;
                }
                this.ExecRequest((WebAPI) new ReqMailRead(mailids, dataOfClass.isPeriod, dataOfClass.page, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 5:
            case 6:
            case 7:
            case 8:
                string str = GlobalVars.UnlockUnitID;
                if (pinID == 5)
                {
                    str = GlobalVars.UnlockUnitID;
                    if (!string.IsNullOrEmpty(str))
                    {
                        GlobalVars.UnitGetReward = new UnitGetParam(MonoSingleton <GameManager> .Instance.GetItemParam(str));
                    }
                }
                else if (pinID == 6)
                {
                    str = GlobalVars.ItemSelectListItemData.iiname;
                }
                else if (pinID == 7)
                {
                    str = GlobalVars.ArtifactListItem.iname;
                }
                else if (pinID == 8)
                {
                    str = GetConceptCardListWindow.GetSelectedConceptCard();
                    GetConceptCardListWindow.ClearSelectedConceptCard();
                }
                this.mReceiveStatus = FlowNode_ReadMail2.ReceiveStatus.Recieve;
                if (Network.Mode == Network.EConnectMode.Offline)
                {
                    ((Behaviour)this).set_enabled(false);
                    this.Success();
                    break;
                }
                this.ExecRequest((WebAPI) new ReqMailRead((long)GlobalVars.SelectedMailUniqueID, (int)GlobalVars.SelectedMailPeriod == 1, (int)GlobalVars.SelectedMailPage, str, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;
            }
        }