diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2019-03-27 18:11:46 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2019-03-27 18:11:46 +0900 |
commit | 037eb26e47e5fb3633e3901e778ea098b676ee1b (patch) | |
tree | 718f39abbdc271bdbf21aab2670f432a7f724d21 | |
parent | 2e462da2a8df4307f1f7cea9587e70779eb4acca (diff) | |
download | wf-clock-037eb26e47e5fb3633e3901e778ea098b676ee1b.tar.gz |
remove Orb Vallis weather timer2019-03-27
Now that it can be seen in the orbiter in-game and also since
Exploiter Orb gave me so many resources that I won't need to go
fishing again, it is useless for me. Get rid of it to make it even
simpler.
-rw-r--r-- | WarframeClock/Clock.cs | 42 | ||||
-rw-r--r-- | WarframeClock/OverlayWindow.xaml.cs | 10 | ||||
-rw-r--r-- | WarframeClock/OverlayWindowViewModel.cs | 26 |
3 files changed, 29 insertions, 49 deletions
diff --git a/WarframeClock/Clock.cs b/WarframeClock/Clock.cs index cf500b1..6f86ea6 100644 --- a/WarframeClock/Clock.cs +++ b/WarframeClock/Clock.cs @@ -1,47 +1,7 @@ -using System; - -namespace WarframeClock +namespace WarframeClock { public static class Clock { public static long? CetusExpiry { get; set; } - - public static string CetusExpiryString() - { - double currentTime = GetCurrentTime(); - double cetusLen = 8998.8748, cetusDayLen = cetusLen * 2 / 3; - double cetusBegin = (CetusExpiry ?? 1548159123053) / 1000.0 - cetusLen; - cetusBegin += Math.Floor((currentTime - cetusBegin) / cetusLen) * cetusLen; - - if (currentTime < cetusBegin + cetusDayLen) - return $"Plains: ☀ {GetReadableTimeSpan(cetusBegin + cetusDayLen - currentTime)}"; - else - return $"Plains: 🌙 {GetReadableTimeSpan(cetusBegin + cetusLen - currentTime)}"; - } - - public static string VallisExpiryString() - { - double currentTime = GetCurrentTime(); - double dayStart = 1548148830; // 2019-01-22 09:20:30 +0000 - dayStart += Math.Floor((currentTime - dayStart) / 1600) * 1600; - - if (currentTime - dayStart < 467) - return $"Vallis: ❄️[→☁] {GetReadableTimeSpan(dayStart + 467 - currentTime)}"; - else if (currentTime - dayStart < 800) - return $"Vallis: ☁[→☀️] {GetReadableTimeSpan(dayStart + 800 - currentTime)}"; - else if (currentTime - dayStart < 1200) - return $"Vallis: ☀️[→☁] {GetReadableTimeSpan(dayStart + 1200 - currentTime)}"; - else - return $"Vallis: ☁[→❄️] {GetReadableTimeSpan(dayStart + 1600 - currentTime)}"; - } - - public static string OverlayString() => - $"{CetusExpiryString()} {VallisExpiryString()}"; - - private static double GetCurrentTime() => - DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds / 1000; - - private static string GetReadableTimeSpan(double span) => - $"{Math.Floor(span / 60)}m{Math.Floor(span % 60)}s"; } } diff --git a/WarframeClock/OverlayWindow.xaml.cs b/WarframeClock/OverlayWindow.xaml.cs index d5b0562..cd0f46b 100644 --- a/WarframeClock/OverlayWindow.xaml.cs +++ b/WarframeClock/OverlayWindow.xaml.cs @@ -49,14 +49,10 @@ namespace WarframeClock private void UpdateTimerTick(object sender, EventArgs e) { - var str = Clock.OverlayString(); - _notifyIcon.Text = $"Warframe Clock - {str}"; + _vm.RefreshOverlayText(); + _notifyIcon.Text = $"Warframe Clock - {_vm.OverlayText}"; - var isActive = AdjustOverlay(); - if (isActive) - { - _vm.OverlayText = str; - } + AdjustOverlay(); } private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e) diff --git a/WarframeClock/OverlayWindowViewModel.cs b/WarframeClock/OverlayWindowViewModel.cs index e051ada..b467fc5 100644 --- a/WarframeClock/OverlayWindowViewModel.cs +++ b/WarframeClock/OverlayWindowViewModel.cs @@ -1,4 +1,5 @@ -using System.Windows; +using System; +using System.Windows; using System.Windows.Media; namespace WarframeClock @@ -16,6 +17,29 @@ namespace WarframeClock } } + public void RefreshOverlayText() + { + var currentTime = DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds / 1000; + const double cetusLen = 8998.8748, cetusDayLen = cetusLen * 2 / 3; + var cetusBegin = (Clock.CetusExpiry ?? 1548159123053) / 1000.0 - cetusLen; + cetusBegin += Math.Floor((currentTime - cetusBegin) / cetusLen) * cetusLen; + + string plainsEmoji; + double plainsRemaining; + if (currentTime < cetusBegin + cetusDayLen) + { + plainsEmoji = "☀"; + plainsRemaining = cetusBegin + cetusDayLen - currentTime; + } + else + { + plainsEmoji = "🌙"; + plainsRemaining = cetusBegin + cetusLen - currentTime; + } + + OverlayText = $"{plainsEmoji} {Math.Floor(plainsRemaining / 60)}m{Math.Floor(plainsRemaining % 60)}s"; + } + private bool _settingsMode; public bool SettingsMode { |