From b4c854cabf20075bb22c69c136e4a46019f97d28 Mon Sep 17 00:00:00 2001 From: eunma Date: Sun, 5 Nov 2023 07:36:05 +0900 Subject: [PATCH] Bug fix --- Entities/LogFileWatcher.cs | 10 +++---- Entities/Multilingual.cs | 8 ++++- Entities/UserSettings.cs | 1 + Views/Settings.Designer.cs | 38 +++++++++++++++++------- Views/Settings.cs | 40 +++++++++++++------------ Views/Stats.cs | 60 ++++++++++++++++++-------------------- 6 files changed, 90 insertions(+), 67 deletions(-) diff --git a/Entities/LogFileWatcher.cs b/Entities/LogFileWatcher.cs index d7d55a22c..78ee9a659 100644 --- a/Entities/LogFileWatcher.cs +++ b/Entities/LogFileWatcher.cs @@ -81,7 +81,7 @@ public class LogFileWatcher { public event Action> OnParsedLogLines; public event Action> OnParsedLogLinesCurrent; public event Action OnNewLogFileDate; - public event Action OnServerConnectionNotification; + public event Action OnServerConnectionNotification; public event Action OnPersonalBestNotification; public event Action OnError; @@ -581,7 +581,7 @@ private bool ParseLine(LogLine line, List round, LogRound logRound) { if (serverConnectionLog != null) { if (!serverConnectionLog.IsNotify) { if (Stats.IsGameRunning && this.StatsForm.CurrentSettings.NotifyServerConnected && !string.IsNullOrEmpty(Stats.LastCountryAlpha2Code)) { - this.OnServerConnectionNotification?.Invoke(Stats.LastCountryAlpha2Code, Stats.LastCountryRegion, Stats.LastCountryCity); + this.OnServerConnectionNotification?.Invoke(); } } @@ -594,7 +594,7 @@ private bool ParseLine(LogLine line, List round, LogRound logRound) { this.serverPingWatcher.Start(); this.SetCountryCodeByIP(Stats.LastServerIp); if (Stats.IsGameRunning && this.StatsForm.CurrentSettings.NotifyServerConnected && !string.IsNullOrEmpty(Stats.LastCountryAlpha2Code)) { - this.OnServerConnectionNotification?.Invoke(Stats.LastCountryAlpha2Code, Stats.LastCountryRegion, Stats.LastCountryCity); + this.OnServerConnectionNotification?.Invoke(); } } } @@ -650,9 +650,7 @@ private bool ParseLine(LogLine line, List round, LogRound logRound) { logRound.Info.CreativeQualificationPercent = this.creativeQualificationPercent; logRound.Info.CreativeTimeLimitSeconds = this.creativeTimeLimitSeconds; } else { - logRound.Info.Name = !logRound.Info.ShowNameId.Equals("wle_mrs_shuffle_show") - ? line.Line.Substring(index + 62, index2 - index - 62) - : this.ReplaceLevelIdInDigisShuffleShow(logRound.Info.ShowNameId, line.Line.Substring(index + 62, index2 - index - 62)); + logRound.Info.Name = this.ReplaceLevelIdInDigisShuffleShow(logRound.Info.ShowNameId, line.Line.Substring(index + 62, index2 - index - 62)); } if (this.IsRealFinalRound(logRound.Info.Name, this.selectedShowId) || logRound.Info.UseShareCode) { diff --git a/Entities/Multilingual.cs b/Entities/Multilingual.cs index 917a44c55..e4ec47091 100644 --- a/Entities/Multilingual.cs +++ b/Entities/Multilingual.cs @@ -370,6 +370,7 @@ public static class Multilingual { {"settings_auto_generate_profiles", "Auto-generate profiles"}, {"settings_select_language_button", "Confirm"}, {"settings_system_tray_icon", "Use the system tray icon"}, + {"settings_notify_personal_best", "๐Ÿ”” Windows notification when you break your personal best during a race round"}, {"settings_notify_server_connected", "๐Ÿ”” Windows notification with the country name of the server when the server is connected"}, {"settings_mute_notification_sounds", "๐Ÿ”‡ Mute notification sounds"}, {"settings_notification_sounds_01", "Notification Sounds 01"}, @@ -834,6 +835,7 @@ public static class Multilingual { {"settings_auto_generate_profiles", "Crรฉer un profil pour chaque รฉmission"}, {"settings_select_language_button", "Confirmer"}, {"settings_system_tray_icon", "Utiliser l'icรดne de la barre des tรขches"}, + {"settings_notify_personal_best", "๐Ÿ”” Notification Windows lorsque vous battez votre record personnel lors d'une course"}, {"settings_notify_server_connected", "๐Ÿ”” Notification Windows avec le nom du pays du serveur lorsque le serveur est connectรฉ"}, {"settings_mute_notification_sounds", "๐Ÿ”‡ Couper les sons des notifications"}, {"settings_notification_sounds_01", "Sons de notification 01"}, @@ -1298,7 +1300,8 @@ public static class Multilingual { {"settings_auto_generate_profiles", "ํ”„๋กœํ•„ ์ž๋™ ์ƒ์„ฑ"}, {"settings_select_language_button", "ํ™•์ธ"}, {"settings_system_tray_icon", "์ž‘์—… ํ‘œ์‹œ์ค„ ์•„์ด์ฝ˜ ์‚ฌ์šฉ"}, - {"settings_notify_server_connected", "๐Ÿ”” ์„œ๋ฒ„๊ฐ€ ์—ฐ๊ฒฐ๋˜๋ฉด ์„œ๋ฒ„๊ฐ€ ์œ„์น˜ํ•œ ๋‚˜๋ผ์˜ ์ด๋ฆ„์„ ์œˆ๋„์šฐ ์•Œ๋ฆผ์œผ๋กœ ๋„์šฐ๊ธฐ"}, + {"settings_notify_personal_best", "๐Ÿ”” ๋ ˆ์ด์Šค ๋ผ์šด๋“œ์—์„œ ๊ฐœ์ธ ์ตœ๊ณ  ๊ธฐ๋ก์„ ๊ฒฝ์‹ ํ•˜๋ฉด ํŒ์—… ์•Œ๋ฆผ"}, + {"settings_notify_server_connected", "๐Ÿ”” ์„œ๋ฒ„๊ฐ€ ์—ฐ๊ฒฐ๋˜๋ฉด ์„œ๋ฒ„๊ฐ€ ์œ„์น˜ํ•œ ๋‚˜๋ผ์˜ ์ด๋ฆ„์„ ํŒ์—… ์•Œ๋ฆผ"}, {"settings_mute_notification_sounds", "๐Ÿ”‡ ์•Œ๋ฆผ ์†Œ๋ฆฌ ์Œ์†Œ๊ฑฐ"}, {"settings_notification_sounds_01", "์•Œ๋ฆผ ์†Œ๋ฆฌ 01"}, {"settings_notification_sounds_02", "์•Œ๋ฆผ ์†Œ๋ฆฌ 02"}, @@ -1762,6 +1765,7 @@ public static class Multilingual { {"settings_auto_generate_profiles", "ใƒ—ใƒญใƒ•ใ‚กใ‚คใƒซใฎ่‡ชๅ‹•็”Ÿๆˆ"}, {"settings_select_language_button", "ไฟๅญ˜"}, {"settings_system_tray_icon", "ใ‚ทใ‚นใƒ†ใƒ ใƒˆใƒฌใ‚คใ‚ขใ‚คใ‚ณใƒณใ‚’ไฝฟ็”จใ™ใ‚‹"}, + {"settings_notify_personal_best", "๐Ÿ”” ใƒฌใƒผใ‚นใƒฉใ‚ฆใƒณใƒ‰ใงๅ€‹ไบบใƒˆใƒƒใƒ—่จ˜้Œฒๆ›ดๆ–ฐๆ™‚ใซWindows้€š็Ÿฅใ‚’้€ไฟกใ™ใ‚‹"}, {"settings_notify_server_connected", "๐Ÿ”” ใ‚ตใƒผใƒใƒผๆŽฅ็ถšๆ™‚ใซใ‚ตใƒผใƒใƒผใฎๅ›ฝๅใ‚’ๅซใ‚€ Windows ้€š็Ÿฅใ‚’้€ไฟกใ™ใ‚‹"}, {"settings_mute_notification_sounds", "๐Ÿ”‡ ้€š็Ÿฅ้Ÿณใ‚’ใƒŸใƒฅใƒผใƒˆ"}, {"settings_notification_sounds_01", "้€š็Ÿฅ้Ÿณ 01"}, @@ -2226,6 +2230,7 @@ public static class Multilingual { {"settings_auto_generate_profiles", "่‡ชๅŠจ็”Ÿๆˆ้…็ฝฎๆ–‡ไปถ"}, {"settings_select_language_button", "้€‰ๆ‹ฉ"}, {"settings_system_tray_icon", "ไฝฟ็”จ็ณป็ปŸๆ‰˜็›˜ๅ›พๆ ‡"}, + {"settings_notify_personal_best", "๐Ÿ”” ๅฝ“ๆ‚จๅœจๆฏ”่ต›ไธญๆ‰“็ ดไธชไบบๆœ€ๅฅฝๆˆ็ปฉๆ—ถ๏ผŒไผšๆ”ถๅˆฐ Windows ้€š็Ÿฅ"}, {"settings_notify_server_connected", "๐Ÿ”” ่ฟžๆŽฅๆœๅŠกๅ™จๆ—ถ๏ผŒๅธฆๆœ‰ๆœๅŠกๅ™จๅ›ฝๅฎถ/ๅœฐๅŒบๅ็งฐ็š„ Windows ้€š็Ÿฅ"}, {"settings_mute_notification_sounds", "๐Ÿ”‡ ๅฐ†้€š็Ÿฅๅฃฐ้Ÿณ้™้Ÿณ"}, {"settings_notification_sounds_01", "้€š็Ÿฅๅฃฐ้Ÿณ 01"}, @@ -2690,6 +2695,7 @@ public static class Multilingual { {"settings_auto_generate_profiles", "่‡ชๅ‹•็”Ÿๆˆ้…็ฝฎๆ–‡ไปถ"}, {"settings_select_language_button", "้ธๆ“‡"}, {"settings_system_tray_icon", "ไฝฟ็”จ็ณป็ตฑๆ‰˜็›คๅœ–ๆจ™"}, + {"settings_notify_personal_best", "๐Ÿ”” ็•ถๆ‚จๅœจๆฏ”่ณฝไธญๆ‰“็ ดๅ€‹ไบบๆœ€ไฝณๆˆ็ธพๆ™‚๏ผŒๆ‚จๆœƒๆ”ถๅˆฐ Windows ้€š็Ÿฅ"}, {"settings_notify_server_connected", "๐Ÿ”” ้€ฃๆŽฅๆœๅ‹™ๅ™จๆ™‚๏ผŒๅธถๆœ‰ๆœๅ‹™ๅ™จๅœ‹ๅฎถ/ๅœฐๅ€ๅ็จฑ็š„ Windows ้€š็Ÿฅ"}, {"settings_mute_notification_sounds", "๐Ÿ”‡ ๅฐ‡้€š็Ÿฅ่ฒ้Ÿณ้œ้Ÿณ"}, {"settings_notification_sounds_01", "้€š็Ÿฅ่ฒ้Ÿณ 01"}, diff --git a/Entities/UserSettings.cs b/Entities/UserSettings.cs index 12b7a1195..d6a76a222 100644 --- a/Entities/UserSettings.cs +++ b/Entities/UserSettings.cs @@ -59,6 +59,7 @@ public class UserSettings { public bool SystemTrayIcon { get; set; } public bool PreventOverlayMouseClicks { get; set; } public bool NotifyServerConnected { get; set; } + public bool NotifyPersonalBest { get; set; } public bool MuteNotificationSounds { get; set; } public int NotificationSounds { get; set; } public int NotificationWindowPosition { get; set; } diff --git a/Views/Settings.Designer.cs b/Views/Settings.Designer.cs index 9c75c31bc..b0c426be4 100644 --- a/Views/Settings.Designer.cs +++ b/Views/Settings.Designer.cs @@ -88,6 +88,7 @@ private void InitializeComponent() this.chkAutoUpdate = new MetroFramework.Controls.MetroCheckBox(); this.chkSystemTrayIcon = new MetroFramework.Controls.MetroCheckBox(); this.chkNotifyServerConnected = new MetroFramework.Controls.MetroCheckBox(); + this.chkNotifyPersonalBest = new MetroFramework.Controls.MetroCheckBox(); this.chkMuteNotificationSounds = new MetroFramework.Controls.MetroCheckBox(); this.cboNotificationSounds = new MetroFramework.Controls.MetroComboBox(); this.cboNotificationWindowPosition = new MetroFramework.Controls.MetroComboBox(); @@ -870,7 +871,7 @@ private void InitializeComponent() // picLanguageSelection // this.picLanguageSelection.Image = global::FallGuysStats.Properties.Resources.language_icon; - this.picLanguageSelection.Location = new System.Drawing.Point(15, 382); + this.picLanguageSelection.Location = new System.Drawing.Point(15, 412); this.picLanguageSelection.Name = "picLanguageSelection"; this.picLanguageSelection.Size = new System.Drawing.Size(29, 29); this.picLanguageSelection.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; @@ -882,7 +883,7 @@ private void InitializeComponent() this.cboMultilingual.Cursor = System.Windows.Forms.Cursors.Hand; this.cboMultilingual.ItemHeight = 23; this.cboMultilingual.Items.AddRange(new object[] { "๐Ÿ‡บ๐Ÿ‡ธ English", "๐Ÿ‡ซ๐Ÿ‡ท Franรงais", "๐Ÿ‡ฐ๐Ÿ‡ท ํ•œ๊ตญ์–ด", "๐Ÿ‡ฏ๐Ÿ‡ต ๆ—ฅๆœฌ่ชž", "๐Ÿ‡จ๐Ÿ‡ณ ็ฎ€ไฝ“ไธญๆ–‡", "๐Ÿ‡จ๐Ÿ‡ณ ็น้ซ”ไธญๆ–‡" }); - this.cboMultilingual.Location = new System.Drawing.Point(53, 382); + this.cboMultilingual.Location = new System.Drawing.Point(53, 412); this.cboMultilingual.Name = "cboMultilingual"; this.cboMultilingual.Size = new System.Drawing.Size(107, 29); this.cboMultilingual.TabIndex = 99; @@ -893,7 +894,7 @@ private void InitializeComponent() // this.lblTheme.AutoSize = true; this.lblTheme.FontWeight = MetroFramework.MetroLabelWeight.Regular; - this.lblTheme.Location = new System.Drawing.Point(12, 345); + this.lblTheme.Location = new System.Drawing.Point(12, 375); this.lblTheme.Name = "lblTheme"; this.lblTheme.Size = new System.Drawing.Size(50, 19); this.lblTheme.TabIndex = 5; @@ -918,7 +919,7 @@ private void InitializeComponent() this.cboTheme.IntegralHeight = false; this.cboTheme.ItemHeight = 23; this.cboTheme.Items.AddRange(new object[] { "Light", "Dark" }); - this.cboTheme.Location = new System.Drawing.Point(67, 340); + this.cboTheme.Location = new System.Drawing.Point(67, 370); this.cboTheme.Name = "cboTheme"; this.cboTheme.Size = new System.Drawing.Size(85, 29); this.cboTheme.TabIndex = 1; @@ -962,6 +963,19 @@ private void InitializeComponent() this.chkRecordEscapeDuringAGame.Text = "If you escape during a game, record it as a loss"; this.chkRecordEscapeDuringAGame.UseSelectable = true; // + // chkNotifyPersonalBest + // + this.chkNotifyPersonalBest.AutoSize = true; + this.chkNotifyPersonalBest.Cursor = System.Windows.Forms.Cursors.Hand; + this.chkNotifyPersonalBest.FontSize = MetroFramework.MetroCheckBoxSize.Medium; + this.chkNotifyPersonalBest.Location = new System.Drawing.Point(15, 240); + this.chkNotifyPersonalBest.Name = "chkNotifyPersonalBest"; + this.chkNotifyPersonalBest.Size = new System.Drawing.Size(420, 19); + this.chkNotifyPersonalBest.TabIndex = 5; + this.chkNotifyPersonalBest.Text = "Windows notification when you break your personal best during a race round"; + this.chkNotifyPersonalBest.UseSelectable = true; + this.chkNotifyPersonalBest.CheckedChanged += new System.EventHandler(this.chkNotify_CheckedChanged); + // // chkNotifyServerConnected // this.chkNotifyServerConnected.AutoSize = true; @@ -973,14 +987,14 @@ private void InitializeComponent() this.chkNotifyServerConnected.TabIndex = 5; this.chkNotifyServerConnected.Text = "Windows notification with server name when server is connected"; this.chkNotifyServerConnected.UseSelectable = true; - this.chkNotifyServerConnected.CheckedChanged += new System.EventHandler(this.chkNotifyServerConnected_CheckedChanged); + this.chkNotifyServerConnected.CheckedChanged += new System.EventHandler(this.chkNotify_CheckedChanged); // // chkMuteNotificationSounds // this.chkMuteNotificationSounds.AutoSize = true; this.chkMuteNotificationSounds.Cursor = System.Windows.Forms.Cursors.Hand; this.chkMuteNotificationSounds.FontSize = MetroFramework.MetroCheckBoxSize.Medium; - this.chkMuteNotificationSounds.Location = new System.Drawing.Point(15, 240); + this.chkMuteNotificationSounds.Location = new System.Drawing.Point(15, 270); this.chkMuteNotificationSounds.Name = "chkMuteNotificationSounds"; this.chkMuteNotificationSounds.Size = new System.Drawing.Size(420, 19); this.chkMuteNotificationSounds.TabIndex = 5; @@ -994,7 +1008,7 @@ private void InitializeComponent() this.cboNotificationSounds.IntegralHeight = false; this.cboNotificationSounds.ItemHeight = 23; this.cboNotificationSounds.Items.AddRange(new object[] { "Notification Sounds 01", "Notification Sounds 02", "Notification Sounds 03", "Notification Sounds 04" }); - this.cboNotificationSounds.Location = new System.Drawing.Point(15, 270); + this.cboNotificationSounds.Location = new System.Drawing.Point(15, 300); this.cboNotificationSounds.Name = "cboNotificationSounds"; this.cboNotificationSounds.Size = new System.Drawing.Size(170, 29); this.cboNotificationSounds.TabIndex = 1; @@ -1007,7 +1021,7 @@ private void InitializeComponent() this.cboNotificationWindowPosition.IntegralHeight = false; this.cboNotificationWindowPosition.ItemHeight = 24; this.cboNotificationWindowPosition.Items.AddRange(new object[] { "Bottom Right", "Top Right" }); - this.cboNotificationWindowPosition.Location = new System.Drawing.Point(15, 270); + this.cboNotificationWindowPosition.Location = new System.Drawing.Point(15, 300); this.cboNotificationWindowPosition.Name = "cboNotificationWindowPosition"; this.cboNotificationWindowPosition.Size = new System.Drawing.Size(116, 29); this.cboNotificationWindowPosition.TabIndex = 1; @@ -1020,7 +1034,7 @@ private void InitializeComponent() this.cboNotificationWindowAnimation.IntegralHeight = false; this.cboNotificationWindowAnimation.ItemHeight = 25; this.cboNotificationWindowAnimation.Items.AddRange(new object[] { "FADE", "SLIDE" }); - this.cboNotificationWindowAnimation.Location = new System.Drawing.Point(15, 270); + this.cboNotificationWindowAnimation.Location = new System.Drawing.Point(15, 300); this.cboNotificationWindowAnimation.Name = "cboNotificationWindowAnimation"; this.cboNotificationWindowAnimation.Size = new System.Drawing.Size(70, 29); this.cboNotificationWindowAnimation.TabIndex = 1; @@ -1032,7 +1046,7 @@ private void InitializeComponent() this.btnPlayNotificationSounds.Cursor = System.Windows.Forms.Cursors.Hand; this.btnPlayNotificationSounds.FontSize = MetroFramework.MetroButtonSize.Medium; this.btnPlayNotificationSounds.FontWeight = MetroFramework.MetroButtonWeight.Bold; - this.btnPlayNotificationSounds.Location = new System.Drawing.Point(300, 270); + this.btnPlayNotificationSounds.Location = new System.Drawing.Point(300, 300); this.btnPlayNotificationSounds.Name = "btnPlayNotificationSounds"; this.btnPlayNotificationSounds.Size = new System.Drawing.Size(29, 29); this.btnPlayNotificationSounds.TabIndex = 3; @@ -1045,7 +1059,7 @@ private void InitializeComponent() this.chkPreventOverlayMouseClicks.AutoSize = true; this.chkPreventOverlayMouseClicks.Cursor = System.Windows.Forms.Cursors.Hand; this.chkPreventOverlayMouseClicks.FontSize = MetroFramework.MetroCheckBoxSize.Medium; - this.chkPreventOverlayMouseClicks.Location = new System.Drawing.Point(15 , 450); + this.chkPreventOverlayMouseClicks.Location = new System.Drawing.Point(15 , 480); this.chkPreventOverlayMouseClicks.Name = "chkPreventOverlayMouseClicks"; this.chkPreventOverlayMouseClicks.Size = new System.Drawing.Size(200, 19); this.chkPreventOverlayMouseClicks.TabIndex = 6; @@ -1269,6 +1283,7 @@ private void InitializeComponent() this.panelProgram.Controls.Add(this.chkSystemTrayIcon); this.panelProgram.Controls.Add(this.chkRecordEscapeDuringAGame); this.panelProgram.Controls.Add(this.chkNotifyServerConnected); + this.panelProgram.Controls.Add(this.chkNotifyPersonalBest); this.panelProgram.Controls.Add(this.chkMuteNotificationSounds); this.panelProgram.Controls.Add(this.cboNotificationSounds); this.panelProgram.Controls.Add(this.cboNotificationWindowPosition); @@ -1848,6 +1863,7 @@ private void InitializeComponent() private MetroFramework.Controls.MetroCheckBox chkAutoUpdate; private MetroFramework.Controls.MetroCheckBox chkSystemTrayIcon; private MetroFramework.Controls.MetroCheckBox chkNotifyServerConnected; + private MetroFramework.Controls.MetroCheckBox chkNotifyPersonalBest; private MetroFramework.Controls.MetroCheckBox chkMuteNotificationSounds; private MetroFramework.Controls.MetroComboBox cboNotificationSounds; private MetroFramework.Controls.MetroComboBox cboNotificationWindowPosition; diff --git a/Views/Settings.cs b/Views/Settings.cs index 35cd30364..0c8b751d0 100644 --- a/Views/Settings.cs +++ b/Views/Settings.cs @@ -99,16 +99,21 @@ private void Settings_Load(object sender, EventArgs e) { //this.chkShowProfile.Checked = this.CurrentSettings.ShowOverlayProfile; this.chkAutoUpdate.Checked = this.CurrentSettings.AutoUpdate; this.chkSystemTrayIcon.Checked = this.CurrentSettings.SystemTrayIcon; + this.chkNotifyServerConnected.Checked = this.CurrentSettings.NotifyServerConnected; - this.chkMuteNotificationSounds.Enabled = this.chkNotifyServerConnected.Checked; + this.chkNotifyPersonalBest.Checked = this.CurrentSettings.NotifyPersonalBest; this.cboNotificationSounds.SelectedIndex = this.CurrentSettings.NotificationSounds; - this.cboNotificationSounds.Enabled = this.chkNotifyServerConnected.Checked; - this.cboNotificationWindowPosition.Enabled = this.chkNotifyServerConnected.Checked; - this.cboNotificationWindowAnimation.Enabled = this.chkNotifyServerConnected.Checked; - this.btnPlayNotificationSounds.Enabled = this.chkNotifyServerConnected.Checked; - if (this.chkNotifyServerConnected.Checked) { + this.cboNotificationSounds.Enabled = this.chkNotifyServerConnected.Checked || this.chkNotifyPersonalBest.Checked; + this.cboNotificationWindowPosition.SelectedIndex = this.CurrentSettings.NotificationWindowPosition; + this.cboNotificationWindowPosition.Enabled = this.chkNotifyServerConnected.Checked || this.chkNotifyPersonalBest.Checked; + this.cboNotificationWindowAnimation.SelectedIndex = this.CurrentSettings.NotificationWindowAnimation; + this.cboNotificationWindowAnimation.Enabled = this.chkNotifyServerConnected.Checked || this.chkNotifyPersonalBest.Checked; + this.btnPlayNotificationSounds.Enabled = this.chkNotifyServerConnected.Checked || this.chkNotifyPersonalBest.Checked; + this.chkMuteNotificationSounds.Enabled = this.chkNotifyServerConnected.Checked || this.chkNotifyPersonalBest.Checked; + if (this.chkNotifyServerConnected.Checked || this.chkNotifyPersonalBest.Checked) { this.chkMuteNotificationSounds.Checked = this.CurrentSettings.MuteNotificationSounds; } + this.chkPreventOverlayMouseClicks.Checked = this.CurrentSettings.PreventOverlayMouseClicks; this.chkFlipped.Checked = this.CurrentSettings.FlippedDisplay; this.chkHidePercentages.Checked = this.CurrentSettings.HideOverlayPercentages; @@ -119,7 +124,6 @@ private void Settings_Load(object sender, EventArgs e) { this.chkFallalyticsAnonymous.Checked = this.CurrentSettings.EnableFallalyticsAnonymous; } this.txtFallalyticsAPIKey.Text = this.CurrentSettings.FallalyticsAPIKey; - this.lblthirdpartyLicences.Font = Overlay.GetMainFont(18); ArrayList imageItemArray = new ArrayList(); if (Directory.Exists("Overlay")) { @@ -491,6 +495,7 @@ private void btnSave_Click(object sender, EventArgs e) { this.CurrentSettings.AutoUpdate = this.chkAutoUpdate.Checked; this.CurrentSettings.SystemTrayIcon = this.chkSystemTrayIcon.Checked; this.CurrentSettings.NotifyServerConnected = this.chkNotifyServerConnected.Checked; + this.CurrentSettings.NotifyPersonalBest = this.chkNotifyPersonalBest.Checked; this.CurrentSettings.MuteNotificationSounds = this.chkMuteNotificationSounds.Checked; this.CurrentSettings.NotificationSounds = this.cboNotificationSounds.SelectedIndex; this.CurrentSettings.NotificationWindowPosition = this.cboNotificationWindowPosition.SelectedIndex; @@ -798,14 +803,14 @@ private void chkFallalyticsReporting_CheckedChanged(object sender, EventArgs e) } } - private void chkNotifyServerConnected_CheckedChanged(object sender, EventArgs e) { - this.chkMuteNotificationSounds.Enabled = ((MetroCheckBox)sender).Checked; - this.cboNotificationSounds.Enabled = ((MetroCheckBox)sender).Checked; - this.cboNotificationWindowPosition.Enabled = ((MetroCheckBox)sender).Checked; - this.cboNotificationWindowAnimation.Enabled = ((MetroCheckBox)sender).Checked; - this.btnPlayNotificationSounds.Enabled = ((MetroCheckBox)sender).Checked; - if (!((MetroCheckBox)sender).Checked) { - this.chkMuteNotificationSounds.Checked = ((MetroCheckBox)sender).Checked; + private void chkNotify_CheckedChanged(object sender, EventArgs e) { + this.chkMuteNotificationSounds.Enabled = this.chkNotifyPersonalBest.Checked || this.chkNotifyServerConnected.Checked; + this.cboNotificationSounds.Enabled = this.chkNotifyPersonalBest.Checked || this.chkNotifyServerConnected.Checked; + this.cboNotificationWindowPosition.Enabled = this.chkNotifyPersonalBest.Checked || this.chkNotifyServerConnected.Checked; + this.cboNotificationWindowAnimation.Enabled = this.chkNotifyPersonalBest.Checked || this.chkNotifyServerConnected.Checked; + this.btnPlayNotificationSounds.Enabled = this.chkNotifyPersonalBest.Checked || this.chkNotifyServerConnected.Checked; + if (!this.chkNotifyPersonalBest.Checked && !this.chkNotifyServerConnected.Checked) { + this.chkMuteNotificationSounds.Checked = false; } } @@ -968,6 +973,7 @@ private void ChangeLanguage(int lang) { this.chkAutoUpdate.Text = Multilingual.GetWord("settings_auto_update_program"); this.chkSystemTrayIcon.Text = Multilingual.GetWord("settings_system_tray_icon"); this.chkNotifyServerConnected.Text = Multilingual.GetWord("settings_notify_server_connected"); + this.chkNotifyPersonalBest.Text = Multilingual.GetWord("settings_notify_personal_best"); this.chkMuteNotificationSounds.Text = Multilingual.GetWord("settings_mute_notification_sounds"); this.cboNotificationSounds.Items.Clear(); this.cboNotificationSounds.Items.AddRange(new object[] { @@ -977,16 +983,13 @@ private void ChangeLanguage(int lang) { Multilingual.GetWord("settings_notification_sounds_04"), }); this.cboNotificationSounds.Width = (lang == 0 || lang == 1) ? 172 : lang == 2 ? 115 : lang == 3 ? 95 : 110; - this.cboNotificationSounds.SelectedIndex = this.CurrentSettings.NotificationSounds; this.cboNotificationWindowPosition.Items.Clear(); this.cboNotificationWindowPosition.Items.AddRange(new object[] { Multilingual.GetWord("settings_notification_window_bottom_right"), Multilingual.GetWord("settings_notification_window_top_right"), }); this.cboNotificationWindowPosition.Width = lang == 0 ? 116 : lang == 1 ? 131 : lang == 2 ? 94 : lang == 3 ? 62 : lang == 4 ? 62 : lang == 5 ? 62 : 120; - this.cboNotificationWindowPosition.SelectedIndex = this.CurrentSettings.NotificationWindowPosition; this.cboNotificationWindowPosition.Location = new Point(this.cboNotificationSounds.Location.X + this.cboNotificationSounds.Width + 5, this.cboNotificationWindowPosition.Location.Y); - this.cboNotificationWindowAnimation.SelectedIndex = this.CurrentSettings.NotificationWindowAnimation; this.cboNotificationWindowAnimation.Location = new Point(this.cboNotificationWindowPosition.Location.X + this.cboNotificationWindowPosition.Width + 5, this.cboNotificationWindowAnimation.Location.Y); this.btnPlayNotificationSounds.Location = new Point(this.cboNotificationWindowAnimation.Location.X + this.cboNotificationWindowAnimation.Width + 5, this.btnPlayNotificationSounds.Location.Y); this.chkPreventOverlayMouseClicks.Text = Multilingual.GetWord("settings_prevent_overlay_mouse_clicks"); @@ -1032,6 +1035,7 @@ private void ChangeLanguage(int lang) { this.fglink2.Text = $"{Multilingual.GetWord("settings_issue_traker")} && {Multilingual.GetWord("settings_translation")}"; this.btnCheckUpdates.Text = Multilingual.GetWord("main_update"); this.btnCheckUpdates.Width = 54; + this.lblthirdpartyLicences.Font = Overlay.GetMainFont(18); #if AllowUpdate this.lblVersion.Text = $"{Multilingual.GetWord("main_fall_guys_stats")} v{Assembly.GetExecutingAssembly().GetName().Version.ToString(2)}"; #else diff --git a/Views/Stats.cs b/Views/Stats.cs index 11c694f85..12c679175 100644 --- a/Views/Stats.cs +++ b/Views/Stats.cs @@ -309,9 +309,10 @@ private Stats() { HostCountryCode = Utils.GetCountryInfoByIp(Utils.GetUserPublicIp(), false); } }); + this.SetSecretKey(); this.mainWndTitle = $" {Multilingual.GetWord("main_fall_guys_stats")} v{Assembly.GetExecutingAssembly().GetName().Version.ToString(2)}"; - this.StatsDB = new LiteDatabase(@"data.db"); + this.StatsDB = new LiteDatabase(@"Filename=data.db;Timeout=120000;Upgrade=true"); this.StatsDB.Pragma("UTC_DATE", true); this.UserSettings = this.StatsDB.GetCollection("UserSettings"); this.StatsDB.BeginTrans(); @@ -322,19 +323,16 @@ private Stats() { try { this.CurrentSettings = this.UserSettings.FindAll().First(); CurrentLanguage = this.CurrentSettings.Multilingual; - CurrentTheme = this.CurrentSettings.Theme == 0 ? MetroThemeStyle.Light : - this.CurrentSettings.Theme == 1 ? MetroThemeStyle.Dark : MetroThemeStyle.Default; + CurrentTheme = this.CurrentSettings.Theme == 0 ? MetroThemeStyle.Light : MetroThemeStyle.Dark; } catch { this.UserSettings.DeleteAll(); this.CurrentSettings = GetDefaultSettings(); this.UserSettings.Insert(this.CurrentSettings); } } + this.StatsDB.Commit(); - this.RemoveUpdateFiles(); - - this.SetSecretKey(); this.InitializeComponent(); this.SetStyle(ControlStyles.UserPaint, true); @@ -355,9 +353,9 @@ private Stats() { this.RoundDetails = this.StatsDB.GetCollection("RoundDetails"); this.Profiles = this.StatsDB.GetCollection("Profiles"); - this.FallalyticsPbLog = this.StatsDB.GetCollection("FallalyticsPbLog"); this.ServerConnectionLog = this.StatsDB.GetCollection("ServerConnectionLog"); this.PersonalBestLog = this.StatsDB.GetCollection("PersonalBestLog"); + this.FallalyticsPbLog = this.StatsDB.GetCollection("FallalyticsPbLog"); this.ClearServerConnectionLog(); this.ClearPersonalBestLog(); @@ -369,15 +367,14 @@ private Stats() { this.RoundDetails.EnsureIndex(r => r.Start); this.RoundDetails.EnsureIndex(r => r.InParty); - // this.Profiles.EnsureIndex(p => p.ProfileId); - // - // this.FallalyticsPbLog.EnsureIndex(f => f.PbId); - // this.FallalyticsPbLog.EnsureIndex(f => f.RoundId); - // this.FallalyticsPbLog.EnsureIndex(f => f.ShowId); - // - // this.ServerConnectionLog.EnsureIndex(f => f.SessionId); - // this.PersonalBestLog.EnsureIndex(f => f.SessionId); + this.Profiles.EnsureIndex(p => p.ProfileId); + + this.ServerConnectionLog.EnsureIndex(f => f.SessionId); + this.PersonalBestLog.EnsureIndex(f => f.SessionId); + this.FallalyticsPbLog.EnsureIndex(f => f.PbId); + this.FallalyticsPbLog.EnsureIndex(f => f.RoundId); + this.FallalyticsPbLog.EnsureIndex(f => f.ShowId); if (this.Profiles.Count() == 0) { string sysLang = CultureInfo.CurrentUICulture.Name.StartsWith("zh") ? @@ -723,8 +720,8 @@ private void SetTheme(MetroThemeStyle theme) { this.SuspendLayout(); this.mtt.Theme = theme; this.omtt.Theme = theme; - this.menu.Renderer = theme == MetroThemeStyle.Light ? (ToolStripRenderer)new CustomLightArrowRenderer() : new CustomDarkArrowRenderer(); - this.trayCMenu.Renderer = theme == MetroThemeStyle.Light ? (ToolStripRenderer)new CustomLightArrowRenderer() : new CustomDarkArrowRenderer(); + this.menu.Renderer = theme == MetroThemeStyle.Light ? new CustomLightArrowRenderer() : new CustomDarkArrowRenderer() as ToolStripRenderer; + this.trayCMenu.Renderer = theme == MetroThemeStyle.Light ? new CustomLightArrowRenderer() : new CustomDarkArrowRenderer() as ToolStripRenderer; foreach (Control c1 in Controls) { if (c1 is MenuStrip ms1) { foreach (var item in ms1.Items) { @@ -824,7 +821,7 @@ private void SetTheme(MetroThemeStyle theme) { } } - foreach (object item in this.gridDetails.CMenu.Items) { + foreach (var item in this.gridDetails.CMenu.Items) { if (item is ToolStripMenuItem tsi) { tsi.BackColor = theme == MetroThemeStyle.Light ? Color.White : Color.FromArgb(17, 17, 17); tsi.ForeColor = theme == MetroThemeStyle.Light ? Color.Black : Color.DarkGray; @@ -2159,6 +2156,7 @@ private UserSettings GetDefaultSettings() { OverlayBackgroundOpacity = 100, IsOverlayBackgroundCustomized = false, NotifyServerConnected = false, + NotifyPersonalBest = false, MuteNotificationSounds = false, NotificationSounds = 0, NotificationWindowPosition = 0, @@ -2772,7 +2770,7 @@ private void LogFile_OnPersonalBestNotification(RoundInfo info) { TimeSpan record = queryResult.Count > 0 ? queryResult.Min(r => r.Finish.Value - r.Start) : TimeSpan.MaxValue; this.UpsertPersonalBestLog(info.SessionId, info.ShowNameId, info.Name, currentRecord.TotalMilliseconds, info.Finish.Value, currentRecord < record); - if (IsGameRunning && currentRecord < record) { + if (this.CurrentSettings.NotifyPersonalBest && IsGameRunning && currentRecord < record) { string timeDiffContent = String.Empty; if (record != TimeSpan.MaxValue) { TimeSpan timeDiff = record - currentRecord; @@ -2797,16 +2795,16 @@ private void LogFile_OnPersonalBestNotification(RoundInfo info) { } } - private void LogFile_OnServerConnectionNotification(string alpha2Code, string region, string city) { + private void LogFile_OnServerConnectionNotification() { string countryFullName; - if (!string.IsNullOrEmpty(alpha2Code)) { - countryFullName = Multilingual.GetCountryName(alpha2Code); - if (!string.IsNullOrEmpty(region)) { - countryFullName += $" ({region}"; - if (!string.IsNullOrEmpty(city)) { - - if (!city.Equals(region)) { - countryFullName += $", {city})"; + if (!string.IsNullOrEmpty(LastCountryAlpha2Code)) { + countryFullName = Multilingual.GetCountryName(LastCountryAlpha2Code); + if (!string.IsNullOrEmpty(LastCountryRegion)) { + countryFullName += $" ({LastCountryRegion}"; + if (!string.IsNullOrEmpty(LastCountryCity)) { + + if (!LastCountryCity.Equals(LastCountryRegion)) { + countryFullName += $", {LastCountryCity})"; } else { countryFullName += ")"; } @@ -2814,15 +2812,15 @@ private void LogFile_OnServerConnectionNotification(string alpha2Code, string re countryFullName += ")"; } } else { - if (!string.IsNullOrEmpty(city)) { - countryFullName += $" ({city})"; + if (!string.IsNullOrEmpty(LastCountryCity)) { + countryFullName += $" ({LastCountryCity})"; } } } else { countryFullName = "UNKNOWN"; } string description = $"{Multilingual.GetWord("message_connected_to_server_prefix")}{countryFullName}{Multilingual.GetWord("message_connected_to_server_suffix")}"; - Image flagImage = (Image)Properties.Resources.ResourceManager.GetObject($"country_{(string.IsNullOrEmpty(alpha2Code) ? "unknown" : alpha2Code)}{(this.CurrentSettings.ShadeTheFlagImage ? "_shiny" : "")}_icon"); + Image flagImage = (Image)Properties.Resources.ResourceManager.GetObject($"country_{(string.IsNullOrEmpty(LastCountryAlpha2Code) ? "unknown" : LastCountryAlpha2Code)}{(this.CurrentSettings.ShadeTheFlagImage ? "_shiny" : "")}_icon"); ToastPosition toastPosition = this.CurrentSettings.NotificationWindowPosition == 0 ? ToastPosition.BottomRight : ToastPosition.TopRight; ToastTheme toastTheme = this.Theme == MetroThemeStyle.Light ? ToastTheme.Light : ToastTheme.Dark; ToastAnimation toastAnimation = this.CurrentSettings.NotificationWindowAnimation == 0 ? ToastAnimation.FADE : ToastAnimation.SLIDE;