CharacterCreation refactoring

celladd
scrawl 10 years ago
parent d00c75d428
commit 7fd1c2c2e2

@ -330,20 +330,7 @@ namespace MWGui
updatePlayerHealth();
//TODO This bit gets repeated a few times; wrap it in a function
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
}
else
{
mCreationStage = CSE_ClassChosen;
}
handleDialogDone(CSE_ClassChosen, GM_Birth);
}
void CharacterCreation::onPickClassDialogBack()
@ -397,19 +384,7 @@ namespace MWGui
mNameDialog = 0;
}
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_NameChosen)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Race);
}
else
{
mCreationStage = CSE_NameChosen;
}
handleDialogDone(CSE_NameChosen, GM_Race);
}
void CharacterCreation::onRaceDialogBack()
@ -456,19 +431,7 @@ namespace MWGui
updatePlayerHealth();
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_RaceChosen)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
}
else
{
mCreationStage = CSE_RaceChosen;
}
handleDialogDone(CSE_RaceChosen, GM_Class);
}
void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
@ -484,15 +447,7 @@ namespace MWGui
updatePlayerHealth();
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage >= CSE_BirthSignChosen)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else
{
mCreationStage = CSE_BirthSignChosen;
}
handleDialogDone(CSE_BirthSignChosen, GM_Review);
}
void CharacterCreation::onBirthSignDialogBack()
@ -543,19 +498,7 @@ namespace MWGui
updatePlayerHealth();
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
}
else
{
mCreationStage = CSE_ClassChosen;
}
handleDialogDone(CSE_ClassChosen, GM_Birth);
}
void CharacterCreation::onCreateClassDialogBack()
@ -711,19 +654,7 @@ namespace MWGui
updatePlayerHealth();
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
}
else
{
mCreationStage = CSE_ClassChosen;
}
handleDialogDone(CSE_ClassChosen, GM_Birth);
}
CharacterCreation::~CharacterCreation()
@ -739,4 +670,20 @@ namespace MWGui
delete mReviewDialog;
}
void CharacterCreation::handleDialogDone(CSE currentStage, int nextMode)
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
if (mCreationStage == CSE_ReviewNext)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
}
else if (mCreationStage >= currentStage)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode((GuiMode)nextMode);
}
else
{
mCreationStage = currentStage;
}
}
}

@ -104,6 +104,8 @@ namespace MWGui
};
CSE mCreationStage; // Which state the character creating is in, controls back/next/ok buttons
void handleDialogDone(CSE currentStage, int nextMode);
};
}

Loading…
Cancel
Save