mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:53:50 +00:00
adding widget MWEnchantment
This commit is contained in:
parent
d568b27b92
commit
c7381d4491
2 changed files with 72 additions and 1 deletions
|
@ -264,6 +264,50 @@ MWSpell::~MWSpell()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* MWEnchantment */
|
||||||
|
|
||||||
|
MWEnchantment::MWEnchantment()
|
||||||
|
: mWindowManager(nullptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWEnchantment::setEnchantmentId(const std::string &enchantId)
|
||||||
|
{
|
||||||
|
id = enchantId;
|
||||||
|
updateWidgets();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWEnchantment::createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI::WidgetPtr creator, MyGUI::IntCoord &coord)
|
||||||
|
{
|
||||||
|
const ESMS::ESMStore &store = mWindowManager->getStore();
|
||||||
|
const ESM::Enchantment *enchant = store.enchants.search(id);
|
||||||
|
MYGUI_ASSERT(enchant, "enchantment with id '" << id << "' not found");
|
||||||
|
|
||||||
|
MWSpellEffectPtr effect = nullptr;
|
||||||
|
std::vector<ESM::ENAMstruct>::const_iterator end = enchant->effects.list.end();
|
||||||
|
for (std::vector<ESM::ENAMstruct>::const_iterator it = enchant->effects.list.begin(); it != end; ++it)
|
||||||
|
{
|
||||||
|
effect = creator->createWidget<MWSpellEffect>("MW_EffectImage", coord, MyGUI::Align::Default);
|
||||||
|
effect->setWindowManager(mWindowManager);
|
||||||
|
effect->setSpellEffect(*it);
|
||||||
|
effects.push_back(effect);
|
||||||
|
coord.top += effect->getHeight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWEnchantment::updateWidgets()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MWEnchantment::initialiseOverride()
|
||||||
|
{
|
||||||
|
Base::initialiseOverride();
|
||||||
|
}
|
||||||
|
|
||||||
|
MWEnchantment::~MWEnchantment()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/* MWSpellEffect */
|
/* MWSpellEffect */
|
||||||
|
|
||||||
MWSpellEffect::MWSpellEffect()
|
MWSpellEffect::MWSpellEffect()
|
||||||
|
|
|
@ -126,7 +126,7 @@ namespace MWGui
|
||||||
protected:
|
protected:
|
||||||
virtual ~MWSpell();
|
virtual ~MWSpell();
|
||||||
|
|
||||||
virtual void initialiseOverride();
|
virtual void initialiseOverride();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateWidgets();
|
void updateWidgets();
|
||||||
|
@ -137,6 +137,33 @@ namespace MWGui
|
||||||
};
|
};
|
||||||
typedef MWSpell* MWSpellPtr;
|
typedef MWSpell* MWSpellPtr;
|
||||||
|
|
||||||
|
class MYGUI_EXPORT MWEnchantment : public Widget
|
||||||
|
{
|
||||||
|
MYGUI_RTTI_DERIVED( MWEnchantment );
|
||||||
|
public:
|
||||||
|
MWEnchantment();
|
||||||
|
|
||||||
|
typedef MWMechanics::Stat<int> EnchantmentValue;
|
||||||
|
|
||||||
|
void setWindowManager(WindowManager* parWindowManager) { mWindowManager = parWindowManager; }
|
||||||
|
void setEnchantmentId(const std::string &enchantId);
|
||||||
|
void createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI::WidgetPtr creator, MyGUI::IntCoord &coord);
|
||||||
|
|
||||||
|
const std::string &getSpellId() const { return id; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual ~MWEnchantment();
|
||||||
|
|
||||||
|
virtual void initialiseOverride();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateWidgets();
|
||||||
|
|
||||||
|
WindowManager* mWindowManager;
|
||||||
|
std::string id;
|
||||||
|
};
|
||||||
|
typedef MWEnchantment* MWEnchantmentPtr;
|
||||||
|
|
||||||
class MYGUI_EXPORT MWSpellEffect : public Widget
|
class MYGUI_EXPORT MWSpellEffect : public Widget
|
||||||
{
|
{
|
||||||
MYGUI_RTTI_DERIVED( MWSpellEffect );
|
MYGUI_RTTI_DERIVED( MWSpellEffect );
|
||||||
|
|
Loading…
Reference in a new issue