Ejemplo n.º 1
0
    private static void OnGetEventsSuccess(GetCatalogItemsResult result)
    {
        // process the catalog items returned; put these into the "events" object
        // then go and get the rest of the title data

        Events.Clear();
        foreach (var eachItem in result.Catalog)
        {
            var newEvent = new UB_EventData
            {
                EventName        = eachItem.DisplayName,
                EventDescription = eachItem.Description,
                StoreToUse       = eachItem.ItemClass,
                BundleId         = eachItem.ItemImageUrl,
                EventKey         = eachItem.ItemId
            };

            Events[eachItem.ItemId] = newEvent;
            Debug.Log("Loaded event: " + eachItem.ItemId);
        }
        GetActiveEventData();
    }
    public void Init()
    {
        // load sales or load default banners
        // set up ad circles
        timeSinceMove = Time.time;

        if (PF_GameData.PromoAssets.Count > 0)
        {
            promos.Clear();
            foreach (var item in PF_GameData.PromoAssets)
            {
                UB_PromoDisplay promo = new UB_PromoDisplay()
                {
                    assets = item
                };

                if (item.ContentKey.Contains("events"))
                {
                    UB_EventData ev = null;
                    PF_GameData.Events.TryGetValue(item.PromoId, out ev);
                    promo.linkedEvent = ev;
                    promo.linkedSale  = null;
                }
                else
                {
                    UB_SaleData sl = null;
                    PF_GameData.Sales.TryGetValue(item.PromoId, out sl);
                    promo.linkedSale  = sl;
                    promo.linkedEvent = null;
                }

                promos.Add(promo);
            }

            SetAdSlotCount(promos.Count);
            SelectBanner(promos[0], 0);
        }
    }