SharedTelephoneSystem.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System.Linq;
  2. namespace Content.Shared.Telephone;
  3. public abstract class SharedTelephoneSystem : EntitySystem
  4. {
  5. public bool IsTelephoneEngaged(Entity<TelephoneComponent> entity)
  6. {
  7. return entity.Comp.LinkedTelephones.Any();
  8. }
  9. public string GetFormattedCallerIdForEntity(string? presumedName, string? presumedJob, Color fontColor, string fontType = "Default", int fontSize = 12)
  10. {
  11. var callerId = Loc.GetString("chat-telephone-unknown-caller",
  12. ("color", fontColor),
  13. ("fontType", fontType),
  14. ("fontSize", fontSize));
  15. if (presumedName == null)
  16. return callerId;
  17. if (presumedJob != null)
  18. callerId = Loc.GetString("chat-telephone-caller-id-with-job",
  19. ("callerName", presumedName),
  20. ("callerJob", presumedJob),
  21. ("color", fontColor),
  22. ("fontType", fontType),
  23. ("fontSize", fontSize));
  24. else
  25. callerId = Loc.GetString("chat-telephone-caller-id-without-job",
  26. ("callerName", presumedName),
  27. ("color", fontColor),
  28. ("fontType", fontType),
  29. ("fontSize", fontSize));
  30. return callerId;
  31. }
  32. public string GetFormattedDeviceIdForEntity(string? deviceName, Color fontColor, string fontType = "Default", int fontSize = 12)
  33. {
  34. if (deviceName == null)
  35. {
  36. return Loc.GetString("chat-telephone-unknown-device",
  37. ("color", fontColor),
  38. ("fontType", fontType),
  39. ("fontSize", fontSize));
  40. }
  41. return Loc.GetString("chat-telephone-device-id",
  42. ("deviceName", deviceName),
  43. ("color", fontColor),
  44. ("fontType", fontType),
  45. ("fontSize", fontSize));
  46. }
  47. }