mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:53:52 +00:00
Merge remote branch 'jpn/dialouge'
This commit is contained in:
commit
2628b5143c
24 changed files with 552 additions and 337 deletions
|
@ -43,6 +43,9 @@ set(GAMEGUI_HEADER
|
|||
mwgui/review.hpp
|
||||
mwgui/window_manager.hpp
|
||||
mwgui/console.hpp
|
||||
mwgui/dialogue.hpp
|
||||
mwgui/dialogue_history.hpp
|
||||
mwgui/window_base.hpp
|
||||
)
|
||||
set(GAMEGUI
|
||||
mwgui/window_manager.cpp
|
||||
|
@ -54,6 +57,9 @@ set(GAMEGUI
|
|||
mwgui/birth.cpp
|
||||
mwgui/class.cpp
|
||||
mwgui/review.cpp
|
||||
mwgui/dialogue.cpp
|
||||
mwgui/dialogue_history.cpp
|
||||
mwgui/window_base.cpp
|
||||
)
|
||||
source_group(apps\\openmw\\mwgui FILES ${GAMEGUI_HEADER} ${GAMEGUI})
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/refdata.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@ -275,7 +275,7 @@ namespace MWDialogue
|
|||
// TODO execute script
|
||||
}
|
||||
|
||||
mEnvironment.mWindowManager->setMode (MWGui::GM_Dialogue);
|
||||
mEnvironment.mInputManager->setGuiMode(MWGui::GM_Dialogue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,17 +12,10 @@ using namespace MWGui;
|
|||
using namespace Widgets;
|
||||
|
||||
BirthDialog::BirthDialog(MWWorld::Environment& environment)
|
||||
: Layout("openmw_chargen_birth_layout.xml")
|
||||
, environment(environment)
|
||||
: WindowBase("openmw_chargen_birth_layout.xml", environment)
|
||||
{
|
||||
// Centre dialog
|
||||
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
|
||||
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;
|
||||
center();
|
||||
|
||||
getWidget(spellArea, "SpellArea");
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef MWGUI_BIRTH_H
|
||||
#define MWGUI_BIRTH_H
|
||||
|
||||
#include <openengine/gui/layout.hpp>
|
||||
#include "window_base.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ namespace MWGui
|
|||
{
|
||||
using namespace MyGUI;
|
||||
|
||||
class BirthDialog : public OEngine::GUI::Layout
|
||||
class BirthDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
BirthDialog(MWWorld::Environment& environment);
|
||||
|
@ -57,8 +57,6 @@ namespace MWGui
|
|||
void updateBirths();
|
||||
void updateSpells();
|
||||
|
||||
MWWorld::Environment& environment;
|
||||
|
||||
MyGUI::ListPtr birthList;
|
||||
MyGUI::WidgetPtr spellArea;
|
||||
MyGUI::StaticImagePtr birthImage;
|
||||
|
|
|
@ -15,15 +15,10 @@ using namespace MWGui;
|
|||
/* GenerateClassResultDialog */
|
||||
|
||||
GenerateClassResultDialog::GenerateClassResultDialog(MWWorld::Environment& environment)
|
||||
: Layout("openmw_chargen_generate_class_result_layout.xml")
|
||||
, environment(environment)
|
||||
: WindowBase("openmw_chargen_generate_class_result_layout.xml", environment)
|
||||
{
|
||||
// Centre dialog
|
||||
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
|
||||
MyGUI::IntCoord coord = mMainWidget->getCoord();
|
||||
coord.left = (gameWindowSize.width - coord.width)/2;
|
||||
coord.top = (gameWindowSize.height - coord.height)/2;
|
||||
mMainWidget->setCoord(coord);
|
||||
center();
|
||||
|
||||
WindowManager *wm = environment.mWindowManager;
|
||||
setText("ReflectT", wm->getGameSettingString("sMessageQuestionAnswer1", ""));
|
||||
|
@ -74,49 +69,31 @@ void GenerateClassResultDialog::onBackClicked(MyGUI::Widget* _sender)
|
|||
/* PickClassDialog */
|
||||
|
||||
PickClassDialog::PickClassDialog(MWWorld::Environment& environment)
|
||||
: Layout("openmw_chargen_class_layout.xml")
|
||||
, environment(environment)
|
||||
: WindowBase("openmw_chargen_class_layout.xml", environment)
|
||||
{
|
||||
// Centre dialog
|
||||
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
|
||||
MyGUI::IntCoord coord = mMainWidget->getCoord();
|
||||
coord.left = (gameWindowSize.width - coord.width)/2;
|
||||
coord.top = (gameWindowSize.height - coord.height)/2;
|
||||
mMainWidget->setCoord(coord);
|
||||
center();
|
||||
|
||||
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);
|
||||
getWidget(favoriteAttribute[0], "FavoriteAttribute0");
|
||||
getWidget(favoriteAttribute[1], "FavoriteAttribute1");
|
||||
favoriteAttribute[0]->setWindowManager(wm);
|
||||
favoriteAttribute[1]->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);
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
char theIndex = '0'+i;
|
||||
getWidget(majorSkill[i], std::string("MajorSkill").append(1, theIndex));
|
||||
getWidget(minorSkill[i], std::string("MinorSkill").append(1, theIndex));
|
||||
majorSkill[i]->setWindowManager(wm);
|
||||
minorSkill[i]->setWindowManager(wm);
|
||||
}
|
||||
|
||||
getWidget(classList, "ClassList");
|
||||
classList->setScrollVisible(true);
|
||||
|
@ -259,28 +236,13 @@ void PickClassDialog::updateStats()
|
|||
};
|
||||
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
|
||||
};
|
||||
favoriteAttribute[0]->setAttributeId(klass->data.attribute[0]);
|
||||
favoriteAttribute[1]->setAttributeId(klass->data.attribute[1]);
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
majorSkills[i]->setSkillNumber(klass->data.skills[i][0]);
|
||||
minorSkills[i]->setSkillNumber(klass->data.skills[i][1]);
|
||||
majorSkill[i]->setSkillNumber(klass->data.skills[i][0]);
|
||||
minorSkill[i]->setSkillNumber(klass->data.skills[i][1]);
|
||||
}
|
||||
|
||||
classImage->setImageTexture(std::string("textures\\levelup\\") + currentClassId + ".dds");
|
||||
|
@ -288,7 +250,7 @@ void PickClassDialog::updateStats()
|
|||
|
||||
/* InfoBoxDialog */
|
||||
|
||||
void fitToText(MyGUI::StaticTextPtr widget)
|
||||
void InfoBoxDialog::fitToText(MyGUI::StaticTextPtr widget)
|
||||
{
|
||||
MyGUI::IntCoord inner = widget->getTextRegion();
|
||||
MyGUI::IntCoord outer = widget->getCoord();
|
||||
|
@ -298,7 +260,7 @@ void fitToText(MyGUI::StaticTextPtr widget)
|
|||
widget->setSize(size);
|
||||
}
|
||||
|
||||
void layoutVertically(MyGUI::WidgetPtr widget, int margin)
|
||||
void InfoBoxDialog::layoutVertically(MyGUI::WidgetPtr widget, int margin)
|
||||
{
|
||||
size_t count = widget->getChildCount();
|
||||
int pos = 0;
|
||||
|
@ -319,8 +281,7 @@ void layoutVertically(MyGUI::WidgetPtr widget, int margin)
|
|||
}
|
||||
|
||||
InfoBoxDialog::InfoBoxDialog(MWWorld::Environment& environment)
|
||||
: Layout("openmw_infobox_layout.xml")
|
||||
, environment(environment)
|
||||
: WindowBase("openmw_infobox_layout.xml", environment)
|
||||
, currentButton(-1)
|
||||
{
|
||||
getWidget(textBox, "TextBox");
|
||||
|
@ -401,16 +362,6 @@ void InfoBoxDialog::onButtonClicked(MyGUI::WidgetPtr _sender)
|
|||
}
|
||||
}
|
||||
|
||||
void InfoBoxDialog::center()
|
||||
{
|
||||
// Centre dialog
|
||||
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
|
||||
MyGUI::IntCoord coord = mMainWidget->getCoord();
|
||||
coord.left = (gameWindowSize.width - coord.width)/2;
|
||||
coord.top = (gameWindowSize.height - coord.height)/2;
|
||||
mMainWidget->setCoord(coord);
|
||||
}
|
||||
|
||||
/* ClassChoiceDialog */
|
||||
|
||||
ClassChoiceDialog::ClassChoiceDialog(MWWorld::Environment& environment)
|
||||
|
@ -429,19 +380,14 @@ ClassChoiceDialog::ClassChoiceDialog(MWWorld::Environment& environment)
|
|||
/* CreateClassDialog */
|
||||
|
||||
CreateClassDialog::CreateClassDialog(MWWorld::Environment& environment)
|
||||
: Layout("openmw_chargen_create_class_layout.xml")
|
||||
, environment(environment)
|
||||
: WindowBase("openmw_chargen_create_class_layout.xml", environment)
|
||||
, specDialog(nullptr)
|
||||
, attribDialog(nullptr)
|
||||
, skillDialog(nullptr)
|
||||
, descDialog(nullptr)
|
||||
{
|
||||
// Centre dialog
|
||||
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
|
||||
MyGUI::IntCoord coord = mMainWidget->getCoord();
|
||||
coord.left = (gameWindowSize.width - coord.width)/2;
|
||||
coord.top = (gameWindowSize.height - coord.height)/2;
|
||||
mMainWidget->setCoord(coord);
|
||||
center();
|
||||
|
||||
WindowManager *wm = environment.mWindowManager;
|
||||
setText("SpecializationT", wm->getGameSettingString("sChooseClassMenu1", "Specialization"));
|
||||
|
@ -458,28 +404,15 @@ CreateClassDialog::CreateClassDialog(MWWorld::Environment& environment)
|
|||
favoriteAttribute1->eventClicked = MyGUI::newDelegate(this, &CreateClassDialog::onAttributeClicked);
|
||||
|
||||
setText("MajorSkillT", wm->getGameSettingString("sSkillClassMajor", ""));
|
||||
getWidget(majorSkill0, "MajorSkill0");
|
||||
getWidget(majorSkill1, "MajorSkill1");
|
||||
getWidget(majorSkill2, "MajorSkill2");
|
||||
getWidget(majorSkill3, "MajorSkill3");
|
||||
getWidget(majorSkill4, "MajorSkill4");
|
||||
skills.push_back(majorSkill0);
|
||||
skills.push_back(majorSkill1);
|
||||
skills.push_back(majorSkill2);
|
||||
skills.push_back(majorSkill3);
|
||||
skills.push_back(majorSkill4);
|
||||
|
||||
setText("MinorSkillT", wm->getGameSettingString("sSkillClassMinor", ""));
|
||||
getWidget(minorSkill0, "MinorSkill0");
|
||||
getWidget(minorSkill1, "MinorSkill1");
|
||||
getWidget(minorSkill2, "MinorSkill2");
|
||||
getWidget(minorSkill3, "MinorSkill3");
|
||||
getWidget(minorSkill4, "MinorSkill4");
|
||||
skills.push_back(minorSkill0);
|
||||
skills.push_back(minorSkill1);
|
||||
skills.push_back(minorSkill2);
|
||||
skills.push_back(minorSkill3);
|
||||
skills.push_back(minorSkill4);
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
char theIndex = '0'+i;
|
||||
getWidget(majorSkill[i], std::string("MajorSkill").append(1, theIndex));
|
||||
getWidget(minorSkill[i], std::string("MinorSkill").append(1, theIndex));
|
||||
skills.push_back(majorSkill[i]);
|
||||
skills.push_back(minorSkill[i]);
|
||||
}
|
||||
|
||||
std::vector<Widgets::MWSkillPtr>::const_iterator end = skills.end();
|
||||
for (std::vector<Widgets::MWSkillPtr>::const_iterator it = skills.begin(); it != end; ++it)
|
||||
|
@ -512,17 +445,17 @@ CreateClassDialog::CreateClassDialog(MWWorld::Environment& environment)
|
|||
favoriteAttribute0->setAttributeId(ESM::Attribute::Strength);
|
||||
favoriteAttribute1->setAttributeId(ESM::Attribute::Agility);
|
||||
|
||||
majorSkill0->setSkillId(ESM::Skill::Block);
|
||||
majorSkill1->setSkillId(ESM::Skill::Armorer);
|
||||
majorSkill2->setSkillId(ESM::Skill::MediumArmor);
|
||||
majorSkill3->setSkillId(ESM::Skill::HeavyArmor);
|
||||
majorSkill4->setSkillId(ESM::Skill::BluntWeapon);
|
||||
majorSkill[0]->setSkillId(ESM::Skill::Block);
|
||||
majorSkill[1]->setSkillId(ESM::Skill::Armorer);
|
||||
majorSkill[2]->setSkillId(ESM::Skill::MediumArmor);
|
||||
majorSkill[3]->setSkillId(ESM::Skill::HeavyArmor);
|
||||
majorSkill[4]->setSkillId(ESM::Skill::BluntWeapon);
|
||||
|
||||
minorSkill0->setSkillId(ESM::Skill::LongBlade);
|
||||
minorSkill1->setSkillId(ESM::Skill::Axe);
|
||||
minorSkill2->setSkillId(ESM::Skill::Spear);
|
||||
minorSkill3->setSkillId(ESM::Skill::Athletics);
|
||||
minorSkill4->setSkillId(ESM::Skill::Enchant);
|
||||
minorSkill[0]->setSkillId(ESM::Skill::LongBlade);
|
||||
minorSkill[1]->setSkillId(ESM::Skill::Axe);
|
||||
minorSkill[2]->setSkillId(ESM::Skill::Spear);
|
||||
minorSkill[3]->setSkillId(ESM::Skill::Athletics);
|
||||
minorSkill[4]->setSkillId(ESM::Skill::Enchant);
|
||||
}
|
||||
|
||||
CreateClassDialog::~CreateClassDialog()
|
||||
|
@ -559,22 +492,20 @@ std::vector<int> CreateClassDialog::getFavoriteAttributes() const
|
|||
std::vector<ESM::Skill::SkillEnum> CreateClassDialog::getMajorSkills() const
|
||||
{
|
||||
std::vector<ESM::Skill::SkillEnum> v;
|
||||
v.push_back(majorSkill0->getSkillId());
|
||||
v.push_back(majorSkill1->getSkillId());
|
||||
v.push_back(majorSkill2->getSkillId());
|
||||
v.push_back(majorSkill3->getSkillId());
|
||||
v.push_back(majorSkill4->getSkillId());
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
v.push_back(majorSkill[i]->getSkillId());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
std::vector<ESM::Skill::SkillEnum> CreateClassDialog::getMinorSkills() const
|
||||
{
|
||||
std::vector<ESM::Skill::SkillEnum> v;
|
||||
v.push_back(majorSkill0->getSkillId());
|
||||
v.push_back(majorSkill1->getSkillId());
|
||||
v.push_back(majorSkill2->getSkillId());
|
||||
v.push_back(majorSkill3->getSkillId());
|
||||
v.push_back(majorSkill4->getSkillId());
|
||||
for(int i=0; i < 5; i++)
|
||||
{
|
||||
v.push_back(majorSkill[i]->getSkillId());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -734,13 +665,10 @@ void CreateClassDialog::onBackClicked(MyGUI::Widget* _sender)
|
|||
/* SelectSpecializationDialog */
|
||||
|
||||
SelectSpecializationDialog::SelectSpecializationDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
|
||||
: Layout("openmw_chargen_select_specialization_layout.xml")
|
||||
: WindowBase("openmw_chargen_select_specialization_layout.xml", 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);
|
||||
center();
|
||||
|
||||
WindowManager *wm = environment.mWindowManager;
|
||||
|
||||
|
@ -788,43 +716,24 @@ void SelectSpecializationDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
/* SelectAttributeDialog */
|
||||
|
||||
SelectAttributeDialog::SelectAttributeDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
|
||||
: Layout("openmw_chargen_select_attribute_layout.xml")
|
||||
: WindowBase("openmw_chargen_select_attribute_layout.xml", 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);
|
||||
center();
|
||||
|
||||
WindowManager *wm = environment.mWindowManager;
|
||||
|
||||
setText("LabelT", wm->getGameSettingString("sAttributesMenu1", ""));
|
||||
|
||||
getWidget(attribute0, "Attribute0");
|
||||
getWidget(attribute1, "Attribute1");
|
||||
getWidget(attribute2, "Attribute2");
|
||||
getWidget(attribute3, "Attribute3");
|
||||
getWidget(attribute4, "Attribute4");
|
||||
getWidget(attribute5, "Attribute5");
|
||||
getWidget(attribute6, "Attribute6");
|
||||
getWidget(attribute7, "Attribute7");
|
||||
|
||||
Widgets::MWAttributePtr attributes[8] = {
|
||||
attribute0,
|
||||
attribute1,
|
||||
attribute2,
|
||||
attribute3,
|
||||
attribute4,
|
||||
attribute5,
|
||||
attribute6,
|
||||
attribute7
|
||||
};
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
attributes[i]->setWindowManager(wm);
|
||||
attributes[i]->setAttributeId(ESM::Attribute::attributeIds[i]);
|
||||
attributes[i]->eventClicked = MyGUI::newDelegate(this, &SelectAttributeDialog::onAttributeClicked);
|
||||
Widgets::MWAttributePtr attribute;
|
||||
char theIndex = '0'+i;
|
||||
|
||||
getWidget(attribute, std::string("Attribute").append(1, theIndex));
|
||||
attribute->setWindowManager(wm);
|
||||
attribute->setAttributeId(ESM::Attribute::attributeIds[i]);
|
||||
attribute->eventClicked = MyGUI::newDelegate(this, &SelectAttributeDialog::onAttributeClicked);
|
||||
}
|
||||
|
||||
// TODO: These buttons should be managed by a Dialog class
|
||||
|
@ -852,13 +761,10 @@ void SelectAttributeDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
/* SelectSkillDialog */
|
||||
|
||||
SelectSkillDialog::SelectSkillDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
|
||||
: Layout("openmw_chargen_select_skill_layout.xml")
|
||||
: WindowBase("openmw_chargen_select_skill_layout.xml", 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);
|
||||
center();
|
||||
|
||||
WindowManager *wm = environment.mWindowManager;
|
||||
|
||||
|
@ -867,69 +773,47 @@ SelectSkillDialog::SelectSkillDialog(MWWorld::Environment& environment, MyGUI::I
|
|||
setText("MagicLabelT", wm->getGameSettingString("sSpecializationMagic", ""));
|
||||
setText("StealthLabelT", wm->getGameSettingString("sSpecializationStealth", ""));
|
||||
|
||||
getWidget(combatSkill0, "CombatSkill0");
|
||||
getWidget(combatSkill1, "CombatSkill1");
|
||||
getWidget(combatSkill2, "CombatSkill2");
|
||||
getWidget(combatSkill3, "CombatSkill3");
|
||||
getWidget(combatSkill4, "CombatSkill4");
|
||||
getWidget(combatSkill5, "CombatSkill5");
|
||||
getWidget(combatSkill6, "CombatSkill6");
|
||||
getWidget(combatSkill7, "CombatSkill7");
|
||||
getWidget(combatSkill8, "CombatSkill8");
|
||||
|
||||
getWidget(magicSkill0, "MagicSkill0");
|
||||
getWidget(magicSkill1, "MagicSkill1");
|
||||
getWidget(magicSkill2, "MagicSkill2");
|
||||
getWidget(magicSkill3, "MagicSkill3");
|
||||
getWidget(magicSkill4, "MagicSkill4");
|
||||
getWidget(magicSkill5, "MagicSkill5");
|
||||
getWidget(magicSkill6, "MagicSkill6");
|
||||
getWidget(magicSkill7, "MagicSkill7");
|
||||
getWidget(magicSkill8, "MagicSkill8");
|
||||
|
||||
getWidget(stealthSkill0, "StealthSkill0");
|
||||
getWidget(stealthSkill1, "StealthSkill1");
|
||||
getWidget(stealthSkill2, "StealthSkill2");
|
||||
getWidget(stealthSkill3, "StealthSkill3");
|
||||
getWidget(stealthSkill4, "StealthSkill4");
|
||||
getWidget(stealthSkill5, "StealthSkill5");
|
||||
getWidget(stealthSkill6, "StealthSkill6");
|
||||
getWidget(stealthSkill7, "StealthSkill7");
|
||||
getWidget(stealthSkill8, "StealthSkill8");
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
char theIndex = '0'+i;
|
||||
getWidget(combatSkill[i], std::string("CombatSkill").append(1, theIndex));
|
||||
getWidget(magicSkill[i], std::string("MagicSkill").append(1, theIndex));
|
||||
getWidget(stealthSkill[i], std::string("StealthSkill").append(1, theIndex));
|
||||
}
|
||||
|
||||
struct {Widgets::MWSkillPtr widget; ESM::Skill::SkillEnum skillId;} skills[3][9] = {
|
||||
{
|
||||
{combatSkill0, ESM::Skill::Block},
|
||||
{combatSkill1, ESM::Skill::Armorer},
|
||||
{combatSkill2, ESM::Skill::MediumArmor},
|
||||
{combatSkill3, ESM::Skill::HeavyArmor},
|
||||
{combatSkill4, ESM::Skill::BluntWeapon},
|
||||
{combatSkill5, ESM::Skill::LongBlade},
|
||||
{combatSkill6, ESM::Skill::Axe},
|
||||
{combatSkill7, ESM::Skill::Spear},
|
||||
{combatSkill8, ESM::Skill::Athletics}
|
||||
{combatSkill[0], ESM::Skill::Block},
|
||||
{combatSkill[1], ESM::Skill::Armorer},
|
||||
{combatSkill[2], ESM::Skill::MediumArmor},
|
||||
{combatSkill[3], ESM::Skill::HeavyArmor},
|
||||
{combatSkill[4], ESM::Skill::BluntWeapon},
|
||||
{combatSkill[5], ESM::Skill::LongBlade},
|
||||
{combatSkill[6], ESM::Skill::Axe},
|
||||
{combatSkill[7], ESM::Skill::Spear},
|
||||
{combatSkill[8], ESM::Skill::Athletics}
|
||||
},
|
||||
{
|
||||
{magicSkill0, ESM::Skill::Enchant},
|
||||
{magicSkill1, ESM::Skill::Destruction},
|
||||
{magicSkill2, ESM::Skill::Alteration},
|
||||
{magicSkill3, ESM::Skill::Illusion},
|
||||
{magicSkill4, ESM::Skill::Conjuration},
|
||||
{magicSkill5, ESM::Skill::Mysticism},
|
||||
{magicSkill6, ESM::Skill::Restoration},
|
||||
{magicSkill7, ESM::Skill::Alchemy},
|
||||
{magicSkill8, ESM::Skill::Unarmored}
|
||||
{magicSkill[0], ESM::Skill::Enchant},
|
||||
{magicSkill[1], ESM::Skill::Destruction},
|
||||
{magicSkill[2], ESM::Skill::Alteration},
|
||||
{magicSkill[3], ESM::Skill::Illusion},
|
||||
{magicSkill[4], ESM::Skill::Conjuration},
|
||||
{magicSkill[5], ESM::Skill::Mysticism},
|
||||
{magicSkill[6], ESM::Skill::Restoration},
|
||||
{magicSkill[7], ESM::Skill::Alchemy},
|
||||
{magicSkill[8], ESM::Skill::Unarmored}
|
||||
},
|
||||
{
|
||||
{stealthSkill0, ESM::Skill::Security},
|
||||
{stealthSkill1, ESM::Skill::Sneak},
|
||||
{stealthSkill2, ESM::Skill::Acrobatics},
|
||||
{stealthSkill3, ESM::Skill::LightArmor},
|
||||
{stealthSkill4, ESM::Skill::ShortBlade},
|
||||
{stealthSkill5 ,ESM::Skill::Marksman},
|
||||
{stealthSkill6 ,ESM::Skill::Mercantile},
|
||||
{stealthSkill7 ,ESM::Skill::Speechcraft},
|
||||
{stealthSkill8 ,ESM::Skill::HandToHand}
|
||||
{stealthSkill[0], ESM::Skill::Security},
|
||||
{stealthSkill[1], ESM::Skill::Sneak},
|
||||
{stealthSkill[2], ESM::Skill::Acrobatics},
|
||||
{stealthSkill[3], ESM::Skill::LightArmor},
|
||||
{stealthSkill[4], ESM::Skill::ShortBlade},
|
||||
{stealthSkill[5] ,ESM::Skill::Marksman},
|
||||
{stealthSkill[6] ,ESM::Skill::Mercantile},
|
||||
{stealthSkill[7] ,ESM::Skill::Speechcraft},
|
||||
{stealthSkill[8] ,ESM::Skill::HandToHand}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -966,14 +850,10 @@ void SelectSkillDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
/* DescriptionDialog */
|
||||
|
||||
DescriptionDialog::DescriptionDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
|
||||
: Layout("openmw_chargen_class_description_layout.xml")
|
||||
, environment(environment)
|
||||
: WindowBase("openmw_chargen_class_description_layout.xml", 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);
|
||||
center();
|
||||
|
||||
getWidget(textEdit, "TextEdit");
|
||||
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
#ifndef MWGUI_CLASS_H
|
||||
#define MWGUI_CLASS_H
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include <openengine/gui/layout.hpp>
|
||||
|
||||
#include <MyGUI.h>
|
||||
|
||||
#include "widgets.hpp"
|
||||
#include "window_base.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
|
@ -23,7 +19,7 @@ namespace MWGui
|
|||
{
|
||||
using namespace MyGUI;
|
||||
|
||||
class InfoBoxDialog : public OEngine::GUI::Layout
|
||||
class InfoBoxDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
InfoBoxDialog(MWWorld::Environment& environment);
|
||||
|
@ -49,10 +45,9 @@ namespace MWGui
|
|||
void onButtonClicked(MyGUI::WidgetPtr _sender);
|
||||
|
||||
private:
|
||||
void center();
|
||||
|
||||
MWWorld::Environment& environment;
|
||||
|
||||
void fitToText(MyGUI::StaticTextPtr widget);
|
||||
void layoutVertically(MyGUI::WidgetPtr widget, int margin);
|
||||
int currentButton;
|
||||
MyGUI::WidgetPtr textBox;
|
||||
MyGUI::StaticTextPtr text;
|
||||
|
@ -75,7 +70,7 @@ namespace MWGui
|
|||
ClassChoiceDialog(MWWorld::Environment& environment);
|
||||
};
|
||||
|
||||
class GenerateClassResultDialog : public OEngine::GUI::Layout
|
||||
class GenerateClassResultDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
GenerateClassResultDialog(MWWorld::Environment& environment);
|
||||
|
@ -103,15 +98,13 @@ namespace MWGui
|
|||
void onBackClicked(MyGUI::Widget* _sender);
|
||||
|
||||
private:
|
||||
MWWorld::Environment& environment;
|
||||
|
||||
MyGUI::StaticImagePtr classImage;
|
||||
MyGUI::StaticTextPtr className;
|
||||
|
||||
std::string currentClassId;
|
||||
};
|
||||
|
||||
class PickClassDialog : public OEngine::GUI::Layout
|
||||
class PickClassDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
PickClassDialog(MWWorld::Environment& environment);
|
||||
|
@ -145,19 +138,17 @@ namespace MWGui
|
|||
void updateClasses();
|
||||
void updateStats();
|
||||
|
||||
MWWorld::Environment& environment;
|
||||
|
||||
MyGUI::StaticImagePtr classImage;
|
||||
MyGUI::ListPtr classList;
|
||||
MyGUI::StaticTextPtr specializationName;
|
||||
Widgets::MWAttributePtr favoriteAttribute0, favoriteAttribute1;
|
||||
Widgets::MWSkillPtr majorSkill0, majorSkill1, majorSkill2, majorSkill3, majorSkill4;
|
||||
Widgets::MWSkillPtr minorSkill0, minorSkill1, minorSkill2, minorSkill3, minorSkill4;
|
||||
Widgets::MWAttributePtr favoriteAttribute[2];
|
||||
Widgets::MWSkillPtr majorSkill[5];
|
||||
Widgets::MWSkillPtr minorSkill[5];
|
||||
|
||||
std::string currentClassId;
|
||||
};
|
||||
|
||||
class SelectSpecializationDialog : public OEngine::GUI::Layout
|
||||
class SelectSpecializationDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
SelectSpecializationDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize);
|
||||
|
@ -187,7 +178,7 @@ namespace MWGui
|
|||
ESM::Class::Specialization specializationId;
|
||||
};
|
||||
|
||||
class SelectAttributeDialog : public OEngine::GUI::Layout
|
||||
class SelectAttributeDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
SelectAttributeDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize);
|
||||
|
@ -214,14 +205,12 @@ namespace MWGui
|
|||
void onCancelClicked(MyGUI::Widget* _sender);
|
||||
|
||||
private:
|
||||
Widgets::MWAttributePtr attribute0, attribute1, attribute2, attribute3,
|
||||
attribute4, attribute5, attribute6, attribute7;
|
||||
Widgets::MWAttributePtr affectedWidget;
|
||||
|
||||
ESM::Attribute::AttributeID attributeId;
|
||||
};
|
||||
|
||||
class SelectSkillDialog : public OEngine::GUI::Layout
|
||||
class SelectSkillDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
SelectSkillDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize);
|
||||
|
@ -248,18 +237,15 @@ namespace MWGui
|
|||
void onCancelClicked(MyGUI::Widget* _sender);
|
||||
|
||||
private:
|
||||
Widgets::MWSkillPtr combatSkill0, combatSkill1, combatSkill2, combatSkill3, combatSkill4,
|
||||
combatSkill5, combatSkill6, combatSkill7, combatSkill8;
|
||||
Widgets::MWSkillPtr magicSkill0, magicSkill1, magicSkill2, magicSkill3, magicSkill4,
|
||||
magicSkill5, magicSkill6, magicSkill7, magicSkill8;
|
||||
Widgets::MWSkillPtr stealthSkill0, stealthSkill1, stealthSkill2, stealthSkill3, stealthSkill4,
|
||||
stealthSkill5, stealthSkill6, stealthSkill7, stealthSkill8;
|
||||
Widgets::MWSkillPtr combatSkill[9];
|
||||
Widgets::MWSkillPtr magicSkill[9];
|
||||
Widgets::MWSkillPtr stealthSkill[9];
|
||||
Widgets::MWSkillPtr affectedWidget;
|
||||
|
||||
ESM::Skill::SkillEnum skillId;
|
||||
};
|
||||
|
||||
class DescriptionDialog : public OEngine::GUI::Layout
|
||||
class DescriptionDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
DescriptionDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize);
|
||||
|
@ -279,12 +265,10 @@ namespace MWGui
|
|||
void onOkClicked(MyGUI::Widget* _sender);
|
||||
|
||||
private:
|
||||
MWWorld::Environment& environment;
|
||||
|
||||
MyGUI::EditPtr textEdit;
|
||||
};
|
||||
|
||||
class CreateClassDialog : public OEngine::GUI::Layout
|
||||
class CreateClassDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
CreateClassDialog(MWWorld::Environment& environment);
|
||||
|
@ -328,13 +312,11 @@ namespace MWGui
|
|||
void onDialogCancel();
|
||||
|
||||
private:
|
||||
MWWorld::Environment& environment;
|
||||
|
||||
MyGUI::EditPtr editName;
|
||||
MyGUI::WidgetPtr specializationName;
|
||||
Widgets::MWAttributePtr favoriteAttribute0, favoriteAttribute1;
|
||||
Widgets::MWSkillPtr majorSkill0, majorSkill1, majorSkill2, majorSkill3, majorSkill4;
|
||||
Widgets::MWSkillPtr minorSkill0, minorSkill1, minorSkill2, minorSkill3, minorSkill4;
|
||||
Widgets::MWSkillPtr majorSkill[5];
|
||||
Widgets::MWSkillPtr minorSkill[5];
|
||||
std::vector<Widgets::MWSkillPtr> skills;
|
||||
std::string description;
|
||||
|
||||
|
|
122
apps/openmw/mwgui/dialogue.cpp
Normal file
122
apps/openmw/mwgui/dialogue.cpp
Normal file
|
@ -0,0 +1,122 @@
|
|||
#include "dialogue.hpp"
|
||||
#include "dialogue_history.hpp"
|
||||
#include "../mwworld/environment.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "window_manager.hpp"
|
||||
#include "widgets.hpp"
|
||||
#include "components/esm_store/store.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
using namespace MWGui;
|
||||
using namespace Widgets;
|
||||
|
||||
DialogueWindow::DialogueWindow(MWWorld::Environment& environment)
|
||||
: WindowBase("openmw_dialogue_window_layout.xml", environment)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
||||
//WindowManager *wm = environment.mWindowManager;
|
||||
setText("NpcName", "Name of character");
|
||||
|
||||
//History view
|
||||
getWidget(history, "History");
|
||||
history->setOverflowToTheLeft(true);
|
||||
history->getClient()->eventMouseButtonClick = MyGUI::newDelegate(this, &DialogueWindow::onHistoryClicked);
|
||||
|
||||
//Topics list
|
||||
getWidget(topicsList, "TopicsList");
|
||||
topicsList->setScrollVisible(true);
|
||||
topicsList->eventListSelectAccept = MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
|
||||
topicsList->eventListMouseItemActivate = MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
|
||||
topicsList->eventListChangePosition = MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
|
||||
|
||||
MyGUI::ButtonPtr byeButton;
|
||||
getWidget(byeButton, "ByeButton");
|
||||
byeButton->eventMouseButtonClick = MyGUI::newDelegate(this, &DialogueWindow::onByeClicked);
|
||||
|
||||
updateOptions();
|
||||
}
|
||||
|
||||
void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
ISubWidgetText* t = history->getSubWidgetText();
|
||||
if(t == nullptr)
|
||||
return;
|
||||
|
||||
const IntPoint& lastPressed = InputManager::getInstance().getLastLeftPressed();
|
||||
|
||||
size_t cursorPosition = t->getCursorPosition(lastPressed);
|
||||
if(history->getColorAtPos(cursorPosition) != "#FFFFFF")
|
||||
{
|
||||
UString key = history->getColorTextAt(cursorPosition);
|
||||
std::cout << "Clicked on key: " << key << std::endl;
|
||||
//eventTopicSelected(key);
|
||||
}
|
||||
}
|
||||
|
||||
void DialogueWindow::open()
|
||||
{
|
||||
updateOptions();
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
eventBye();
|
||||
}
|
||||
|
||||
void DialogueWindow::onSelectTopic(MyGUI::List* _sender, size_t _index)
|
||||
{
|
||||
if (_index == MyGUI::ITEM_NONE)
|
||||
return;
|
||||
|
||||
//const std::string* theTopic = topicsList->getItemDataAt<std::string>(_index);
|
||||
//std::cout << "Selected: "<< theTopic << std::endl;
|
||||
//eventTopicSelected(key);
|
||||
}
|
||||
|
||||
|
||||
void DialogueWindow::updateOptions()
|
||||
{
|
||||
//FIXME Add this properly
|
||||
history->addDialogText("Through the translucent surface of the orb, you see shifting images of distant locations...");
|
||||
for(int z = 0; z < 10; z++)
|
||||
{
|
||||
history->addDialogHeading("Fort Frostmoth");
|
||||
history->addDialogText("The image in the orb flickers, and you see.... The cold courtyard of #FF0000Fort Frostmoth#FFFFFF, battered bu werewolf attack, but still standing, still projecting Imperial might even to this distant and cold corner of the world.");
|
||||
}
|
||||
|
||||
//Clear the list of topics
|
||||
topicsList->removeAllItems();
|
||||
int i = 0;
|
||||
topicsList->addItem("Ald'ruhn", i++);
|
||||
topicsList->addItem("Balmora", i++);
|
||||
topicsList->addItem("Sadrith Mora", i++);
|
||||
topicsList->addItem("Vivec", i++);
|
||||
topicsList->addItem("Ald Velothi", i++);
|
||||
topicsList->addItem("Caldera", i++);
|
||||
topicsList->addItem("Dagon Fel ", i++);
|
||||
topicsList->addItem("Gnaar Mok", i++);
|
||||
topicsList->addItem("Gnisis", i++);
|
||||
topicsList->addItem("Hla Oad", i++);
|
||||
topicsList->addItem("Khuul", i++);
|
||||
topicsList->addItem("Maar Gan", i++);
|
||||
topicsList->addItem("Molag Mar", i++);
|
||||
topicsList->addItem("Pelagiad", i++);
|
||||
topicsList->addItem("Seyda Neen", i++);
|
||||
topicsList->addItem("Suran", i++);
|
||||
topicsList->addItem("Tel Aruhn", i++);
|
||||
topicsList->addItem("Tel Branora", i++);
|
||||
topicsList->addItem("Tel Fyr", i++);
|
||||
topicsList->addItem("Tel Mora", i++);
|
||||
topicsList->addItem("Tel Vos", i++);
|
||||
topicsList->addItem("Vos", i++);
|
||||
}
|
||||
|
50
apps/openmw/mwgui/dialogue.hpp
Normal file
50
apps/openmw/mwgui/dialogue.hpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#ifndef MWGUI_DIALOGE_H
|
||||
#define MWGUI_DIALOGE_H
|
||||
|
||||
#include "window_base.hpp"
|
||||
#include <boost/array.hpp>
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Environment;
|
||||
}
|
||||
|
||||
/*
|
||||
This file contains the dialouge window
|
||||
Layout is defined by resources/mygui/openmw_dialogue_window_layout.xml.
|
||||
*/
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class DialogeHistory;
|
||||
|
||||
using namespace MyGUI;
|
||||
|
||||
class DialogueWindow: public WindowBase
|
||||
{
|
||||
public:
|
||||
DialogueWindow(MWWorld::Environment& environment);
|
||||
|
||||
void open();
|
||||
|
||||
// Events
|
||||
typedef delegates::CDelegate0 EventHandle_Void;
|
||||
|
||||
/** Event : Dialog finished, OK button clicked.\n
|
||||
signature : void method()\n
|
||||
*/
|
||||
EventHandle_Void eventBye;
|
||||
|
||||
protected:
|
||||
void onSelectTopic(MyGUI::List* _sender, size_t _index);
|
||||
void onByeClicked(MyGUI::Widget* _sender);
|
||||
void onHistoryClicked(MyGUI::Widget* _sender);
|
||||
|
||||
private:
|
||||
void updateOptions();
|
||||
|
||||
DialogeHistory* history;
|
||||
MyGUI::ListPtr topicsList;
|
||||
};
|
||||
}
|
||||
#endif
|
77
apps/openmw/mwgui/dialogue_history.cpp
Normal file
77
apps/openmw/mwgui/dialogue_history.cpp
Normal file
|
@ -0,0 +1,77 @@
|
|||
#include "dialogue_history.hpp"
|
||||
#include "../mwworld/environment.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "window_manager.hpp"
|
||||
#include "widgets.hpp"
|
||||
#include "components/esm_store/store.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
using namespace MWGui;
|
||||
using namespace Widgets;
|
||||
|
||||
UString DialogeHistory::getColorAtPos(size_t _pos)
|
||||
{
|
||||
UString colour = TextIterator::convertTagColour(mText->getTextColour());
|
||||
TextIterator iterator(mText->getCaption());
|
||||
while(iterator.moveNext())
|
||||
{
|
||||
size_t pos = iterator.getPosition();
|
||||
iterator.getTagColour(colour);
|
||||
if (pos < _pos)
|
||||
continue;
|
||||
else if (pos == _pos)
|
||||
break;
|
||||
}
|
||||
return colour;
|
||||
}
|
||||
|
||||
UString DialogeHistory::getColorTextAt(size_t _pos)
|
||||
{
|
||||
bool breakOnNext = false;
|
||||
UString colour = TextIterator::convertTagColour(mText->getTextColour());
|
||||
UString colour2 = colour;
|
||||
TextIterator iterator(mText->getCaption());
|
||||
TextIterator col_start = iterator;
|
||||
while(iterator.moveNext())
|
||||
{
|
||||
size_t pos = iterator.getPosition();
|
||||
iterator.getTagColour(colour);
|
||||
if(colour != colour2)
|
||||
{
|
||||
if(breakOnNext)
|
||||
{
|
||||
return getOnlyText().substr(col_start.getPosition(), iterator.getPosition()-col_start.getPosition());
|
||||
}
|
||||
col_start = iterator;
|
||||
colour2 = colour;
|
||||
}
|
||||
if (pos < _pos)
|
||||
continue;
|
||||
else if (pos == _pos)
|
||||
{
|
||||
breakOnNext = true;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void DialogeHistory::addDialogHeading(const UString& parText)
|
||||
{
|
||||
UString head("\n#00FF00");
|
||||
head.append(parText);
|
||||
head.append("#FFFFFF\n");
|
||||
addText(head);
|
||||
}
|
||||
|
||||
void DialogeHistory::addDialogText(const UString& parText)
|
||||
{
|
||||
addText(parText);
|
||||
addText("\n");
|
||||
}
|
||||
|
20
apps/openmw/mwgui/dialogue_history.hpp
Normal file
20
apps/openmw/mwgui/dialogue_history.hpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef MWGUI_DIALOGE_HISTORY_H
|
||||
#define MWGUI_DIALOGE_HISTORY_H
|
||||
#include <openengine/gui/layout.hpp>
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
using namespace MyGUI;
|
||||
class DialogeHistory : public MyGUI::Edit
|
||||
{
|
||||
MYGUI_RTTI_DERIVED( DialogeHistory )
|
||||
public:
|
||||
Widget* getClient() { return mClient; }
|
||||
UString getColorAtPos(size_t _pos);
|
||||
UString getColorTextAt(size_t _pos);
|
||||
void addDialogHeading(const UString& parText);
|
||||
void addDialogText(const UString& parText);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
@ -13,8 +13,7 @@ using namespace MWGui;
|
|||
const int StatsWindow::lineHeight = 18;
|
||||
|
||||
StatsWindow::StatsWindow (MWWorld::Environment& environment)
|
||||
: Layout("openmw_stats_window_layout.xml")
|
||||
, environment(environment)
|
||||
: WindowBase("openmw_stats_window_layout.xml", environment)
|
||||
, lastPos(0)
|
||||
, reputation(0)
|
||||
, bounty(0)
|
||||
|
@ -56,10 +55,11 @@ StatsWindow::StatsWindow (MWWorld::Environment& environment)
|
|||
for (int i = 0; i < ESM::Skill::Length; ++i)
|
||||
{
|
||||
skillValues.insert(std::pair<int, MWMechanics::Stat<float> >(i, MWMechanics::Stat<float>()));
|
||||
skillWidgetMap.insert(std::pair<int, MyGUI::WidgetPtr>(i, nullptr));
|
||||
skillWidgetMap.insert(std::pair<int, MyGUI::StaticTextPtr>(i, nullptr));
|
||||
}
|
||||
|
||||
static_cast<MyGUI::WindowPtr>(mMainWidget)->eventWindowChangeCoord = MyGUI::newDelegate(this, &StatsWindow::onWindowResize);
|
||||
MyGUI::WindowPtr t = static_cast<MyGUI::WindowPtr>(mMainWidget);
|
||||
t->eventWindowChangeCoord = MyGUI::newDelegate(this, &StatsWindow::onWindowResize);
|
||||
}
|
||||
|
||||
void StatsWindow::onScrollChangePosition(MyGUI::VScrollPtr scroller, size_t pos)
|
||||
|
@ -99,7 +99,7 @@ void StatsWindow::setPlayerName(const std::string& playerName)
|
|||
mMainWidget->setCaption(playerName);
|
||||
}
|
||||
|
||||
void StatsWindow::setStyledText(MyGUI::WidgetPtr widget, ColorStyle style, const std::string &value)
|
||||
void StatsWindow::setStyledText(MyGUI::StaticTextPtr widget, ColorStyle style, const std::string &value)
|
||||
{
|
||||
widget->setCaption(value);
|
||||
if (style == CS_Super)
|
||||
|
@ -205,13 +205,13 @@ void StatsWindow::setValue (const std::string& id, const MWMechanics::Stat<float
|
|||
{"SkillSpeechcraft", ESM::Skill::Speechcraft},
|
||||
{"SkillHandToHand", ESM::Skill::HandToHand},
|
||||
};
|
||||
for (int i = 0; i < sizeof(skillMap)/sizeof(skillMap[0]); ++i)
|
||||
for (size_t i = 0; i < sizeof(skillMap)/sizeof(skillMap[0]); ++i)
|
||||
{
|
||||
if (skillMap[i].id == id)
|
||||
{
|
||||
int skillId = skillMap[i].skillId;
|
||||
skillValues[skillId] = value;
|
||||
MyGUI::WidgetPtr widget = skillWidgetMap[skillId];
|
||||
MyGUI::StaticTextPtr widget = skillWidgetMap[skillId];
|
||||
if (widget)
|
||||
{
|
||||
float modified = value.getModified(), base = value.getBase();
|
||||
|
@ -277,7 +277,7 @@ void StatsWindow::addGroup(const std::string &label, MyGUI::IntCoord &coord1, My
|
|||
coord2.top += lineHeight;
|
||||
}
|
||||
|
||||
MyGUI::WidgetPtr StatsWindow::addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
||||
MyGUI::StaticTextPtr StatsWindow::addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
||||
{
|
||||
MyGUI::StaticTextPtr skillNameWidget, skillValueWidget;
|
||||
|
||||
|
@ -312,8 +312,6 @@ void StatsWindow::addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI
|
|||
void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
||||
{
|
||||
WindowManager *wm = environment.mWindowManager;
|
||||
MWMechanics::MechanicsManager *mm = environment.mMechanicsManager;
|
||||
ESMS::ESMStore &store = environment.mWorld->getStore();
|
||||
|
||||
// Add a line separator if there are items above
|
||||
if (!skillWidgets.empty())
|
||||
|
@ -340,7 +338,7 @@ void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId,
|
|||
style = CS_Super;
|
||||
else if (modified < base)
|
||||
style = CS_Sub;
|
||||
MyGUI::WidgetPtr widget = addValueItem(wm->getGameSettingString(skillNameId, skillNameId), boost::lexical_cast<std::string>(static_cast<int>(modified)), style, coord1, coord2);
|
||||
MyGUI::StaticTextPtr widget = addValueItem(wm->getGameSettingString(skillNameId, skillNameId), boost::lexical_cast<std::string>(static_cast<int>(modified)), style, coord1, coord2);
|
||||
skillWidgetMap[skillId] = widget;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "../mwmechanics/stat.hpp"
|
||||
#include "../mwworld/environment.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "window_base.hpp"
|
||||
|
||||
/*
|
||||
This file contains classes corresponding to all the window layouts
|
||||
|
@ -177,7 +178,7 @@ namespace MWGui
|
|||
}
|
||||
};
|
||||
|
||||
class StatsWindow : public OEngine::GUI::Layout
|
||||
class StatsWindow : public WindowBase
|
||||
{
|
||||
public:
|
||||
typedef std::pair<std::string, int> Faction;
|
||||
|
@ -212,11 +213,11 @@ namespace MWGui
|
|||
CS_Normal,
|
||||
CS_Super
|
||||
};
|
||||
void setStyledText(MyGUI::WidgetPtr widget, ColorStyle style, const std::string &value);
|
||||
void setStyledText(MyGUI::StaticTextPtr widget, ColorStyle style, const std::string &value);
|
||||
void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
MyGUI::WidgetPtr addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
MyGUI::StaticTextPtr addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
void addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
void updateScroller();
|
||||
|
||||
|
@ -225,14 +226,13 @@ namespace MWGui
|
|||
|
||||
static const int lineHeight;
|
||||
|
||||
MWWorld::Environment& environment;
|
||||
MyGUI::WidgetPtr skillAreaWidget, skillClientWidget;
|
||||
MyGUI::VScrollPtr skillScrollerWidget;
|
||||
int lastPos, clientHeight;
|
||||
|
||||
SkillList majorSkills, minorSkills, miscSkills;
|
||||
std::map<int, MWMechanics::Stat<float> > skillValues;
|
||||
std::map<int, MyGUI::WidgetPtr> skillWidgetMap;
|
||||
std::map<int, MyGUI::StaticTextPtr> skillWidgetMap;
|
||||
std::map<std::string, MyGUI::WidgetPtr> factionWidgetMap;
|
||||
FactionList factions; ///< Stores a list of factions and the current rank
|
||||
std::string birthSignId;
|
||||
|
|
|
@ -16,8 +16,7 @@ using namespace MWGui;
|
|||
using namespace Widgets;
|
||||
|
||||
RaceDialog::RaceDialog(MWWorld::Environment& environment)
|
||||
: Layout("openmw_chargen_race_layout.xml")
|
||||
, environment(environment)
|
||||
: WindowBase("openmw_chargen_race_layout.xml", environment)
|
||||
, genderIndex(0)
|
||||
, faceIndex(0)
|
||||
, hairIndex(0)
|
||||
|
@ -25,11 +24,7 @@ RaceDialog::RaceDialog(MWWorld::Environment& environment)
|
|||
, hairCount(14)
|
||||
{
|
||||
// Centre dialog
|
||||
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
|
||||
MyGUI::IntCoord coord = mMainWidget->getCoord();
|
||||
coord.left = (gameWindowSize.width - coord.width)/2;
|
||||
coord.top = (gameWindowSize.height - coord.height)/2;
|
||||
mMainWidget->setCoord(coord);
|
||||
center();
|
||||
|
||||
// These are just demo values, you should replace these with
|
||||
// real calls from outside the class later.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include <openengine/gui/layout.hpp>
|
||||
#include "window_base.hpp"
|
||||
|
||||
#include <boost/array.hpp>
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace MWGui
|
|||
{
|
||||
using namespace MyGUI;
|
||||
|
||||
class RaceDialog : public OEngine::GUI::Layout
|
||||
class RaceDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
RaceDialog(MWWorld::Environment& environment);
|
||||
|
@ -80,8 +80,6 @@ namespace MWGui
|
|||
void updateSkills();
|
||||
void updateSpellPowers();
|
||||
|
||||
MWWorld::Environment& environment;
|
||||
|
||||
MyGUI::CanvasPtr appearanceBox;
|
||||
MyGUI::ListPtr raceList;
|
||||
MyGUI::HScrollPtr headRotate;
|
||||
|
|
|
@ -14,16 +14,11 @@ using namespace Widgets;
|
|||
const int ReviewDialog::lineHeight = 18;
|
||||
|
||||
ReviewDialog::ReviewDialog(MWWorld::Environment& environment)
|
||||
: Layout("openmw_chargen_review_layout.xml")
|
||||
, environment(environment)
|
||||
: WindowBase("openmw_chargen_review_layout.xml", environment)
|
||||
, lastPos(0)
|
||||
{
|
||||
// Centre dialog
|
||||
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
|
||||
MyGUI::IntCoord coord = mMainWidget->getCoord();
|
||||
coord.left = (gameWindowSize.width - coord.width)/2;
|
||||
coord.top = (gameWindowSize.height - coord.height)/2;
|
||||
mMainWidget->setCoord(coord);
|
||||
center();
|
||||
|
||||
WindowManager *wm = environment.mWindowManager;
|
||||
|
||||
|
@ -85,7 +80,7 @@ ReviewDialog::ReviewDialog(MWWorld::Environment& environment)
|
|||
for (int i = 0; i < ESM::Skill::Length; ++i)
|
||||
{
|
||||
skillValues.insert(std::pair<int, MWMechanics::Stat<float> >(i, MWMechanics::Stat<float>()));
|
||||
skillWidgetMap.insert(std::pair<int, MyGUI::WidgetPtr>(i, nullptr));
|
||||
skillWidgetMap.insert(std::pair<int, MyGUI::StaticTextPtr>(i, nullptr));
|
||||
}
|
||||
|
||||
static_cast<MyGUI::WindowPtr>(mMainWidget)->eventWindowChangeCoord = MyGUI::newDelegate(this, &ReviewDialog::onWindowResize);
|
||||
|
@ -180,7 +175,7 @@ void ReviewDialog::setAttribute(ESM::Attribute::AttributeID attributeId, const M
|
|||
void ReviewDialog::setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::Stat<float>& value)
|
||||
{
|
||||
skillValues[skillId] = value;
|
||||
MyGUI::WidgetPtr widget = skillWidgetMap[skillId];
|
||||
MyGUI::StaticTextPtr widget = skillWidgetMap[skillId];
|
||||
if (widget)
|
||||
{
|
||||
float modified = value.getModified(), base = value.getBase();
|
||||
|
@ -214,7 +209,7 @@ void ReviewDialog::configureSkills(const std::vector<int>& major, const std::vec
|
|||
}
|
||||
}
|
||||
|
||||
void ReviewDialog::setStyledText(MyGUI::WidgetPtr widget, ColorStyle style, const std::string &value)
|
||||
void ReviewDialog::setStyledText(MyGUI::StaticTextPtr widget, ColorStyle style, const std::string &value)
|
||||
{
|
||||
widget->setCaption(value);
|
||||
if (style == CS_Super)
|
||||
|
@ -244,7 +239,7 @@ void ReviewDialog::addGroup(const std::string &label, MyGUI::IntCoord &coord1, M
|
|||
coord2.top += lineHeight;
|
||||
}
|
||||
|
||||
MyGUI::WidgetPtr ReviewDialog::addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
||||
MyGUI::StaticTextPtr ReviewDialog::addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
||||
{
|
||||
MyGUI::StaticTextPtr skillNameWidget, skillValueWidget;
|
||||
|
||||
|
@ -279,8 +274,6 @@ void ReviewDialog::addItem(const std::string text, MyGUI::IntCoord &coord1, MyGU
|
|||
void ReviewDialog::addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
||||
{
|
||||
WindowManager *wm = environment.mWindowManager;
|
||||
MWMechanics::MechanicsManager *mm = environment.mMechanicsManager;
|
||||
ESMS::ESMStore &store = environment.mWorld->getStore();
|
||||
|
||||
// Add a line separator if there are items above
|
||||
if (!skillWidgets.empty())
|
||||
|
@ -307,7 +300,7 @@ void ReviewDialog::addSkills(const SkillList &skills, const std::string &titleId
|
|||
style = CS_Super;
|
||||
else if (modified < base)
|
||||
style = CS_Sub;
|
||||
MyGUI::WidgetPtr widget = addValueItem(wm->getGameSettingString(skillNameId, skillNameId), boost::lexical_cast<std::string>(static_cast<int>(modified)), style, coord1, coord2);
|
||||
MyGUI::StaticTextPtr widget = addValueItem(wm->getGameSettingString(skillNameId, skillNameId), boost::lexical_cast<std::string>(static_cast<int>(modified)), style, coord1, coord2);
|
||||
skillWidgetMap[skillId] = widget;
|
||||
}
|
||||
}
|
||||
|
@ -333,9 +326,6 @@ void ReviewDialog::updateSkillArea()
|
|||
if (!miscSkills.empty())
|
||||
addSkills(miscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2);
|
||||
|
||||
WindowManager *wm = environment.mWindowManager;
|
||||
ESMS::ESMStore &store = environment.mWorld->getStore();
|
||||
|
||||
clientHeight = coord1.top;
|
||||
updateScroller();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#ifndef MWGUI_REVIEW_H
|
||||
#define MWGUI_REVIEW_H
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include <openengine/gui/layout.hpp>
|
||||
#include "window_base.hpp"
|
||||
#include "../mwmechanics/stat.hpp"
|
||||
#include "widgets.hpp"
|
||||
|
||||
|
@ -20,7 +19,7 @@ namespace MWGui
|
|||
{
|
||||
using namespace MyGUI;
|
||||
|
||||
class ReviewDialog : public OEngine::GUI::Layout
|
||||
class ReviewDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
typedef std::vector<int> SkillList;
|
||||
|
@ -92,11 +91,11 @@ namespace MWGui
|
|||
CS_Normal,
|
||||
CS_Super
|
||||
};
|
||||
void setStyledText(MyGUI::WidgetPtr widget, ColorStyle style, const std::string &value);
|
||||
void setStyledText(MyGUI::StaticTextPtr widget, ColorStyle style, const std::string &value);
|
||||
void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
MyGUI::WidgetPtr addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
MyGUI::StaticTextPtr addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
void addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
void updateScroller();
|
||||
void updateSkillArea();
|
||||
|
@ -106,7 +105,6 @@ namespace MWGui
|
|||
|
||||
static const int lineHeight;
|
||||
|
||||
MWWorld::Environment& environment;
|
||||
MyGUI::StaticTextPtr nameWidget, raceWidget, classWidget, birthSignWidget;
|
||||
MyGUI::WidgetPtr skillAreaWidget, skillClientWidget;
|
||||
MyGUI::VScrollPtr skillScrollerWidget;
|
||||
|
@ -118,7 +116,7 @@ namespace MWGui
|
|||
|
||||
SkillList majorSkills, minorSkills, miscSkills;
|
||||
std::map<int, MWMechanics::Stat<float> > skillValues;
|
||||
std::map<int, MyGUI::WidgetPtr> skillWidgetMap;
|
||||
std::map<int, MyGUI::StaticTextPtr> skillWidgetMap;
|
||||
std::string name, raceId, birthSignId;
|
||||
ESM::Class klass;
|
||||
std::vector<MyGUI::WidgetPtr> skillWidgets; //< Skills and other information
|
||||
|
|
|
@ -6,15 +6,10 @@
|
|||
using namespace MWGui;
|
||||
|
||||
TextInputDialog::TextInputDialog(MWWorld::Environment& environment)
|
||||
: Layout("openmw_text_input_layout.xml")
|
||||
, environment(environment)
|
||||
: WindowBase("openmw_text_input_layout.xml", environment)
|
||||
{
|
||||
// Centre dialog
|
||||
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
|
||||
MyGUI::IntCoord coord = mMainWidget->getCoord();
|
||||
coord.left = (gameWindowSize.width - coord.width)/2;
|
||||
coord.top = (gameWindowSize.height - coord.height)/2;
|
||||
mMainWidget->setCoord(coord);
|
||||
center();
|
||||
|
||||
getWidget(textEdit, "TextEdit");
|
||||
textEdit->eventEditSelectAccept = newDelegate(this, &TextInputDialog::onTextAccepted);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef MWGUI_TEXT_INPUT_H
|
||||
#define MWGUI_TEXT_INPUT_H
|
||||
|
||||
#include <openengine/gui/layout.hpp>
|
||||
#include "window_base.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ namespace MWGui
|
|||
{
|
||||
using namespace MyGUI;
|
||||
|
||||
class TextInputDialog : public OEngine::GUI::Layout
|
||||
class TextInputDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
TextInputDialog(MWWorld::Environment& environment);
|
||||
|
@ -40,8 +40,6 @@ namespace MWGui
|
|||
void onTextAccepted(MyGUI::Edit* _sender);
|
||||
|
||||
private:
|
||||
MWWorld::Environment& environment;
|
||||
|
||||
MyGUI::EditPtr textEdit;
|
||||
};
|
||||
}
|
||||
|
|
25
apps/openmw/mwgui/window_base.cpp
Normal file
25
apps/openmw/mwgui/window_base.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include "window_base.hpp"
|
||||
#include "../mwworld/environment.hpp"
|
||||
#include "window_manager.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
WindowBase::WindowBase(const std::string& parLayout, MWWorld::Environment& parEnvironment)
|
||||
: Layout(parLayout)
|
||||
, environment(parEnvironment)
|
||||
{
|
||||
}
|
||||
|
||||
void WindowBase::open()
|
||||
{
|
||||
}
|
||||
|
||||
void WindowBase::center()
|
||||
{
|
||||
// Centre dialog
|
||||
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
|
||||
MyGUI::IntCoord coord = mMainWidget->getCoord();
|
||||
coord.left = (gameWindowSize.width - coord.width)/2;
|
||||
coord.top = (gameWindowSize.height - coord.height)/2;
|
||||
mMainWidget->setCoord(coord);
|
||||
}
|
27
apps/openmw/mwgui/window_base.hpp
Normal file
27
apps/openmw/mwgui/window_base.hpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef MWGUI_WINDOW_BASE_H
|
||||
#define MWGUI_WINDOW_BASE_H
|
||||
|
||||
#include <openengine/gui/layout.hpp>
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Environment;
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowBase: public OEngine::GUI::Layout
|
||||
{
|
||||
public:
|
||||
WindowBase(const std::string& parLayout, MWWorld::Environment& parEnvironment);
|
||||
|
||||
virtual void open();
|
||||
void center();
|
||||
|
||||
protected:
|
||||
MWWorld::Environment& environment;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -5,6 +5,8 @@
|
|||
#include "class.hpp"
|
||||
#include "birth.hpp"
|
||||
#include "review.hpp"
|
||||
#include "dialogue.hpp"
|
||||
#include "dialogue_history.hpp"
|
||||
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
|
@ -22,6 +24,7 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
|
|||
: environment(environment)
|
||||
, nameDialog(nullptr)
|
||||
, raceDialog(nullptr)
|
||||
, dialogueWindow(nullptr)
|
||||
, classChoiceDialog(nullptr)
|
||||
, generateClassQuestionDialog(nullptr)
|
||||
, generateClassResultDialog(nullptr)
|
||||
|
@ -41,6 +44,10 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
|
|||
, shown(GW_ALL)
|
||||
, allowed(newGame ? GW_None : GW_ALL)
|
||||
{
|
||||
|
||||
//Register own widgets with MyGUI
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<DialogeHistory>("Widget");
|
||||
|
||||
// Get size info from the Gui object
|
||||
assert(gui);
|
||||
int w = gui->getViewSize().width;
|
||||
|
@ -86,6 +93,7 @@ WindowManager::~WindowManager()
|
|||
|
||||
delete nameDialog;
|
||||
delete raceDialog;
|
||||
delete dialogueWindow;
|
||||
delete classChoiceDialog;
|
||||
delete generateClassQuestionDialog;
|
||||
delete generateClassResultDialog;
|
||||
|
@ -311,6 +319,17 @@ void WindowManager::updateVisible()
|
|||
return;
|
||||
}
|
||||
|
||||
if (mode == GM_Dialogue)
|
||||
{
|
||||
if (dialogueWindow)
|
||||
removeDialog(dialogueWindow);
|
||||
dialogueWindow = new DialogueWindow(environment);
|
||||
dialogueWindow->eventBye = MyGUI::newDelegate(this, &WindowManager::onDialogueWindowBye);
|
||||
dialogueWindow->open();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Unsupported mode, switch back to game
|
||||
// Note: The call will eventually end up this method again but
|
||||
// will stop at the check if(mode == GM_Game) above.
|
||||
|
@ -337,7 +356,7 @@ void WindowManager::setValue (const std::string& id, const MWMechanics::Stat<int
|
|||
ESM::Attribute::Personality,
|
||||
ESM::Attribute::Luck
|
||||
};
|
||||
for (int i = 0; i < sizeof(ids)/sizeof(ids[0]); ++i)
|
||||
for (size_t i = 0; i < sizeof(ids)/sizeof(ids[0]); ++i)
|
||||
{
|
||||
if (id != ids[i])
|
||||
continue;
|
||||
|
@ -380,7 +399,7 @@ void WindowManager::setValue (const std::string& id, const MWMechanics::Stat<flo
|
|||
{"SkillSpeechcraft", ESM::Skill::Speechcraft},
|
||||
{"SkillHandToHand", ESM::Skill::HandToHand},
|
||||
};
|
||||
for (int i = 0; i < sizeof(skillMap)/sizeof(skillMap[0]); ++i)
|
||||
for (size_t i = 0; i < sizeof(skillMap)/sizeof(skillMap[0]); ++i)
|
||||
{
|
||||
if (skillMap[i].id == id)
|
||||
{
|
||||
|
@ -526,6 +545,16 @@ void WindowManager::onRaceDialogDone()
|
|||
setGuiMode(GM_Game);
|
||||
}
|
||||
|
||||
void WindowManager::onDialogueWindowBye()
|
||||
{
|
||||
if (dialogueWindow)
|
||||
{
|
||||
//FIXME set some state and stuff?
|
||||
removeDialog(dialogueWindow);
|
||||
}
|
||||
setGuiMode(GM_Game);
|
||||
}
|
||||
|
||||
void WindowManager::onRaceDialogBack()
|
||||
{
|
||||
if (raceDialog)
|
||||
|
@ -775,7 +804,6 @@ void WindowManager::onClassQuestionChosen(MyGUI::Widget* _sender, int _index)
|
|||
|
||||
void WindowManager::onGenerateClassBack()
|
||||
{
|
||||
bool goNext = classChosen; // Go to next dialog if class was previously chosen
|
||||
classChosen = true;
|
||||
|
||||
if (generateClassResultDialog)
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace MWGui
|
|||
class TextInputDialog;
|
||||
class InfoBoxDialog;
|
||||
class RaceDialog;
|
||||
class DialogueWindow;
|
||||
class ClassChoiceDialog;
|
||||
class GenerateClassResultDialog;
|
||||
class PickClassDialog;
|
||||
|
@ -82,6 +83,7 @@ namespace MWGui
|
|||
// Character creation
|
||||
TextInputDialog *nameDialog;
|
||||
RaceDialog *raceDialog;
|
||||
DialogueWindow *dialogueWindow;
|
||||
ClassChoiceDialog *classChoiceDialog;
|
||||
InfoBoxDialog *generateClassQuestionDialog;
|
||||
GenerateClassResultDialog *generateClassResultDialog;
|
||||
|
@ -250,6 +252,9 @@ namespace MWGui
|
|||
const std::string &getGameSettingString(const std::string &id, const std::string &default_);
|
||||
|
||||
private:
|
||||
|
||||
void onDialogueWindowBye();
|
||||
|
||||
// Character generation: Name dialog
|
||||
void onNameDialogDone();
|
||||
|
||||
|
|
1
extern/mygui_3.0.1/CMakeLists.txt
vendored
1
extern/mygui_3.0.1/CMakeLists.txt
vendored
|
@ -53,6 +53,7 @@ configure_file("${SDIR}/openmw_chargen_select_skill_layout.xml" "${DDIR}/openmw_
|
|||
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_review_layout.xml" "${DDIR}/openmw_chargen_review_layout.xml" COPYONLY)
|
||||
configure_file("${SDIR}/openmw_dialogue_window_layout.xml" "${DDIR}/openmw_dialogue_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_mainmenu_layout.xml" "${DDIR}/openmw_mainmenu_layout.xml" COPYONLY)
|
||||
|
|
29
extern/mygui_3.0.1/openmw_resources/openmw_dialogue_window_layout.xml
vendored
Normal file
29
extern/mygui_3.0.1/openmw_resources/openmw_dialogue_window_layout.xml
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<MyGUI type="Layout">
|
||||
<Widget type="Window" skin="MW_Dialog" layer="Windows" position="0 0 588 433" name="_Main">
|
||||
<!-- HEADER -->
|
||||
<Widget type="StaticText" skin="HeaderText" position="0 0 588 18" name="NpcName" align="ALIGN_LEFT ALIGN_TOP">
|
||||
<Property key="Widget_Caption" value="Name"/>
|
||||
<Property key="Widget_AlignText" value="ALIGN_CENTER"/>
|
||||
</Widget>
|
||||
|
||||
<!-- The Dialogue history -->
|
||||
<Widget type="DialogeHistory" skin="MW_TextBoxEdit" position="8 39 400 375" name="History" align="ALIGN_LEFT ALIGN_TOP STRETCH">
|
||||
<Property key="Edit_Static" value="true"/>
|
||||
<Property key="Edit_WordWrap" value="true"/>
|
||||
<Property key="Text_FontHeight" value="18"/>
|
||||
<Property key="Edit_MultiLine" value="1" />
|
||||
<Property key="Edit_VisibleVScroll" value="1" />
|
||||
</Widget>
|
||||
|
||||
<!-- The list of topics -->
|
||||
<Widget type="List" skin="MW_List" position="432 39 132 341" name="TopicsList">
|
||||
</Widget>
|
||||
|
||||
<!-- The Goodbye button -->
|
||||
<Widget type="Button" skin="MW_Button" position="432 387 132 23" name="ByeButton">
|
||||
<Property key="Widget_Caption" value="Goodbye"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
</MyGUI>
|
Loading…
Reference in a new issue