private void Start()
        {
            if (Object.op_Inequality((Object)this.Title, (Object)null))
            {
                this.Title.set_text(LocalizedText.Get("sys.UPDATE_ITEMLIST_TITLE"));
            }
            if (Object.op_Inequality((Object)this.Message, (Object)null))
            {
                ShopParam shopParam = MonoSingleton <GameManager> .Instance.MasterParam.GetShopParam(GlobalVars.ShopType);

                string empty = string.Empty;
                string str;
                switch (shopParam.UpdateCostType)
                {
                case ESaleType.Gold:
                    str   = LocalizedText.Get("sys.GOLD");
                    empty = LocalizedText.Get("sys.GOLD");
                    break;

                case ESaleType.TourCoin:
                    str = LocalizedText.Get("sys.TOUR_COIN");
                    break;

                case ESaleType.ArenaCoin:
                    str = LocalizedText.Get("sys.ARENA_COIN");
                    break;

                case ESaleType.PiecePoint:
                    str = LocalizedText.Get("sys.PIECE_POINT");
                    break;

                case ESaleType.MultiCoin:
                    str = LocalizedText.Get("sys.MULTI_COIN");
                    break;

                case ESaleType.EventCoin:
                    ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(GlobalVars.EventShopItem.shop_cost_iname);

                    str = itemParam == null?LocalizedText.Get("sys.EVENT_COIN") : itemParam.name;

                    break;

                default:
                    str = LocalizedText.Get("sys.COIN");
                    break;
                }
                int shopUpdateCost = MonoSingleton <GameManager> .Instance.Player.GetShopUpdateCost(GlobalVars.ShopType, false);

                this.Message.set_text(string.Format(LocalizedText.Get("sys.UPDATE_ITEMLIST_MESSAGE"), (object)str, (object)shopUpdateCost, (object)empty));
            }
            if (Object.op_Inequality((Object)this.DecideText, (Object)null))
            {
                this.DecideText.set_text(LocalizedText.Get("sys.CMD_YES"));
            }
            if (Object.op_Inequality((Object)this.CancelText, (Object)null))
            {
                this.CancelText.set_text(LocalizedText.Get("sys.CMD_NO"));
            }
            this.Refresh();
        }
예제 #2
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 1)
            {
                return;
            }
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            ((Behaviour)this).set_enabled(false);
            ShopData shopData = player.GetShopData(GlobalVars.ShopType);

            if (shopData == null)
            {
                this.ActivateOutputLinks(104);
            }
            else
            {
                ShopItem shopItem = shopData.items[GlobalVars.ShopBuyIndex];
                if (shopItem.is_soldout)
                {
                    this.ActivateOutputLinks(105);
                }
                else
                {
                    ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(shopItem.iname);

                    if (!player.CheckItemCapacity(itemParam, shopItem.num))
                    {
                        this.ActivateOutputLinks(106);
                    }
                    else
                    {
                        switch (shopItem.saleType)
                        {
                        case ESaleType.Gold:
                            if (player.Gold < (int)itemParam.buy * shopItem.num)
                            {
                                this.ActivateOutputLinks(107);
                                return;
                            }
                            break;

                        case ESaleType.Coin:
                            if (player.Coin < (int)itemParam.coin * shopItem.num)
                            {
                                this.ActivateOutputLinks(108);
                                return;
                            }
                            break;

                        case ESaleType.TourCoin:
                            if (player.TourCoin < (int)itemParam.tour_coin * shopItem.num)
                            {
                                this.ActivateOutputLinks(109);
                                return;
                            }
                            break;

                        case ESaleType.ArenaCoin:
                            if (player.ArenaCoin < (int)itemParam.arena_coin * shopItem.num)
                            {
                                this.ActivateOutputLinks(110);
                                return;
                            }
                            break;

                        case ESaleType.PiecePoint:
                            if (player.PiecePoint < (int)itemParam.piece_point * shopItem.num)
                            {
                                this.ActivateOutputLinks(111);
                                return;
                            }
                            break;

                        case ESaleType.MultiCoin:
                            if (player.MultiCoin < (int)itemParam.multi_coin * shopItem.num)
                            {
                                this.ActivateOutputLinks(112);
                                return;
                            }
                            break;

                        case ESaleType.EventCoin:
                            DebugUtility.Assert("There is no common price in the event coin.");
                            this.ActivateOutputLinks(113);
                            return;
                        }
                        this.mShopType = GlobalVars.ShopType;
                        int shopBuyIndex = GlobalVars.ShopBuyIndex;
                        if (Network.Mode == Network.EConnectMode.Offline)
                        {
                            player.DEBUG_BUY_ITEM(this.mShopType, shopBuyIndex);
                            ShopParam shopParam = MonoSingleton <GameManager> .Instance.MasterParam.GetShopParam(this.mShopType);

                            player.OnBuyAtShop(shopParam.iname, itemParam.iname, shopItem.num);
                            this.Success();
                        }
                        else
                        {
                            this.ExecRequest((WebAPI) new ReqItemShopBuypaid(this.mShopType.ToString(), shopBuyIndex, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                            ((Behaviour)this).set_enabled(true);
                        }
                    }
                }
            }
        }
예제 #3
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.ShopSoldOut:
                case Network.EErrCode.ShopBuyCostShort:
                case Network.EErrCode.ShopBuyLvShort:
                case Network.EErrCode.ShopBuyNotFound:
                case Network.EErrCode.ShopBuyItemNotFound:
                    this.OnBack();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_ShopBuyResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_ShopBuyResponse> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                if (jsonObject.body == null)
                {
                    this.OnRetry();
                }
                else
                {
                    Network.RemoveAPI();
                    ShopData shop = MonoSingleton <GameManager> .Instance.Player.GetShopData(this.mShopType) ?? new ShopData();

                    if (!shop.Deserialize(jsonObject.body))
                    {
                        this.OnFailed();
                    }
                    else
                    {
                        MonoSingleton <GameManager> .Instance.Player.SetShopData(this.mShopType, shop);

                        ShopParam shopParam = MonoSingleton <GameManager> .Instance.MasterParam.GetShopParam(this.mShopType);

                        if (shopParam != null)
                        {
                            PlayerData player    = MonoSingleton <GameManager> .Instance.Player;
                            ShopItem   shopItem  = shop.items[GlobalVars.ShopBuyIndex];
                            ItemParam  itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(shopItem.iname);

                            int num = 0;
                            switch (shopItem.saleType)
                            {
                            case ESaleType.Gold:
                                num = (int)itemParam.buy * shopItem.num;
                                break;

                            case ESaleType.Coin:
                                num = (int)itemParam.coin * shopItem.num;
                                break;

                            case ESaleType.TourCoin:
                                num = (int)itemParam.tour_coin * shopItem.num;
                                break;

                            case ESaleType.ArenaCoin:
                                num = (int)itemParam.arena_coin * shopItem.num;
                                break;

                            case ESaleType.PiecePoint:
                                num = (int)itemParam.piece_point * shopItem.num;
                                break;

                            case ESaleType.MultiCoin:
                                num = (int)itemParam.multi_coin * shopItem.num;
                                break;

                            case ESaleType.EventCoin:
                                num = 0;
                                DebugUtility.Assert("There is no common price in the event coin.");
                                break;
                            }
                            player.OnBuyAtShop(shopParam.iname, itemParam.iname, shopItem.num);
                            AnalyticsManager.TrackCurrencyObtain((AnalyticsManager.CurrencyType)(itemParam.type != EItemType.Ticket ? 4 : 2), AnalyticsManager.CurrencySubType.FREE, (long)shopItem.num, "Shop", new Dictionary <string, object>()
                            {
                                {
                                    "item_id",
                                    (object)shopItem.iname
                                }
                            });
                        }
                        this.Success();
                    }
                }
            }
        }
예제 #4
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 1)
            {
                return;
            }
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            ((Behaviour)this).set_enabled(false);
            ShopData shopData = player.GetShopData(GlobalVars.ShopType);

            if (shopData == null)
            {
                this.ActivateOutputLinks(104);
            }
            else
            {
                ShopItem shopitem = shopData.items.FirstOrDefault <ShopItem>((Func <ShopItem, bool>)(item => item.id == GlobalVars.ShopBuyIndex));
                if (shopitem.is_soldout)
                {
                    this.ActivateOutputLinks(105);
                }
                else
                {
                    int       buy       = 0;
                    ItemParam itemParam = (ItemParam)null;
                    if (shopitem.IsArtifact)
                    {
                        buy = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(shopitem.iname).GetBuyNum(shopitem.saleType);
                    }
                    else if (shopitem.IsConceptCard)
                    {
                        if (!MonoSingleton <GameManager> .Instance.Player.CheckConceptCardCapacity(shopitem.num * GlobalVars.ShopBuyAmount))
                        {
                            ConceptCardParam conceptCardParam = MonoSingleton <GameManager> .Instance.MasterParam.GetConceptCardParam(shopitem.iname);

                            if (conceptCardParam != null && conceptCardParam.type == eCardType.Equipment)
                            {
                                this.ActivateOutputLinks(106);
                                return;
                            }
                        }
                    }
                    else
                    {
                        itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(shopitem.iname);

                        if (!shopitem.IsSet && !player.CheckItemCapacity(itemParam, shopitem.num * GlobalVars.ShopBuyAmount))
                        {
                            this.ActivateOutputLinks(106);
                            return;
                        }
                        buy = itemParam.GetBuyNum(shopitem.saleType);
                    }
                    switch (shopitem.saleType)
                    {
                    case ESaleType.Gold:
                        if (!this.CheckCanBuy(shopitem, buy, player.Gold, 107))
                        {
                            return;
                        }
                        break;

                    case ESaleType.Coin:
                        if (!this.CheckCanBuy(shopitem, buy, player.Coin, 108))
                        {
                            return;
                        }
                        break;

                    case ESaleType.TourCoin:
                        if (!this.CheckCanBuy(shopitem, buy, player.TourCoin, 109))
                        {
                            return;
                        }
                        break;

                    case ESaleType.ArenaCoin:
                        if (!this.CheckCanBuy(shopitem, buy, player.ArenaCoin, 110))
                        {
                            return;
                        }
                        break;

                    case ESaleType.PiecePoint:
                        if (!this.CheckCanBuy(shopitem, buy, player.PiecePoint, 111))
                        {
                            return;
                        }
                        break;

                    case ESaleType.MultiCoin:
                        if (!this.CheckCanBuy(shopitem, buy, player.MultiCoin, 112))
                        {
                            return;
                        }
                        break;

                    case ESaleType.EventCoin:
                        DebugUtility.Assert("There is no common price in the event coin.");
                        this.ActivateOutputLinks(113);
                        return;

                    case ESaleType.Coin_P:
                        if (!this.CheckCanBuy(shopitem, buy, player.PaidCoin, 114))
                        {
                            return;
                        }
                        break;
                    }
                    this.mShopType = GlobalVars.ShopType;
                    int shopBuyIndex = GlobalVars.ShopBuyIndex;
                    if (Network.Mode == Network.EConnectMode.Offline)
                    {
                        if (itemParam == null)
                        {
                            return;
                        }
                        player.DEBUG_BUY_ITEM(this.mShopType, shopBuyIndex);
                        ShopParam shopParam = MonoSingleton <GameManager> .Instance.MasterParam.GetShopParam(this.mShopType);

                        player.OnBuyAtShop(shopParam.iname, itemParam.iname, shopitem.num);
                        this.Success();
                    }
                    else
                    {
                        if (this.mShopType == EShopType.Guerrilla)
                        {
                            this.ExecRequest((WebAPI) new ReqItemGuerrillaShopBuypaid(shopBuyIndex, GlobalVars.ShopBuyAmount, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                        }
                        else
                        {
                            this.ExecRequest((WebAPI) new ReqItemShopBuypaid(this.mShopType.ToString(), shopBuyIndex, GlobalVars.ShopBuyAmount, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                        }
                        ((Behaviour)this).set_enabled(true);
                    }
                }
            }
        }
예제 #5
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.ShopSoldOut:
                case Network.EErrCode.ShopBuyCostShort:
                case Network.EErrCode.ShopBuyLvShort:
                case Network.EErrCode.ShopBuyNotFound:
                case Network.EErrCode.ShopBuyItemNotFound:
                    this.OnBack();
                    break;

                case Network.EErrCode.ShopRefreshItemList:
                    UIUtility.SystemMessage((string)null, Network.ErrMsg, (UIUtility.DialogResultEvent)(go => this.ActivateOutputLinks(121)), (GameObject)null, false, -1);
                    ((Behaviour)this).set_enabled(false);
                    Network.RemoveAPI();
                    Network.ResetError();
                    break;

                case Network.EErrCode.ShopBuyOutofItemPeriod:
                    UIUtility.SystemMessage((string)null, Network.ErrMsg, (UIUtility.DialogResultEvent)(go => this.ActivateOutputLinks(120)), (GameObject)null, false, -1);
                    ((Behaviour)this).set_enabled(false);
                    Network.RemoveAPI();
                    Network.ResetError();
                    break;

                case Network.EErrCode.ShopBuyOutofPeriod:
                    UIUtility.SystemMessage((string)null, Network.ErrMsg, (UIUtility.DialogResultEvent)(go => this.ActivateOutputLinks(122)), (GameObject)null, false, -1);
                    ((Behaviour)this).set_enabled(false);
                    Network.RemoveAPI();
                    Network.ResetError();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_ShopBuyResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_ShopBuyResponse> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                if (jsonObject.body == null)
                {
                    this.OnRetry();
                }
                else
                {
                    Network.RemoveAPI();
                    ShopData shop = MonoSingleton <GameManager> .Instance.Player.GetShopData(this.mShopType) ?? new ShopData();

                    if (!shop.Deserialize(jsonObject.body))
                    {
                        this.OnFailed();
                    }
                    else
                    {
                        MonoSingleton <GameManager> .Instance.Player.SetShopData(this.mShopType, shop);

                        if (jsonObject.body.cards != null && jsonObject.body.cards.Length > 0)
                        {
                            GlobalVars.IsDirtyConceptCardData.Set(true);
                            Json_ShopBuyConceptCard[] cards = jsonObject.body.cards;
                            for (int index = 0; index < cards.Length; ++index)
                            {
                                if (cards[index] != null && cards[index].IsGetConceptCardUnit)
                                {
                                    FlowNode_ConceptCardGetUnit.AddConceptCardData(ConceptCardData.CreateConceptCardDataForDisplay(cards[index].iname));
                                }
                            }
                        }
                        ShopParam shopParam = MonoSingleton <GameManager> .Instance.MasterParam.GetShopParam(this.mShopType);

                        if (shopParam != null)
                        {
                            PlayerData player   = MonoSingleton <GameManager> .Instance.Player;
                            ShopItem   shopItem = shop.items.FirstOrDefault <ShopItem>((Func <ShopItem, bool>)(item => item.id == GlobalVars.ShopBuyIndex));
                            string     iname    = shopItem.iname;
                            if (shopItem.isSetSaleValue)
                            {
                                MyMetaps.TrackSpendShop(shopItem.saleType, this.mShopType, shopItem.saleValue);
                            }
                            else
                            {
                                int num = !shopItem.IsArtifact ? (!shopItem.IsConceptCard ? MonoSingleton <GameManager> .Instance.GetItemParam(shopItem.iname).GetBuyNum(shopItem.saleType) * shopItem.num : shopItem.saleValue) : MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(shopItem.iname).GetBuyNum(shopItem.saleType) * shopItem.num;

                                if (num > 0)
                                {
                                    MyMetaps.TrackSpendShop(shopItem.saleType, this.mShopType, num);
                                }
                            }
                            player.OnBuyAtShop(shopParam.iname, iname, shopItem.num);
                        }
                        this.Success();
                    }
                }
            }
        }
예제 #6
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 1 || ((Behaviour)this).get_enabled())
            {
                return;
            }
            this.mShopType = GlobalVars.ShopType;
            ShopData shopData = MonoSingleton <GameManager> .Instance.Player.GetShopData(this.mShopType);

            ShopParam shopParam = MonoSingleton <GameManager> .Instance.MasterParam.GetShopParam(this.mShopType);

            ((Behaviour)this).set_enabled(false);
            if (shopData == null || shopParam == null)
            {
                this.ActivateOutputLinks(101);
            }
            else
            {
                PlayerData player         = MonoSingleton <GameManager> .Instance.Player;
                int        shopUpdateCost = player.GetShopUpdateCost(this.mShopType, false);
                switch (shopParam.UpdateCostType)
                {
                case ESaleType.Gold:
                    if (player.Gold < shopUpdateCost)
                    {
                        this.ActivateOutputLinks(103);
                        return;
                    }
                    break;

                case ESaleType.Coin:
                    if (player.Coin < shopUpdateCost)
                    {
                        this.ActivateOutputLinks(104);
                        return;
                    }
                    break;

                case ESaleType.TourCoin:
                    if (player.TourCoin < shopUpdateCost)
                    {
                        this.ActivateOutputLinks(105);
                        return;
                    }
                    break;

                case ESaleType.ArenaCoin:
                    if (player.ArenaCoin < shopUpdateCost)
                    {
                        this.ActivateOutputLinks(106);
                        return;
                    }
                    break;

                case ESaleType.PiecePoint:
                    if (player.PiecePoint < shopUpdateCost)
                    {
                        this.ActivateOutputLinks(107);
                        return;
                    }
                    break;

                case ESaleType.MultiCoin:
                    if (player.MultiCoin < shopUpdateCost)
                    {
                        this.ActivateOutputLinks(108);
                        return;
                    }
                    break;

                case ESaleType.EventCoin:
                    if (player.EventCoinNum(GlobalVars.EventShopItem.shop_cost_iname) < shopUpdateCost)
                    {
                        this.ActivateOutputLinks(109);
                        return;
                    }
                    break;
                }
                if (Network.Mode == Network.EConnectMode.Online)
                {
                    if (this.mShopType != EShopType.Event)
                    {
                        this.ExecRequest((WebAPI) new ReqItemShopUpdate(this.mShopType.ToString(), new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                    }
                    else
                    {
                        this.ExecRequest((WebAPI) new ReqItemEventShopUpdate(GlobalVars.EventShopItem.shops.gname, GlobalVars.EventShopItem.shop_cost_iname, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                    }
                    ((Behaviour)this).set_enabled(true);
                }
                else if (!player.CheckShopUpdateCost(GlobalVars.ShopType))
                {
                    this.ActivateOutputLinks(104);
                }
                else
                {
                    this.Success();
                }
            }
        }
예제 #7
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.ShopRefreshCostShort:
                case Network.EErrCode.ShopRefreshLvSort:
                    this.OnBack();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                if (GlobalVars.ShopType != EShopType.Event)
                {
                    WebAPI.JSON_BodyResponse <Json_ShopUpdateResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_ShopUpdateResponse> >(www.text);
                    DebugUtility.Assert(jsonObject != null, "res == null");
                    if (jsonObject.body == null)
                    {
                        this.OnRetry();
                        return;
                    }
                    Network.RemoveAPI();
                    ShopData shop = MonoSingleton <GameManager> .Instance.Player.GetShopData(this.mShopType) ?? new ShopData();

                    if (!shop.Deserialize(jsonObject.body))
                    {
                        this.OnFailed();
                        return;
                    }
                    MonoSingleton <GameManager> .Instance.Player.SetShopData(this.mShopType, shop);
                }
                else
                {
                    WebAPI.JSON_BodyResponse <Json_EventShopUpdateResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_EventShopUpdateResponse> >(www.text);
                    DebugUtility.Assert(jsonObject != null, "res == null");
                    if (jsonObject.body == null)
                    {
                        this.OnRetry();
                        return;
                    }
                    List <JSON_EventShopItemListSet> eventShopItemListSetList = new List <JSON_EventShopItemListSet>((IEnumerable <JSON_EventShopItemListSet>)jsonObject.body.shopitems);
                    jsonObject.body.shopitems = eventShopItemListSetList.ToArray();
                    Network.RemoveAPI();
                    EventShopData shop = MonoSingleton <GameManager> .Instance.Player.GetEventShopData() ?? new EventShopData();

                    if (!shop.Deserialize(jsonObject.body))
                    {
                        this.OnFailed();
                        return;
                    }
                    MonoSingleton <GameManager> .Instance.Player.SetEventShopData(shop);
                }
                ShopParam shopParam = MonoSingleton <GameManager> .Instance.MasterParam.GetShopParam(this.mShopType);

                if (shopParam != null)
                {
                    PlayerData player = MonoSingleton <GameManager> .Instance.Player;
                    AnalyticsManager.TrackSpendShopUpdate(shopParam.UpdateCostType, this.mShopType, player.GetShopUpdateCost(this.mShopType, true));
                }
                this.Success();
            }
        }
예제 #8
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.ShopRefreshCostShort:
                case Network.EErrCode.ShopRefreshLvSort:
                    this.OnBack();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                switch (GlobalVars.ShopType)
                {
                case EShopType.Event:
                    WebAPI.JSON_BodyResponse <Json_EventShopUpdateResponse> jsonObject1 = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_EventShopUpdateResponse> >(www.text);
                    DebugUtility.Assert(jsonObject1 != null, "res == null");
                    if (jsonObject1.body == null)
                    {
                        this.OnRetry();
                        return;
                    }
                    List <JSON_EventShopItemListSet> eventShopItemListSetList = new List <JSON_EventShopItemListSet>((IEnumerable <JSON_EventShopItemListSet>)jsonObject1.body.shopitems);
                    jsonObject1.body.shopitems = eventShopItemListSetList.ToArray();
                    Network.RemoveAPI();
                    EventShopData shop1 = MonoSingleton <GameManager> .Instance.Player.GetEventShopData() ?? new EventShopData();

                    if (!shop1.Deserialize(jsonObject1.body))
                    {
                        this.OnFailed();
                        return;
                    }
                    MonoSingleton <GameManager> .Instance.Player.SetEventShopData(shop1);

                    break;

                case EShopType.Limited:
                    WebAPI.JSON_BodyResponse <Json_LimitedShopUpdateResponse> jsonObject2 = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_LimitedShopUpdateResponse> >(www.text);
                    DebugUtility.Assert(jsonObject2 != null, "res == null");
                    if (jsonObject2.body == null)
                    {
                        this.OnRetry();
                        return;
                    }
                    List <JSON_LimitedShopItemListSet> limitedShopItemListSetList = new List <JSON_LimitedShopItemListSet>((IEnumerable <JSON_LimitedShopItemListSet>)jsonObject2.body.shopitems);
                    jsonObject2.body.shopitems = limitedShopItemListSetList.ToArray();
                    Network.RemoveAPI();
                    LimitedShopData shop2 = MonoSingleton <GameManager> .Instance.Player.GetLimitedShopData() ?? new LimitedShopData();

                    if (!shop2.Deserialize(jsonObject2.body))
                    {
                        this.OnFailed();
                        return;
                    }
                    MonoSingleton <GameManager> .Instance.Player.SetLimitedShopData(shop2);

                    break;

                default:
                    WebAPI.JSON_BodyResponse <Json_ShopUpdateResponse> jsonObject3 = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_ShopUpdateResponse> >(www.text);
                    DebugUtility.Assert(jsonObject3 != null, "res == null");
                    if (jsonObject3.body == null)
                    {
                        this.OnRetry();
                        return;
                    }
                    Network.RemoveAPI();
                    ShopData shop3 = MonoSingleton <GameManager> .Instance.Player.GetShopData(this.mShopType) ?? new ShopData();

                    if (!shop3.Deserialize(jsonObject3.body))
                    {
                        this.OnFailed();
                        return;
                    }
                    MonoSingleton <GameManager> .Instance.Player.SetShopData(this.mShopType, shop3);

                    break;
                }
                ShopParam shopParam = MonoSingleton <GameManager> .Instance.MasterParam.GetShopParam(this.mShopType);

                if (shopParam != null)
                {
                    AnalyticsManager.TrackOriginalCurrencyUse(shopParam.UpdateCostType, MonoSingleton <GameManager> .Instance.Player.GetShopUpdateCost(this.mShopType, true), "ShopUpdate." + (object)this.mShopType);
                }
                this.Success();
            }
        }
예제 #9
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.ShopSoldOut:
                case Network.EErrCode.ShopBuyCostShort:
                case Network.EErrCode.ShopBuyLvShort:
                case Network.EErrCode.ShopBuyNotFound:
                case Network.EErrCode.ShopBuyItemNotFound:
                    this.OnBack();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_ShopBuyResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_ShopBuyResponse> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                if (jsonObject.body == null)
                {
                    this.OnRetry();
                }
                else
                {
                    Network.RemoveAPI();
                    ShopData shop = MonoSingleton <GameManager> .Instance.Player.GetShopData(this.mShopType) ?? new ShopData();

                    if (!shop.Deserialize(jsonObject.body))
                    {
                        this.OnFailed();
                    }
                    else
                    {
                        MonoSingleton <GameManager> .Instance.Player.SetShopData(this.mShopType, shop);

                        ShopParam shopParam = MonoSingleton <GameManager> .Instance.MasterParam.GetShopParam(this.mShopType);

                        if (shopParam != null)
                        {
                            PlayerData player   = MonoSingleton <GameManager> .Instance.Player;
                            ShopItem   shopItem = shop.items[GlobalVars.ShopBuyIndex];
                            string     iname    = shopItem.iname;
                            if (shopItem.isSetSaleValue)
                            {
                                MyMetaps.TrackSpendShop(shopItem.saleType, this.mShopType, shopItem.saleValue);
                            }
                            else
                            {
                                int num = !shopItem.IsArtifact ? MonoSingleton <GameManager> .Instance.GetItemParam(shopItem.iname).GetBuyNum(shopItem.saleType) * shopItem.num : MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(shopItem.iname).GetBuyNum(shopItem.saleType) * shopItem.num;

                                if (num > 0)
                                {
                                    MyMetaps.TrackSpendShop(shopItem.saleType, this.mShopType, num);
                                }
                            }
                            player.OnBuyAtShop(shopParam.iname, iname, shopItem.num);
                        }
                        this.Success();
                    }
                }
            }
        }