Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qubqub committed Nov 4, 2023
1 parent b4c854c commit 82b5b8e
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 48 deletions.
17 changes: 11 additions & 6 deletions Entities/LevelStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,25 @@ public void ToLocalTime() {
this.FinishLocal = this.Finish.Value.ToLocalTime();
}
}

public void VerifyName() {
if (string.IsNullOrEmpty(this.SceneName)) { return; }

if (LevelStats.SceneToRound.TryGetValue(this.SceneName, out string roundName)) {
this.Name = roundName;
}
}

public string VerifiedName() {
return string.IsNullOrEmpty(this.SceneName)
? this.Name
: LevelStats.SceneToRound.TryGetValue(this.SceneName, out string roundName) ? roundName : this.Name;
}

public override string ToString() {
return $"{this.Name}: Round={this.Round} Position={this.Position} Duration={this.End - this.Start} Kudos={this.Kudos}";
}

public override bool Equals(object obj) {
return obj is RoundInfo info
&& info.End == this.End
Expand All @@ -111,20 +115,17 @@ public override bool Equals(object obj) {
&& info.SessionId == this.SessionId
&& info.UseShareCode == this.UseShareCode;
}

public override int GetHashCode() {
return Name.GetHashCode() ^ ShowID ^ Round;
}

public int CompareTo(RoundInfo other) {
int showCompare = ShowID.CompareTo(other.ShowID);
return showCompare != 0 ? showCompare : Round.CompareTo(other.Round);
}
}
public enum QualifyTier {
Pink,
Gold,
Silver,
Bronze
}

public class LevelStats {
public static Dictionary<string, LevelStats> ALL = new Dictionary<string, LevelStats>(StringComparer.OrdinalIgnoreCase) {
{ "user_creative_race_round", new LevelStats("user_creative_race_round", "User Creative Race Round", LevelType.CreativeRace, BestRecordType.Fastest, true, false, 10, 0, 0, Properties.Resources.round_creative_icon, Properties.Resources.round_creative_big_icon) },
Expand Down Expand Up @@ -698,6 +699,7 @@ public class LevelStats {
{ "round_thin_ice", new LevelStats("round_thin_ice", "Thin Ice", LevelType.Survival, BestRecordType.Longest, false, true, 3, 300, 300, Properties.Resources.round_thin_ice_icon, Properties.Resources.round_thin_ice_big_icon) },
{ "round_tiptoefinale_almond", new LevelStats("round_tiptoefinale_almond", "Tip Toe Finale", LevelType.Race, BestRecordType.Fastest, false, true, 8, 300, 300, Properties.Resources.round_tip_toe_finale_icon, Properties.Resources.round_tip_toe_finale_big_icon) },
};

public static Dictionary<string, string> SceneToRound = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) {
{ "FallGuy_DoorDash", "round_door_dash" },
{ "FallGuy_Gauntlet_02_01", "round_gauntlet_02" },
Expand Down Expand Up @@ -834,6 +836,7 @@ public LevelStats(string levelId, string levelName, LevelType type, BestRecordTy
this.Stats = new List<RoundInfo>();
this.Clear();
}

public void Clear() {
this.Qualified = 0;
this.Gold = 0;
Expand All @@ -848,6 +851,7 @@ public void Clear() {
this.Longest = TimeSpan.Zero;
this.Stats.Clear();
}

public void Increase(RoundInfo stat, bool isLinkedCustomShow) {
if (!stat.PrivateLobby || "user_creative_race_round".Equals(stat.Name) || isLinkedCustomShow) {
this.Played++;
Expand Down Expand Up @@ -882,6 +886,7 @@ public void Increase(RoundInfo stat, bool isLinkedCustomShow) {
}
}
}

public void Add(RoundInfo stat) {
this.Stats.Add(stat);
}
Expand Down
25 changes: 5 additions & 20 deletions Entities/LevelType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,6 @@
using MetroFramework;

namespace FallGuysStats {
public enum LevelType {
Unknown,
CreativeRace,
CreativeSurvival,
CreativeHunt,
CreativeLogic,
CreativeTeam,
Race,
Survival,
Hunt,
Logic,
Team,
Invisibeans,
Final
}
public enum BestRecordType {
Fastest,
Longest,
HighScore
}
internal static class LevelTypeBehavior {
public static int FastestLabel(this LevelType type) {
switch (type) {
Expand All @@ -38,6 +18,7 @@ public static int FastestLabel(this LevelType type) {
}
return 1;
}

public static string CreativeLevelTypeId(this LevelType type) {
switch (type) {
case LevelType.CreativeRace:
Expand All @@ -53,6 +34,7 @@ public static string CreativeLevelTypeId(this LevelType type) {
}
return "Unknown";
}

public static string LevelTitle(this LevelType type, bool isFinal) {
if (isFinal) {
return Multilingual.GetWord("level_detail_final");
Expand All @@ -74,6 +56,7 @@ public static string LevelTitle(this LevelType type, bool isFinal) {
}
return "Unknown";
}

public static Color LevelDefaultColor(this LevelType type, bool isFinal) {
if (isFinal) {
return Color.FromArgb(251, 198, 0);
Expand All @@ -95,6 +78,7 @@ public static Color LevelDefaultColor(this LevelType type, bool isFinal) {
}
return Color.DarkGray;
}

public static Color LevelBackColor(this LevelType type, bool isFinal, bool isTeam, int alpha) {
if (isFinal && type != LevelType.CreativeRace) {
return Color.FromArgb(alpha, 250, 195, 0);
Expand All @@ -120,6 +104,7 @@ public static Color LevelBackColor(this LevelType type, bool isFinal, bool isTea
}
return Color.DarkGray;
}

public static Color LevelForeColor(this LevelType type, bool isFinal, bool isTeam, MetroThemeStyle theme = MetroThemeStyle.Default) {
if (isFinal && type != LevelType.CreativeRace) {
return Color.FromArgb(130, 100, 0);
Expand Down
8 changes: 7 additions & 1 deletion Entities/Multilingual.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ public static class Multilingual {
{"message_new_personal_best_timediff_by_minute_infix", " minute,"},
{"message_new_personal_best_timediff_by_minute_suffix", " seconds less!"},
{"message_new_personal_best_timediff_by_second", " seconds shortened!"},
{"message_test_notifications_caption", "🔔 Test notifications"},
{"message_connected_to_server_caption", "Server connection notification"},
{"message_connected_to_server_prefix", "You are connected to a "},
{"message_connected_to_server_suffix", " server."},
Expand Down Expand Up @@ -720,7 +721,8 @@ public static class Multilingual {
{"message_new_personal_best_timediff_by_minute_infix", " minute,"},
{"message_new_personal_best_timediff_by_minute_suffix", " secondes de moins!"},
{"message_new_personal_best_timediff_by_second", " secondes raccourcies !"},
{"message_connected_to_server_caption", "Notification de connexion au serveur"},
{"message_test_notifications_caption", "🔔 Notifications de test"},
{"message_connected_to_server_caption", "🔔 Notification de connexion au serveur"},
{"message_connected_to_server_prefix", "Vous êtes connecté à un serveur "},
{"message_connected_to_server_suffix", "."},
{"message_check_internet_connection_caption", "Erreur réseau"},
Expand Down Expand Up @@ -1185,6 +1187,7 @@ public static class Multilingual {
{"message_new_personal_best_timediff_by_minute_infix", "분"},
{"message_new_personal_best_timediff_by_minute_suffix", "초 단축!"},
{"message_new_personal_best_timediff_by_second", "초 단축!"},
{"message_test_notifications_caption", "🔔 알림 테스트"},
{"message_connected_to_server_caption", "서버 연결 알림"},
{"message_connected_to_server_prefix", ""},
{"message_connected_to_server_suffix", " 서버에 연결되었습니다."},
Expand Down Expand Up @@ -1650,6 +1653,7 @@ public static class Multilingual {
{"message_new_personal_best_timediff_by_minute_infix", "分"},
{"message_new_personal_best_timediff_by_minute_suffix", "秒短縮!"},
{"message_new_personal_best_timediff_by_second", " 秒短縮!"},
{"message_test_notifications_caption", "🔔 通知テスト"},
{"message_connected_to_server_caption", "サーバー接続通知"},
{"message_connected_to_server_prefix", "あなたは "},
{"message_connected_to_server_suffix", " サーバーに接続しています。"},
Expand Down Expand Up @@ -2115,6 +2119,7 @@ public static class Multilingual {
{"message_new_personal_best_timediff_by_minute_infix", " 分 "},
{"message_new_personal_best_timediff_by_minute_suffix", " 秒!"},
{"message_new_personal_best_timediff_by_second", " 秒缩短!"},
{"message_test_notifications_caption", "🔔 测试通知"},
{"message_connected_to_server_caption", "服务器连接通知"},
{"message_connected_to_server_prefix", "您已连接到 "},
{"message_connected_to_server_suffix", " 服务器。"},
Expand Down Expand Up @@ -2580,6 +2585,7 @@ public static class Multilingual {
{"message_new_personal_best_timediff_by_minute_infix", " 分 "},
{"message_new_personal_best_timediff_by_minute_suffix", " 秒!"},
{"message_new_personal_best_timediff_by_second", " 秒縮短!"},
{"message_test_notifications_caption", "🔔 測試通知"},
{"message_connected_to_server_caption", "服務器連接通知"},
{"message_connected_to_server_prefix", "您已連接到 "},
{"message_connected_to_server_suffix", " 服務器。"},
Expand Down
29 changes: 29 additions & 0 deletions Enums/Enums.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@
namespace FallGuysStats {
public enum LevelType {
Unknown,
CreativeRace,
CreativeSurvival,
CreativeHunt,
CreativeLogic,
CreativeTeam,
Race,
Survival,
Hunt,
Logic,
Team,
Invisibeans,
Final
}

public enum BestRecordType {
Fastest,
Longest,
HighScore
}

public enum QualifyTier {
Pink,
Gold,
Silver,
Bronze
}

public enum HashTypes { MD5, RIPEMD160, SHA1, SHA256, SHA384, SHA512 }

public enum DWMWINDOWATTRIBUTE {
Expand Down
5 changes: 3 additions & 2 deletions Views/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ private void btnPlayNotificationSounds_Click(object sender, EventArgs e) {
case 3: toastSound = ToastSound.Generic04; break;
default: toastSound = ToastSound.Generic01; break;
}
this.StatsForm.ShowToastNotification(this.StatsForm, Properties.Resources.main_120_icon, Multilingual.GetWord("message_connected_to_server_caption", this.DisplayLang), "MADE BY Qubit Guy@eunma A.K.A. 제임스 웹 우주 망원경",
this.StatsForm.ShowToastNotification(this.StatsForm, Properties.Resources.main_120_icon, Multilingual.GetWord("message_test_notifications_caption", this.DisplayLang), "MADE BY Qubit Guy@eunma A.K.A. 제임스 웹 우주 망원경",
Overlay.GetMainFont(16, FontStyle.Bold, this.DisplayLang), flagImage, ToastDuration.VERY_SHORT, toastPosition, toastAnimation, toastTheme, toastSound, this.chkMuteNotificationSounds.Checked, true);
});
}
Expand Down Expand Up @@ -859,7 +859,6 @@ private void ChangeLanguage(int lang) {
this.chkHidePercentages.Text = Multilingual.GetWord("settings_hide_percentages");
this.chkHideWinsInfo.Text = Multilingual.GetWord("settings_hide_wins_info");


this.cboOverlayColor.Items.Clear();
this.cboOverlayColor.Items.AddRange(new object[] {
Multilingual.GetWord("settings_transparent"),
Expand Down Expand Up @@ -982,12 +981,14 @@ private void ChangeLanguage(int lang) {
Multilingual.GetWord("settings_notification_sounds_03"),
Multilingual.GetWord("settings_notification_sounds_04"),
});
this.cboNotificationSounds.SelectedIndex = this.CurrentSettings.NotificationSounds;
this.cboNotificationSounds.Width = (lang == 0 || lang == 1) ? 172 : lang == 2 ? 115 : lang == 3 ? 95 : 110;
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.SelectedIndex = this.CurrentSettings.NotificationWindowPosition;
this.cboNotificationWindowPosition.Width = lang == 0 ? 116 : lang == 1 ? 131 : lang == 2 ? 94 : lang == 3 ? 62 : lang == 4 ? 62 : lang == 5 ? 62 : 120;
this.cboNotificationWindowPosition.Location = new Point(this.cboNotificationSounds.Location.X + this.cboNotificationSounds.Width + 5, this.cboNotificationWindowPosition.Location.Y);
this.cboNotificationWindowAnimation.Location = new Point(this.cboNotificationWindowPosition.Location.X + this.cboNotificationWindowPosition.Width + 5, this.cboNotificationWindowAnimation.Location.Y);
Expand Down
34 changes: 15 additions & 19 deletions Views/Stats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2589,22 +2589,20 @@ private void Stats_Load(object sender, EventArgs e) {
try {
this.SetTheme(CurrentTheme);

this.BeginInvoke((MethodInvoker)delegate {
this.infoStrip.Renderer = new CustomToolStripSystemRenderer();
this.infoStrip2.Renderer = new CustomToolStripSystemRenderer();
Utils.DwmSetWindowAttribute(this.menu.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.menuFilters.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.menuStatsFilter.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.menuPartyFilter.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.menuProfile.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.menuLookHere.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.trayCMenu.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.trayFilters.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.trayStatsFilter.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.trayPartyFilter.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.trayProfile.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.trayLookHere.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
});
this.infoStrip.Renderer = new CustomToolStripSystemRenderer();
this.infoStrip2.Renderer = new CustomToolStripSystemRenderer();
Utils.DwmSetWindowAttribute(this.menu.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.menuFilters.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.menuStatsFilter.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.menuPartyFilter.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.menuProfile.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.menuLookHere.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.trayCMenu.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.trayFilters.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.trayStatsFilter.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.trayPartyFilter.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.trayProfile.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));
Utils.DwmSetWindowAttribute(this.trayLookHere.DropDown.Handle, DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE, ref windowConerPreference, sizeof(uint));

this.UpdateDates();
} catch (Exception ex) {
Expand Down Expand Up @@ -4397,9 +4395,7 @@ private void SortGridDetails(bool isInitialize, int columnIndex = 0) {
LevelType oneType = one.IsFinal ? LevelType.Final : one.Type;
LevelType twoType = two.IsFinal ? LevelType.Final : two.Type;

int typeCompare = this.CurrentSettings.IgnoreLevelTypeWhenSorting && sortOrder != SortOrder.None
? 0
: ((int)oneType).CompareTo((int)twoType);
int typeCompare = this.CurrentSettings.IgnoreLevelTypeWhenSorting && sortOrder != SortOrder.None ? 0 : ((int)oneType).CompareTo((int)twoType);

if (sortOrder == SortOrder.Descending) {
(one, two) = (two, one);
Expand Down

0 comments on commit 82b5b8e

Please sign in to comment.