Skip to content

Commit

Permalink
Ctrl+Rでチュートリアルやり直し可能
Browse files Browse the repository at this point in the history
  • Loading branch information
sashi0034 committed Nov 21, 2023
1 parent 349c73c commit fa9d165
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions Sukuu/Sukuu/GamesSupervisor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ struct Sukuu::GamesSupervisor::Impl
tutorial:
tutorialLoop(yield, self);
title:
titleLoop(yield, self);
if (const bool retryTutorial = titleLoop(yield, self)) goto tutorial;
play:
if (const bool cleared = playLoop(yield, self)) goto ending;
if (const bool clearedPlay = playLoop(yield, self)) goto ending;
goto title;
ending:
endingLoop(yield, self);
Expand All @@ -76,11 +76,11 @@ struct Sukuu::GamesSupervisor::Impl
tutorial.Init();
yield.WaitForTrue([&]() { return tutorial.IsFinished(); });
tutorial.Kill();

SaveSavedata(m_savedata);
yield();
}

void titleLoop(YieldExtended& yield, ActorView self) const
bool titleLoop(YieldExtended& yield, ActorView self) const
{
auto title = self.AsParent().Birth(Title::TitleScene());
title.Init(m_savedata);
Expand All @@ -89,9 +89,25 @@ struct Sukuu::GamesSupervisor::Impl
// 遊んだ後なら死に戻り演出
title.PerformReincarnate();
}
yield.WaitForTrue([&]() { return title.IsConcluded(); });
yield.WaitForTrue([&]()
{
return dialogRetryTutorial() || title.IsConcluded();
});
const bool retryTutorial = not title.IsConcluded();
title.Kill();
yield();
return retryTutorial;;
}

static bool dialogRetryTutorial()
{
if (KeyLControl.pressed() && KeyR.down())
{
const bool yes =
System::MessageBoxYesNo(U"もう一度チュートリアルをしますか?", MessageBoxStyle::Question) == MessageBoxResult::Yes;
return yes;
}
return false;
}

bool playLoop(YieldExtended& yield, ActorView self)
Expand Down

0 comments on commit fa9d165

Please sign in to comment.