forked from teamnwah/openmw-tes3coop
Initial work on the Class Create dialog.
This commit is contained in:
parent
283e0df3a0
commit
d97dad7a86
4 changed files with 297 additions and 0 deletions
|
@ -12,6 +12,8 @@
|
|||
|
||||
using namespace MWGui;
|
||||
|
||||
/* PickClassDialog */
|
||||
|
||||
PickClassDialog::PickClassDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
|
||||
: Layout("openmw_chargen_class_layout.xml")
|
||||
, environment(environment)
|
||||
|
@ -221,3 +223,184 @@ void PickClassDialog::updateStats()
|
|||
|
||||
classImage->setImageTexture(std::string("textures\\levelup\\") + currentClassId + ".dds");
|
||||
}
|
||||
|
||||
|
||||
/* CreateClassDialog */
|
||||
|
||||
CreateClassDialog::CreateClassDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
|
||||
: Layout("openmw_chargen_create_class_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;
|
||||
setText("SpecializationT", wm->getGameSettingString("sChooseClassMenu1", "Specialization"));
|
||||
getWidget(specializationName, "SpecializationName");
|
||||
|
||||
setText("FavoriteAttributesT", wm->getGameSettingString("sChooseClassMenu2", "Favorite Attributes:"));
|
||||
getWidget(favoriteAttribute0, "FavoriteAttribute0");
|
||||
getWidget(favoriteAttribute1, "FavoriteAttribute1");
|
||||
favoriteAttribute0->setWindowManager(wm);
|
||||
favoriteAttribute1->setWindowManager(wm);
|
||||
|
||||
setText("MajorSkillT", wm->getGameSettingString("sChooseClassMenu3", "Major Skills:"));
|
||||
getWidget(majorSkill0, "MajorSkill0");
|
||||
getWidget(majorSkill1, "MajorSkill1");
|
||||
getWidget(majorSkill2, "MajorSkill2");
|
||||
getWidget(majorSkill3, "MajorSkill3");
|
||||
getWidget(majorSkill4, "MajorSkill4");
|
||||
majorSkill0->setWindowManager(wm);
|
||||
majorSkill1->setWindowManager(wm);
|
||||
majorSkill2->setWindowManager(wm);
|
||||
majorSkill3->setWindowManager(wm);
|
||||
majorSkill4->setWindowManager(wm);
|
||||
|
||||
setText("MinorSkillT", wm->getGameSettingString("sChooseClassMenu4", "Minor Skills:"));
|
||||
getWidget(minorSkill0, "MinorSkill0");
|
||||
getWidget(minorSkill1, "MinorSkill1");
|
||||
getWidget(minorSkill2, "MinorSkill2");
|
||||
getWidget(minorSkill3, "MinorSkill3");
|
||||
getWidget(minorSkill4, "MinorSkill4");
|
||||
minorSkill0->setWindowManager(wm);
|
||||
minorSkill1->setWindowManager(wm);
|
||||
minorSkill2->setWindowManager(wm);
|
||||
minorSkill3->setWindowManager(wm);
|
||||
minorSkill4->setWindowManager(wm);
|
||||
|
||||
setText("LabelT", wm->getGameSettingString("sName", ""));
|
||||
getWidget(editName, "EditName");
|
||||
|
||||
// TODO: These buttons should be managed by a Dialog class
|
||||
MyGUI::ButtonPtr descriptionButton;
|
||||
getWidget(descriptionButton, "DescriptionButton");
|
||||
descriptionButton->eventMouseButtonClick = MyGUI::newDelegate(this, &CreateClassDialog::onDescriptionClicked);
|
||||
|
||||
MyGUI::ButtonPtr backButton;
|
||||
getWidget(backButton, "BackButton");
|
||||
backButton->eventMouseButtonClick = MyGUI::newDelegate(this, &CreateClassDialog::onBackClicked);
|
||||
|
||||
MyGUI::ButtonPtr okButton;
|
||||
getWidget(okButton, "OKButton");
|
||||
okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &CreateClassDialog::onOkClicked);
|
||||
|
||||
updateStats();
|
||||
}
|
||||
|
||||
void CreateClassDialog::setNextButtonShow(bool shown)
|
||||
{
|
||||
MyGUI::ButtonPtr descriptionButton;
|
||||
getWidget(descriptionButton, "DescriptionButton");
|
||||
|
||||
MyGUI::ButtonPtr backButton;
|
||||
getWidget(backButton, "BackButton");
|
||||
|
||||
MyGUI::ButtonPtr okButton;
|
||||
getWidget(okButton, "OKButton");
|
||||
|
||||
// TODO: All hardcoded coords for buttons are temporary, will be replaced with a dynamic system.
|
||||
if (shown)
|
||||
{
|
||||
okButton->setCaption("Next");
|
||||
|
||||
// Adjust back button when next is shown
|
||||
descriptionButton->setCoord(MyGUI::IntCoord(207 - 18, 158, 143, 23));
|
||||
backButton->setCoord(MyGUI::IntCoord(356 - 18, 158, 53, 23));
|
||||
okButton->setCoord(MyGUI::IntCoord(417 - 18, 158, 42 + 18, 23));
|
||||
}
|
||||
else
|
||||
{
|
||||
okButton->setCaption("OK");
|
||||
descriptionButton->setCoord(MyGUI::IntCoord(207, 158, 143, 23));
|
||||
backButton->setCoord(MyGUI::IntCoord(356, 158, 53, 23));
|
||||
okButton->setCoord(MyGUI::IntCoord(417, 158, 42, 23));
|
||||
}
|
||||
}
|
||||
|
||||
void CreateClassDialog::open()
|
||||
{
|
||||
updateStats();
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
//void CreateClassDialog::setClassId(const std::string &classId)
|
||||
//{
|
||||
// currentClassId = classId;
|
||||
// classList->setIndexSelected(MyGUI::ITEM_NONE);
|
||||
// size_t count = classList->getItemCount();
|
||||
// for (size_t i = 0; i < count; ++i)
|
||||
// {
|
||||
// if (boost::iequals(*classList->getItemDataAt<std::string>(i), classId))
|
||||
// {
|
||||
// classList->setIndexSelected(i);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// updateStats();
|
||||
//}
|
||||
|
||||
// widget controls
|
||||
|
||||
void CreateClassDialog::onDescriptionClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
// TODO: Show description dialog
|
||||
}
|
||||
|
||||
void CreateClassDialog::onOkClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
eventDone();
|
||||
}
|
||||
|
||||
void CreateClassDialog::onBackClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
eventBack();
|
||||
}
|
||||
|
||||
// update widget content
|
||||
|
||||
void CreateClassDialog::updateStats()
|
||||
{
|
||||
if (currentClassId.empty())
|
||||
return;
|
||||
WindowManager *wm = environment.mWindowManager;
|
||||
ESMS::ESMStore &store = environment.mWorld->getStore();
|
||||
const ESM::Class *klass = store.classes.find(currentClassId);
|
||||
|
||||
ESM::Class::Specialization specialization = static_cast<ESM::Class::Specialization>(klass->data.specialization);
|
||||
|
||||
static const char *specIds[3] = {
|
||||
"sSpecializationCombat",
|
||||
"sSpecializationMagic",
|
||||
"sSpecializationStealth"
|
||||
};
|
||||
specializationName->setCaption(wm->getGameSettingString(specIds[specialization], specIds[specialization]));
|
||||
|
||||
favoriteAttribute0->setAttributeId(klass->data.attribute[0]);
|
||||
favoriteAttribute1->setAttributeId(klass->data.attribute[1]);
|
||||
|
||||
Widgets::MWSkillPtr majorSkills[5] = {
|
||||
majorSkill0,
|
||||
majorSkill1,
|
||||
majorSkill2,
|
||||
majorSkill3,
|
||||
majorSkill4
|
||||
};
|
||||
Widgets::MWSkillPtr minorSkills[5] = {
|
||||
minorSkill0,
|
||||
minorSkill1,
|
||||
minorSkill2,
|
||||
minorSkill3,
|
||||
minorSkill4
|
||||
};
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
majorSkills[i]->setSkillNumber(klass->data.skills[i][0]);
|
||||
minorSkills[i]->setSkillNumber(klass->data.skills[i][1]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,5 +68,48 @@ namespace MWGui
|
|||
|
||||
std::string currentClassId;
|
||||
};
|
||||
|
||||
class CreateClassDialog : public OEngine::GUI::Layout
|
||||
{
|
||||
public:
|
||||
CreateClassDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize);
|
||||
|
||||
// const std::string &getClassId() const { return currentClassId; }
|
||||
// void setClassId(const std::string &classId);
|
||||
|
||||
void setNextButtonShow(bool shown);
|
||||
void open();
|
||||
|
||||
// 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 onDescriptionClicked(MyGUI::Widget* _sender);
|
||||
void onOkClicked(MyGUI::Widget* _sender);
|
||||
void onBackClicked(MyGUI::Widget* _sender);
|
||||
|
||||
private:
|
||||
void updateStats();
|
||||
|
||||
MWWorld::Environment& environment;
|
||||
|
||||
MyGUI::EditPtr editName;
|
||||
MyGUI::StaticTextPtr specializationName;
|
||||
Widgets::MWAttributePtr favoriteAttribute0, favoriteAttribute1;
|
||||
Widgets::MWSkillPtr majorSkill0, majorSkill1, majorSkill2, majorSkill3, majorSkill4;
|
||||
Widgets::MWSkillPtr minorSkill0, minorSkill1, minorSkill2, minorSkill3, minorSkill4;
|
||||
|
||||
std::string currentClassId;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
1
extern/mygui_3.0.1/CMakeLists.txt
vendored
1
extern/mygui_3.0.1/CMakeLists.txt
vendored
|
@ -44,6 +44,7 @@ configure_file("${SDIR}/openmw_hud_layout.xml" "${DDIR}/openmw_hud_layout.xml" C
|
|||
configure_file("${SDIR}/openmw_text_input_layout.xml" "${DDIR}/openmw_text_input_layout.xml" COPYONLY)
|
||||
configure_file("${SDIR}/openmw_chargen_race_layout.xml" "${DDIR}/openmw_chargen_race_layout.xml" COPYONLY)
|
||||
configure_file("${SDIR}/openmw_chargen_class_layout.xml" "${DDIR}/openmw_chargen_class_layout.xml" COPYONLY)
|
||||
configure_file("${SDIR}/openmw_chargen_create_class_layout.xml" "${DDIR}/openmw_chargen_create_class_layout.xml" COPYONLY)
|
||||
configure_file("${SDIR}/openmw_chargen_birth_layout.xml" "${DDIR}/openmw_chargen_birth_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)
|
||||
|
|
70
extern/mygui_3.0.1/openmw_resources/openmw_chargen_create_class_layout.xml
vendored
Normal file
70
extern/mygui_3.0.1/openmw_resources/openmw_chargen_create_class_layout.xml
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MyGUI type="Layout">
|
||||
<!-- correct size is 474 192, adjust when skin is changed to a dialog -->
|
||||
<Widget type="Window" skin="MW_Window" layer="Windows" position="0 0 482 220" name="_Main">
|
||||
<!-- content, used to adjust offsets while the window skin is used -->
|
||||
<Widget type="Widget" skin="" position="0 0 474 192" align="ALIGN_STRETCH">
|
||||
|
||||
<!-- Class name -->
|
||||
<Widget type="StaticText" skin="ProgressText" position="12 12 48 30" name="LabelT" align="ALIGN_LEFT ALIGN_TOP">
|
||||
<Property key="Widget_Caption" value="Name"/>
|
||||
<Property key="Widget_AlignText" value="ALIGN_LEFT ALIGN_VCENTRE"/>
|
||||
</Widget>
|
||||
<Widget type="Edit" skin="MW_TextEdit" position="62 12 250 30" name="EditName" align="ALIGN_HSTRETCH ALIGN_TOP"/>
|
||||
|
||||
<Widget type="Widget" skin="" position="12 46 480 110" align="ALIGN_STRETCH">
|
||||
|
||||
<!-- Specialization -->
|
||||
<Widget type="StaticText" skin="HeaderText" position="0 0 156 18" name="SpecializationT" align="ALIGN_LEFT ALIGN_TOP">
|
||||
<Property key="Widget_Caption" value="Specialization:"/>
|
||||
<Property key="Widget_AlignText" value="ALIGN_LEFT ALIGN_TOP"/>
|
||||
</Widget>
|
||||
<Widget type="StaticText" skin="SandText" position="0 18 156 18" name="SpecializationName" align="ALIGN_LEFT ALIGN_TOP">
|
||||
<Property key="Widget_AlignText" value="ALIGN_LEFT ALIGN_TOP"/>
|
||||
</Widget>
|
||||
|
||||
<!-- Favorite Attributes -->
|
||||
<Widget type="StaticText" skin="HeaderText" position="0 41 156 18" name="FavoriteAttributesT" align="ALIGN_LEFT ALIGN_TOP">
|
||||
<Property key="Widget_Caption" value="Favorite Attributes:"/>
|
||||
<Property key="Widget_AlignText" value="ALIGN_LEFT ALIGN_TOP"/>
|
||||
</Widget>
|
||||
<Widget type="MWAttribute" skin="MW_StatName" position="0 59 156 18" name="FavoriteAttribute0" align="ALIGN_LEFT ALIGN_TOP" />
|
||||
<Widget type="MWAttribute" skin="MW_StatName" position="0 77 156 18" name="FavoriteAttribute1" align="ALIGN_LEFT ALIGN_TOP" />
|
||||
|
||||
<!-- Major Skills -->
|
||||
<Widget type="StaticText" skin="HeaderText" position="156 0 158 18" name="MajorSkillT" align="ALIGN_LEFT ALIGN_TOP">
|
||||
<Property key="Widget_Caption" value="Major Skills:"/>
|
||||
<Property key="Widget_AlignText" value="ALIGN_LEFT ALIGN_TOP"/>
|
||||
</Widget>
|
||||
<Widget type="MWSkill" skin="MW_StatName" position="156 18 158 18" name="MajorSkill0" align="ALIGN_LEFT ALIGN_TOP" />
|
||||
<Widget type="MWSkill" skin="MW_StatName" position="156 36 158 18" name="MajorSkill1" align="ALIGN_LEFT ALIGN_TOP" />
|
||||
<Widget type="MWSkill" skin="MW_StatName" position="156 54 158 18" name="MajorSkill2" align="ALIGN_LEFT ALIGN_TOP" />
|
||||
<Widget type="MWSkill" skin="MW_StatName" position="156 72 158 18" name="MajorSkill3" align="ALIGN_LEFT ALIGN_TOP" />
|
||||
<Widget type="MWSkill" skin="MW_StatName" position="156 90 158 18" name="MajorSkill4" align="ALIGN_LEFT ALIGN_TOP" />
|
||||
|
||||
<!-- Minor Skills -->
|
||||
<Widget type="StaticText" skin="HeaderText" position="314 0 140 18" name="MinorSkillT" align="ALIGN_LEFT ALIGN_TOP">
|
||||
<Property key="Widget_Caption" value="Minor Skills:"/>
|
||||
<Property key="Widget_AlignText" value="ALIGN_LEFT ALIGN_TOP"/>
|
||||
</Widget>
|
||||
<Widget type="MWSkill" skin="MW_StatName" position="314 18 140 18" name="MinorSkill0" align="ALIGN_LEFT ALIGN_TOP" />
|
||||
<Widget type="MWSkill" skin="MW_StatName" position="341 36 140 18" name="MinorSkill1" align="ALIGN_LEFT ALIGN_TOP" />
|
||||
<Widget type="MWSkill" skin="MW_StatName" position="314 54 140 18" name="MinorSkill2" align="ALIGN_LEFT ALIGN_TOP" />
|
||||
<Widget type="MWSkill" skin="MW_StatName" position="314 72 140 18" name="MinorSkill3" align="ALIGN_LEFT ALIGN_TOP" />
|
||||
<Widget type="MWSkill" skin="MW_StatName" position="314 90 140 18" name="MinorSkill4" align="ALIGN_LEFT ALIGN_TOP" />
|
||||
|
||||
</Widget>
|
||||
|
||||
<!-- Dialog buttons -->
|
||||
<Widget type="Button" skin="MW_Button" position="207 158 143 23" name="DescriptionButton">
|
||||
<Property key="Widget_Caption" value="Class Description"/>
|
||||
</Widget>
|
||||
<Widget type="Button" skin="MW_Button" position="356 158 53 23" name="BackButton">
|
||||
<Property key="Widget_Caption" value="Back"/>
|
||||
</Widget>
|
||||
<Widget type="Button" skin="MW_Button" position="417 158 42 23" name="OKButton">
|
||||
<Property key="Widget_Caption" value="OK"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
</Widget>
|
||||
</MyGUI>
|
Loading…
Reference in a new issue