void OnFlavoringOptionPropertyChanged(object sender, PropertyChangedEventArgs e) { // Since the user can select more than one additional flavoring to add to their // cup of coffee, we check all available flavorings and combine the enum values. Flavorings flavorings = Flavorings.None; foreach (OptionViewModel <Flavorings> option in this.AvailableFlavorings) { if (option.IsSelected) { flavorings |= option.GetValue(); } } base.CupOfCoffee.Flavorings = flavorings; }
public override string ToString() { var str = $"{Name}\r\n {Description}\r\n需要等级:{Level}\r\n"; if (!Materials.IsNullOrEmpty()) { str += $"需要材料:{string.Join(",", Materials.Select(m => $"{m.Key}×{m.Value}"))}\r\n"; } if (!Flavorings.IsNullOrEmpty()) { str += $"需要调味料:{string.Join(",", Flavorings.Select(m => $"{m.Key}×{m.Value}"))}\r\n"; } str += $"可提供经验值:{Exp}\r\n特性:{string.Join(",", Attributes)}"; str += $"\r\n可使用【{ExchangeHonor}】兑换"; return(str); }