Slip- und Beschuldigungslogik überarbeitet
All checks were successful
Build / build (push) Successful in 2m19s
All checks were successful
Build / build (push) Successful in 2m19s
Slips werden jetzt 30 Sekunden vorgehalten und anschließend automatisch abgeschlossen; direkte Spieler-Beschuldigungen, Win-Status, SignalR-Events, MAUI-UI, EF-Mapping/Migrationen sowie Tests wurden an die neue Spiellogik angepasst.
This commit is contained in:
@@ -10,6 +10,8 @@ public class GameStateDto
|
||||
public int HostUserId { get; set; }
|
||||
public int CurrentRound { get; set; }
|
||||
public int RoundTimeRemaining { get; set; }
|
||||
public int? WinnerPlayerId { get; set; }
|
||||
public string? WinnerUsername { get; set; }
|
||||
}
|
||||
|
||||
public class PlayerInfoDto
|
||||
@@ -29,12 +31,55 @@ public class PlayerHandDto
|
||||
public List<PlayerCardDto> Cards { get; set; } = [];
|
||||
}
|
||||
|
||||
public class PlayerCardDto
|
||||
public class PlayerCardDto : System.ComponentModel.INotifyPropertyChanged
|
||||
{
|
||||
private bool _isUsed;
|
||||
private DateTime? _slippedAt;
|
||||
private int _slippedHoldSecondsRemaining;
|
||||
|
||||
public event System.ComponentModel.PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
public int CardId { get; set; }
|
||||
public int PhraseId { get; set; }
|
||||
public string Text { get; set; } = string.Empty;
|
||||
public bool IsUsed { get; set; }
|
||||
|
||||
public bool IsUsed
|
||||
{
|
||||
get => _isUsed;
|
||||
set { _isUsed = value; NotifyStateChanged(); }
|
||||
}
|
||||
|
||||
public DateTime? SlippedAt
|
||||
{
|
||||
get => _slippedAt;
|
||||
set { _slippedAt = value; NotifyStateChanged(); }
|
||||
}
|
||||
|
||||
public int SlippedHoldSecondsRemaining
|
||||
{
|
||||
get => _slippedHoldSecondsRemaining;
|
||||
set
|
||||
{
|
||||
_slippedHoldSecondsRemaining = value;
|
||||
Raise(nameof(SlippedHoldSecondsRemaining));
|
||||
Raise(nameof(SlipButtonText));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsPendingSlip => SlippedAt.HasValue && !IsUsed;
|
||||
public bool CanSlip => !IsPendingSlip && !IsUsed;
|
||||
public string SlipButtonText => IsPendingSlip ? $"Vorgehalten ({SlippedHoldSecondsRemaining}s)" : "Slip";
|
||||
|
||||
private void NotifyStateChanged()
|
||||
{
|
||||
Raise(nameof(IsUsed));
|
||||
Raise(nameof(SlippedAt));
|
||||
Raise(nameof(IsPendingSlip));
|
||||
Raise(nameof(CanSlip));
|
||||
Raise(nameof(SlipButtonText));
|
||||
}
|
||||
|
||||
private void Raise(string name) => PropertyChanged?.Invoke(this, new(name));
|
||||
}
|
||||
|
||||
public class SlipChallengeDto
|
||||
@@ -43,7 +88,8 @@ public class SlipChallengeDto
|
||||
public int ChallengingPlayerId { get; set; }
|
||||
public string ChallengingPlayerName { get; set; } = string.Empty;
|
||||
public int TargetPlayerId { get; set; }
|
||||
public int TargetCardId { get; set; }
|
||||
public string TargetPlayerName { get; set; } = string.Empty;
|
||||
public int? TargetCardId { get; set; }
|
||||
public string Status { get; set; } = string.Empty;
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user