Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Use GetInfo method instead of GetComponent #55

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void ChangeName(Player player, string newName)
return;
}

PlayerInfo playerInfo = player.GetComponent<AccountComponent>().PlayerInfo;
PlayerInfo playerInfo = player.GetInfo();
string oldName = playerInfo.Name;
Result result = playerInfo.SetName(newName);
if (result.IsFailed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async void ShowPasswordDialog(Player player)

private void ChangePassword(Player player, string enteredPassword)
{
PlayerInfo playerInfo = player.GetComponent<AccountComponent>().PlayerInfo;
PlayerInfo playerInfo = player.GetInfo();
Result result = playerInfo.SetPassword(enteredPassword);
if (result.IsFailed)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class PlayerStatsSystem(IDialogService dialogService) : ISystem
[PlayerCommand("stats")]
public void ShowStats(Player player)
{
PlayerInfo playerInfo = player.GetComponent<AccountComponent>().PlayerInfo;
PlayerInfo playerInfo = player.GetInfo();
var content =
$"""
Kills for Round: {playerInfo.StatsPerRound.Kills}
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Players/PlayerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void OnPlayerDeath(Player player, Player killer, Weapon reason)
if (killer.IsInvalidPlayer())
return;

PlayerInfo killerInfo = killer.GetComponent<AccountComponent>().PlayerInfo;
PlayerInfo killerInfo = killer.GetInfo();
killerInfo.StatsPerRound.AddKills();
killerInfo.AddTotalKills();
playerRepository.UpdateTotalKills(killerInfo);
Expand Down
Loading