public void LoadConversation(PlayerMapCharacter player, QuestDialogData questDialogData) { autoDialog = true; this.player = player; foreach (QuestDialogSentenceData sentence in questDialogData.sentences) { if (sentence.characterTalking != player.CharacterID) { this.NPCTriggerID = sentence.characterTalking; break; } } topDialogBox = new DialogBox(new Vector2(GameClass.CurrentGameCamera.Position.X + GameClass.ViewPortBounds.Width / 2, GameClass.CurrentGameCamera.Position.Y + 90)); bottomDialogBox = new DialogBox(new Vector2(GameClass.CurrentGameCamera.Position.X + GameClass.ViewPortBounds.Width / 2, GameClass.CurrentGameCamera.Position.Y + 190)); currentSentenceIndex = 0; currentSentenceOrderID = 0; inputIconTexture = GameClass.LoadTextureData("General/BButton"); inputIconAlpha = 0.0f; inputIconState = InputIconState.Hidden; inputFlashDirection = 0; currentState = DialogManagerState.IdleHidden; topDialogBox.DialogCharacter = NPCTriggerID; topDialogBox.PortraitTexture = GameClass.LoadTextureData("MapCharacters/" + NPCTriggerID.ToString() + "/" + NPCTriggerID.ToString() + "Portrait"); bottomDialogBox.DialogCharacter = player.CharacterID; bottomDialogBox.PortraitTexture = player.PortraitTexture; screenCoverTexture = GameClass.LoadTextureData("Black"); screenCoverAlpha = 0.0f; currentConversation = questDialogData; currentSentenceIndex = 0; currentSentenceOrderID = 0; currentState = DialogManagerState.BeginShowDialog; }
public void LoadConversation(PlayerMapCharacter player, NPCMapCharacter NPCConversationTrigger) { autoDialog = false; this.player = player; this.NPCTriggerID = NPCConversationTrigger.CharacterID; topDialogBox = new DialogBox(new Vector2(GameClass.CurrentGameCamera.Position.X + GameClass.ViewPortBounds.Width / 2, GameClass.CurrentGameCamera.Position.Y + 90)); bottomDialogBox = new DialogBox(new Vector2(GameClass.CurrentGameCamera.Position.X + GameClass.ViewPortBounds.Width / 2, GameClass.CurrentGameCamera.Position.Y + 190)); currentSentenceIndex = 0; currentSentenceOrderID = 0; inputIconTexture = GameClass.LoadTextureData("General/BButton"); inputIconAlpha = 0.0f; inputIconState = InputIconState.Hidden; inputFlashDirection = 0; currentState = DialogManagerState.IdleHidden; player.CurrentAction = MapCharacterAction.Idle; topDialogBox.DialogCharacter = NPCConversationTrigger.CharacterID; topDialogBox.PortraitTexture = NPCConversationTrigger.PortraitTexture; bottomDialogBox.DialogCharacter = player.CharacterID; bottomDialogBox.PortraitTexture = player.PortraitTexture; screenCoverTexture = GameClass.LoadTextureData("Black"); screenCoverAlpha = 0.0f; bool convoTriggered = false; foreach(QuestDialogData dialogData in NPCConversationTrigger.LinkedNPCData.dialog) { if (dialogData.flagsToTrigger != null) { int triggerCount = dialogData.flagsToTrigger.Count; int flagsTriggered = 0; foreach (QuestFlagData flagTriggerRequirement in dialogData.flagsToTrigger) { if (GlobalGameInfo.CheckFlagTrigger(dialogData.flagsToTrigger) == true) { flagsTriggered += 1; } } if (flagsTriggered == triggerCount) { convoTriggered = true; currentConversation = dialogData; break; } } else { convoTriggered = true; currentConversation = dialogData; break; } } if (convoTriggered == false) { throw new Exception("no conversation found."); } else { currentSentenceIndex = 0; currentSentenceOrderID = 0; currentState = DialogManagerState.BeginShowDialog; } }