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.
96 lines
2.9 KiB
C#
96 lines
2.9 KiB
C#
namespace SlipItIn.Shared.DTOs;
|
|
|
|
public class GameStateDto
|
|
{
|
|
public int GameId { get; set; }
|
|
public string LobbyCode { get; set; } = string.Empty;
|
|
public string Status { get; set; } = string.Empty;
|
|
public List<PlayerInfoDto> Players { get; set; } = [];
|
|
// Host user id to let clients determine whether the current user is the host
|
|
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
|
|
{
|
|
// Öffentliche Daten (für alle sichtbar)
|
|
public int PlayerId { get; set; }
|
|
public string Username { get; set; } = string.Empty;
|
|
public int Score { get; set; }
|
|
public bool IsReady { get; set; }
|
|
public int CardCount { get; set; } // Anzahl der Karten (nicht die Karten selbst!)
|
|
}
|
|
|
|
public class PlayerHandDto
|
|
{
|
|
// Private Daten (nur für den Spieler selbst)
|
|
public int PlayerId { get; set; }
|
|
public List<PlayerCardDto> Cards { get; set; } = [];
|
|
}
|
|
|
|
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 => _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
|
|
{
|
|
public int ChallengeId { get; set; }
|
|
public int ChallengingPlayerId { get; set; }
|
|
public string ChallengingPlayerName { get; set; } = string.Empty;
|
|
public int TargetPlayerId { 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; }
|
|
}
|