| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- //-----------------------------------------------------------------------------
- // QuestNpcScreen.cs
- //
- // Microsoft XNA Community Game Platform
- // Copyright (C) Microsoft Corporation. All rights reserved.
- //-----------------------------------------------------------------------------
- using System;
- using RolePlaying.Data;
- namespace RolePlaying
- {
- class QuestNpcScreen : NpcScreen<QuestNpc>
- {
- /// <summary>
- /// Constructs a new QuestNpcScreen object.
- /// </summary>
- /// <param name="mapEntry">The map entry for the quest NPC.</param>
- public QuestNpcScreen(MapEntry<QuestNpc> mapEntry)
- : base(mapEntry)
- {
- // assign and check the parameter
- QuestNpc questNpc = character as QuestNpc;
- if (questNpc == null)
- {
- throw new ArgumentException(
- "QuestNpcScreen requires a MapEntry with a QuestNpc");
- }
- // check to see if this is NPC is the current quest destination
- if ((Session.Quest != null) &&
- (Session.Quest.Stage == Quest.QuestStage.RequirementsMet) &&
- TileEngine.Map.AssetName.EndsWith(
- Session.Quest.DestinationMapContentName) &&
- (Session.Quest.DestinationNpcContentName == mapEntry.ContentName))
- {
- // use the quest completion dialog
- this.DialogueText = Session.Quest.CompletionMessage;
- // mark the quest for completion
- // -- the session will not update until the pop-up screens are cleared
- Session.Quest.Stage = Quest.QuestStage.Completed;
- }
- else
- {
- // this NPC is not the destination, so use the npc's welcome text
- this.DialogueText = questNpc.IntroductionDialogue;
- }
- }
- }
- }
|