Example #1
0
        public void SetShopList(JSON_ShopListArray.Shops shops, Json_ShopMsgResponse msg)
        {
            this.EventShopInfo.shops = shops;
            if (msg != null)
            {
                this.EventShopInfo.banner_sprite   = msg.banner;
                this.EventShopInfo.shop_cost_iname = msg.costiname;
                if (msg.update != null)
                {
                    this.EventShopInfo.btn_update = msg.update.Equals("on");
                }
            }
            GachaTabSprites gachaTabSprites = AssetManager.Load <GachaTabSprites>(this.EventShopSpritePath);

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)gachaTabSprites, (UnityEngine.Object)null) && gachaTabSprites.Sprites != null && gachaTabSprites.Sprites.Length > 0)
            {
                Sprite[] sprites = gachaTabSprites.Sprites;
                for (int index = 0; index < sprites.Length; ++index)
                {
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)sprites[index], (UnityEngine.Object)null) && ((UnityEngine.Object)sprites[index]).get_name() == this.EventShopInfo.banner_sprite)
                    {
                        this.banner.set_sprite(sprites[index]);
                    }
                }
            }
            EventCoinData data = MonoSingleton <GameManager> .Instance.Player.EventCoinList.Find((Predicate <EventCoinData>)(f => f.iname.Equals(this.EventShopInfo.shop_cost_iname)));

            if (data == null)
            {
                data       = new EventCoinData();
                data.param = MonoSingleton <GameManager> .Instance.MasterParam.Items.Find((Predicate <ItemParam>)(f => f.iname.Equals(this.EventShopInfo.shop_cost_iname)));
            }
            DataSource.Bind <ItemParam>(this.mPaidCoinIcon, data.param);
            DataSource.Bind <EventCoinData>(this.mPaidCoinNum, data);
            if (shops.unlock == null || !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mLockObject, (UnityEngine.Object)null) || !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mLockText, (UnityEngine.Object)null))
            {
                return;
            }
            bool   flag      = shops.unlock.flg == 1;
            Button component = (Button)((Component)this).GetComponent <Button>();

            if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)component))
            {
                return;
            }
            if (flag)
            {
                ((Selectable)component).set_interactable(true);
                this.mLockObject.SetActive(false);
                this.mLockText.set_text(string.Empty);
            }
            else
            {
                ((Selectable)component).set_interactable(false);
                this.mLockObject.SetActive(true);
                this.mLockText.set_text(shops.unlock.message != null ? shops.unlock.message : string.Empty);
            }
        }
Example #2
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);
         }
     }
 }
        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);
            }
        }