Пример #1
0
        public void ApplyData(PushItem data)
        {
            _data = data;

            if (data != null)
            {
                if (!ContentTxt.gameObject.activeSelf)
                {
                    ContentTxt.gameObject.SetActive(true);
                }

                ContentTxt.text = data.content;

                var prepayment = data.type == PushItemType.Prepayment;
                var vip        = data.type == PushItemType.Vip;
                var exchange   = data.type == PushItemType.RecheckinCard || data.type == PushItemType.CardRecorder;
                var activity   = data.type == PushItemType.UserTask;

                var isEnableVip   = false;
                var featureSwitch = GetDataRepository().GetContainer <FeatureSwitch>(DataKey.FeatureSwitch).Read();
                if (featureSwitch == null)
                {
                    isEnableVip = false;
                }
                else
                {
                    isEnableVip = featureSwitch.vip;
                }

                if (!isEnableVip)
                {
                    vip = false;
                }

                if (ChargeBtn.gameObject.activeSelf != prepayment)
                {
                    ChargeBtn.gameObject.SetActive(prepayment);
                }

                if (VipBtn.gameObject.activeSelf != vip)
                {
                    VipBtn.gameObject.SetActive(vip);
                }

                if (ExchangeBtn.gameObject.activeSelf != exchange)
                {
                    ExchangeBtn.gameObject.SetActive(exchange);
                }

                if (ActivityBtn.gameObject.activeSelf != activity)
                {
                    ActivityBtn.gameObject.SetActive(activity);
                }

                // 统计。
                var eventId = string.Format("pushitem_{0}_{1}_show", PushItemType.IdOf(data.type), data.code);
                Dictionary <string, string> attrs = null;
                if (prepayment)
                {
                    attrs = new Dictionary <string, string>();
                    var p = data.prepayment;
                    attrs.Add("prepayment", p != null ? p.name : "NULL");
                }

                var analyticManager = GetAnalyticManager();
                if (attrs != null)
                {
                    analyticManager.Event(eventId, attrs);
                }
                else
                {
                    analyticManager.Event(eventId);
                }
            }
            else
            {
                if (ContentTxt.gameObject.activeSelf)
                {
                    ContentTxt.gameObject.SetActive(false);
                }

                if (ChargeBtn.gameObject.activeSelf)
                {
                    ChargeBtn.gameObject.SetActive(false);
                }

                if (VipBtn.gameObject.activeSelf)
                {
                    VipBtn.gameObject.SetActive(false);
                }
            }
        }
 public PushItem(PushItemType type, string id, string description)
 {
     Type = type;
     ID = id;
     Description = description;
 }
Пример #3
0
 public PushItem(PushItemType type, string id, string description)
 {
     Type        = type;
     ID          = id;
     Description = description;
 }