protected override void OnFreshView() { base.OnFreshView(); if (Data != null) { if (Data is SlideItemData) { var slideData = Data as SlideItemData; AsyncImage.Instance.GetAsyncImage(slideData.TextureUrl, (texture, hashCode) => { ShowTexture.TrySetComponentValue(texture); }); LinkUrl = slideData.LinkUrl; } } }
/// <summary> /// 解析推广数据并处理相关UI /// </summary> /// <param name="data"></param> private void GetPromotionData(Dictionary <string, object> data) { var codeUrl = ""; var allGet = 0; var unGet = 0; var linkUrl = ""; data.TryGetValueWitheKey(out codeUrl, KeyPromotionQrCode); data.TryGetValueWitheKey(out allGet, KeyPromotionAllAffReward); data.TryGetValueWitheKey(out unGet, KeyPromotionUnEffectAffReward); data.TryGetValueWitheKey(out linkUrl, KeyPromotionAffDetailUrl); AsyncImage.Instance.GetAsyncImage(codeUrl, (texture, s) => { PromotionTex.TrySetComponentValue(texture); }); AllAffReward.TrySetComponentValue(allGet); UnEffectAffReward.TrySetComponentValue(unGet); AffDetailUrl = string.Format(LinkFormat, linkUrl, Singleton <LoginInfo> .Instance.user_id, Singleton <LoginInfo> .Instance.ctoken); }