Пример #1
0
    // need a way to serve up assets by id now.
    public UB_UnpackedAssetBundle GetAssetsByID(string id)
    {
        if (unpackedAssets.ContainsKey(id))
        {
            if (unpackedAssets[id].Splash == null)
            {
                unpackedAssets[id].Splash = defaultSplash;
            }
            if (unpackedAssets[id].Banner == null)
            {
                unpackedAssets[id].Splash = defaultBanner;
            }
            return(unpackedAssets[id]);
        }
        else
        {
            var obj = new UB_UnpackedAssetBundle
            {
                ContentKey = "Default",
                PromoId    = "Default",
                Splash     = defaultSplash,
                Banner     = defaultBanner
            };

            return(obj);
        }
    }
Пример #2
0
    void OnEnable()
    {
        Tips = PF_GameData.promoItems.FindAll((i) => { return(i.PromoType == PromotionalItemTypes.Tip); }).ToList();
        if (this.Tips.Count > 0)
        {
            int rng = UnityEngine.Random.Range(0, this.Tips.Count - 1);
            this.CurrentTip = Tips[rng];
            message.text    = this.CurrentTip.PromoBody;
        }

        if (PF_GameData.MinimumInterstitialWait > 0)
        {
            waitTime = PF_GameData.MinimumInterstitialWait;
        }

        if (PF_GameData.PromoAssets.Count > 0)
        {
            ThanksForPlaying.gameObject.SetActive(false);

            int rng = UnityEngine.Random.Range(0, PF_GameData.PromoAssets.Count);

            UB_UnpackedAssetBundle assets = GameController.Instance.cdnController.GetAssetsByID(PF_GameData.PromoAssets[rng].PromoId);
            this.mainImage.overrideSprite = Sprite.Create(assets.Splash, new Rect(0, 0, assets.Splash.width, assets.Splash.height), new Vector2(0.5f, 0.5f));
        }
        else
        {
            Debug.Log("No Assets found in PromoAssets");
        }

        StartCoroutine(Spin());
    }