mirror of
https://github.com/uberhalit/SekiroFpsUnlockAndMore.git
synced 2026-06-13 09:57:55 +00:00
Added stats to status bar display
This commit is contained in:
parent
bc92867063
commit
77a518da3b
3 changed files with 152 additions and 76 deletions
|
|
@ -85,6 +85,33 @@
|
||||||
v1.1.0 - by uberhalit
|
v1.1.0 - by uberhalit
|
||||||
</Hyperlink>
|
</Hyperlink>
|
||||||
</Label>
|
</Label>
|
||||||
|
<StatusBar DockPanel.Dock="Bottom" Margin="-10,0,-10,0" VerticalAlignment="Bottom">
|
||||||
|
<StatusBar.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
</Grid>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</StatusBar.ItemsPanel>
|
||||||
|
|
||||||
|
<StatusBarItem Grid.Column="0">
|
||||||
|
<TextBlock Name="sbDeathCount">
|
||||||
|
<Run Text="Deaths:"/>
|
||||||
|
<Run Text="{Binding Deaths}"/>
|
||||||
|
</TextBlock>
|
||||||
|
</StatusBarItem>
|
||||||
|
<Separator Grid.Column="1" />
|
||||||
|
<StatusBarItem Grid.Column="2">
|
||||||
|
<TextBlock Name="sbKillCount">
|
||||||
|
<Run Text="Kills:"/>
|
||||||
|
<Run Text="{Binding Kills}"/>
|
||||||
|
</TextBlock>
|
||||||
|
</StatusBarItem>
|
||||||
|
</StatusBar>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,8 @@ namespace SekiroFpsUnlockAndMore
|
||||||
internal SettingsService _settingsService;
|
internal SettingsService _settingsService;
|
||||||
internal const string totalKillsFilename = "TotalKillsCounter.txt";
|
internal const string totalKillsFilename = "TotalKillsCounter.txt";
|
||||||
|
|
||||||
|
internal StatViewModel _statViewModel = new StatViewModel();
|
||||||
|
private bool _statLoggingEnabled = false;
|
||||||
internal readonly Timer _statRecordTimer = new Timer();
|
internal readonly Timer _statRecordTimer = new Timer();
|
||||||
internal readonly DispatcherTimer _dispatcherTimerCheck = new DispatcherTimer();
|
internal readonly DispatcherTimer _dispatcherTimerCheck = new DispatcherTimer();
|
||||||
internal bool _running = false;
|
internal bool _running = false;
|
||||||
|
|
@ -48,9 +50,11 @@ namespace SekiroFpsUnlockAndMore
|
||||||
internal bool _retryAccess = true;
|
internal bool _retryAccess = true;
|
||||||
internal RECT _windowRect;
|
internal RECT _windowRect;
|
||||||
|
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
DataContext = _statViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -89,6 +93,7 @@ namespace SekiroFpsUnlockAndMore
|
||||||
|
|
||||||
_statRecordTimer.Elapsed += new ElapsedEventHandler(StatReadTimer);
|
_statRecordTimer.Elapsed += new ElapsedEventHandler(StatReadTimer);
|
||||||
_statRecordTimer.Interval = 1500;
|
_statRecordTimer.Interval = 1500;
|
||||||
|
_statRecordTimer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -699,18 +704,19 @@ namespace SekiroFpsUnlockAndMore
|
||||||
/// </summary
|
/// </summary
|
||||||
private void StatReadTimer(object sender, EventArgs e)
|
private void StatReadTimer(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (_gameAccessHwndStatic == IntPtr.Zero) return;
|
||||||
if (IsValidAddress(_pointer_player_deaths))
|
if (IsValidAddress(_pointer_player_deaths))
|
||||||
{
|
{
|
||||||
int playerDeaths = Read<Int32>(_gameAccessHwndStatic, _pointer_player_deaths);
|
int playerDeaths = Read<Int32>(_gameAccessHwndStatic, _pointer_player_deaths);
|
||||||
//Debug.WriteLine("[STAT]Player deaths: " + playerDeaths);
|
_statViewModel.Deaths = playerDeaths;
|
||||||
LogStatFile(deathCounterFilename, playerDeaths.ToString());
|
if (_statLoggingEnabled) LogStatFile(deathCounterFilename, playerDeaths.ToString());
|
||||||
|
|
||||||
if (IsValidAddress(_pointer_total_kills))
|
if (IsValidAddress(_pointer_total_kills))
|
||||||
{
|
{
|
||||||
int totalKills = Read<Int32>(_gameAccessHwndStatic, _pointer_total_kills);
|
int totalKills = Read<Int32>(_gameAccessHwndStatic, _pointer_total_kills);
|
||||||
totalKills -= playerDeaths; //Since this value seems to track every death, including the player
|
totalKills -= playerDeaths; //Since this value seems to track every death, including the player
|
||||||
//Debug.WriteLine("[STAT]Enemies killed: " + totalKills);
|
_statViewModel.Kills = totalKills;
|
||||||
LogStatFile(totalKillsFilename, totalKills.ToString());
|
if (_statLoggingEnabled) LogStatFile(totalKillsFilename, totalKills.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1067,7 +1073,7 @@ namespace SekiroFpsUnlockAndMore
|
||||||
|
|
||||||
private void CbStatChanged(object sender, RoutedEventArgs e)
|
private void CbStatChanged(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
_statRecordTimer.Enabled = (bool)cbLogStats.IsChecked;
|
_statLoggingEnabled = (bool)cbLogStats.IsChecked;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BPatch_Click(object sender, RoutedEventArgs e)
|
private void BPatch_Click(object sender, RoutedEventArgs e)
|
||||||
|
|
|
||||||
43
SekiroFpsUnlockAndMore/StatViewModel.cs
Normal file
43
SekiroFpsUnlockAndMore/StatViewModel.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SekiroFpsUnlockAndMore
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// For Status bar display
|
||||||
|
/// </summary>
|
||||||
|
class StatViewModel : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
private int _deaths = 0;
|
||||||
|
public int Deaths
|
||||||
|
{
|
||||||
|
get { return _deaths; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_deaths = value;
|
||||||
|
OnPropertyChanged(new PropertyChangedEventArgs("Deaths"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int _kills = 0;
|
||||||
|
public int Kills
|
||||||
|
{
|
||||||
|
get { return _kills; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_kills = value;
|
||||||
|
OnPropertyChanged(new PropertyChangedEventArgs("Kills"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
public void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue