@ -21,6 +21,8 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
: environment ( environment )
: environment ( environment )
, nameDialog ( nullptr )
, nameDialog ( nullptr )
, raceDialog ( nullptr )
, raceDialog ( nullptr )
, classChoiceDialog ( nullptr )
, generateClassQuestionDialog ( nullptr )
, pickClassDialog ( nullptr )
, pickClassDialog ( nullptr )
, birthSignDialog ( nullptr )
, birthSignDialog ( nullptr )
, nameChosen ( false )
, nameChosen ( false )
@ -67,6 +69,8 @@ WindowManager::~WindowManager()
delete nameDialog ;
delete nameDialog ;
delete raceDialog ;
delete raceDialog ;
delete classChoiceDialog ;
delete generateClassQuestionDialog ;
delete pickClassDialog ;
delete pickClassDialog ;
delete birthSignDialog ;
delete birthSignDialog ;
}
}
@ -129,6 +133,22 @@ void WindowManager::updateVisible()
}
}
if ( mode = = GM_Class )
if ( mode = = GM_Class )
{
if ( classChoiceDialog )
delete classChoiceDialog ;
classChoiceDialog = new ClassChoiceDialog ( environment ) ;
classChoiceDialog - > eventButtonSelected = MyGUI : : newDelegate ( this , & WindowManager : : onClassChoice ) ;
return ;
}
if ( mode = = GM_ClassGenerate )
{
generateClassStep = 0 ;
showClassQuestionDialog ( ) ;
return ;
}
if ( mode = = GM_ClassPick )
{
{
if ( ! pickClassDialog )
if ( ! pickClassDialog )
pickClassDialog = new PickClassDialog ( environment , gui - > getViewSize ( ) ) ;
pickClassDialog = new PickClassDialog ( environment , gui - > getViewSize ( ) ) ;
@ -139,6 +159,13 @@ void WindowManager::updateVisible()
return ;
return ;
}
}
if ( mode = = GM_ClassCreate )
{
CreateClassDialog * ccd = new CreateClassDialog ( environment , gui - > getViewSize ( ) ) ;
ccd - > open ( ) ;
return ;
}
if ( mode = = GM_Birth )
if ( mode = = GM_Birth )
{
{
if ( ! birthSignDialog )
if ( ! birthSignDialog )
@ -317,6 +344,88 @@ void WindowManager::onRaceDialogBack()
environment . mInputManager - > setGuiMode ( GM_Name ) ;
environment . mInputManager - > setGuiMode ( GM_Name ) ;
}
}
void WindowManager : : onClassChoice ( MyGUI : : WidgetPtr , int _index )
{
classChoiceDialog - > setVisible ( false ) ;
// classChoiceDialog = nullptr;
if ( _index = = ClassChoiceDialog : : Class_Generate )
{
environment . mInputManager - > setGuiMode ( GM_ClassGenerate ) ;
}
else if ( _index = = ClassChoiceDialog : : Class_Pick )
{
environment . mInputManager - > setGuiMode ( GM_ClassPick ) ;
}
else if ( _index = = ClassChoiceDialog : : Class_Create )
{
environment . mInputManager - > setGuiMode ( GM_ClassCreate ) ;
}
else if ( _index = = ClassChoiceDialog : : Class_Back )
{
environment . mInputManager - > setGuiMode ( GM_Race ) ;
}
}
void WindowManager : : showClassQuestionDialog ( )
{
if ( ! generateClassQuestionDialog )
generateClassQuestionDialog = new InfoBoxDialog ( environment ) ;
struct Step
{
const char * text ;
const char * buttons [ 3 ] ;
} ;
static boost : : array < Step , 2 > steps = { {
{ " On a clear day you chance upon a strange animal, its legs trapped in a hunter's clawsnare. Judging from the bleeding, it will not survive long. " ,
{ " Use herbs from your pack to put it to sleep? " ,
" Do not interfere in the natural evolution of events, but rather take the opportunity to learn more about a strange animal that you have never seen before? " ,
" Draw your dagger, mercifully endings its life with a single thrust? " }
} ,
{ " Your mother sends you to the market with a list of goods to buy. After you finish you find that by mistake a shopkeeper has given you too much money back in exchange for one of the items. " ,
{ " Return to the store and give the shopkeeper his hard-earned money, explaining to him the mistake? " ,
" Pocket the extra money, knowing that shopkeepers in general tend to overcharge customers anyway? " ,
" Decide to put the extra money to good use and purchase items that would help your family? " }
} ,
} } ;
if ( generateClassStep > steps . size ( ) )
{
environment . mInputManager - > setGuiMode ( GM_Class ) ;
return ;
}
if ( generateClassStep = = steps . size ( ) )
{
// TODO: Show selected class
environment . mInputManager - > setGuiMode ( GM_Review ) ;
return ;
}
InfoBoxDialog : : ButtonList buttons ;
generateClassQuestionDialog - > setText ( steps [ generateClassStep ] . text ) ;
buttons . push_back ( steps [ generateClassStep ] . buttons [ 0 ] ) ;
buttons . push_back ( steps [ generateClassStep ] . buttons [ 1 ] ) ;
buttons . push_back ( steps [ generateClassStep ] . buttons [ 2 ] ) ;
generateClassQuestionDialog - > setButtons ( buttons ) ;
generateClassQuestionDialog - > update ( ) ;
generateClassQuestionDialog - > eventButtonSelected = MyGUI : : newDelegate ( this , & WindowManager : : onClassQuestionChosen ) ;
generateClassQuestionDialog - > setVisible ( true ) ;
}
void WindowManager : : onClassQuestionChosen ( MyGUI : : Widget * _sender , int _index )
{
generateClassQuestionDialog - > setVisible ( false ) ;
if ( _index < 0 | | _index > = 3 )
{
environment . mInputManager - > setGuiMode ( GM_Class ) ;
return ;
}
+ + generateClassStep ;
showClassQuestionDialog ( ) ;
}
void WindowManager : : onPickClassDialogDone ( )
void WindowManager : : onPickClassDialogDone ( )
{
{
pickClassDialog - > eventDone = MWGui : : PickClassDialog : : EventHandle_Void ( ) ;
pickClassDialog - > eventDone = MWGui : : PickClassDialog : : EventHandle_Void ( ) ;
@ -349,7 +458,7 @@ void WindowManager::onPickClassDialogBack()
updateCharacterGeneration ( ) ;
updateCharacterGeneration ( ) ;
environment . mInputManager - > setGuiMode ( GM_ Race ) ;
environment . mInputManager - > setGuiMode ( GM_ Class ) ;
}
}
void WindowManager : : onBirthSignDialogDone ( )
void WindowManager : : onBirthSignDialogDone ( )