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(); } } } }
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(); } }
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(); } }
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(); } } } }