示例#1
0
 private void Event()
 {
     Control.SecondChange += (ss, ee) =>
     {
         SecondChange?.Invoke(this, new TimeUpdateEventArgs());
     };
     Control.DayChange += (ss, ee) =>
     {
         DayChange?.Invoke(this, new TimeUpdateEventArgs());
     };
     Control.HourChange += (ss, ee) =>
     {
         HourChange?.Invoke(this, new TimeUpdateEventArgs());
     };
     Control.MinuteChange += (ss, ee) =>
     {
         MinuteChange?.Invoke(this, new TimeUpdateEventArgs());
     };
     Control.MonthChange += (ss, ee) =>
     {
         MonthChange?.Invoke(this, new TimeUpdateEventArgs());
     };
     Control.YearChange += (ss, ee) =>
     {
         YearChange?.Invoke(this, new TimeUpdateEventArgs());
     };
     Control.MillisecondChange += (ss, ee) =>
     {
         MillisecondChange?.Invoke(ss, ee);
     };
 }
示例#2
0
 public virtual void OnDayChange(DateTime date)
 {
     if (DayChange != null)
     {
         DayChange.Invoke(date);
     }
 }
示例#3
0
        public static void Tick(GameSpeed gameSpeed)
        {
            int _currentDay = GameTime.Day;

            switch (gameSpeed)
            {
            case GameSpeed.Paused:
            {
                break;
            }

            case GameSpeed.RealTime:
            {
                GameTime = GameTime.AddSeconds(REAL_TIME);
                break;
            }

            case GameSpeed.Single:
            {
                GameTime = GameTime.AddMinutes(SINGLE);
                break;
            }

            case GameSpeed.Double:
            {
                GameTime = GameTime.AddMinutes(DOUBLE);
                break;
            }

            case GameSpeed.Triple:
            {
                GameTime = GameTime.AddMinutes(TRIPLE);
                break;
            }

            default:
            {
                GameTime = GameTime.AddMinutes(SINGLE);
                break;
            }
            }
            if (_currentDay != GameTime.Day)
            {
                DayChange?.Invoke(_dayChange);
            }
        }
示例#4
0
        private void Event()
        {
            try
            {
                foreach (var list in timeChange)
                {
                    switch (list)
                    {
                    case TimeChange.Second:
                        SecondChange?.Invoke(this, new TimeUpdateEventArgs());
                        break;

                    case TimeChange.Minute:
                        MinuteChange?.Invoke(this, new TimeUpdateEventArgs());
                        break;

                    case TimeChange.Hour:
                        HourChange?.Invoke(this, new TimeUpdateEventArgs());
                        break;

                    case TimeChange.Day:
                        DayChange?.Invoke(this, new TimeUpdateEventArgs());
                        break;

                    case TimeChange.Month:
                        MonthChange?.Invoke(this, new TimeUpdateEventArgs());
                        break;

                    case TimeChange.Year:
                        YearChange?.Invoke(this, new TimeUpdateEventArgs());
                        break;

                    default: break;
                    }
                }
            }
            catch
            {
            }
        }
示例#5
0
        private static void OnDayChange(Cycle.Week day)
        {
            foreach (var behaviour in _registeredHandlers)
            {
                try
                {
                    behaviour.Key.OnDayChange(day);
                }
                catch (Exception e)
                {
                    KoikatuAPI.Logger.LogError(e);
                }
            }

            try
            {
                DayChange?.Invoke(KoikatuAPI.Instance, new DayChangeEventArgs(day));
            }
            catch (Exception e)
            {
                KoikatuAPI.Logger.LogError(e);
            }
        }
示例#6
0
 private void DayChangeEvent(object sender, EventArgs e)
 {
     DayChange?.Invoke(sender, e);
 }