StickerInfo.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System.Linq;
  2. using CardCollector.DataBase.Entity;
  3. using CardCollector.Resources;
  4. namespace CardCollector.Others
  5. {
  6. /* Класс-расщирение, который может содержать дополнительную информацию о стикере */
  7. public class StickerInfo : StickerEntity
  8. {
  9. public StickerInfo(StickerEntity entity)
  10. {
  11. Id = entity.Id;
  12. Title = entity.Title;
  13. Author = entity.Author;
  14. IncomeCoins = entity.IncomeCoins;
  15. IncomeGems = entity.IncomeGems;
  16. IncomeTime = entity.IncomeTime;
  17. PriceCoins = entity.PriceCoins;
  18. PriceGems = entity.PriceGems;
  19. Tier = entity.Tier;
  20. Emoji = entity.Emoji;
  21. Description = entity.Description;
  22. Md5Hash = entity.Md5Hash;
  23. }
  24. public int Count = 1;
  25. public int MaxCount;
  26. public TraderInformation TraderInfo = null;
  27. public int GetCoinsPrice()
  28. {
  29. return Count * TraderInfo?.PriceCoins ?? PriceCoins;
  30. }
  31. public int GetGemsPrice()
  32. {
  33. return Count * TraderInfo?.PriceGems ?? PriceGems;
  34. }
  35. public override string ToString()
  36. {
  37. var count = TraderInfo?.Quantity ?? MaxCount;
  38. var str = $"\n{Title} {string.Concat(Enumerable.Repeat(Text.star, Tier))}" +
  39. $"\n{Text.emoji}: {Emoji}" +
  40. $"\n{Text.author}: {Author}" +
  41. $"\n{Text.count}: {(count != -1 ? count : "∞")}" +
  42. $"\n{IncomeCoins}{Text.coin} / {IncomeGems}{Text.gem} {IncomeTime}{Text.time}{Text.minutes}";
  43. if (Description != "") str += $"\n\n{Text.description}: {Description}";
  44. return str;
  45. }
  46. }
  47. }