forked from teamnwah/openmw-tes3coop
Initial work on the stat review dialog.
parent
c45811770a
commit
1c1d33e723
@ -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
|
@ -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…
Reference in New Issue