Skip to content

Commit 87a46e6

Browse files
authored
Merge pull request #94 from BitTim/93-recent-maps
This closes #93
2 parents 97092f4 + 9ebb185 commit 87a46e6

File tree

10 files changed

+145
-76
lines changed

10 files changed

+145
-76
lines changed

VexTrack.sln.DotSettings.user

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003AC_0021_003FUsers_003Ftim_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F2c8e7ca976f350cba9836d5565dac56b11e0b56656fa786460eb1395857a6fa_003FThrowHelper_002Ecs_002Fz_003A3_002D2/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>

VexTrack/Core/Constants.cs

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace VexTrack.Core
66
static class Constants
77
{
88
public static readonly string AppName = "VexTrack";
9-
public static readonly string Version = "v1.87";
9+
public static readonly string Version = "v1.88";
1010

1111
public static readonly string DataFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"/VexTrack - Preview";
1212
public static readonly string LegacyDataFolder = @"dat";
@@ -32,24 +32,40 @@ static class Constants
3232
public static readonly List<string> Maps = new List<string>()
3333
{
3434
"Ascent",
35+
"Split",
36+
"Fracture",
3537
"Bind",
3638
"Breeze",
37-
"Fracture",
38-
"Haven",
39+
"Abyss",
40+
"Lotus",
41+
"Sunset",
42+
"Peral",
3943
"Icebox",
40-
"Split",
41-
"None"
44+
"Corrode",
45+
"Haven",
46+
"Disctrict",
47+
"Kasbah",
48+
"Drift",
49+
"Glitch",
50+
"Piazza",
51+
"Skirmish A",
52+
"Skirmish B",
53+
"Skirmish C",
54+
"Custom"
4255
};
4356

4457
public static readonly List<string> Gamemodes = new List<string>()
4558
{
4659
"Unrated",
47-
"Competetive",
60+
"Competitive",
61+
"Swiftplay",
4862
"Spike Rush",
63+
"Team Deathmatch",
4964
"Deathmatch",
5065
"Escalation",
5166
"Replication",
52-
"Snowballfight",
67+
"Snowball Fight",
68+
"Skirmish",
5369
"Custom"
5470
};
5571

@@ -58,11 +74,14 @@ static class Constants
5874
[Gamemodes[0]] = "Score",
5975
[Gamemodes[1]] = "Score",
6076
[Gamemodes[2]] = "Score",
61-
[Gamemodes[3]] = "Placement",
77+
[Gamemodes[3]] = "Score",
6278
[Gamemodes[4]] = "Score",
63-
[Gamemodes[5]] = "Score",
79+
[Gamemodes[5]] = "Placement",
6480
[Gamemodes[6]] = "Score",
65-
[Gamemodes[7]] = "None"
81+
[Gamemodes[7]] = "Score",
82+
[Gamemodes[8]] = "Score",
83+
[Gamemodes[9]] = "Score",
84+
[Gamemodes[10]] = "None"
6685
};
6786

6887
public static readonly Dictionary<string, int> StreakStatusOrder = new Dictionary<string, int>

VexTrack/Core/HistoryDataCalc.cs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ namespace VexTrack.Core
55
{
66
public static class HistoryDataCalc
77
{
8-
public static string CalcHistoryResultFromScores(string scoreType, int score, int enemyScore, bool surrenderedWin, bool surrenderedLoss)
8+
public static string CalcHistoryResultFromScores(string scoreType, string description, int score, int enemyScore, bool surrenderedWin, bool surrenderedLoss)
99
{
1010
if (scoreType == "Score")
1111
{
1212
if (surrenderedWin) return "Surrendered Win";
1313
if (surrenderedLoss) return "Surrendered Loss";
1414
}
1515

16-
if (scoreType == "Placement" || scoreType == "None") enemyScore = -1;
17-
if (scoreType == "None") score = -1;
16+
if (scoreType == "Placement") enemyScore = -1;
17+
if (scoreType == "None") (_, _, score, enemyScore) = DescriptionToScores(description);
1818

1919
if (enemyScore == -1)
2020
{
@@ -81,24 +81,22 @@ public static (string, string, int, int) DescriptionToScores(string description)
8181

8282
int score = -1;
8383
int enemyScore = -1;
84+
8485

85-
if (!isCustom)
86-
{
87-
string[] splitDesc = description.Split(" ");
88-
string scoreStr = "";
86+
string[] splitDesc = description.Split(" ");
87+
string scoreStr = "";
8988

90-
foreach (string token in splitDesc)
91-
{
92-
if (!token.Contains("-")) { continue; }
93-
scoreStr = token;
89+
foreach (string token in splitDesc)
90+
{
91+
if (!token.Contains("-")) { continue; }
92+
scoreStr = token;
9493

95-
string[] scoreTokens = scoreStr.Split("-");
96-
if (scoreTokens.Length != 2) continue;
97-
if (scoreTokens[0] == "" || scoreTokens[1] == "") continue;
94+
string[] scoreTokens = scoreStr.Split("-");
95+
if (scoreTokens.Length != 2) continue;
96+
if (scoreTokens[0] == "" || scoreTokens[1] == "") continue;
9897

99-
(score, enemyScore) = (int.Parse(scoreTokens[0]), int.Parse(scoreTokens[1]));
100-
break;
101-
}
98+
(score, enemyScore) = (int.Parse(scoreTokens[0]), int.Parse(scoreTokens[1]));
99+
break;
102100
}
103101

104102
string desc = isCustom ? description : "";
@@ -138,7 +136,7 @@ public HistoryEntryData(string sUUID, string hUUID, string gameMode, long time,
138136
SurrenderedLoss = surrenderedLoss;
139137

140138
if (Constants.ScoreTypes[GameMode] == "None") Title = Description;
141-
else if (Constants.ScoreTypes[GameMode] == "Placement") Title = GameMode + " " + HistoryDataCalc.CalcHistoryResultFromScores("Placement", Score, EnemyScore, SurrenderedWin, SurrenderedLoss);
139+
else if (Constants.ScoreTypes[GameMode] == "Placement") Title = GameMode + " " + HistoryDataCalc.CalcHistoryResultFromScores("Placement", Description, Score, EnemyScore, SurrenderedWin, SurrenderedLoss);
142140
else Title = GameMode + " " + Score.ToString() + "-" + EnemyScore.ToString();
143141
}
144142
}

VexTrack/Core/TrackingData.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,24 @@ public static void LoadData()
273273
string map = (string)historyEntry["map"];
274274
string description = (string)historyEntry["description"];
275275

276-
if (map == null || map == "") map = Constants.Maps.Last();
276+
// Fix previous typos
277+
if (gamemode == "Competetive")
278+
{
279+
gamemode = "Competitive";
280+
reSave = true;
281+
}
282+
283+
if (gamemode == "Snowballfight")
284+
{
285+
gamemode = "Snowball Fight";
286+
reSave = true;
287+
}
277288

278289
string gameMode, desc;
279290
int score, enemyScore;
280291
bool surrenderedWin, surrenderedLoss;
281292

282-
if (gamemode == null)
293+
if (gamemode is null or "Custom")
283294
{
284295
(gameMode, desc, score, enemyScore) = HistoryDataCalc.DescriptionToScores(description);
285296
surrenderedWin = false;
@@ -662,7 +673,7 @@ public static void EditHistoryEntry(string sUUID, string hUUID, HistoryEntry dat
662673
.History.FindIndex(he => he.UUID == hUUID)] = data;
663674

664675
HistoryViewModel HistoryVM = (HistoryViewModel)ViewModelManager.ViewModels["History"];
665-
HistoryVM.EditEntry(new HistoryEntryData(sUUID, hUUID, data.GameMode, data.Time, data.Amount, data.Map, HistoryDataCalc.CalcHistoryResultFromScores(Constants.ScoreTypes[data.GameMode], data.Score, data.EnemyScore, data.SurrenderedWin, data.SurrenderedLoss), data.Description, data.Score, data.EnemyScore, data.SurrenderedWin, data.SurrenderedLoss));
676+
HistoryVM.EditEntry(new HistoryEntryData(sUUID, hUUID, data.GameMode, data.Time, data.Amount, data.Map, HistoryDataCalc.CalcHistoryResultFromScores(Constants.ScoreTypes[data.GameMode], data.Description, data.Score, data.EnemyScore, data.SurrenderedWin, data.SurrenderedLoss), data.Description, data.Score, data.EnemyScore, data.SurrenderedWin, data.SurrenderedLoss));
666677

667678
Recalculate();
668679
CallUpdate();

VexTrack/MVVM/View/Popups/AboutPopup.xaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<RowDefinition Height="Auto"/>
5151
<RowDefinition Height="Auto"/>
5252
<RowDefinition Height="Auto"/>
53+
<RowDefinition Height="Auto"/>
5354
</Grid.RowDefinitions>
5455

5556
<TextBlock Grid.Row="0"
@@ -74,28 +75,40 @@
7475
HorizontalAlignment="Center"
7576
Foreground="{DynamicResource Foreground}"
7677
Margin="0, 0, 0, 8">
77-
GitHub:
7878
<Hyperlink NavigateUri="https://github.com/BitTim/VexTrack" RequestNavigate="Hyperlink_RequestNavigate">
7979
https://github.com/BitTim/VexTrack
8080
</Hyperlink>
8181
</TextBlock>
8282

83-
<TextBlock Text="Created by BitTim, Copyright ©2021 - 2022"
83+
<TextBlock Text="Created by BitTim, Copyright ©2021 - 2025"
8484
Grid.Row="3"
8585
FontSize="14"
8686
TextWrapping="Wrap"
8787
HorizontalAlignment="Center"
8888
Foreground="{DynamicResource Foreground}"
8989
Margin="0, 0, 0, 32"/>
9090

91-
<TextBlock Text="v2.0 is gonna be big"
91+
<TextBlock Text="This is the end. Please check out Valolink!"
9292
Grid.Row="4"
9393
FontSize="14"
9494
FontStyle="Italic"
9595
TextWrapping="Wrap"
9696
HorizontalAlignment="Center"
9797
Foreground="{DynamicResource Foreground}"
9898
Margin="0, 0, 0, 2"/>
99+
100+
<TextBlock Text=""
101+
Grid.Row="5"
102+
FontSize="14"
103+
FontStyle="Italic"
104+
TextWrapping="Wrap"
105+
HorizontalAlignment="Center"
106+
Foreground="{DynamicResource Foreground}"
107+
Margin="0, 0, 0, 2">
108+
<Hyperlink NavigateUri="https://github.com/BitTim/Valolink" RequestNavigate="Hyperlink_RequestNavigate">
109+
https://github.com/BitTim/Valolink
110+
</Hyperlink>
111+
</TextBlock>
99112
</Grid>
100113
</Grid>
101114

VexTrack/MVVM/View/Popups/EditableHistoryEntryPopup.xaml

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<conv:TimestampToStringConverter x:Key="TimestampConv"/>
1616
<conv:StringToVisibilityConverter x:Key="StringToVisibleConv"/>
1717
<conv:InvertedStringToVisibilityConverter x:Key="InvStringToVisibleConv"/>
18+
<BooleanToVisibilityConverter x:Key="BoolToVisibleConv"/>
1819
</UserControl.Resources>
1920

2021
<Grid Height="Auto"
@@ -53,6 +54,7 @@
5354
<RowDefinition Height="Auto"/>
5455
<RowDefinition Height="30"/>
5556
<RowDefinition Height="30"/>
57+
<RowDefinition Height="30"/>
5658
</Grid.RowDefinitions>
5759

5860
<TextBlock Text="Game mode"
@@ -105,26 +107,35 @@
105107
Margin="0, 0, 0, 8"/>
106108

107109
<TextBlock Text="Map"
108-
Grid.Row="3"
109-
Grid.Column="0"
110-
FontSize="14"
111-
FontWeight="Bold"
112-
VerticalAlignment="Center"
113-
Foreground="{Binding Result, Converter={StaticResource ResultToKeyConv}, ConverterParameter=Foreground}"
114-
Margin="0, 0, 0, 8"/>
110+
Grid.Row="3"
111+
Grid.Column="0"
112+
FontSize="14"
113+
FontWeight="Bold"
114+
VerticalAlignment="Center"
115+
Foreground="{Binding Result, Converter={StaticResource ResultToKeyConv}, ConverterParameter=Foreground}"
116+
Margin="0, 0, 0, 8"/>
117+
118+
<TextBlock Text="Custom Map Name"
119+
Grid.Row="4"
120+
Grid.Column="0"
121+
FontSize="14"
122+
FontWeight="Bold"
123+
VerticalAlignment="Center"
124+
Foreground="{Binding Result, Converter={StaticResource ResultToKeyConv}, ConverterParameter=Foreground}"
125+
Visibility="{Binding IsMapCustom, Converter={StaticResource BoolToVisibleConv}, ConverterParameter=None}"
126+
Margin="0, 0, 0, 8"/>
115127

116128
<TextBlock Text="Result"
117-
Grid.Row="4"
129+
Grid.Row="5"
118130
Grid.Column="0"
119131
FontSize="14"
120132
FontWeight="Bold"
121133
VerticalAlignment="Center"
122134
Foreground="{Binding Result, Converter={StaticResource ResultToKeyConv}, ConverterParameter=Foreground}"
123-
Visibility="{Binding ScoreType, Converter={StaticResource StringToVisibleConv}, ConverterParameter=Score}"
124135
Margin="0, 0, 0, 8"/>
125136

126137
<TextBlock Text="Time"
127-
Grid.Row="5"
138+
Grid.Row="6"
128139
Grid.Column="0"
129140
FontSize="14"
130141
FontWeight="Bold"
@@ -133,7 +144,7 @@
133144
Margin="0, 0, 0, 8"/>
134145

135146
<TextBlock Text="Gained XP"
136-
Grid.Row="6"
147+
Grid.Row="7"
137148
Grid.Column="0"
138149
FontSize="14"
139150
FontWeight="Bold"
@@ -259,24 +270,32 @@
259270
</Grid>
260271

261272
<ComboBox Grid.Row="3"
262-
Grid.Column="1"
263-
Margin="0, 0, 0, 8"
264-
FontSize="14"
265-
ItemsSource="{Binding Maps}"
266-
SelectedIndex="0"
267-
SelectedItem="{Binding Map, UpdateSourceTrigger=PropertyChanged}"/>
273+
Grid.Column="1"
274+
Margin="0, 0, 0, 8"
275+
FontSize="14"
276+
ItemsSource="{Binding Maps}"
277+
SelectedIndex="0"
278+
SelectedItem="{Binding Map, UpdateSourceTrigger=PropertyChanged}"/>
279+
280+
<TextBox Text="{Binding CustomMapName, UpdateSourceTrigger=PropertyChanged}"
281+
Grid.Row="4"
282+
Grid.Column="1"
283+
FontSize="14"
284+
Margin="0, 0, 0, 8"
285+
Height="22"
286+
Visibility="{Binding IsMapCustom, Converter={StaticResource BoolToVisibleConv}, ConverterParameter=None}"
287+
Style="{DynamicResource TextBoxTheme}"/>
268288

269289
<TextBlock Text="{Binding Result, UpdateSourceTrigger=PropertyChanged}"
270-
Grid.Row="4"
290+
Grid.Row="5"
271291
Grid.Column="1"
272292
FontSize="14"
273293
Foreground="{Binding Result, Converter={StaticResource ResultToKeyConv}, ConverterParameter=Foreground}"
274-
Visibility="{Binding ScoreType, Converter={StaticResource StringToVisibleConv}, ConverterParameter=Score}"
275294
Margin="0, 0, 0, 8"
276295
Height="22"/>
277296

278297
<TextBox x:Name="PART_DateTimeBox"
279-
Grid.Row="5"
298+
Grid.Row="6"
280299
Grid.Column="1"
281300
FontSize="14"
282301
Margin="0, 0, 0, 8"
@@ -297,7 +316,7 @@
297316
</TextBox>
298317

299318
<TextBox x:Name="PART_AmountBox"
300-
Grid.Row="6"
319+
Grid.Row="7"
301320
Grid.Column="1"
302321
FontSize="14"
303322
Margin="0, 0, 0, 8"

VexTrack/MVVM/ViewModel/HistoryViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ from e in g.Entries
7474
where e.HUUID == he.UUID
7575
select e).Any())
7676
{
77-
string result = HistoryDataCalc.CalcHistoryResultFromScores(Constants.ScoreTypes[he.GameMode], he.Score, he.EnemyScore, he.SurrenderedWin, he.SurrenderedLoss);
77+
string result = HistoryDataCalc.CalcHistoryResultFromScores(Constants.ScoreTypes[he.GameMode], he.Description, he.Score, he.EnemyScore, he.SurrenderedWin, he.SurrenderedLoss);
7878
HistoryEntryData hed = new HistoryEntryData(TrackingDataHelper.CurrentSeasonUUID, he.UUID, he.GameMode, he.Time, he.Amount, he.Map, result, he.Description, he.Score, he.EnemyScore, he.SurrenderedWin, he.SurrenderedLoss);
7979

8080
InsertEntry(hed);

0 commit comments

Comments
 (0)