private void Refresh()
        {
            MonoSingleton <GameManager> .Instance.Player.UpdateEventCoin();

            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null))
            {
                return;
            }
            this.SetPossessionCoinParam();
            EventShopData eventShopData = MonoSingleton <GameManager> .Instance.Player.GetEventShopData();

            DebugUtility.Assert(eventShopData != null, "ショップ情報が存在しない");
            for (int index = 0; index < this.mBuyItems.Count; ++index)
            {
                this.mBuyItems[index].get_gameObject().SetActive(false);
            }
            int count = eventShopData.items.Count;

            for (int index = 0; index < count; ++index)
            {
                EventShopItem data1 = eventShopData.items[index];
                if (index >= this.mBuyItems.Count)
                {
                    GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemTemplate);
                    gameObject.get_transform().SetParent((Transform)this.ItemLayoutParent, false);
                    this.mBuyItems.Add(gameObject);
                }
                GameObject mBuyItem = this.mBuyItems[index];
                ((EventShopBuyList)mBuyItem.GetComponentInChildren <EventShopBuyList>()).eventShopItem = data1;
                DataSource.Bind <EventShopItem>(mBuyItem, data1);
                if (data1.IsArtifact)
                {
                    ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(data1.iname);

                    DataSource.Bind <ArtifactParam>(mBuyItem, artifactParam);
                }
                else
                {
                    ItemData data2 = new ItemData();
                    data2.Setup(0L, data1.iname, data1.num);
                    DataSource.Bind <ItemData>(mBuyItem, data2);
                    DataSource.Bind <ItemParam>(mBuyItem, MonoSingleton <GameManager> .Instance.GetItemParam(data1.iname));
                }
                ListItemEvents component1 = (ListItemEvents)mBuyItem.GetComponent <ListItemEvents>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component1, (UnityEngine.Object)null))
                {
                    component1.OnSelect = new ListItemEvents.ListItemEvent(this.OnSelect);
                }
                Button component2 = (Button)mBuyItem.GetComponent <Button>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component2, (UnityEngine.Object)null))
                {
                    ((Selectable)component2).set_interactable(!data1.is_soldout);
                }
                mBuyItem.SetActive(true);
            }
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
        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_EventShopBuyResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_EventShopBuyResponse> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                if (jsonObject.body == null)
                {
                    this.OnRetry();
                }
                else
                {
                    Network.RemoveAPI();
                    EventShopData shop = MonoSingleton <GameManager> .Instance.Player.GetEventShopData() ?? new EventShopData();

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

                        EventShopItem eventShopItem = shop.items[GlobalVars.ShopBuyIndex];
                        if (eventShopItem.saleValue > 0)
                        {
                            PlayerData player = MonoSingleton <GameManager> .Instance.Player;
                            AnalyticsManager.TrackSpendShop(eventShopItem.saleType, this.mShopType, player.GetShopUpdateCost(this.mShopType, true));
                        }
                        this.Success();
                    }
                }
            }
        }
Example #3
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                if (Network.ErrCode == Network.EErrCode.LimitedShopOutOfPeriod)
                {
                    this.OnPeriod();
                }
                else
                {
                    this.OnRetry();
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_EventShopResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_EventShopResponse> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                if (jsonObject.body == null)
                {
                    this.OnRetry();
                }
                else
                {
                    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();
                    }
                    else
                    {
                        MonoSingleton <GameManager> .Instance.Player.SetEventShopData(shop);

                        this.Success();
                    }
                }
            }
        }
        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();
            }
        }
        private void Refresh()
        {
            GameUtility.DestroyGameObjects(this.mItems);
            this.mItems.Clear();
            EventShopData eventShopData = MonoSingleton <GameManager> .Instance.Player.GetEventShopData();

            if (eventShopData == null || eventShopData.items.Count <= 0 || Object.op_Equality((Object)this.ItemTemplate, (Object)null))
            {
                return;
            }
            int           shopBuyIndex  = GlobalVars.ShopBuyIndex;
            Transform     parent        = !Object.op_Inequality((Object)this.ItemParent, (Object)null) ? this.ItemTemplate.get_transform().get_parent() : this.ItemParent.get_transform();
            EventShopItem eventShopItem = eventShopData.items[shopBuyIndex];

            if (eventShopItem.IsArtifact)
            {
                eventShopItem.children          = new Json_ShopItemDesc[1];
                eventShopItem.children[0]       = new Json_ShopItemDesc();
                eventShopItem.children[0].iname = eventShopItem.iname;
                eventShopItem.children[0].num   = eventShopItem.num;
            }
            if (eventShopItem.children != null && eventShopItem.children.Length > 0)
            {
                foreach (Json_ShopItemDesc child in eventShopItem.children)
                {
                    string     empty = string.Empty;
                    GameObject gameObject;
                    string     name;
                    if (child.IsArtifact)
                    {
                        ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(child.iname);

                        if (artifactParam != null)
                        {
                            gameObject = this.InstantiateItem <ArtifactParam>(this.ItemTemplate, parent, artifactParam);
                            name       = artifactParam.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        ItemData itemData = new ItemData();
                        if (itemData.Setup(0L, child.iname, child.num))
                        {
                            gameObject = this.InstantiateItem <ItemData>(this.ItemTemplate, parent, itemData);
                            name       = itemData.Param.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    EventShopGiftItem component = (EventShopGiftItem)gameObject.GetComponent <EventShopGiftItem>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        component.SetShopItemInfo(child, name);
                    }
                }
            }
            GameParameter.UpdateAll(((Component)parent).get_gameObject());
        }
Example #6
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();
            }
        }
Example #7
0
        private void Refresh()
        {
            MonoSingleton <GameManager> .Instance.Player.UpdateEventCoin();

            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null))
            {
                return;
            }
            this.SetPossessionCoinParam();
            EventShopData eventShopData = MonoSingleton <GameManager> .Instance.Player.GetEventShopData();

            DebugUtility.Assert(eventShopData != null, "ショップ情報が存在しない");
            for (int index = 0; index < this.mBuyItems.Count; ++index)
            {
                this.mBuyItems[index].get_gameObject().SetActive(false);
            }
            int                  count         = eventShopData.items.Count;
            DateTime             serverTime    = TimeManager.ServerTime;
            List <EventShopItem> nearbyTimeout = new List <EventShopItem>();

            for (int index = 0; index < count; ++index)
            {
                EventShopItem data1 = eventShopData.items[index];
                if (data1.end != 0L)
                {
                    DateTime dateTime = TimeManager.FromUnixTime(data1.end);
                    if (!(serverTime >= dateTime))
                    {
                        if ((dateTime - serverTime).TotalHours < 1.0)
                        {
                            nearbyTimeout.Add(data1);
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                if (index >= this.mBuyItems.Count)
                {
                    GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemTemplate);
                    gameObject.get_transform().SetParent((Transform)this.ItemLayoutParent, false);
                    this.mBuyItems.Add(gameObject);
                }
                GameObject       mBuyItem            = this.mBuyItems[index];
                EventShopBuyList componentInChildren = (EventShopBuyList)mBuyItem.GetComponentInChildren <EventShopBuyList>();
                componentInChildren.eventShopItem = data1;
                DataSource.Bind <EventShopItem>(mBuyItem, data1);
                if (data1.IsArtifact)
                {
                    ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(data1.iname);

                    DataSource.Bind <ArtifactParam>(mBuyItem, artifactParam);
                }
                else if (data1.IsConceptCard)
                {
                    ConceptCardData cardDataForDisplay = ConceptCardData.CreateConceptCardDataForDisplay(data1.iname);
                    componentInChildren.SetupConceptCard(cardDataForDisplay);
                }
                else if (data1.IsItem || data1.IsSet)
                {
                    ItemData data2 = new ItemData();
                    data2.Setup(0L, data1.iname, data1.num);
                    DataSource.Bind <ItemData>(mBuyItem, data2);
                    DataSource.Bind <ItemParam>(mBuyItem, MonoSingleton <GameManager> .Instance.GetItemParam(data1.iname));
                }
                else
                {
                    DebugUtility.LogError(string.Format("不明な商品タイプが設定されています (shopitem.iname({0}) => {1})", (object)data1.iname, (object)data1.ShopItemType));
                }
                ListItemEvents component1 = (ListItemEvents)mBuyItem.GetComponent <ListItemEvents>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component1, (UnityEngine.Object)null))
                {
                    component1.OnSelect = new ListItemEvents.ListItemEvent(this.OnSelect);
                }
                Button component2 = (Button)mBuyItem.GetComponent <Button>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component2, (UnityEngine.Object)null))
                {
                    ((Selectable)component2).set_interactable(!data1.is_soldout);
                }
                mBuyItem.SetActive(true);
            }
            this.ShowAndSaveTimeOutItem(nearbyTimeout);
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
        public override void OnActivate(int pinID)
        {
            if (pinID != 1)
            {
                return;
            }
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            ((Behaviour)this).set_enabled(false);
            EventShopData eventShopData = player.GetEventShopData();

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

                    if (!eventShopItem.IsSet && !player.CheckItemCapacity(itemParam, eventShopItem.num))
                    {
                        this.ActivateOutputLinks(106);
                    }
                    else
                    {
                        switch (eventShopItem.saleType)
                        {
                        case ESaleType.Gold:
                            int num1 = !eventShopItem.isSetSaleValue ? (int)itemParam.buy * eventShopItem.num : eventShopItem.saleValue;
                            if (player.Gold < num1)
                            {
                                this.ActivateOutputLinks(107);
                                return;
                            }
                            break;

                        case ESaleType.Coin:
                            int num2 = !eventShopItem.isSetSaleValue ? (int)itemParam.coin * eventShopItem.num : eventShopItem.saleValue;
                            if (player.Coin < num2)
                            {
                                this.ActivateOutputLinks(108);
                                return;
                            }
                            break;

                        case ESaleType.TourCoin:
                            int num3 = !eventShopItem.isSetSaleValue ? (int)itemParam.tour_coin * eventShopItem.num : eventShopItem.saleValue;
                            if (player.TourCoin < num3)
                            {
                                this.ActivateOutputLinks(109);
                                return;
                            }
                            break;

                        case ESaleType.ArenaCoin:
                            int num4 = !eventShopItem.isSetSaleValue ? (int)itemParam.arena_coin * eventShopItem.num : eventShopItem.saleValue;
                            if (player.ArenaCoin < num4)
                            {
                                this.ActivateOutputLinks(110);
                                return;
                            }
                            break;

                        case ESaleType.PiecePoint:
                            int num5 = !eventShopItem.isSetSaleValue ? (int)itemParam.piece_point * eventShopItem.num : eventShopItem.saleValue;
                            if (player.PiecePoint < num5)
                            {
                                this.ActivateOutputLinks(111);
                                return;
                            }
                            break;

                        case ESaleType.MultiCoin:
                            int num6 = !eventShopItem.isSetSaleValue ? (int)itemParam.multi_coin * eventShopItem.num : eventShopItem.saleValue;
                            if (player.MultiCoin < num6)
                            {
                                this.ActivateOutputLinks(112);
                                return;
                            }
                            break;

                        case ESaleType.EventCoin:
                            if (eventShopItem.isSetSaleValue)
                            {
                                int saleValue = eventShopItem.saleValue;
                                if (player.EventCoinNum(eventShopItem.cost_iname) < saleValue)
                                {
                                    this.ActivateOutputLinks(114);
                                    return;
                                }
                                break;
                            }
                            break;

                        case ESaleType.Coin_P:
                            int num7 = !eventShopItem.isSetSaleValue ? (int)itemParam.coin * eventShopItem.num : eventShopItem.saleValue;
                            if (player.PaidCoin < num7)
                            {
                                this.ActivateOutputLinks(113);
                                return;
                            }
                            break;
                        }
                        if (Network.Mode == Network.EConnectMode.Offline)
                        {
                            player.DEBUG_BUY_ITEM(GlobalVars.ShopType, GlobalVars.ShopBuyIndex);
                            this.Success();
                        }
                        else
                        {
                            this.mShopType = GlobalVars.ShopType;
                            this.ExecRequest((WebAPI) new ReqItemEventShopBuypaid(GlobalVars.EventShopItem.shops.gname, GlobalVars.ShopBuyIndex, 1, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                            ((Behaviour)this).set_enabled(true);
                        }
                    }
                }
            }
        }
        public override void OnActivate(int pinID)
        {
            if (pinID != 1)
            {
                return;
            }
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            ((Behaviour)this).set_enabled(false);
            EventShopData eventShopData = player.GetEventShopData();

            if (eventShopData == null)
            {
                this.ActivateOutputLinks(104);
            }
            else
            {
                EventShopItem shopitem = eventShopData.items[GlobalVars.ShopBuyIndex];
                if (shopitem.is_soldout)
                {
                    this.ActivateOutputLinks(105);
                }
                else
                {
                    int buy = 0;
                    if (shopitem.IsArtifact)
                    {
                        buy = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(shopitem.iname).GetBuyNum(shopitem.saleType);
                    }
                    else
                    {
                        ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(shopitem.iname);

                        if (!shopitem.IsSet && !player.CheckItemCapacity(itemParam, shopitem.num))
                        {
                            this.ActivateOutputLinks(106);
                            return;
                        }
                    }
                    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:
                        if (shopitem.isSetSaleValue)
                        {
                            int saleValue = shopitem.saleValue;
                            if (player.EventCoinNum(shopitem.cost_iname) < saleValue)
                            {
                                this.ActivateOutputLinks(114);
                                return;
                            }
                            break;
                        }
                        break;

                    case ESaleType.Coin_P:
                        if (!this.CheckCanBuy(shopitem, buy, player.PaidCoin, 113))
                        {
                            return;
                        }
                        break;
                    }
                    if (Network.Mode == Network.EConnectMode.Offline)
                    {
                        player.DEBUG_BUY_ITEM(GlobalVars.ShopType, GlobalVars.ShopBuyIndex);
                        this.Success();
                    }
                    else
                    {
                        this.mShopType = GlobalVars.ShopType;
                        this.ExecRequest((WebAPI) new ReqItemEventShopBuypaid(GlobalVars.EventShopItem.shops.gname, GlobalVars.ShopBuyIndex, 1, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                        ((Behaviour)this).set_enabled(true);
                    }
                }
            }
        }
        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_EventShopBuyResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_EventShopBuyResponse> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                if (jsonObject.body == null)
                {
                    this.OnRetry();
                }
                else
                {
                    Network.RemoveAPI();
                    EventShopData shop = MonoSingleton <GameManager> .Instance.Player.GetEventShopData() ?? new EventShopData();

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

                        EventShopItem eventShopItem = shop.items.FirstOrDefault <EventShopItem>((Func <EventShopItem, bool>)(item => item.id == GlobalVars.ShopBuyIndex));
                        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));
                                }
                            }
                        }
                        if (eventShopItem.saleValue > 0)
                        {
                            MyMetaps.TrackSpendShop(eventShopItem.saleType, this.mShopType, eventShopItem.saleValue);
                        }
                        this.Success();
                    }
                }
            }
        }
        private void Refresh()
        {
            GameUtility.DestroyGameObjects(this.mItems);
            this.mItems.Clear();
            EventShopData eventShopData = MonoSingleton <GameManager> .Instance.Player.GetEventShopData();

            if (eventShopData == null || eventShopData.items.Count <= 0 || UnityEngine.Object.op_Equality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null))
            {
                return;
            }
            int                      shopdata_index       = GlobalVars.ShopBuyIndex;
            Transform                parent               = !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ItemParent, (UnityEngine.Object)null) ? this.ItemTemplate.get_transform().get_parent() : this.ItemParent.get_transform();
            EventShopItem            eventShopItem        = eventShopData.items.FirstOrDefault <EventShopItem>((Func <EventShopItem, bool>)(item => item.id == shopdata_index));
            List <Json_ShopItemDesc> jsonShopItemDescList = new List <Json_ShopItemDesc>();

            if (eventShopItem.IsArtifact)
            {
                jsonShopItemDescList.Add(new Json_ShopItemDesc()
                {
                    iname = eventShopItem.iname,
                    itype = ShopData.ShopItemType2String(eventShopItem.ShopItemType),
                    num   = eventShopItem.num
                });
            }
            else if (eventShopItem.children != null && eventShopItem.children.Length > 0)
            {
                jsonShopItemDescList.AddRange((IEnumerable <Json_ShopItemDesc>)eventShopItem.children);
            }
            if (jsonShopItemDescList.Count > 0)
            {
                for (int index = 0; index < jsonShopItemDescList.Count; ++index)
                {
                    Json_ShopItemDesc shop_item_desc = jsonShopItemDescList[index];
                    string            empty          = string.Empty;
                    GameObject        gameObject;
                    string            name;
                    if (shop_item_desc.IsArtifact)
                    {
                        ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(shop_item_desc.iname);

                        if (artifactParam != null)
                        {
                            gameObject = this.InstantiateItem <ArtifactParam>(this.ItemTemplate, parent, artifactParam);
                            name       = artifactParam.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else if (shop_item_desc.IsConceptCard)
                    {
                        ConceptCardData cardDataForDisplay = ConceptCardData.CreateConceptCardDataForDisplay(shop_item_desc.iname);
                        if (cardDataForDisplay != null)
                        {
                            gameObject = this.InstantiateItem <ConceptCardData>(this.ItemTemplate, parent, cardDataForDisplay);
                            ConceptCardIcon componentInChildren = (ConceptCardIcon)gameObject.GetComponentInChildren <ConceptCardIcon>();
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)componentInChildren, (UnityEngine.Object)null))
                            {
                                componentInChildren.Setup(cardDataForDisplay);
                            }
                            name = cardDataForDisplay.Param.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        ItemData itemData = new ItemData();
                        if (itemData.Setup(0L, shop_item_desc.iname, shop_item_desc.num))
                        {
                            gameObject = this.InstantiateItem <ItemData>(this.ItemTemplate, parent, itemData);
                            name       = itemData.Param.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    EventShopGiftItem component = (EventShopGiftItem)gameObject.GetComponent <EventShopGiftItem>();
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                    {
                        component.SetShopItemInfo(shop_item_desc, name, GlobalVars.ShopBuyAmount);
                    }
                }
            }
            GameParameter.UpdateAll(((Component)parent).get_gameObject());
        }