SignedInGamer.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. namespace Microsoft.Xna.Framework.GamerServices
  2. {
  3. /// <summary>
  4. /// Represents a signed-in gamer.
  5. /// </summary>
  6. public class SignedInGamer : Gamer
  7. {
  8. private static SignedInGamer current;
  9. /// <summary>
  10. /// Gets the current signed-in gamer.
  11. /// </summary>
  12. public static SignedInGamer Current
  13. {
  14. get
  15. {
  16. if (current == null)
  17. {
  18. current = new SignedInGamer();
  19. current.SetGamertag(Environment.UserName);
  20. }
  21. return current;
  22. }
  23. internal set => current = value;
  24. }
  25. private string gamertag;
  26. /// <summary>
  27. /// Gets or sets the gamertag for this gamer.
  28. /// </summary>
  29. public override string Gamertag
  30. {
  31. get => gamertag;
  32. }
  33. /// <summary>
  34. /// Sets the gamertag for this gamer.
  35. /// </summary>
  36. internal void SetGamertag(string value)
  37. {
  38. gamertag = value;
  39. }
  40. /// <summary>
  41. /// Gets whether this gamer is signed in to a live service.
  42. /// </summary>
  43. public bool IsSignedInToLive => false; // Mock implementation
  44. /// <summary>
  45. /// Gets whether this gamer is a guest.
  46. /// </summary>
  47. public bool IsGuest => false;
  48. /// <summary>
  49. /// Gets the display name for this gamer.
  50. /// </summary>
  51. public new string DisplayName => Gamertag;
  52. /// <summary>
  53. /// Gets the presence information for this gamer.
  54. /// </summary>
  55. public GamerPresence Presence { get; } = new GamerPresence();
  56. /// <summary>
  57. /// Gets the player index for this gamer.
  58. /// </summary>
  59. public PlayerIndex PlayerIndex { get; internal set; } = PlayerIndex.One;
  60. internal SignedInGamer() { }
  61. public GamerPrivileges Privileges
  62. {
  63. get;
  64. private set;
  65. }
  66. }
  67. }