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) { PlayerData player = MonoSingleton <GameManager> .Instance.Player; MyMetaps.TrackSpendShopUpdate(shopParam.UpdateCostType, this.mShopType, player.GetShopUpdateCost(this.mShopType, true)); } this.Success(); } }
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_LimitedShopBuyResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_LimitedShopBuyResponse> >(www.text); DebugUtility.Assert(jsonObject != null, "res == null"); if (jsonObject.body == null) { this.OnRetry(); } else { Network.RemoveAPI(); LimitedShopData shop = MonoSingleton <GameManager> .Instance.Player.GetLimitedShopData() ?? new LimitedShopData(); if (!shop.Deserialize(jsonObject.body)) { this.OnFailed(); } else { MonoSingleton <GameManager> .Instance.Player.SetLimitedShopData(shop); LimitedShopItem limitedShopItem = shop.items[GlobalVars.ShopBuyIndex]; ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(limitedShopItem.iname); if (limitedShopItem.isSetSaleValue) { PlayerData player = MonoSingleton <GameManager> .Instance.Player; AnalyticsManager.TrackSpendShop(limitedShopItem.saleType, this.mShopType, player.GetShopUpdateCost(this.mShopType, true)); } else { int num = 0; switch (limitedShopItem.saleType) { case ESaleType.Gold: num = (int)itemParam.buy * limitedShopItem.num; break; case ESaleType.Coin: num = (int)itemParam.coin * limitedShopItem.num; break; case ESaleType.TourCoin: num = (int)itemParam.tour_coin * limitedShopItem.num; break; case ESaleType.ArenaCoin: num = (int)itemParam.arena_coin * limitedShopItem.num; break; case ESaleType.PiecePoint: num = (int)itemParam.piece_point * limitedShopItem.num; break; case ESaleType.MultiCoin: num = (int)itemParam.multi_coin * limitedShopItem.num; break; case ESaleType.EventCoin: num = 0; break; case ESaleType.Coin_P: num = (int)itemParam.coin * limitedShopItem.num; break; } if (num > 0) { PlayerData player = MonoSingleton <GameManager> .Instance.Player; AnalyticsManager.TrackSpendShop(limitedShopItem.saleType, this.mShopType, player.GetShopUpdateCost(this.mShopType, true)); } } this.Success(); } } } }
public override void OnActivate(int pinID) { if (pinID != 1) { return; } PlayerData player = MonoSingleton <GameManager> .Instance.Player; ((Behaviour)this).set_enabled(false); LimitedShopData limitedShopData = player.GetLimitedShopData(); if (limitedShopData == null) { this.ActivateOutputLinks(104); } else { LimitedShopItem shopitem = limitedShopData.items.FirstOrDefault <LimitedShopItem>((Func <LimitedShopItem, bool>)(item => item.id == 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 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 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: this.ActivateOutputLinks(113); return; 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 ReqItemLimitedShopBuypaid(GlobalVars.LimitedShopItem.shops.gname, GlobalVars.ShopBuyIndex, GlobalVars.ShopBuyAmount, 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_LimitedShopBuyResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_LimitedShopBuyResponse> >(www.text); DebugUtility.Assert(jsonObject != null, "res == null"); if (jsonObject.body == null) { this.OnRetry(); } else { Network.RemoveAPI(); LimitedShopData shop = MonoSingleton <GameManager> .Instance.Player.GetLimitedShopData() ?? new LimitedShopData(); if (!shop.Deserialize(jsonObject.body)) { this.OnFailed(); } else { MonoSingleton <GameManager> .Instance.Player.SetLimitedShopData(shop); LimitedShopItem limitedShopItem = shop.items.FirstOrDefault <LimitedShopItem>((Func <LimitedShopItem, 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 (limitedShopItem.isSetSaleValue) { MyMetaps.TrackSpendShop(limitedShopItem.saleType, this.mShopType, limitedShopItem.saleValue); } else { int num = !limitedShopItem.IsArtifact ? (!limitedShopItem.IsConceptCard ? MonoSingleton <GameManager> .Instance.GetItemParam(limitedShopItem.iname).GetBuyNum(limitedShopItem.saleType) * limitedShopItem.num : limitedShopItem.saleValue) : MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(limitedShopItem.iname).GetBuyNum(limitedShopItem.saleType) * limitedShopItem.num; if (num > 0) { MyMetaps.TrackSpendShop(limitedShopItem.saleType, this.mShopType, num); } } this.Success(); } } } }
private void Refresh() { GameUtility.DestroyGameObjects(this.mItems); this.mItems.Clear(); LimitedShopData limitedShopData = MonoSingleton <GameManager> .Instance.Player.GetLimitedShopData(); if (limitedShopData == null || limitedShopData.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(); LimitedShopItem limitedShopItem = limitedShopData.items.FirstOrDefault <LimitedShopItem>((Func <LimitedShopItem, bool>)(item => item.id == shopdata_index)); List <Json_ShopItemDesc> jsonShopItemDescList = new List <Json_ShopItemDesc>(); if (limitedShopItem.IsArtifact) { jsonShopItemDescList.Add(new Json_ShopItemDesc() { iname = limitedShopItem.iname, itype = ShopData.ShopItemType2String(limitedShopItem.ShopItemType), num = limitedShopItem.num }); } else if (limitedShopItem.children != null && limitedShopItem.children.Length > 0) { jsonShopItemDescList.AddRange((IEnumerable <Json_ShopItemDesc>)limitedShopItem.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; } } LimitedShopGiftItem component = (LimitedShopGiftItem)gameObject.GetComponent <LimitedShopGiftItem>(); 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()); }
private void Refresh() { GameUtility.DestroyGameObjects(this.mItems); this.mItems.Clear(); LimitedShopData limitedShopData = MonoSingleton <GameManager> .Instance.Player.GetLimitedShopData(); if (limitedShopData == null || limitedShopData.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(); LimitedShopItem limitedShopItem = limitedShopData.items[shopBuyIndex]; if (limitedShopItem.IsArtifact) { limitedShopItem.children = new Json_ShopItemDesc[1]; limitedShopItem.children[0] = new Json_ShopItemDesc(); limitedShopItem.children[0].iname = limitedShopItem.iname; limitedShopItem.children[0].num = limitedShopItem.num; } if (limitedShopItem.children != null && limitedShopItem.children.Length > 0) { foreach (Json_ShopItemDesc child in limitedShopItem.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; } } LimitedShopGiftItem component = (LimitedShopGiftItem)gameObject.GetComponent <LimitedShopGiftItem>(); if (Object.op_Inequality((Object)component, (Object)null)) { component.SetShopItemInfo(child, name); } } } GameParameter.UpdateAll(((Component)parent).get_gameObject()); }
private void Refresh() { if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null)) { return; } LimitedShopData limitedShopData = MonoSingleton <GameManager> .Instance.Player.GetLimitedShopData(); DebugUtility.Assert(limitedShopData != null, "ショップ情報が存在しない"); this.ShopName.set_text(LocalizedText.Get(GlobalVars.LimitedShopItem.shops.info.title)); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Updated, (UnityEngine.Object)null)) { this.Updated.SetActive(GlobalVars.LimitedShopItem.btn_update); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Update, (UnityEngine.Object)null)) { this.Update.SetActive(GlobalVars.LimitedShopItem.btn_update); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Lineup, (UnityEngine.Object)null)) { this.Lineup.SetActive(GlobalVars.LimitedShopItem.btn_update); } for (int index = 0; index < this.mBuyItems.Count; ++index) { this.mBuyItems[index].get_gameObject().SetActive(false); } int count = limitedShopData.items.Count; for (int index = 0; index < count; ++index) { LimitedShopItem data1 = limitedShopData.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]; LimitedShopBuyList componentInChildren = (LimitedShopBuyList)mBuyItem.GetComponentInChildren <LimitedShopBuyList>(); componentInChildren.limitedShopItem = data1; componentInChildren.amount.SetActive(!data1.IsSet); DataSource.Bind <LimitedShopItem>(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()); }