Skip to content

Commit

Permalink
Bind to ExperienceBonus
Browse files Browse the repository at this point in the history
  • Loading branch information
exilekit committed Aug 6, 2023
1 parent ae6dff3 commit b57399b
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 18 deletions.
8 changes: 4 additions & 4 deletions PoESplit/CsvExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ namespace PoESplit
{
static class CsvExporter
{
public static void Export(string path, TimeTracker timeTracker)
public static void Export(string path, MetricsTracker metricTracker)
{
try
{
using (StreamWriter sw = File.CreateText(path))
{
// write the total campaign time
WriteRow(sw, new List<object>() { "Total Campaign", timeTracker.fCampaignTime.fTimeSpan });
WriteRow(sw, new List<object>() { "Total Campaign", metricTracker.fCampaignTime.fTimeSpan });
WriteRow(sw, new List<object>() { });

// write the act sums
Expand All @@ -25,7 +25,7 @@ public static void Export(string path, TimeTracker timeTracker)
for (int actIdx = 0; actIdx < BakedData.fMapPins.Length; ++actIdx)
{
row.Add($"Act {actIdx + 1}");
row.Add(timeTracker.fActTimestamps[actIdx].fTimeSpan);
row.Add(metricTracker.fActTimestamps[actIdx].fTimeSpan);
}
WriteRow(sw, row);
WriteRow(sw, new List<object>() { });
Expand All @@ -45,7 +45,7 @@ public static void Export(string path, TimeTracker timeTracker)
if (pinIdx < BakedData.fMapPins[actIdx].Count)
{
row.Add(BakedData.fMapPins[actIdx][pinIdx].Name);
row.Add(timeTracker.fMapPinMetrics[actIdx][pinIdx].fTimeSpan);
row.Add(metricTracker.fMapPinMetrics[actIdx][pinIdx].fTimeSpan);
rowHadData = true;
}
else
Expand Down
14 changes: 7 additions & 7 deletions PoESplit/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace PoESplit
{
public partial class MainWindow : Window, INotifyPropertyChanged
{
public TimeTracker fTimeTracker;
public MetricsTracker fMetricsTracker;
public readonly MapWindow fMapWindow;
public readonly DebugWindow fDebugWindow;
readonly LogReader fLogReader;
Expand All @@ -22,7 +22,7 @@ public partial class MainWindow : Window, INotifyPropertyChanged
public MainWindow()
{
this.DataContext = this;
fTimeTracker = new TimeTracker();
fMetricsTracker = new MetricsTracker();
fDebugWindow = new DebugWindow(this);
fLogReader = new LogReader(this);
fLogEventController = new LogEventController(this);
Expand Down Expand Up @@ -52,20 +52,20 @@ private void ExportCSV_Click(object sender, RoutedEventArgs e)
bool? result = sfd.ShowDialog();
if (result == true)
{
CsvExporter.Export(sfd.FileName, fTimeTracker);
CsvExporter.Export(sfd.FileName, fMetricsTracker);
}
}

private void ToggleRun_Click(object sender, RoutedEventArgs e)
{
if (toggleRun.IsChecked == true)
{
fTimeTracker.fStopwatch.Start();
fMetricsTracker.fStopwatch.Start();
toggleRun.Content = "Pause Run";
}
else
{
fTimeTracker.fStopwatch.Stop();
fMetricsTracker.fStopwatch.Stop();
toggleRun.Content = "Resume Run";
}
}
Expand All @@ -80,7 +80,7 @@ private void ResetRun_Click(object sender, RoutedEventArgs e)
if (result == MessageBoxResult.Yes)
{
PlayerInformation.NotifyRunReset();
fTimeTracker = new TimeTracker();
fMetricsTracker = new MetricsTracker();
fMapWindow.NotifyRunReset();
toggleRun.Content = "Begin Run";
toggleRun.IsChecked = false;
Expand Down Expand Up @@ -139,7 +139,7 @@ private void DispatcherTimer_Tick(object sender, EventArgs e)
}
}

fTimeTracker.Tick();
fMetricsTracker.Tick();
}

public bool IsMapVisible
Expand Down
13 changes: 13 additions & 0 deletions PoESplit/MapPinMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ public double Y
}
}

public int ExperienceBonus
{
get
{
return 42;
}
}

public void NotifyPlayerLevelChange()
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ExperienceBonus)));
}

public bool IsVisible
{
get
Expand Down
6 changes: 3 additions & 3 deletions PoESplit/MapWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public ICollection<MapPinMetrics> MapPinMetrics
{
get
{
return fMainWindow.fTimeTracker.fMapPinMetrics[fVisibleActIdx];
return fMainWindow.fMetricsTracker.fMapPinMetrics[fVisibleActIdx];
}
}

Expand All @@ -151,15 +151,15 @@ public MapPinMetrics ActTimestamp
{
get
{
return fMainWindow.fTimeTracker.fActTimestamps[fVisibleActIdx];
return fMainWindow.fMetricsTracker.fActTimestamps[fVisibleActIdx];
}
}

public MapPinMetrics CampaignTimestamp
{
get
{
return fMainWindow.fTimeTracker.fCampaignTime;
return fMainWindow.fMetricsTracker.fCampaignTime;
}
}

Expand Down
2 changes: 1 addition & 1 deletion PoESplit/MarkupTemplates/MapPinMetrics.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
FontSize="12"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<TextBlock Text="+58%"/>
<TextBlock Text="{Binding ExperienceBonus}"/>
</Label>
</StackPanel>
</DataTemplate>
Expand Down
4 changes: 2 additions & 2 deletions PoESplit/TimeTracker.cs → PoESplit/MetricsTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace PoESplit
{
public class TimeTracker
public class MetricsTracker
{
public readonly Stopwatch fStopwatch = new Stopwatch();
private TimeSpan fLastElapsed;
Expand All @@ -18,7 +18,7 @@ public class TimeTracker

private MapPinMetrics fUnknownArea = new MapPinMetrics();

public TimeTracker()
public MetricsTracker()
{
fMapPinMetrics = BakedData.fMapPins.Select(a => a.Select(b => new MapPinMetrics(b)).ToList()).ToArray();
fActTimestamps = BakedData.fMapPins.Select(a => new MapPinMetrics()).ToArray();
Expand Down
2 changes: 1 addition & 1 deletion PoESplit/PoESplit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<Compile Include="PlayerInformation.cs" />
<Compile Include="CsvExporter.cs" />
<Compile Include="SubtractHalfMultiValueConverter.cs" />
<Compile Include="TimeTracker.cs" />
<Compile Include="MetricsTracker.cs" />
<Page Include="DebugWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down

0 comments on commit b57399b

Please sign in to comment.