mirror of
https://github.com/OpenMW/openmw.git
synced 2025-10-25 02:26:42 +00:00
Update 2 files
- /apps/openmw/mwgui/spellcreationdialog.cpp - /apps/openmw/mwgui/spellcreationdialog.hpp
This commit is contained in:
parent
2d2df30f80
commit
190a1266a1
2 changed files with 947 additions and 947 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,185 +1,185 @@
|
||||||
#ifndef MWGUI_SPELLCREATION_H
|
#ifndef MWGUI_SPELLCREATION_H
|
||||||
#define MWGUI_SPELLCREATION_H
|
#define MWGUI_SPELLCREATION_H
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <components/esm3/loadmgef.hpp>
|
#include <components/esm3/loadmgef.hpp>
|
||||||
#include <components/esm3/loadspel.hpp>
|
#include <components/esm3/loadspel.hpp>
|
||||||
|
|
||||||
#include "referenceinterface.hpp"
|
#include "referenceinterface.hpp"
|
||||||
#include "windowbase.hpp"
|
#include "windowbase.hpp"
|
||||||
|
|
||||||
namespace Gui
|
namespace Gui
|
||||||
{
|
{
|
||||||
class MWList;
|
class MWList;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
||||||
class SelectSkillDialog;
|
class SelectSkillDialog;
|
||||||
class SelectAttributeDialog;
|
class SelectAttributeDialog;
|
||||||
|
|
||||||
class EditEffectDialog : public WindowModal
|
class EditEffectDialog : public WindowModal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EditEffectDialog();
|
EditEffectDialog();
|
||||||
|
|
||||||
void onOpen() override;
|
void onOpen() override;
|
||||||
bool exit() override;
|
bool exit() override;
|
||||||
|
|
||||||
void setConstantEffect(bool constant);
|
void setConstantEffect(bool constant);
|
||||||
|
|
||||||
void setSkill(ESM::RefId skill);
|
void setSkill(ESM::RefId skill);
|
||||||
void setAttribute(ESM::RefId attribute);
|
void setAttribute(ESM::RefId attribute);
|
||||||
|
|
||||||
void newEffect(const ESM::MagicEffect* effect);
|
void newEffect(const ESM::MagicEffect* effect);
|
||||||
void editEffect(ESM::ENAMstruct effect);
|
void editEffect(ESM::ENAMstruct effect);
|
||||||
typedef MyGUI::delegates::MultiDelegate<ESM::ENAMstruct> EventHandle_Effect;
|
typedef MyGUI::delegates::MultiDelegate<ESM::ENAMstruct> EventHandle_Effect;
|
||||||
|
|
||||||
EventHandle_Effect eventEffectAdded;
|
EventHandle_Effect eventEffectAdded;
|
||||||
EventHandle_Effect eventEffectModified;
|
EventHandle_Effect eventEffectModified;
|
||||||
EventHandle_Effect eventEffectRemoved;
|
EventHandle_Effect eventEffectRemoved;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MyGUI::Button* mCancelButton;
|
MyGUI::Button* mCancelButton;
|
||||||
MyGUI::Button* mOkButton;
|
MyGUI::Button* mOkButton;
|
||||||
MyGUI::Button* mDeleteButton;
|
MyGUI::Button* mDeleteButton;
|
||||||
|
|
||||||
MyGUI::Button* mRangeButton;
|
MyGUI::Button* mRangeButton;
|
||||||
|
|
||||||
MyGUI::Widget* mDurationBox;
|
MyGUI::Widget* mDurationBox;
|
||||||
MyGUI::Widget* mMagnitudeBox;
|
MyGUI::Widget* mMagnitudeBox;
|
||||||
MyGUI::Widget* mAreaBox;
|
MyGUI::Widget* mAreaBox;
|
||||||
|
|
||||||
MyGUI::TextBox* mMagnitudeMinValue;
|
MyGUI::TextBox* mMagnitudeMinValue;
|
||||||
MyGUI::TextBox* mMagnitudeMaxValue;
|
MyGUI::TextBox* mMagnitudeMaxValue;
|
||||||
MyGUI::TextBox* mDurationValue;
|
MyGUI::TextBox* mDurationValue;
|
||||||
MyGUI::TextBox* mAreaValue;
|
MyGUI::TextBox* mAreaValue;
|
||||||
|
|
||||||
MyGUI::ScrollBar* mMagnitudeMinSlider;
|
MyGUI::ScrollBar* mMagnitudeMinSlider;
|
||||||
MyGUI::ScrollBar* mMagnitudeMaxSlider;
|
MyGUI::ScrollBar* mMagnitudeMaxSlider;
|
||||||
MyGUI::ScrollBar* mDurationSlider;
|
MyGUI::ScrollBar* mDurationSlider;
|
||||||
MyGUI::ScrollBar* mAreaSlider;
|
MyGUI::ScrollBar* mAreaSlider;
|
||||||
|
|
||||||
MyGUI::TextBox* mAreaText;
|
MyGUI::TextBox* mAreaText;
|
||||||
|
|
||||||
MyGUI::ImageBox* mEffectImage;
|
MyGUI::ImageBox* mEffectImage;
|
||||||
MyGUI::TextBox* mEffectName;
|
MyGUI::TextBox* mEffectName;
|
||||||
|
|
||||||
bool mEditing;
|
bool mEditing;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onRangeButtonClicked(MyGUI::Widget* sender);
|
void onRangeButtonClicked(MyGUI::Widget* sender);
|
||||||
void onDeleteButtonClicked(MyGUI::Widget* sender);
|
void onDeleteButtonClicked(MyGUI::Widget* sender);
|
||||||
void onOkButtonClicked(MyGUI::Widget* sender);
|
void onOkButtonClicked(MyGUI::Widget* sender);
|
||||||
void onCancelButtonClicked(MyGUI::Widget* sender);
|
void onCancelButtonClicked(MyGUI::Widget* sender);
|
||||||
|
|
||||||
void onMagnitudeMinChanged(MyGUI::ScrollBar* sender, size_t pos);
|
void onMagnitudeMinChanged(MyGUI::ScrollBar* sender, size_t pos);
|
||||||
void onMagnitudeMaxChanged(MyGUI::ScrollBar* sender, size_t pos);
|
void onMagnitudeMaxChanged(MyGUI::ScrollBar* sender, size_t pos);
|
||||||
void onDurationChanged(MyGUI::ScrollBar* sender, size_t pos);
|
void onDurationChanged(MyGUI::ScrollBar* sender, size_t pos);
|
||||||
void onAreaChanged(MyGUI::ScrollBar* sender, size_t pos);
|
void onAreaChanged(MyGUI::ScrollBar* sender, size_t pos);
|
||||||
void setMagicEffect(const ESM::MagicEffect* effect);
|
void setMagicEffect(const ESM::MagicEffect* effect);
|
||||||
|
|
||||||
void updateBoxes();
|
void updateBoxes();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ESM::ENAMstruct mEffect;
|
ESM::ENAMstruct mEffect;
|
||||||
ESM::ENAMstruct mOldEffect;
|
ESM::ENAMstruct mOldEffect;
|
||||||
|
|
||||||
const ESM::MagicEffect* mMagicEffect;
|
const ESM::MagicEffect* mMagicEffect;
|
||||||
|
|
||||||
bool mConstantEffect;
|
bool mConstantEffect;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EffectEditorBase
|
class EffectEditorBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Type
|
enum Type
|
||||||
{
|
{
|
||||||
Spellmaking,
|
Spellmaking,
|
||||||
Enchanting
|
Enchanting
|
||||||
};
|
};
|
||||||
|
|
||||||
EffectEditorBase(Type type);
|
EffectEditorBase(Type type);
|
||||||
virtual ~EffectEditorBase();
|
virtual ~EffectEditorBase();
|
||||||
|
|
||||||
void setConstantEffect(bool constant);
|
void setConstantEffect(bool constant);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::map<int, short> mButtonMapping; // maps button ID to effect ID
|
std::map<int, short> mButtonMapping; // maps button ID to effect ID
|
||||||
|
|
||||||
Gui::MWList* mAvailableEffectsList;
|
Gui::MWList* mAvailableEffectsList;
|
||||||
MyGUI::ScrollView* mUsedEffectsView;
|
MyGUI::ScrollView* mUsedEffectsView;
|
||||||
|
|
||||||
EditEffectDialog mAddEffectDialog;
|
EditEffectDialog mAddEffectDialog;
|
||||||
std::unique_ptr<SelectAttributeDialog> mSelectAttributeDialog;
|
std::unique_ptr<SelectAttributeDialog> mSelectAttributeDialog;
|
||||||
std::unique_ptr<SelectSkillDialog> mSelectSkillDialog;
|
std::unique_ptr<SelectSkillDialog> mSelectSkillDialog;
|
||||||
|
|
||||||
int mSelectedEffect;
|
int mSelectedEffect;
|
||||||
short mSelectedKnownEffectId;
|
short mSelectedKnownEffectId;
|
||||||
|
|
||||||
bool mConstantEffect;
|
bool mConstantEffect;
|
||||||
|
|
||||||
std::vector<ESM::ENAMstruct> mEffects;
|
std::vector<ESM::ENAMstruct> mEffects;
|
||||||
|
|
||||||
void onEffectAdded(ESM::ENAMstruct effect);
|
void onEffectAdded(ESM::ENAMstruct effect);
|
||||||
void onEffectModified(ESM::ENAMstruct effect);
|
void onEffectModified(ESM::ENAMstruct effect);
|
||||||
void onEffectRemoved(ESM::ENAMstruct effect);
|
void onEffectRemoved(ESM::ENAMstruct effect);
|
||||||
|
|
||||||
void onAvailableEffectClicked(MyGUI::Widget* sender);
|
void onAvailableEffectClicked(MyGUI::Widget* sender);
|
||||||
|
|
||||||
void onAttributeOrSkillCancel();
|
void onAttributeOrSkillCancel();
|
||||||
void onSelectAttribute();
|
void onSelectAttribute();
|
||||||
void onSelectSkill();
|
void onSelectSkill();
|
||||||
|
|
||||||
void onEditEffect(MyGUI::Widget* sender);
|
void onEditEffect(MyGUI::Widget* sender);
|
||||||
|
|
||||||
void updateEffectsView();
|
void updateEffectsView();
|
||||||
|
|
||||||
void startEditing();
|
void startEditing();
|
||||||
void setWidgets(Gui::MWList* availableEffectsList, MyGUI::ScrollView* usedEffectsView);
|
void setWidgets(Gui::MWList* availableEffectsList, MyGUI::ScrollView* usedEffectsView);
|
||||||
|
|
||||||
virtual void notifyEffectsChanged() {}
|
virtual void notifyEffectsChanged() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Type mType;
|
Type mType;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SpellCreationDialog : public WindowBase, public ReferenceInterface, public EffectEditorBase
|
class SpellCreationDialog : public WindowBase, public ReferenceInterface, public EffectEditorBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SpellCreationDialog();
|
SpellCreationDialog();
|
||||||
|
|
||||||
void onOpen() override;
|
void onOpen() override;
|
||||||
void clear() override { resetReference(); }
|
void clear() override { resetReference(); }
|
||||||
|
|
||||||
void onFrame(float dt) override { checkReferenceAvailable(); }
|
void onFrame(float dt) override { checkReferenceAvailable(); }
|
||||||
|
|
||||||
void setPtr(const MWWorld::Ptr& actor) override;
|
void setPtr(const MWWorld::Ptr& actor) override;
|
||||||
|
|
||||||
std::string_view getWindowIdForLua() const override { return "SpellCreationDialog"; }
|
std::string_view getWindowIdForLua() const override { return "SpellCreationDialog"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onReferenceUnavailable() override;
|
void onReferenceUnavailable() override;
|
||||||
|
|
||||||
void onCancelButtonClicked(MyGUI::Widget* sender);
|
void onCancelButtonClicked(MyGUI::Widget* sender);
|
||||||
void onBuyButtonClicked(MyGUI::Widget* sender);
|
void onBuyButtonClicked(MyGUI::Widget* sender);
|
||||||
void onAccept(MyGUI::EditBox* sender);
|
void onAccept(MyGUI::EditBox* sender);
|
||||||
|
|
||||||
void notifyEffectsChanged() override;
|
void notifyEffectsChanged() override;
|
||||||
|
|
||||||
MyGUI::EditBox* mNameEdit;
|
MyGUI::EditBox* mNameEdit;
|
||||||
MyGUI::TextBox* mMagickaCost;
|
MyGUI::TextBox* mMagickaCost;
|
||||||
MyGUI::TextBox* mSuccessChance;
|
MyGUI::TextBox* mSuccessChance;
|
||||||
MyGUI::Button* mBuyButton;
|
MyGUI::Button* mBuyButton;
|
||||||
MyGUI::Button* mCancelButton;
|
MyGUI::Button* mCancelButton;
|
||||||
MyGUI::TextBox* mPriceLabel;
|
MyGUI::TextBox* mPriceLabel;
|
||||||
MyGUI::TextBox* mPlayerGold;
|
MyGUI::TextBox* mPlayerGold;
|
||||||
|
|
||||||
ESM::Spell mSpell;
|
ESM::Spell mSpell;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue