Example #1
0
    public override void addItem(BaseResponse response)
    {
        if (response != null && response.status != BaseResponse.ERROR)
        {
            //Boss Battle or not

            SevenDaysBuyResponse seven = response as SevenDaysBuyResponse;
            if (seven != null && seven.data != null)
            {
                AddGems(seven.data.p);
            }

            GetLevelRewardResponse GLRResponse = response as GetLevelRewardResponse;
            if (GLRResponse != null)
            {
                AddGems(GLRResponse.data);
            }

            GetTresureResponse GTResponse = response as GetTresureResponse;
            if (GTResponse != null)
            {
                AddGems(GTResponse.data.p);
            }
        }
    }
Example #2
0
    private void AddSevenDayRewardItem(SevenDaysBuyResponse res)
    {
        Utils.Assert(res == null, "We can't add empty list.");
        if (res != null)
        {
            for (int j = 0; j < res.data.p.Length; j++)
            {
                if (res != null && res.data != null && res.data.p[j] != null && DataCore.getDataType(res.data.p[j].pid) == ConfigDataType.Item)
                {
                    ItemInfo itIf = new ItemInfo();
                    itIf.id    = res.data.p[j].ppid;
                    itIf.num   = res.data.p[j].pid;
                    itIf.count = res.data.p[j].num;

                    Item item = new Item(getItemData(res.data.p[j].pid), itIf);
                    if (res.data.p[j].pid == 110052)
                    {
                        Core.Data.playerManager.RTData.curStone += res.data.p[j].num;
                    }
                    else if (res.data.p[j].pid == 110051)
                    {
                        Core.Data.playerManager.RTData.curCoin += res.data.p[j].num;
                    }

                    if (item != null && item.configData.ID != 110051 && item.configData.ID != 110052 && item.configData.ID != JIFEN)
                    {
                        if (BagOfItem.ContainsKey(item.RtData.id))
                        {
                            BagOfItem[item.RtData.id].RtData.count += res.data.p[j].num;
                            BagOfItem[item.RtData.id].isNew         = true;
                        }
                        else
                        {
                            BagOfItem.Add(item.RtData.id, item);
                        }

                        List <Item> itemList = null;

                        if (BagOfItem2.TryGetValue(item.configData.ID, out itemList))
                        {
                            itemList.Add(item);
                        }
                        else
                        {
                            BagOfItem2.Add(item.configData.ID, new List <Item>(new Item[] { item }));
                        }
                    }
                }
            }
        }
    }
Example #3
0
    public override void addItem(BaseResponse response)
    {
        if (response != null && response.status != BaseResponse.ERROR)
        {
            BattleResponse battleResp = response as BattleResponse;
            if (battleResp != null && battleResp.data != null)
            {
                if (battleResp.data.reward != null)
                {
                    AddSoul(battleResp.data.reward.p);
                }
                if (battleResp.data.ext != null)
                {
                    AddSoul(battleResp.data.ext.p);
                }
            }

            SecretShopBuyResponse secretshop = response as SecretShopBuyResponse;
            if (secretshop != null && secretshop.data != null && secretshop.data.p != null)
            {
                AddSoul(secretshop.data.p);
            }

            GetLevelRewardResponse GLRResponse = response as GetLevelRewardResponse;
            if (GLRResponse != null)
            {
                AddSoul(GLRResponse.data);
            }

            SevenDaysBuyResponse seven = response as SevenDaysBuyResponse;
            if (seven != null && seven.data != null)
            {
                AddSoul(seven.data.p);
            }

            NewFinalTrialFightResponse fightres = response as NewFinalTrialFightResponse;
            if (fightres != null && fightres.data != null && fightres.data.rushResult != null && fightres.data.rushResult.award != null)
            {
                AddSoul(fightres.data.rushResult.award);
            }

            GetTresureResponse GTResponse = response as GetTresureResponse;
            if (GTResponse != null)
            {
                AddSoul(GTResponse.data.p);
            }
        }
    }
Example #4
0
    void testHttpResp_UI(BaseHttpRequest request, BaseResponse response)
    {
        if (response != null)
        {
            if (response.status != BaseResponse.ERROR)
            {
                SevenDaysBuyResponse mbuyres = response as SevenDaysBuyResponse;

                SevenDaysListData sData = Core.Data.ActivityManager.GetSevenData();
                if (sData != null)
                {
                    sData.canGain = false;
                    if (sData.index < 7)
                    {
                        sData.index++;
                    }
                }
                Core.Data.ActivityManager.SaveSevenDayData(sData);
                GetRewardSucUI.OpenUI(mbuyres.data.p, Core.Data.stringManager.getString(5047));
                _type = SevenDayCellType.SevenDayCellType_HAVETAKE;
                ShowHaveTake();

                if (sData.index >= 7)
                {
                    Core.Data.ActivityManager.SetDailyGiftState(ActivityManager.sevenDayType, "3");
                    GetGiftPanelController.Instance.SevenDayRewardRefresh();
                }
                else
                {
                    Core.Data.ActivityManager.SetDailyGiftState(ActivityManager.sevenDayType, "2");
                }
                GetGiftPanelController.Instance.CheckNewPos();
            }
            else
            {
                SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getNetworkErrorString(response.errorCode));
            }
        }
        ComLoading.Close();
    }
Example #5
0
    public void addItemshop(BaseResponse response)
    {
        if (response != null && response.status != BaseResponse.ERROR)
        {
            if (response is BuyItemResponse)
            {
                BuyItemResponse buyitemResp = response as BuyItemResponse;
                if (buyitemResp != null && buyitemResp.data != null)
                {
                    if (buyitemResp.data.ndProp != null && buyitemResp.data.ndProp.Length != 0)
                    {
                        int pid = Core.Data.itemManager.GetBagItemPid(buyitemResp.data.ndProp[0]);
                        if (pid != -1)
                        {
                            Core.Data.itemManager.UseItem(pid, buyitemResp.data.ndProp[1]);
                        }
                    }
                    if (buyitemResp.data.Result != null)
                    {
                        if (buyitemResp.data.Result.p != null)
                        {
                            addItem(buyitemResp.data.Result.p);
                        }
                    }
                    else
                    {
                        addItem(buyitemResp.data.p);
                    }
                }
            }
            else if (response is ZhanGongBuyItemResponse)
            {
                ZhanGongBuyItemResponse buyitemResp = response as ZhanGongBuyItemResponse;
                if (buyitemResp != null && buyitemResp.data != null)
                {
                    addItem(buyitemResp.data.p);
//					foreach (ItemdataStruct ids in buyitemResp.data.p) {
//						AddItem (ids);
//					}
                }
            }
            else if (response is QiangDuoGoldBuyItemResponse)
            {
                QiangDuoGoldBuyItemResponse buyitemResp = response as QiangDuoGoldBuyItemResponse;
                if (buyitemResp != null && buyitemResp.data != null)
                {
                    addItem(buyitemResp.data.p);
//					foreach (ItemdataStruct ids in buyitemResp.data.p) {
//						AddItem (ids);
//					}
                }
            }
            else if (response is SecretShopBuyResponse)
            {
                SecretShopBuyResponse buyitemResp = response as SecretShopBuyResponse;
                if (buyitemResp != null)
                {
                    addItem(buyitemResp.data.p);
                }
            }
            else if (response is SevenDaysBuyResponse)
            {
                SevenDaysBuyResponse sevenbuy = response as SevenDaysBuyResponse;
                if (sevenbuy != null)
                {
                    AddSevenDayRewardItem(sevenbuy);
                }
            }
            else if (response is UsePropResponse)
            {
                UsePropResponse propose = response as UsePropResponse;
                if (propose != null)
                {
                    addItem(propose.data.p);
                }
            }
            else if (response is GetMailAttachmentResponse)
            {
                GetMailAttachmentResponse resp = response as GetMailAttachmentResponse;
                if (resp != null && resp.data != null)
                {
                    for (int i = 0; i < resp.data.p.Length; i++)
                    {
                        AddRewardToBag(resp.data.p [i]);
                    }
                }
            }
            else if (response is GetFirstChargeGiftResponse)
            {
                GetFirstChargeGiftResponse resp = response as GetFirstChargeGiftResponse;
                if (resp != null && resp.data != null)
                {
                    for (int i = 0; i < resp.data.award.Length; i++)
                    {
                        AddRewardToBag(resp.data.award [i]);
                    }
                }
            }
            else if (response is GetVipLevelRewardResponse)
            {
                GetVipLevelRewardResponse resp = response as GetVipLevelRewardResponse;
                if (resp != null && resp.data != null)
                {
                    addItem(resp.data.p);
                }
            }
            else if (response is GetMonthGiftResponse)
            {
                GetMonthGiftResponse resp = response  as GetMonthGiftResponse;
                if (resp != null && resp.data != null)
                {
                    addItem(resp.data);
                }
            }
            else if (response is GetActivityLimittimeRewardResponse)
            {
                GetActivityLimittimeRewardResponse resp = response  as GetActivityLimittimeRewardResponse;
                if (resp != null && resp.data != null)
                {
                    addItem(resp.data.p);
                }
            }
        }
    }
Example #6
0
    public override void addItem(BaseResponse response)
    {
        if (response != null && response.status != BaseResponse.ERROR)
        {
            BattleResponse battleResp = response as BattleResponse;
            if (battleResp != null && battleResp.data != null)
            {
                if (battleResp.data.reward != null)
                {
                    addEquipment(battleResp.data.reward);
                }
                if (battleResp.data.ext != null)
                {
                    AddEquip(battleResp.data.ext.p);
                }
            }

            GetLevelRewardResponse GLRResponse = response as GetLevelRewardResponse;
            if (GLRResponse != null)
            {
                AddEquip(GLRResponse.data);
            }

            NewFinalTrialFightResponse fightres = response as NewFinalTrialFightResponse;
            if (fightres != null && fightres.data != null && fightres.data.rushResult != null && fightres.data.rushResult.award != null)
            {
                AddEquip(fightres.data.rushResult.award);
            }

            SockBuyItemResponse buyItem = response as SockBuyItemResponse;
            if (buyItem != null)
            {
                if (buyItem.data.retCode == 1)
                {
                    ItemOfReward[] tReward = new ItemOfReward[1] {
                        buyItem.data.p
                    };
                    AddEquip(tReward);
                }
            }

            UsePropResponse propose = response as UsePropResponse;
            if (propose != null && propose.data != null && propose.data.p != null)
            {
                AddEquip(propose.data.p);
            }


            SevenDaysBuyResponse seven = response as SevenDaysBuyResponse;
            if (seven != null && seven.data != null)
            {
                AddEquip(seven.data.p);
            }

            GetTresureResponse GTResponse = response as GetTresureResponse;
            if (GTResponse != null)
            {
                AddEquip(GTResponse.data.p);
            }
        }
    }
Example #7
0
    /// <summary>
    /// Win Battle & Get Reward
    /// </summary>
    /// <param name="response">Response.</param>
    public override void addItem(BaseResponse response)
    {
        if (response != null && response.status != BaseResponse.ERROR)
        {
            //Boss Battle or not
            BattleResponse battleResp = response as BattleResponse;
            if (battleResp != null && battleResp.data != null)
            {
                BattleReward Rewards = battleResp.data.reward;

                if (Rewards != null)
                {
                    addMonster(Rewards);

                    if (Rewards.p != null)
                    {
                        foreach (ItemOfReward it in Rewards.p)
                        {
                            ConfigDataType type = DataCore.getDataType(it.pid);
                            if (type == ConfigDataType.Gems)
                            {
                                Core.Data.gemsManager.AddGems(it);
                            }
                        }
                    }
                }
                if (battleResp.data.ext != null)
                {
                    addMonster(battleResp.data.ext.p);
                }
            }

            SecretShopBuyResponse secretshop = response as SecretShopBuyResponse;
            if (secretshop != null && secretshop.data != null && secretshop.data.p != null)
            {
                AddShopMon(secretshop.data.p);
            }

            SevenDaysBuyResponse seven = response as SevenDaysBuyResponse;
            if (seven != null && seven.data != null)
            {
                addMonster(seven.data.p);
            }

            GetLevelRewardResponse GLRResponse = response as GetLevelRewardResponse;
            if (GLRResponse != null)
            {
                AddShopMon(GLRResponse.data);
            }

            NewFinalTrialFightResponse fightres = response as NewFinalTrialFightResponse;
            if (fightres != null && fightres.data != null && fightres.data.rushResult != null && fightres.data.rushResult.award != null)
            {
                addMonster(fightres.data.rushResult.award);
            }

            SockBuyItemResponse buyItem = response as SockBuyItemResponse;
            if (buyItem != null)
            {
                if (buyItem.data.retCode == 1)
                {
                    // if (ActivityNetController.tempHonorGiftId != 0) {
                    ItemOfReward[] tReward = new ItemOfReward[1] {
                        buyItem.data.p
                    };
                    addMonster(tReward);
                    //  }
                }
            }

            GetTresureResponse GTResponse = response as GetTresureResponse;
            if (GTResponse != null)
            {
                addMonster(GTResponse.data.p);
            }
        }
    }