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) { AnalyticsManager.TrackOriginalCurrencyUse(limitedShopItem.saleType, MonoSingleton <GameManager> .Instance.Player.GetShopUpdateCost(this.mShopType, true), "ShopBuy." + (object)this.mShopType); } else if ((!limitedShopItem.IsArtifact ? itemParam.GetBuyNum(limitedShopItem.saleType) * limitedShopItem.num : MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(limitedShopItem.iname).GetBuyNum(limitedShopItem.saleType) * limitedShopItem.num) > 0) { AnalyticsManager.TrackOriginalCurrencyUse(limitedShopItem.saleType, MonoSingleton <GameManager> .Instance.Player.GetShopUpdateCost(this.mShopType, true), "ShopBuy." + (object)this.mShopType); } this.Success(); } } } }
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); } } } }
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[GlobalVars.ShopBuyIndex]; if (shopitem.is_soldout) { this.ActivateOutputLinks(105); } else { int buyNum; if (shopitem.IsArtifact) { buyNum = 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; } buyNum = itemParam.GetBuyNum(shopitem.saleType); } switch (shopitem.saleType) { case ESaleType.Gold: if (!this.CheckCanBuy(shopitem, buyNum, player.Gold, 107)) { return; } break; case ESaleType.Coin: if (!this.CheckCanBuy(shopitem, buyNum, player.Coin, 108)) { return; } break; case ESaleType.TourCoin: if (!this.CheckCanBuy(shopitem, buyNum, player.TourCoin, 109)) { return; } break; case ESaleType.ArenaCoin: if (!this.CheckCanBuy(shopitem, buyNum, player.ArenaCoin, 110)) { return; } break; case ESaleType.PiecePoint: if (!this.CheckCanBuy(shopitem, buyNum, player.PiecePoint, 111)) { return; } break; case ESaleType.MultiCoin: if (!this.CheckCanBuy(shopitem, buyNum, player.MultiCoin, 112)) { return; } break; case ESaleType.EventCoin: this.ActivateOutputLinks(113); return; case ESaleType.Coin_P: if (!this.CheckCanBuy(shopitem, buyNum, 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, 1, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); ((Behaviour)this).set_enabled(true); } } } }