NpcScreen.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //-----------------------------------------------------------------------------
  2. // NpcScreen.cs
  3. //
  4. // Microsoft XNA Community Game Platform
  5. // Copyright (C) Microsoft Corporation. All rights reserved.
  6. //-----------------------------------------------------------------------------
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Text;
  10. using Microsoft.Xna.Framework;
  11. using Microsoft.Xna.Framework.Graphics;
  12. using Microsoft.Xna.Framework.Content;
  13. using RolePlaying.Data;
  14. namespace RolePlaying
  15. {
  16. /// <summary>
  17. /// Display of conversation dialog between the player and the npc
  18. /// </summary>
  19. abstract class NpcScreen<T> : DialogueScreen where T : Character
  20. {
  21. protected MapEntry<T> mapEntry = null;
  22. protected Character character = null;
  23. /// <summary>
  24. /// Create a new NpcScreen object.
  25. /// </summary>
  26. /// <param name="mapEntry"></param>
  27. public NpcScreen(MapEntry<T> mapEntry) : base()
  28. {
  29. if (mapEntry == null)
  30. {
  31. throw new ArgumentNullException("mapEntry");
  32. }
  33. this.mapEntry = mapEntry;
  34. this.character = mapEntry.Content as Character;
  35. if (this.character == null)
  36. {
  37. throw new ArgumentNullException(
  38. "NpcScreen requires a MapEntry with a character.");
  39. }
  40. TitleText = character.Name;
  41. }
  42. }
  43. }