Ejemplo n.º 1
0
        public virtual void SetData(object data)
        {
            starttime = EB.Dot.Integer("start", data, 0);
            fintime = EB.Dot.Integer("end", data, 0);
            disappeartime = EB.Dot.Integer("displayuntil", data, 0);
            state = EB.Dot.String("state", data, "");
            int timeZone = ZoneTimeDiff.GetTimeZone();
            if (Event_Time != null) Event_Time.text = EB.Time.FromPosixTime(starttime + timeZone * 3600).ToString("yyyy.MM.dd") + " - " + EB.Time.FromPosixTime(fintime + timeZone * 3600).ToString("yyyy.MM.dd");
            NavString = EB.Dot.String("nav_string", data, "").Split('-');
            TagString = EB.Dot.String("tag", data, "");
            eventType = EB.Dot.String("eventtype", data, "");

            if (NavString.Length <= 0)
            {
                int aid = EB.Dot.Integer("activity_id", data, 0);
                var activity = Hotfix_LT.Data.EventTemplateManager.Instance.GetTimeLimitActivity(aid);
                NavString = activity.nav_parameter.Split('-');
            }
            if (NavButton != null && NavLabel != null) UpdateNavText();
            UpdateCountDown(EB.Time.Now);
        }
Ejemplo n.º 2
0
        public override void SetData(object data)
        {
            base.SetData(data);

            _endTime   = fintime;
            _eventType = eventType;
            int timeZone = ZoneTimeDiff.GetTimeZone();

            if (desc != null)
            {
                desc.text = EB.Time.FromPosixTime(starttime + timeZone * 3600).ToString("yyyy.MM.dd") + " - " + EB.Time.FromPosixTime(disappeartime + timeZone * 3600).ToString("yyyy.MM.dd");
            }

            int timeTemp = Mathf.Max(fintime - EB.Time.Now, 0);

            System.TimeSpan ts = new System.TimeSpan(0, 0, timeTemp);
            PlayerPrefs.SetInt(HasEnterActivityKey, ts.Days);
            PlayerPrefs.Save();

            activityId = EB.Dot.Integer("activity_id", data, 0);

            if (state.Equals("pending"))
            {
                PlayerPrefs.DeleteKey(HasEnterShopKey);
                PlayerPrefs.DeleteKey(CanBuyCountFromShopKey);
                PlayerPrefs.DeleteKey(HasEnterActivityKey);
                _parent.gameObject.SetActive(false);
            }
            else if (state.Equals("running"))
            {
                _parent.gameObject.SetActive(true);
                RefreshShopRedPoint();
                RefreshRewardRedPoint();
            }
            else
            {
                if (_tips1 != null)
                {
                    _tips1.gameObject.SetActive(false);
                }

                if (_tips2Label != null)
                {
                    _tips2Label.transform.parent.gameObject.SetActive(true);
                }

                if (EB.Time.Now >= disappeartime)
                {
                    PlayerPrefs.DeleteKey(HasEnterShopKey);
                    PlayerPrefs.DeleteKey(CanBuyCountFromShopKey);
                    PlayerPrefs.DeleteKey(HasEnterActivityKey);
                }

                _parent.gameObject.SetActive(false);
                Event_Time.color = Color.red;
            }

            SetCurrency(_eventType);

            InitBtnList(activityId, fintime);

            if (title != null)
            {
                title.UpdateRedPoint();
            }
        }