Beispiel #1
0
 public virtual bool CheckTimeState()
 {
     ActivityPhase.TimeState timeState;
     if (this._owner.timeState == Activity.TimeState.Going)
     {
         if (this.StartTime > 0 && this.CloseTime > 0)
         {
             DateTime dateTime  = Utility.ToUtcTime2Local((long)CRoleInfo.GetCurrentUTCTime());
             DateTime dateTime2 = Utility.SecondsToDateTime(dateTime.get_Year(), dateTime.get_Month(), dateTime.get_Day(), this.StartTime);
             this._secondSpan = (int)(dateTime - dateTime2).get_TotalSeconds();
             if (this._secondSpan < 0)
             {
                 this._secondSpan = -this._secondSpan;
                 timeState        = ActivityPhase.TimeState.NotStart;
             }
             else
             {
                 DateTime dateTime3 = Utility.SecondsToDateTime(dateTime.get_Year(), dateTime.get_Month(), dateTime.get_Day(), this.CloseTime);
                 this._secondSpan = (int)(dateTime - dateTime3).get_TotalSeconds();
                 if (this._secondSpan < 0)
                 {
                     this._secondSpan = -this._secondSpan;
                     timeState        = ActivityPhase.TimeState.Started;
                 }
                 else
                 {
                     timeState = ActivityPhase.TimeState.Closed;
                 }
             }
         }
         else
         {
             this._secondSpan = 0;
             timeState        = ActivityPhase.TimeState.Started;
         }
     }
     else if (this._owner.timeState == Activity.TimeState.ForeShow || this._owner.timeState == Activity.TimeState.InHiding)
     {
         timeState = ActivityPhase.TimeState.NotStart;
     }
     else
     {
         timeState = ActivityPhase.TimeState.Closed;
     }
     if (timeState != this._timeState)
     {
         this._timeState = timeState;
         if (this.OnTimeStateChange != null)
         {
             this.OnTimeStateChange(this);
         }
         return(true);
     }
     return(false);
 }
Beispiel #2
0
 public ActivityPhase(Activity owner)
 {
     this._owner            = owner;
     this._timeState        = ActivityPhase.TimeState.NotStart;
     this._secondSpan       = 0;
     this._marked           = false;
     this._rewardStore      = null;
     this._rewardCount      = 0;
     this._extraRewardStore = null;
     this._extraRewardCount = 0;
 }