Initial work on the stat review dialog.

actorid
Jan Borsodi 14 years ago
parent c45811770a
commit 1c1d33e723

@ -40,6 +40,7 @@ set(GAMEGUI_HEADER
mwgui/race.hpp mwgui/race.hpp
mwgui/class.hpp mwgui/class.hpp
mwgui/birth.hpp mwgui/birth.hpp
mwgui/review.hpp
mwgui/window_manager.hpp mwgui/window_manager.hpp
mwgui/console.hpp mwgui/console.hpp
) )
@ -52,6 +53,7 @@ set(GAMEGUI
mwgui/race.cpp mwgui/race.cpp
mwgui/birth.cpp mwgui/birth.cpp
mwgui/class.cpp mwgui/class.cpp
mwgui/review.cpp
) )
source_group(apps\\openmw\\mwgui FILES ${GAMEGUI_HEADER} ${GAMEGUI}) source_group(apps\\openmw\\mwgui FILES ${GAMEGUI_HEADER} ${GAMEGUI})

@ -0,0 +1,93 @@
#include "review.hpp"
#include "../mwworld/environment.hpp"
#include "../mwworld/world.hpp"
#include "window_manager.hpp"
#include "widgets.hpp"
#include "components/esm_store/store.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
using namespace MWGui;
using namespace Widgets;
ReviewDialog::ReviewDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
: Layout("openmw_chargen_review_layout.xml")
, environment(environment)
{
// Centre dialog
MyGUI::IntCoord coord = mMainWidget->getCoord();
coord.left = (gameWindowSize.width - coord.width)/2;
coord.top = (gameWindowSize.height - coord.height)/2;
mMainWidget->setCoord(coord);
WindowManager *wm = environment.mWindowManager;
// Setup static stats
StaticTextPtr name, race, klass, sign;
ButtonPtr button;
getWidget(name, "NameText");
name->setCaption("Drizt");
getWidget(button, "NameButton");
button->setCaption(wm->getGameSettingString("sName", ""));
getWidget(race, "RaceText");
race->setCaption("Dark Elf");
getWidget(button, "RaceButton");
button->setCaption(wm->getGameSettingString("sRace", ""));
getWidget(klass, "ClassText");
klass->setCaption("Adventurer");
getWidget(button, "ClassButton");
button->setCaption(wm->getGameSettingString("sClass", ""));
getWidget(sign, "SignText");
sign->setCaption("The Angel");
getWidget(button, "SignButton");
button->setCaption(wm->getGameSettingString("sBirthSign", ""));
// Setup dynamic stats
MWDynamicStatPtr health, magicka, fatigue;
getWidget(health, "Health");
health->setTitle(wm->getGameSettingString("sHealth", ""));
health->setValue(45, 45);
getWidget(magicka, "Magicka");
magicka->setTitle(wm->getGameSettingString("sMagic", ""));
magicka->setValue(50, 50);
getWidget(fatigue, "Fatigue");
fatigue->setTitle(wm->getGameSettingString("sFatigue", ""));
fatigue->setValue(160, 160);
// Setup attributes
MWAttributePtr attribute;
for (int idx = 0; idx < ESM::Attribute::Length; ++idx)
{
getWidget(attribute, std::string("Attribute") + boost::lexical_cast<std::string>(idx));
attribute->setWindowManager(wm);
attribute->setAttributeId(ESM::Attribute::attributeIds[idx]);
attribute->setAttributeValue(MWAttribute::AttributeValue(40, 50));
}
// TODO: These buttons should be managed by a Dialog class
MyGUI::ButtonPtr backButton;
getWidget(backButton, "BackButton");
backButton->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onBackClicked);
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onOkClicked);
}
// widget controls
void ReviewDialog::onOkClicked(MyGUI::Widget* _sender)
{
eventDone();
}
void ReviewDialog::onBackClicked(MyGUI::Widget* _sender)
{
eventBack();
}

@ -0,0 +1,46 @@
#ifndef MWGUI_REVIEW_H
#define MWGUI_REVIEW_H
#include <openengine/gui/layout.hpp>
namespace MWWorld
{
class Environment;
}
/*
This file contains the dialog for reviewing the generated character.
Layout is defined by resources/mygui/openmw_chargen_review_layout.xml.
*/
namespace MWGui
{
using namespace MyGUI;
class ReviewDialog : public OEngine::GUI::Layout
{
public:
ReviewDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize);
// Events
typedef delegates::CDelegate0 EventHandle_Void;
/** Event : Back button clicked.\n
signature : void method()\n
*/
EventHandle_Void eventBack;
/** Event : Dialog finished, OK button clicked.\n
signature : void method()\n
*/
EventHandle_Void eventDone;
protected:
void onOkClicked(MyGUI::Widget* _sender);
void onBackClicked(MyGUI::Widget* _sender);
private:
MWWorld::Environment& environment;
};
}
#endif

@ -4,6 +4,7 @@
#include "race.hpp" #include "race.hpp"
#include "class.hpp" #include "class.hpp"
#include "birth.hpp" #include "birth.hpp"
#include "review.hpp"
#include "../mwmechanics/mechanicsmanager.hpp" #include "../mwmechanics/mechanicsmanager.hpp"
#include "../mwinput/inputmanager.hpp" #include "../mwinput/inputmanager.hpp"
@ -27,6 +28,7 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
, pickClassDialog(nullptr) , pickClassDialog(nullptr)
, createClassDialog(nullptr) , createClassDialog(nullptr)
, birthSignDialog(nullptr) , birthSignDialog(nullptr)
, reviewDialog(nullptr)
, nameChosen(false) , nameChosen(false)
, raceChosen(false) , raceChosen(false)
, classChosen(false) , classChosen(false)
@ -77,6 +79,7 @@ WindowManager::~WindowManager()
delete pickClassDialog; delete pickClassDialog;
delete createClassDialog; delete createClassDialog;
delete birthSignDialog; delete birthSignDialog;
delete reviewDialog;
} }
void WindowManager::updateVisible() void WindowManager::updateVisible()
@ -185,6 +188,17 @@ void WindowManager::updateVisible()
return; return;
} }
if (mode == GM_Review)
{
reviewNext = false;
if (!reviewDialog)
reviewDialog = new ReviewDialog(environment, gui->getViewSize());
reviewDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onReviewDialogDone);
reviewDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onReviewDialogBack);
reviewDialog->setVisible(true);
return;
}
if(mode == GM_Inventory) if(mode == GM_Inventory)
{ {
// Ah, inventory mode. First, compute the effective set of // Ah, inventory mode. First, compute the effective set of
@ -605,3 +619,31 @@ void WindowManager::onBirthSignDialogBack()
environment.mInputManager->setGuiMode(GM_Class); environment.mInputManager->setGuiMode(GM_Class);
} }
void WindowManager::onReviewDialogDone()
{
reviewDialog->eventDone = MWGui::BirthDialog::EventHandle_Void();
if (reviewDialog)
{
reviewDialog->setVisible(false);
//environment.mMechanicsManager->setPlayerBirthsign(reviewDialog->getBirthId());
}
updateCharacterGeneration();
environment.mInputManager->setGuiMode(GM_Game);
}
void WindowManager::onReviewDialogBack()
{
if (reviewDialog)
{
reviewDialog->setVisible(false);
//environment.mMechanicsManager->setPlayerBirthsign(reviewDialog->getBirthId());
}
updateCharacterGeneration();
environment.mInputManager->setGuiMode(GM_Birth);
}

@ -50,6 +50,7 @@ namespace MWGui
class PickClassDialog; class PickClassDialog;
class CreateClassDialog; class CreateClassDialog;
class BirthDialog; class BirthDialog;
class ReviewDialog;
class WindowManager class WindowManager
{ {
@ -72,6 +73,7 @@ namespace MWGui
PickClassDialog *pickClassDialog; PickClassDialog *pickClassDialog;
CreateClassDialog *createClassDialog; CreateClassDialog *createClassDialog;
BirthDialog *birthSignDialog; BirthDialog *birthSignDialog;
ReviewDialog *reviewDialog;
// Which dialogs have been shown, controls back/next/ok buttons // Which dialogs have been shown, controls back/next/ok buttons
bool nameChosen; bool nameChosen;
@ -222,6 +224,10 @@ namespace MWGui
// Character generation: Birth sign dialog // Character generation: Birth sign dialog
void onBirthSignDialogDone(); void onBirthSignDialogDone();
void onBirthSignDialogBack(); void onBirthSignDialogBack();
// Character generation: Review dialog
void onReviewDialogDone();
void onReviewDialogBack();
}; };
} }
#endif #endif

@ -52,6 +52,7 @@ configure_file("${SDIR}/openmw_chargen_select_attribute_layout.xml" "${DDIR}/ope
configure_file("${SDIR}/openmw_chargen_select_skill_layout.xml" "${DDIR}/openmw_chargen_select_skill_layout.xml" COPYONLY) configure_file("${SDIR}/openmw_chargen_select_skill_layout.xml" "${DDIR}/openmw_chargen_select_skill_layout.xml" COPYONLY)
configure_file("${SDIR}/openmw_chargen_class_description_layout.xml" "${DDIR}/openmw_chargen_class_description_layout.xml" COPYONLY) configure_file("${SDIR}/openmw_chargen_class_description_layout.xml" "${DDIR}/openmw_chargen_class_description_layout.xml" COPYONLY)
configure_file("${SDIR}/openmw_chargen_birth_layout.xml" "${DDIR}/openmw_chargen_birth_layout.xml" COPYONLY) configure_file("${SDIR}/openmw_chargen_birth_layout.xml" "${DDIR}/openmw_chargen_birth_layout.xml" COPYONLY)
configure_file("${SDIR}/openmw_chargen_review_layout.xml" "${DDIR}/openmw_chargen_review_layout.xml" COPYONLY)
configure_file("${SDIR}/openmw_inventory_window_layout.xml" "${DDIR}/openmw_inventory_window_layout.xml" COPYONLY) configure_file("${SDIR}/openmw_inventory_window_layout.xml" "${DDIR}/openmw_inventory_window_layout.xml" COPYONLY)
configure_file("${SDIR}/openmw_layers.xml" "${DDIR}/openmw_layers.xml" COPYONLY) configure_file("${SDIR}/openmw_layers.xml" "${DDIR}/openmw_layers.xml" COPYONLY)
configure_file("${SDIR}/openmw_mainmenu_layout.xml" "${DDIR}/openmw_mainmenu_layout.xml" COPYONLY) configure_file("${SDIR}/openmw_mainmenu_layout.xml" "${DDIR}/openmw_mainmenu_layout.xml" COPYONLY)

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Window" skin="MW_Dialog" layer="Windows" position="0 0 520 409" name="_Main">
<!-- Player name, race, class and birth sign-->
<Widget type="Widget" skin="MW_Box" position="8 12 244 126">
<Widget type="Button" skin="MW_Button" position="8 8 64 23" name="NameButton"/>
<Widget type="Button" skin="MW_Button" position="8 37 56 23" name="RaceButton"/>
<Widget type="Button" skin="MW_Button" position="8 66 56 23" name="ClassButton"/>
<Widget type="Button" skin="MW_Button" position="8 95 54 23" name="SignButton"/>
<Widget type="StaticText" skin="SandTextRight" position="100 10 140 18" name="NameText"/>
<Widget type="StaticText" skin="SandTextRight" position="100 39 140 18" name="RaceText"/>
<Widget type="StaticText" skin="SandTextRight" position="100 68 140 18" name="ClassText"/>
<Widget type="StaticText" skin="SandTextRight" position="100 97 140 18" name="SignText"/>
</Widget>
<!-- Player health, magicka and fatigue -->
<Widget type="Widget" skin="MW_Box" position="8 144 244 64">
<Widget type="MWDynamicStat" skin="MW_DynamicStat_Red" position="4 4 236 18" name="Health"/>
<Widget type="MWDynamicStat" skin="MW_DynamicStat_Blue" position="4 22 236 18" name="Magicka"/>
<Widget type="MWDynamicStat" skin="MW_DynamicStat_Green" position="4 40 236 18" name="Fatigue"/>
</Widget>
<!-- Player attributes -->
<Widget type="Widget" skin="MW_Box" position="8 214 244 154">
<Widget type="MWAttribute" skin="MW_StatNameValue" position="4 4 236 18" name="Attribute0" />
<Widget type="MWAttribute" skin="MW_StatNameValue" position="4 22 236 18" name="Attribute1" />
<Widget type="MWAttribute" skin="MW_StatNameValue" position="4 40 236 18" name="Attribute2" />
<Widget type="MWAttribute" skin="MW_StatNameValue" position="4 58 236 18" name="Attribute3" />
<Widget type="MWAttribute" skin="MW_StatNameValue" position="4 76 236 18" name="Attribute4" />
<Widget type="MWAttribute" skin="MW_StatNameValue" position="4 94 236 18" name="Attribute5" />
<Widget type="MWAttribute" skin="MW_StatNameValue" position="4 112 236 18" name="Attribute6" />
<Widget type="MWAttribute" skin="MW_StatNameValue" position="4 130 236 18" name="Attribute7" />
</Widget>
<!-- Player skills, factions, birthsign and reputation -->
<Widget type="Widget" skin="MW_Box" position="258 12 244 356" align="ALIGN_LEFT ALIGN_VSTRETCH" name="Skills">
<Widget type="Widget" skin="" position="4 4 218 346" align="ALIGN_STRETCH" name="SkillClient" />
<Widget type="VScroll" skin="MW_VScroll" position="226 4 14 346" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="SkillScroller" />
</Widget>
<!-- Dialog buttons -->
<Widget type="Button" skin="MW_Button" position="400 372 53 23" name="BackButton">
<Property key="Widget_Caption" value="Back"/>
</Widget>
<Widget type="Button" skin="MW_Button" position="460 372 42 23" name="OKButton">
<Property key="Widget_Caption" value="OK"/>
</Widget>
</Widget>
</MyGUI>
Loading…
Cancel
Save