public override void Validate()
        {
            ActivityPhase curPhase = base.view.activity.CurPhase;

            if (curPhase == null)
            {
                return;
            }
            if (curPhase.RewardDesc.get_Length() > 0)
            {
                this._awardDesc.set_text(curPhase.RewardDesc);
            }
            else
            {
                CUseable useable = curPhase.GetUseable(0);
                if (useable != null)
                {
                    this._awardDesc.set_text(useable.m_name + ":" + curPhase.GetDropCount(0));
                }
            }
            if (curPhase.ReadyForGet)
            {
                this._getBtn.GetComponent <CUIEventScript>().enabled = true;
                this._getBtn.GetComponent <Button>().set_interactable(true);
                this._getBtnText.set_color(Color.white);
                this._awardTitle.set_text(Singleton <CTextManager> .GetInstance().GetText("awardToday"));
                this._getBtnText.set_text(Singleton <CTextManager> .GetInstance().GetText("get"));
                this._remainSeconds = 0u;
                this._timeRemain.set_text(Singleton <CTextManager> .GetInstance().GetText("timeCountDown").Replace("{0}", Utility.SecondsToTimeText(0u)));
            }
            else
            {
                this._getBtn.GetComponent <CUIEventScript>().enabled = false;
                this._getBtn.GetComponent <Button>().set_interactable(false);
                this._getBtnText.set_color(Color.gray);
                if (base.view.activity.Completed)
                {
                    this._awardTitle.set_text(Singleton <CTextManager> .GetInstance().GetText("awardToday"));
                    this._getBtnText.set_text(Singleton <CTextManager> .GetInstance().GetText("finished"));
                    this._remainSeconds = 0u;
                    this._timeRemain.set_text(Singleton <CTextManager> .GetInstance().GetText("congraduFinish"));
                }
                else
                {
                    this._awardTitle.set_text(Singleton <CTextManager> .GetInstance().GetText("awardTomorrow"));
                    this._getBtnText.set_text(Singleton <CTextManager> .GetInstance().GetText("notInTime"));
                    DateTime dateTime  = Utility.ToUtcTime2Local((long)CRoleInfo.GetCurrentUTCTime());
                    DateTime dateTime2 = dateTime.AddDays(1.0);
                    dateTime2           = new DateTime(dateTime2.get_Year(), dateTime2.get_Month(), dateTime2.get_Day(), 0, 0, 0);
                    this._remainSeconds = (uint)(dateTime2 - dateTime).get_TotalSeconds();
                    this._timeRemain.set_text(Singleton <CTextManager> .GetInstance().GetText("timeCountDown").Replace("{0}", Utility.SecondsToTimeText(this._remainSeconds)));
                }
            }
            Text   progLabel = this._progLabel;
            string text      = Singleton <CTextManager> .GetInstance().GetText("CheckInProgress");

            string text2   = "{0}";
            int    current = base.view.activity.Current;

            progLabel.set_text(text.Replace(text2, current.ToString()).Replace("{1}", base.view.activity.Target.ToString()));
        }
Esempio n. 2
0
        public override void Validate()
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo != null)
            {
                ActivityPhase curPhase = base.view.activity.CurPhase;
                if (curPhase != null)
                {
                    if (curPhase.RewardDesc.Length > 0)
                    {
                        this._awardDesc.text = curPhase.RewardDesc;
                    }
                    else
                    {
                        CUseable useable = curPhase.GetUseable(0);
                        if (useable != null)
                        {
                            this._awardDesc.text = useable.m_name + ":" + curPhase.GetDropCount(0);
                        }
                    }
                    if (curPhase.ReadyForGet)
                    {
                        this._getBtn.GetComponent <CUIEventScript>().enabled = true;
                        this._getBtn.GetComponent <Button>().interactable    = true;
                        this._getBtnText.color = Color.white;
                        this._awardTitle.text  = Singleton <CTextManager> .GetInstance().GetText("awardToday");

                        this._getBtnText.text = Singleton <CTextManager> .GetInstance().GetText("get");

                        this._remainSeconds   = 0;
                        this._timeRemain.text = Singleton <CTextManager> .GetInstance().GetText("timeCountDown").Replace("{0}", Utility.SecondsToTimeText(0));
                    }
                    else
                    {
                        this._getBtn.GetComponent <CUIEventScript>().enabled = false;
                        this._getBtn.GetComponent <Button>().interactable    = false;
                        this._getBtnText.color = Color.gray;
                        if (base.view.activity.Completed)
                        {
                            this._awardTitle.text = Singleton <CTextManager> .GetInstance().GetText("awardToday");

                            this._getBtnText.text = Singleton <CTextManager> .GetInstance().GetText("finished");

                            this._remainSeconds   = 0;
                            this._timeRemain.text = Singleton <CTextManager> .GetInstance().GetText("congraduFinish");
                        }
                        else
                        {
                            this._awardTitle.text = Singleton <CTextManager> .GetInstance().GetText("awardTomorrow");

                            this._getBtnText.text = Singleton <CTextManager> .GetInstance().GetText("notInTime");

                            DateTime time  = Utility.ToUtcTime2Local((long)masterRoleInfo.getCurrentTimeSinceLogin());
                            DateTime time2 = time.AddDays(1.0);
                            time2 = new DateTime(time2.Year, time2.Month, time2.Day, 0, 0, 0);
                            TimeSpan span = (TimeSpan)(time2 - time);
                            this._remainSeconds   = (uint)span.TotalSeconds;
                            this._timeRemain.text = Singleton <CTextManager> .GetInstance().GetText("timeCountDown").Replace("{0}", Utility.SecondsToTimeText(this._remainSeconds));
                        }
                    }
                    this._progLabel.text = Singleton <CTextManager> .GetInstance().GetText("CheckInProgress").Replace("{0}", base.view.activity.Current.ToString()).Replace("{1}", base.view.activity.Target.ToString());
                }
            }
        }