cs1 improvements

This commit is contained in:
renspastoor
2025-06-12 11:57:48 +02:00
parent 1086760c4a
commit 3d69c8b93d
21 changed files with 278 additions and 261 deletions

View File

@@ -59,7 +59,7 @@ namespace PoloClubApp {
/// </summary>
/// <returns>True if assigned, false otherwise.</returns>
public bool IsAssigned(){
return !string.IsNullOrEmpty(PlayerName);
return !string.IsNullOrEmpty(PlayerName);
}
/// <summary>
@@ -68,17 +68,16 @@ namespace PoloClubApp {
/// <param name="playerName">Name of the player to assign to.</param>
/// <param name="waterResistanceMeters">Water resistance for wearables (nullable).</param>
/// <exception cref="Exception">Throws when assignment fails.</exception>
public void AssignDevice(string playerName, int? waterResistanceMeters)
{
if (IsAssigned())
public void AssignDevice(string playerName, int? waterResistanceMeters){
if (IsAssigned()){
throw new Exception("Device is already assigned");
if (this is IWearable && waterResistanceMeters < 3)
}
if (this is IWearable && waterResistanceMeters < 3){
throw new Exception("Water resistance must be 3 meters or more for wearables");
if (Id == 0)
}
if (Id == 0){
throw new Exception("Invalid device ID");
}
PlayerName = playerName;
}
@@ -87,11 +86,11 @@ namespace PoloClubApp {
/// </summary>
/// <returns>True if successful, false if device wasn't assigned.</returns>
public bool ReturnDevice(){
if (!IsAssigned())
return false;
PlayerName = null;
return true;
if (!IsAssigned()){
return false;
}
PlayerName = null;
return true;
}
}
}