Exemplo n.º 1
0
 private void HourChanged(HourChanged hourChanged)
 {
     if (hourChanged.Hour == 20)
     {
         WorkDayEnded();
     }
 }
Exemplo n.º 2
0
 public void SaveGame(HourChanged hourChanged)
 {
     if (hourChanged.Hour.Equals(20))
     {
         _save.Save($"autosave-{DateTime.Now:yyMMddHHmmss}");
     }
 }
Exemplo n.º 3
0
        private DateTimeService()
        {
            lastNow     = Now;
            tPeriodical = new AsyncTimerAction(TimeSpan.FromSeconds(1), () =>
            {
                now = Now;
                if (now.Minute != lastNow.Minute)
                {
                    tPeriodical.Interval = TimeSpan.FromMinutes(1);

                    MinuteChanged?.Invoke(this, now);

                    if (now.Hour != lastNow.Hour)
                    {
                        HourChanged?.Invoke(this, now);
                    }
                    if (now.Day != lastNow.Day)
                    {
                        DayChanged?.Invoke(this, now);
                    }
                    if (now.Month != lastNow.Month)
                    {
                        MonthChanged?.Invoke(this, now);
                    }
                    if (now.Year != lastNow.Year)
                    {
                        YearChanged?.Invoke(this, now);
                    }
                }

                lastNow = now;
            });
            tPeriodical.Start();
        }
Exemplo n.º 4
0
 private void HourChanged(HourChanged obj)
 {
     if (Rng.Int(10) == 9)
     {
         _playerAccount.Remove(new Tax(10));
         World.Publish(new PlayerNotification("Government", $"You have automatically paid living taxes with MBit - 10"));
     }
 }
        private void GameDateComponent_TimeChanged(GameDateComponent sender)
        {
            if (prevMinute != Minute)
            {
                prevMinute = Minute;
                if (MinuteChanged != null)
                {
                    MinuteChanged.Invoke(this);
                }
            }

            if (prevHour != Hour)
            {
                prevHour = Hour;
                if (HourChanged != null)
                {
                    HourChanged.Invoke(this);
                }
            }

            if (prevDay != Day)
            {
                prevDay = Day;
                if (DayChanged != null)
                {
                    DayChanged.Invoke(this);
                }
            }

            if (prevMonth != Month)
            {
                prevMonth = Month;
                if (MonthChanged != null)
                {
                    MonthChanged.Invoke(this);
                }
            }

            if (prevYear != Year)
            {
                prevYear = Year;
                if (YearChanged != null)
                {
                    YearChanged.Invoke(this);
                }
            }
        }
Exemplo n.º 6
0
 private void OnHourChanged(int value) => HourChanged?.Invoke(this, new IntEventArgs(value));
Exemplo n.º 7
0
 protected void ChangeOfHours(int godzina)
 {
     HourChanged?.Invoke(godzina);
     //   Debug.Log("godzina: " + Godzina + " minuta: " + Minuta);
 }