예제 #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
파일: Controller.cs 프로젝트: xdaker/clock
        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);
 }