From db50617371b180398fe2c8b2d33aedde97f08af8 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Mon, 29 Jul 2024 11:31:08 -0400 Subject: [PATCH] Add dialog loading function to call and trigger Dialog game state. Add Artificer Introduction tutorial task. --- Adventures in Lestoria/Adventures in Lestoria.vcxproj | 1 + .../Adventures in Lestoria.vcxproj.filters | 3 +++ Adventures in Lestoria/NPC.cpp | 6 +++++- Adventures in Lestoria/Tutorial.cpp | 1 + Adventures in Lestoria/Tutorial.h | 11 +++++++++++ Adventures in Lestoria/VisualNovel.cpp | 11 +++++++++++ Adventures in Lestoria/VisualNovel.h | 1 + 7 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj index 610ab9f7..24280b05 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj @@ -1169,6 +1169,7 @@ + diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters index 1339d862..490bce68 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters @@ -1343,6 +1343,9 @@ Documentation\Mechanics + + Configurations\Story + diff --git a/Adventures in Lestoria/NPC.cpp b/Adventures in Lestoria/NPC.cpp index cebb79ed..9f2149f4 100644 --- a/Adventures in Lestoria/NPC.cpp +++ b/Adventures in Lestoria/NPC.cpp @@ -45,6 +45,7 @@ All rights reserved. #include "RowInventoryScrollableWindowComponent.h" #include "InventoryCreator.h" #include "Tutorial.h" +#include "VisualNovel.h" using A=Attribute; @@ -85,7 +86,10 @@ void Monster::STRATEGY::NPC(Monster&m,float fElapsedTime,std::string strategy){ Menu::OpenMenu(MenuType::MERCHANT); }else if(m.npcData.function=="Artificer"){ - Menu::OpenMenu(MenuType::MERCHANT); + if(!Tutorial::TaskIsComplete(TutorialTaskName::ARTIFICER_INTRO)){ + Tutorial::CompleteTask(TutorialTaskName::ARTIFICER_INTRO); + VisualNovel::LoadDialog("ARTIFICER_INTRO"); + } } } }else{ diff --git a/Adventures in Lestoria/Tutorial.cpp b/Adventures in Lestoria/Tutorial.cpp index cffe40b5..b5e0a21b 100644 --- a/Adventures in Lestoria/Tutorial.cpp +++ b/Adventures in Lestoria/Tutorial.cpp @@ -51,6 +51,7 @@ void Tutorial::Initialize(){ CREATETASK(TutorialTaskName::USE_RECOVERY_ITEMS,UseRecoveryItemsTask); CREATETASK(TutorialTaskName::BLACKSMITH,BlacksmithTask); CREATETASK(TutorialTaskName::EQUIP_GEAR,EquipGearTask); + CREATETASK(TutorialTaskName::ARTIFICER_INTRO,ArtificerIntroductionTask); currentTaskState=TutorialTaskName::SET_LOADOUT_ITEM; ResetTasks(); } diff --git a/Adventures in Lestoria/Tutorial.h b/Adventures in Lestoria/Tutorial.h index 6a885d02..e905f3a1 100644 --- a/Adventures in Lestoria/Tutorial.h +++ b/Adventures in Lestoria/Tutorial.h @@ -63,6 +63,7 @@ enum class TutorialTaskName{ USE_RECOVERY_ITEMS, BLACKSMITH, EQUIP_GEAR, + ARTIFICER_INTRO, NONE, }; @@ -355,4 +356,14 @@ private: startGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"to equip your new gear.",255,InputType::KEY,{0.85f,1.f},"Open the #FFCF0CCharacter#FFFFFF menu with "); } } +}; + +class ArtificerIntroductionTask:public TutorialTask{ +public: + inline ArtificerIntroductionTask():TutorialTask(){}; +private: + virtual inline bool CompleteCondition()override final{ + return false; + } + virtual inline void OnComplete()override final{} }; \ No newline at end of file diff --git a/Adventures in Lestoria/VisualNovel.cpp b/Adventures in Lestoria/VisualNovel.cpp index f563a7e2..d8aaf29d 100644 --- a/Adventures in Lestoria/VisualNovel.cpp +++ b/Adventures in Lestoria/VisualNovel.cpp @@ -192,6 +192,17 @@ void VisualNovel::Reset(){ commands.clear(); commandIndex=0; } +void VisualNovel::LoadDialog(std::string dialogName){ + novel.storyLevel=dialogName; + novel.Reset(); + for(std::unique_ptr&command:storyLevelData.at(dialogName)){ + novel.commands.push_back(command.get()); + } + GameState::ChangeState(States::DIALOG); + novel.ExecuteNextCommand(); + novel.prevTheme=Menu::GetCurrentTheme().GetThemeName(); + Menu::themeSelection="Purple"; +} void VisualNovel::LoadVisualNovel(std::string storyLevelName){ novel.storyLevel=storyLevelName; novel.Reset(); diff --git a/Adventures in Lestoria/VisualNovel.h b/Adventures in Lestoria/VisualNovel.h index a8334045..b8d92c8a 100644 --- a/Adventures in Lestoria/VisualNovel.h +++ b/Adventures in Lestoria/VisualNovel.h @@ -187,6 +187,7 @@ public: VisualNovel(VisualNovel&)=delete; VisualNovel(VisualNovel&&)=delete; static void Initialize(); + static void LoadDialog(std::string dialogName); static void LoadVisualNovel(std::string storyLevelName); void ExecuteNextCommand(); void Update();