void OnEnable() { Tips = PF_GameData.promoItems.FindAll((i) => { return(i.PromoType == PromotionalItemTypes.Tip); }).ToList(); if (Tips.Count > 0) { int rng = UnityEngine.Random.Range(0, Tips.Count - 1); CurrentTip = Tips[rng]; message.text = 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); var assets = GameController.Instance.cdnController.GetAssetsByID(PF_GameData.PromoAssets[rng].PromoId); 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()); }
public void Prev() { if (Tips.Count == 0) { message.text = GlobalStrings.LOADING_MSG; return; } int index = Tips.IndexOf(CurrentTip); index = (index + Tips.Count - 1) % Tips.Count; CurrentTip = Tips[index]; message.text = CurrentTip.PromoBody; }
public void Next() { if (Tips.Count == 0) { message.text = GlobalStrings.LOADING_MSG; return; } int index = Tips.IndexOf(this.CurrentTip); index = (index + 1) % Tips.Count; this.CurrentTip = Tips[index]; message.text = this.CurrentTip.PromoBody; }
private static void OnGetTitleNewsSuccess(GetTitleNewsResult result) { // parse news "tags" // sort newsitems into buckets for easier use elsewhere // some buckets would be News / Sales / Tips / Images promoItems.Clear(); foreach (var item in result.News) { int endTagsIndex = item.Title.LastIndexOf('}'); var pItem = new UB_PromotionalItem(); pItem.TimeStamp = item.Timestamp; pItem.PromoBody = item.Body; pItem.PromoTitle = item.Title.Substring(endTagsIndex + 1); pItem.PromoType = PromotionalItemTypes.Tip; promoItems.Add(pItem); } PF_Bridge.RaiseCallbackSuccess("Title News Loaded", PlayFabAPIMethods.GetTitleNews, MessageDisplayStyle.none); }