private void Client_CardPicked(object sender, int e) { AddPopUpMessage($"Új kártya, hátravan még: {e}"); OptionsOrSubEvents.Clear(); Card card = _client.Card; CurrentCardDescription = card.GetDescription(); CurrentCardToolTip = card.ToolTip(); RequiresAttributes = card.RequiresAttributes; var optionsOrSubEvents = card.GetOptionsOrSubEvents(); _isPlayersTurn = false; card.DiceRolled += Card_DiceRolled; if (optionsOrSubEvents == null) { return; } foreach (OptionOrSubEvent item in optionsOrSubEvents) { OptionsOrSubEvents.Add(new OptionOrSubEventViewModel { Description = item.Description, ClickCommand = new DelegateCommand(param => { return(item.Condition(_ship) && !_client.Crashed && !_gameOver && (!card.RequiresOrder || (card.RequiresOrder && _isPlayersTurn))); } , param => item.Action(_client, _ship)) }); } }
private void Client_GameEnded(object sender, EndResultEventArgs e) { StringBuilder resultMessage = new StringBuilder(); for (int i = 0; i < e.Results.Count; ++i) { resultMessage.AppendLine($"{i + 1}. helyezés: {e.Results[i].Item1.GetDescription()}, {e.Results[i].Item2} pénzzel."); } StatusMessage = $"{resultMessage}\n{StatusMessage}"; OptionsOrSubEvents.Clear(); CurrentCardDescription = "Vissza a menübe..."; CurrentCardToolTip = null; SendAttributesCommand = new DelegateCommand(param => { _playerList.UnsubscribeFromEvents(); UnsubscribeFromEvents(); GameEnded?.Invoke(this, EventArgs.Empty); }); OnPropertyChanged(nameof(SendAttributesCommand)); }