public override void OnActivate(int pinID) { if (pinID != 0) { return; } this.mode = FlowNode_ReqCoinShop.Mode.GetShopList; this.ExecRequest((WebAPI) new ReqEventShopList(new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); }
public override void OnSuccess(WWWResult www) { if (Network.IsError) { this.OnRetry(); } else { if (this.mode == FlowNode_ReqCoinShop.Mode.GetShopList) { WebAPI.JSON_BodyResponse <JSON_ShopListArray> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <JSON_ShopListArray> >(www.text); Network.RemoveAPI(); if (jsonObject.body.shops != null && jsonObject.body.shops.Length > 0) { for (int index = 0; index < jsonObject.body.shops.Length; ++index) { if (jsonObject.body.shops[index] == null) { this.OnRetry(); return; } } foreach (JSON_ShopListArray.Shops shop in jsonObject.body.shops) { if (shop.gname.Split('-')[0] == "EventSummon2") { MonoSingleton <GameManager> .Instance.Player.UpdateEventCoin(); EventShopInfo eventShopInfo = new EventShopInfo(); eventShopInfo.shops = shop; Json_ShopMsgResponse msg = EventShopList.ParseMsg(shop); if (msg != null) { eventShopInfo.banner_sprite = msg.banner; eventShopInfo.shop_cost_iname = msg.costiname; if (msg.update != null) { eventShopInfo.btn_update = msg.update.Equals("on"); } GlobalVars.EventShopItem = eventShopInfo; GlobalVars.ShopType = EShopType.Event; this.mode = FlowNode_ReqCoinShop.Mode.GetCoinNum; this.ExecRequest((WebAPI) new ReqGetCoinNum(new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); return; } } } } } else if (this.mode == FlowNode_ReqCoinShop.Mode.GetCoinNum) { WebAPI.JSON_BodyResponse <FlowNode_ReqCoinShop.JSON_CoinNum> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReqCoinShop.JSON_CoinNum> >(www.text); Network.RemoveAPI(); if (jsonObject.body != null && jsonObject.body.item != null && jsonObject.body.item.Length > 0) { MonoSingleton <GameManager> .Instance.Player.Deserialize(jsonObject.body.item); } if (jsonObject.body != null && jsonObject.body.newcoin != null) { GlobalVars.NewSummonCoinInfo = new GlobalVars.SummonCoinInfo() { Period = jsonObject.body.newcoin.period } } ; this.ActivateOutputLinks(1); return; } this.ActivateOutputLinks(2); } }