Ejemplo n.º 1
0
 public void AddEventShopList(JSON_ShopListArray.Shops[] shops)
 {
     for (int index = 0; index < shops.Length; ++index)
     {
         Json_ShopMsgResponse msg = EventShopList.ParseMsg(shops[index]);
         if (msg != null && msg.hide == 0)
         {
             GameObject        gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemTemplate);
             EventShopListItem component  = (EventShopListItem)gameObject.GetComponent <EventShopListItem>();
             component.SetShopList(shops[index], msg);
             gameObject.get_transform().SetParent(((Component)this).get_transform());
             gameObject.get_transform().set_localScale(this.ItemTemplate.get_transform().get_localScale());
             ((ListItemEvents)gameObject.GetComponent <ListItemEvents>()).OnSelect = new ListItemEvents.ListItemEvent(this.OnSelectItem);
             gameObject.SetActive(true);
             GlobalVars.EventShopListItems.Add(component);
         }
     }
 }
Ejemplo n.º 2
0
        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);
            }
        }