forked from mirror/openmw-tes3mp
Renamed SpellBuyingWindow, took some suggestions from scrawl
This commit is contained in:
parent
d1cae132aa
commit
08410b9062
11 changed files with 76 additions and 150 deletions
|
@ -29,7 +29,7 @@ add_openmw_dir (mwgui
|
||||||
map_window window_pinnable_base cursorreplace tooltips scrollwindow bookwindow list
|
map_window window_pinnable_base cursorreplace tooltips scrollwindow bookwindow list
|
||||||
formatting inventorywindow container hud countdialog tradewindow settingswindow
|
formatting inventorywindow container hud countdialog tradewindow settingswindow
|
||||||
confirmationdialog alchemywindow referenceinterface spellwindow mainmenu quickkeysmenu
|
confirmationdialog alchemywindow referenceinterface spellwindow mainmenu quickkeysmenu
|
||||||
itemselection spellswindow
|
itemselection spellbuyingwindow
|
||||||
)
|
)
|
||||||
|
|
||||||
add_openmw_dir (mwdialogue
|
add_openmw_dir (mwdialogue
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace MWGui
|
||||||
class Console;
|
class Console;
|
||||||
class SpellWindow;
|
class SpellWindow;
|
||||||
class TradeWindow;
|
class TradeWindow;
|
||||||
class SpellsWindow;
|
class SpellBuyingWindow;
|
||||||
class ConfirmationDialog;
|
class ConfirmationDialog;
|
||||||
class CountDialog;
|
class CountDialog;
|
||||||
class ScrollWindow;
|
class ScrollWindow;
|
||||||
|
@ -107,7 +107,7 @@ namespace MWBase
|
||||||
virtual MWGui::CountDialog* getCountDialog() = 0;
|
virtual MWGui::CountDialog* getCountDialog() = 0;
|
||||||
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
|
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
|
||||||
virtual MWGui::TradeWindow* getTradeWindow() = 0;
|
virtual MWGui::TradeWindow* getTradeWindow() = 0;
|
||||||
virtual MWGui::SpellsWindow* getSpellsWindow() = 0;
|
virtual MWGui::SpellBuyingWindow* getSpellBuyingWindow() = 0;
|
||||||
virtual MWGui::SpellWindow* getSpellWindow() = 0;
|
virtual MWGui::SpellWindow* getSpellWindow() = 0;
|
||||||
virtual MWGui::Console* getConsole() = 0;
|
virtual MWGui::Console* getConsole() = 0;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "widgets.hpp"
|
#include "widgets.hpp"
|
||||||
#include "list.hpp"
|
#include "list.hpp"
|
||||||
#include "tradewindow.hpp"
|
#include "tradewindow.hpp"
|
||||||
#include "spellswindow.hpp"
|
#include "spellbuyingwindow.hpp"
|
||||||
#include "inventorywindow.hpp"
|
#include "inventorywindow.hpp"
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
@ -131,8 +131,8 @@ void DialogueWindow::onSelectTopic(std::string topic)
|
||||||
}
|
}
|
||||||
else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sSpells")->str)
|
else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sSpells")->str)
|
||||||
{
|
{
|
||||||
mWindowManager.pushGuiMode(GM_Spells);
|
mWindowManager.pushGuiMode(GM_SpellBuying);
|
||||||
mWindowManager.getSpellsWindow()->startSpells(mPtr);
|
mWindowManager.getSpellBuyingWindow()->startSpellBuying(mPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace MWGui
|
||||||
GM_Dialogue, // NPC interaction
|
GM_Dialogue, // NPC interaction
|
||||||
GM_Barter,
|
GM_Barter,
|
||||||
GM_Rest,
|
GM_Rest,
|
||||||
GM_Spells,
|
GM_SpellBuying,
|
||||||
|
|
||||||
// Startup character creation dialogs
|
// Startup character creation dialogs
|
||||||
GM_Name,
|
GM_Name,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "spellswindow.hpp"
|
#include "spellbuyingwindow.hpp"
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
@ -18,19 +18,16 @@
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
const int SpellsWindow::sLineHeight = 18;
|
const int SpellBuyingWindow::sLineHeight = 18;
|
||||||
|
|
||||||
SpellsWindow::SpellsWindow(MWBase::WindowManager& parWindowManager) :
|
SpellBuyingWindow::SpellBuyingWindow(MWBase::WindowManager& parWindowManager) :
|
||||||
WindowBase("openmw_spells_window.layout", parWindowManager)
|
WindowBase("openmw_spells_window.layout", parWindowManager)
|
||||||
, ContainerBase(NULL) // no drag&drop
|
, ContainerBase(NULL) // no drag&drop
|
||||||
, mSpellsWidgetMap()
|
, mSpellsWidgetMap()
|
||||||
, mCurrentY(0)
|
, mCurrentY(0)
|
||||||
, mLastPos(0)
|
, mLastPos(0)
|
||||||
, mSpellsWidgets()
|
|
||||||
, mSpellsPriceMap()
|
|
||||||
{
|
{
|
||||||
setCoord(0, 0, 450, 300);
|
setCoord(0, 0, 450, 300);
|
||||||
center();
|
|
||||||
|
|
||||||
getWidget(mCancelButton, "CancelButton");
|
getWidget(mCancelButton, "CancelButton");
|
||||||
getWidget(mPlayerGold, "PlayerGold");
|
getWidget(mPlayerGold, "PlayerGold");
|
||||||
|
@ -40,11 +37,11 @@ namespace MWGui
|
||||||
getWidget(mSpellsClientWidget, "SpellsClient");
|
getWidget(mSpellsClientWidget, "SpellsClient");
|
||||||
getWidget(mSpellsScrollerWidget, "SpellsScroller");
|
getWidget(mSpellsScrollerWidget, "SpellsScroller");
|
||||||
|
|
||||||
mSpellsClientWidget->eventMouseWheel += MyGUI::newDelegate(this, &SpellsWindow::onMouseWheel);
|
mSpellsClientWidget->eventMouseWheel += MyGUI::newDelegate(this, &SpellBuyingWindow::onMouseWheel);
|
||||||
|
|
||||||
mSpellsScrollerWidget->eventScrollChangePosition += MyGUI::newDelegate(this, &SpellsWindow::onScrollChangePosition);
|
mSpellsScrollerWidget->eventScrollChangePosition += MyGUI::newDelegate(this, &SpellBuyingWindow::onScrollChangePosition);
|
||||||
|
|
||||||
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellsWindow::onCancelButtonClicked);
|
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellBuyingWindow::onCancelButtonClicked);
|
||||||
|
|
||||||
int cancelButtonWidth = mCancelButton->getTextSize().width + 24;
|
int cancelButtonWidth = mCancelButton->getTextSize().width + 24;
|
||||||
mCancelButton->setCoord(430-cancelButtonWidth,
|
mCancelButton->setCoord(430-cancelButtonWidth,
|
||||||
|
@ -59,71 +56,40 @@ namespace MWGui
|
||||||
mSelect->getTop(),
|
mSelect->getTop(),
|
||||||
mSelect->getTextSize().width,
|
mSelect->getTextSize().width,
|
||||||
mSelect->getHeight());
|
mSelect->getHeight());
|
||||||
|
|
||||||
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &SpellsWindow::onWindowResize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellsWindow::addSpell(std::string spellID)
|
void SpellBuyingWindow::addSpell(std::string spellID)
|
||||||
{
|
{
|
||||||
MyGUI::Button* toAdd;
|
MyGUI::Button* toAdd;
|
||||||
|
|
||||||
toAdd = mSpellsClientWidget->createWidget<MyGUI::Button>("SandText", 0, mCurrentY, 200, sLineHeight, MyGUI::Align::Default);
|
|
||||||
mCurrentY += sLineHeight;
|
|
||||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellID);
|
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellID);
|
||||||
/// \todo price adjustment depending on merchantile skill
|
|
||||||
int price = spell->data.cost*MWBase::Environment::get().getWorld()->getStore().gameSettings.search("fSpellValueMult")->f;
|
int price = spell->data.cost*MWBase::Environment::get().getWorld()->getStore().gameSettings.search("fSpellValueMult")->f;
|
||||||
mSpellsPriceMap.insert(std::pair<const ESM::Spell*, int>(spell,price));
|
toAdd = mSpellsClientWidget->createWidget<MyGUI::Button>((price>mWindowManager.getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SpellText", 0, mCurrentY, 200, sLineHeight, MyGUI::Align::Default);
|
||||||
if (price>mWindowManager.getInventoryWindow()->getPlayerGold())
|
mCurrentY += sLineHeight;
|
||||||
toAdd->setCaption("#A3997B" + spell->name+" - "+boost::lexical_cast<std::string>(price)+MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sgp")->str);
|
/// \todo price adjustment depending on merchantile skill
|
||||||
else
|
toAdd->setUserData(price);
|
||||||
toAdd->setCaption(spell->name+" - "+boost::lexical_cast<std::string>(price)+MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sgp")->str);
|
toAdd->setCaption(spell->name+" - "+boost::lexical_cast<std::string>(price)+MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sgp")->str);
|
||||||
toAdd->setSize(toAdd->getTextSize().width,sLineHeight);
|
toAdd->setSize(toAdd->getTextSize().width,sLineHeight);
|
||||||
toAdd->eventMouseWheel += MyGUI::newDelegate(this, &SpellsWindow::onMouseWheel);
|
toAdd->eventMouseWheel += MyGUI::newDelegate(this, &SpellBuyingWindow::onMouseWheel);
|
||||||
toAdd->setUserString("ToolTipType", "Spell");
|
toAdd->setUserString("ToolTipType", "Spell");
|
||||||
toAdd->setUserString("Spell", spellID);
|
toAdd->setUserString("Spell", spellID);
|
||||||
toAdd->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellsWindow::onSpellButtonClick);
|
toAdd->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellBuyingWindow::onSpellButtonClick);
|
||||||
toAdd->eventMouseSetFocus += MyGUI::newDelegate(this, &SpellsWindow::onFocus);
|
|
||||||
toAdd->eventMouseLostFocus += MyGUI::newDelegate(this, &SpellsWindow::onFocusLost);
|
|
||||||
mSpellsWidgets.push_back(toAdd);
|
|
||||||
mSpellsWidgetMap.insert(std::pair<MyGUI::Widget*, const ESM::Spell*>(toAdd,spell));
|
mSpellsWidgetMap.insert(std::pair<MyGUI::Widget*, const ESM::Spell*>(toAdd,spell));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellsWindow::onFocusLost(MyGUI::Widget* _sender, MyGUI::Widget* _old)
|
void SpellBuyingWindow::clearSpells()
|
||||||
{
|
|
||||||
updateLabels();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellsWindow::onFocus(MyGUI::Widget* _sender, MyGUI::Widget* _old)
|
|
||||||
{
|
|
||||||
updateLabels();
|
|
||||||
MyGUI::Button* toUpdate;
|
|
||||||
toUpdate = (MyGUI::Button*) _sender;
|
|
||||||
const ESM::Spell* spell = mSpellsWidgetMap.find(toUpdate)->second;
|
|
||||||
int price = mSpellsPriceMap.find(spell)->second;
|
|
||||||
if (price>mWindowManager.getInventoryWindow()->getPlayerGold())
|
|
||||||
toUpdate->setCaption("#A3997B" + spell->name+" - "+boost::lexical_cast<std::string>(price)+MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sgp")->str);
|
|
||||||
else
|
|
||||||
toUpdate->setCaption("#D8C09A" + spell->name+" - "+boost::lexical_cast<std::string>(price)+MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sgp")->str);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellsWindow::clearSpells()
|
|
||||||
{
|
{
|
||||||
mSpellsScrollerWidget->setScrollPosition(0);
|
mSpellsScrollerWidget->setScrollPosition(0);
|
||||||
onScrollChangePosition(mSpellsScrollerWidget, mSpellsScrollerWidget->getScrollPosition());
|
onScrollChangePosition(mSpellsScrollerWidget, mSpellsScrollerWidget->getScrollPosition());
|
||||||
mCurrentY = 0;
|
mCurrentY = 0;
|
||||||
mSpellsWidgets.clear();
|
while (mSpellsClientWidget->getChildCount())
|
||||||
while (mSpellsClientWidget->getChildCount()!=0)
|
MyGUI::Gui::getInstance().destroyWidget(mSpellsClientWidget->getChildAt(0));
|
||||||
{
|
|
||||||
MyGUI::Widget* toRemove;
|
|
||||||
toRemove = mSpellsClientWidget->getChildAt(0);
|
|
||||||
mSpellsClientWidget->_destroyChildWidget(toRemove);
|
|
||||||
}
|
|
||||||
mSpellsWidgetMap.clear();
|
mSpellsWidgetMap.clear();
|
||||||
mSpellsPriceMap.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellsWindow::startSpells(MWWorld::Ptr actor)
|
void SpellBuyingWindow::startSpellBuying(MWWorld::Ptr actor)
|
||||||
{
|
{
|
||||||
|
center();
|
||||||
|
mActor = actor;
|
||||||
clearSpells();
|
clearSpells();
|
||||||
|
|
||||||
if (actor.getTypeName() == typeid(ESM::NPC).name())
|
if (actor.getTypeName() == typeid(ESM::NPC).name())
|
||||||
|
@ -150,10 +116,10 @@ namespace MWGui
|
||||||
updateScroller();
|
updateScroller();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellsWindow::onSpellButtonClick(MyGUI::Widget* _sender)
|
void SpellBuyingWindow::onSpellButtonClick(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
const ESM::Spell* spell = mSpellsWidgetMap.find(_sender)->second;
|
const ESM::Spell* spell = mSpellsWidgetMap.find(_sender)->second;
|
||||||
int price = mSpellsPriceMap.find(spell)->second;
|
int price = *_sender->getUserData<int>();
|
||||||
|
|
||||||
if (mWindowManager.getInventoryWindow()->getPlayerGold()>=price)
|
if (mWindowManager.getInventoryWindow()->getPlayerGold()>=price)
|
||||||
{
|
{
|
||||||
|
@ -162,48 +128,19 @@ namespace MWGui
|
||||||
MWMechanics::Spells& spells = stats.getSpells();
|
MWMechanics::Spells& spells = stats.getSpells();
|
||||||
spells.add(spell->name);
|
spells.add(spell->name);
|
||||||
mWindowManager.getTradeWindow()->addOrRemoveGold(-price);
|
mWindowManager.getTradeWindow()->addOrRemoveGold(-price);
|
||||||
mSpellsWidgetMap.erase(_sender);
|
|
||||||
mSpellsPriceMap.erase(spell);
|
|
||||||
for (std::vector<MyGUI::WidgetPtr>::iterator it = mSpellsWidgets.begin(); it != mSpellsWidgets.end(); ++it)
|
|
||||||
{
|
|
||||||
if (*it==_sender)
|
|
||||||
{
|
|
||||||
mSpellsWidgets.erase(it);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mSpellsClientWidget->_destroyChildWidget(_sender);
|
|
||||||
unsigned int i;
|
|
||||||
mSpellsScrollerWidget->setScrollPosition(0);
|
mSpellsScrollerWidget->setScrollPosition(0);
|
||||||
onScrollChangePosition(mSpellsScrollerWidget, mSpellsScrollerWidget->getScrollPosition());
|
onScrollChangePosition(mSpellsScrollerWidget, mSpellsScrollerWidget->getScrollPosition());
|
||||||
mCurrentY = 0;
|
|
||||||
for (i=0;i<mSpellsClientWidget->getChildCount();i++)
|
|
||||||
{
|
|
||||||
MyGUI::Widget* toMove;
|
|
||||||
toMove = mSpellsClientWidget->getChildAt(i);
|
|
||||||
toMove->setPosition(0,mCurrentY);
|
|
||||||
mCurrentY+=sLineHeight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
updateLabels();
|
|
||||||
updateScroller();
|
updateScroller();
|
||||||
|
startSpellBuying(mActor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellsWindow::onWindowResize(MyGUI::Window* _sender)
|
void SpellBuyingWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
|
mWindowManager.removeGuiMode(GM_SpellBuying);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellsWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
void SpellBuyingWindow::updateLabels()
|
||||||
{
|
|
||||||
mWindowManager.removeGuiMode(GM_Spells);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellsWindow::updateLabels()
|
|
||||||
{
|
{
|
||||||
mPlayerGold->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str
|
mPlayerGold->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str
|
||||||
+ ": " + boost::lexical_cast<std::string>(mWindowManager.getInventoryWindow()->getPlayerGold()));
|
+ ": " + boost::lexical_cast<std::string>(mWindowManager.getInventoryWindow()->getPlayerGold()));
|
||||||
|
@ -211,28 +148,16 @@ namespace MWGui
|
||||||
mPlayerGold->getTop(),
|
mPlayerGold->getTop(),
|
||||||
mPlayerGold->getTextSize().width,
|
mPlayerGold->getTextSize().width,
|
||||||
mPlayerGold->getHeight());
|
mPlayerGold->getHeight());
|
||||||
unsigned int i;
|
|
||||||
for (i=0;i<mSpellsClientWidget->getChildCount();i++)
|
|
||||||
{
|
|
||||||
MyGUI::Button* toUpdate;
|
|
||||||
toUpdate = (MyGUI::Button*) mSpellsClientWidget->getChildAt(i);
|
|
||||||
const ESM::Spell* spell = mSpellsWidgetMap.find(toUpdate)->second;
|
|
||||||
int price = mSpellsPriceMap.find(spell)->second;
|
|
||||||
if (price>mWindowManager.getInventoryWindow()->getPlayerGold())
|
|
||||||
toUpdate->setCaption("#A3997B" + spell->name+" - "+boost::lexical_cast<std::string>(price)+MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sgp")->str);
|
|
||||||
else
|
|
||||||
toUpdate->setCaption(spell->name+" - "+boost::lexical_cast<std::string>(price)+MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sgp")->str);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellsWindow::onReferenceUnavailable()
|
void SpellBuyingWindow::onReferenceUnavailable()
|
||||||
{
|
{
|
||||||
// remove both Spells and Dialogue (since you always trade with the NPC/creature that you have previously talked to)
|
// remove both Spells and Dialogue (since you always trade with the NPC/creature that you have previously talked to)
|
||||||
mWindowManager.removeGuiMode(GM_Spells);
|
mWindowManager.removeGuiMode(GM_SpellBuying);
|
||||||
mWindowManager.removeGuiMode(GM_Dialogue);
|
mWindowManager.removeGuiMode(GM_Dialogue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellsWindow::updateScroller()
|
void SpellBuyingWindow::updateScroller()
|
||||||
{
|
{
|
||||||
mSpellsScrollerWidget->setScrollRange(std::max(mCurrentY - mSpellsClientWidget->getHeight(), 0));
|
mSpellsScrollerWidget->setScrollRange(std::max(mCurrentY - mSpellsClientWidget->getHeight(), 0));
|
||||||
mSpellsScrollerWidget->setScrollPage(std::max(mSpellsClientWidget->getHeight() - sLineHeight, 0));
|
mSpellsScrollerWidget->setScrollPage(std::max(mSpellsClientWidget->getHeight() - sLineHeight, 0));
|
||||||
|
@ -240,7 +165,7 @@ namespace MWGui
|
||||||
mSpellsScrollerWidget->setTrackSize( (mSpellsBoxWidget->getHeight() / float(mCurrentY)) * mSpellsScrollerWidget->getLineSize() );
|
mSpellsScrollerWidget->setTrackSize( (mSpellsBoxWidget->getHeight() / float(mCurrentY)) * mSpellsScrollerWidget->getLineSize() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellsWindow::onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos)
|
void SpellBuyingWindow::onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos)
|
||||||
{
|
{
|
||||||
int diff = mLastPos - pos;
|
int diff = mLastPos - pos;
|
||||||
// Adjust position of all widget according to difference
|
// Adjust position of all widget according to difference
|
||||||
|
@ -248,14 +173,16 @@ namespace MWGui
|
||||||
return;
|
return;
|
||||||
mLastPos = pos;
|
mLastPos = pos;
|
||||||
|
|
||||||
std::vector<MyGUI::WidgetPtr>::const_iterator end = mSpellsWidgets.end();
|
unsigned int i;
|
||||||
for (std::vector<MyGUI::WidgetPtr>::const_iterator it = mSpellsWidgets.begin(); it != end; ++it)
|
for (i=0;i<mSpellsClientWidget->getChildCount();i++)
|
||||||
{
|
{
|
||||||
(*it)->setCoord((*it)->getCoord() + MyGUI::IntPoint(0, diff));
|
MyGUI::Widget* toMove;
|
||||||
|
toMove = mSpellsClientWidget->getChildAt(i);
|
||||||
|
toMove->setCoord(toMove->getCoord() + MyGUI::IntPoint(0, diff));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellsWindow::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
void SpellBuyingWindow::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||||
{
|
{
|
||||||
if (mSpellsScrollerWidget->getScrollPosition() - _rel*0.3 < 0)
|
if (mSpellsScrollerWidget->getScrollPosition() - _rel*0.3 < 0)
|
||||||
mSpellsScrollerWidget->setScrollPosition(0);
|
mSpellsScrollerWidget->setScrollPosition(0);
|
||||||
|
@ -267,3 +194,4 @@ namespace MWGui
|
||||||
onScrollChangePosition(mSpellsScrollerWidget, mSpellsScrollerWidget->getScrollPosition());
|
onScrollChangePosition(mSpellsScrollerWidget, mSpellsScrollerWidget->getScrollPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef MWGUI_SPELLSWINDOW_H
|
#ifndef MWGUI_SpellBuyingWINDOW_H
|
||||||
#define MWGUI_SPELLSWINDOW_H
|
#define MWGUI_SpellBuyingWINDOW_H
|
||||||
|
|
||||||
#include "container.hpp"
|
#include "container.hpp"
|
||||||
#include "window_base.hpp"
|
#include "window_base.hpp"
|
||||||
|
@ -20,12 +20,12 @@ namespace MWGui
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
class SpellsWindow : public ContainerBase, public WindowBase
|
class SpellBuyingWindow : public ContainerBase, public WindowBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SpellsWindow(MWBase::WindowManager& parWindowManager);
|
SpellBuyingWindow(MWBase::WindowManager& parWindowManager);
|
||||||
|
|
||||||
void startSpells(MWWorld::Ptr actor);
|
void startSpellBuying(MWWorld::Ptr actor);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MyGUI::Button* mCancelButton;
|
MyGUI::Button* mCancelButton;
|
||||||
|
@ -36,31 +36,21 @@ namespace MWGui
|
||||||
MyGUI::WidgetPtr mSpellsBoxWidget, mSpellsClientWidget;
|
MyGUI::WidgetPtr mSpellsBoxWidget, mSpellsClientWidget;
|
||||||
MyGUI::ScrollBar* mSpellsScrollerWidget;
|
MyGUI::ScrollBar* mSpellsScrollerWidget;
|
||||||
|
|
||||||
std::map<MyGUI::Widget*, const ESM::Spell*> mSpellsWidgetMap;
|
MWWorld::Ptr mActor;
|
||||||
std::map<const ESM::Spell*, int> mSpellsPriceMap;
|
|
||||||
std::vector<MyGUI::WidgetPtr> mSpellsWidgets;
|
std::map<MyGUI::Widget*, const ESM::Spell*> mSpellsWidgetMap;
|
||||||
|
|
||||||
void onWindowResize(MyGUI::Window* _sender);
|
|
||||||
void onFilterChanged(MyGUI::Widget* _sender);
|
|
||||||
void onCancelButtonClicked(MyGUI::Widget* _sender);
|
void onCancelButtonClicked(MyGUI::Widget* _sender);
|
||||||
void onFocus(MyGUI::Widget* _sender, MyGUI::Widget* _old);
|
|
||||||
void onFocusLost(MyGUI::Widget* _sender, MyGUI::Widget* _old);
|
|
||||||
void onSpellButtonClick(MyGUI::Widget* _sender);
|
void onSpellButtonClick(MyGUI::Widget* _sender);
|
||||||
void addSpell(std::string spellID);
|
|
||||||
void clearSpells();
|
|
||||||
void updateScroller();
|
void updateScroller();
|
||||||
void onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos);
|
void onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos);
|
||||||
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
||||||
|
void addSpell(std::string spellID);
|
||||||
|
void clearSpells();
|
||||||
int mLastPos,mCurrentY;
|
int mLastPos,mCurrentY;
|
||||||
|
|
||||||
static const int sLineHeight;
|
static const int sLineHeight;
|
||||||
|
|
||||||
// don't show items that the NPC has equipped in his trade-window.
|
|
||||||
virtual bool ignoreEquippedItems() { return true; }
|
|
||||||
|
|
||||||
virtual bool isTrading() { return true; }
|
|
||||||
virtual bool isTradeWindow() { return true; }
|
|
||||||
|
|
||||||
void updateLabels();
|
void updateLabels();
|
||||||
|
|
||||||
virtual void onReferenceUnavailable();
|
virtual void onReferenceUnavailable();
|
|
@ -37,7 +37,7 @@
|
||||||
#include "mainmenu.hpp"
|
#include "mainmenu.hpp"
|
||||||
#include "countdialog.hpp"
|
#include "countdialog.hpp"
|
||||||
#include "tradewindow.hpp"
|
#include "tradewindow.hpp"
|
||||||
#include "spellswindow.hpp"
|
#include "spellbuyingwindow.hpp"
|
||||||
#include "settingswindow.hpp"
|
#include "settingswindow.hpp"
|
||||||
#include "confirmationdialog.hpp"
|
#include "confirmationdialog.hpp"
|
||||||
#include "alchemywindow.hpp"
|
#include "alchemywindow.hpp"
|
||||||
|
@ -62,7 +62,7 @@ WindowManager::WindowManager(
|
||||||
, mScrollWindow(NULL)
|
, mScrollWindow(NULL)
|
||||||
, mCountDialog(NULL)
|
, mCountDialog(NULL)
|
||||||
, mTradeWindow(NULL)
|
, mTradeWindow(NULL)
|
||||||
, mSpellsWindow(NULL)
|
, mSpellBuyingWindow(NULL)
|
||||||
, mSettingsWindow(NULL)
|
, mSettingsWindow(NULL)
|
||||||
, mConfirmationDialog(NULL)
|
, mConfirmationDialog(NULL)
|
||||||
, mAlchemyWindow(NULL)
|
, mAlchemyWindow(NULL)
|
||||||
|
@ -128,7 +128,7 @@ WindowManager::WindowManager(
|
||||||
mMessageBoxManager = new MessageBoxManager(this);
|
mMessageBoxManager = new MessageBoxManager(this);
|
||||||
mInventoryWindow = new InventoryWindow(*this,mDragAndDrop);
|
mInventoryWindow = new InventoryWindow(*this,mDragAndDrop);
|
||||||
mTradeWindow = new TradeWindow(*this);
|
mTradeWindow = new TradeWindow(*this);
|
||||||
mSpellsWindow = new SpellsWindow(*this);
|
mSpellBuyingWindow = new SpellBuyingWindow(*this);
|
||||||
mDialogueWindow = new DialogueWindow(*this);
|
mDialogueWindow = new DialogueWindow(*this);
|
||||||
mContainerWindow = new ContainerWindow(*this,mDragAndDrop);
|
mContainerWindow = new ContainerWindow(*this,mDragAndDrop);
|
||||||
mHud = new HUD(w,h, mShowFPSLevel, mDragAndDrop);
|
mHud = new HUD(w,h, mShowFPSLevel, mDragAndDrop);
|
||||||
|
@ -185,7 +185,7 @@ WindowManager::~WindowManager()
|
||||||
delete mBookWindow;
|
delete mBookWindow;
|
||||||
delete mScrollWindow;
|
delete mScrollWindow;
|
||||||
delete mTradeWindow;
|
delete mTradeWindow;
|
||||||
delete mSpellsWindow;
|
delete mSpellBuyingWindow;
|
||||||
delete mSettingsWindow;
|
delete mSettingsWindow;
|
||||||
delete mConfirmationDialog;
|
delete mConfirmationDialog;
|
||||||
delete mAlchemyWindow;
|
delete mAlchemyWindow;
|
||||||
|
@ -232,7 +232,7 @@ void WindowManager::updateVisible()
|
||||||
mScrollWindow->setVisible(false);
|
mScrollWindow->setVisible(false);
|
||||||
mBookWindow->setVisible(false);
|
mBookWindow->setVisible(false);
|
||||||
mTradeWindow->setVisible(false);
|
mTradeWindow->setVisible(false);
|
||||||
mSpellsWindow->setVisible(false);
|
mSpellBuyingWindow->setVisible(false);
|
||||||
mSettingsWindow->setVisible(false);
|
mSettingsWindow->setVisible(false);
|
||||||
mAlchemyWindow->setVisible(false);
|
mAlchemyWindow->setVisible(false);
|
||||||
mSpellWindow->setVisible(false);
|
mSpellWindow->setVisible(false);
|
||||||
|
@ -322,8 +322,8 @@ void WindowManager::updateVisible()
|
||||||
mInventoryWindow->setVisible(true);
|
mInventoryWindow->setVisible(true);
|
||||||
mTradeWindow->setVisible(true);
|
mTradeWindow->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case GM_Spells:
|
case GM_SpellBuying:
|
||||||
mSpellsWindow->setVisible(true);
|
mSpellBuyingWindow->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case GM_InterMessageBox:
|
case GM_InterMessageBox:
|
||||||
break;
|
break;
|
||||||
|
@ -517,7 +517,7 @@ void WindowManager::onFrame (float frameDuration)
|
||||||
|
|
||||||
mDialogueWindow->checkReferenceAvailable();
|
mDialogueWindow->checkReferenceAvailable();
|
||||||
mTradeWindow->checkReferenceAvailable();
|
mTradeWindow->checkReferenceAvailable();
|
||||||
mSpellsWindow->checkReferenceAvailable();
|
mSpellBuyingWindow->checkReferenceAvailable();
|
||||||
mContainerWindow->checkReferenceAvailable();
|
mContainerWindow->checkReferenceAvailable();
|
||||||
mConsole->checkReferenceAvailable();
|
mConsole->checkReferenceAvailable();
|
||||||
}
|
}
|
||||||
|
@ -795,7 +795,7 @@ MWGui::ScrollWindow* WindowManager::getScrollWindow() { return mScrollWindow; }
|
||||||
MWGui::CountDialog* WindowManager::getCountDialog() { return mCountDialog; }
|
MWGui::CountDialog* WindowManager::getCountDialog() { return mCountDialog; }
|
||||||
MWGui::ConfirmationDialog* WindowManager::getConfirmationDialog() { return mConfirmationDialog; }
|
MWGui::ConfirmationDialog* WindowManager::getConfirmationDialog() { return mConfirmationDialog; }
|
||||||
MWGui::TradeWindow* WindowManager::getTradeWindow() { return mTradeWindow; }
|
MWGui::TradeWindow* WindowManager::getTradeWindow() { return mTradeWindow; }
|
||||||
MWGui::SpellsWindow* WindowManager::getSpellsWindow() { return mSpellsWindow; }
|
MWGui::SpellBuyingWindow* WindowManager::getSpellBuyingWindow() { return mSpellBuyingWindow; }
|
||||||
MWGui::SpellWindow* WindowManager::getSpellWindow() { return mSpellWindow; }
|
MWGui::SpellWindow* WindowManager::getSpellWindow() { return mSpellWindow; }
|
||||||
MWGui::Console* WindowManager::getConsole() { return mConsole; }
|
MWGui::Console* WindowManager::getConsole() { return mConsole; }
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ namespace MWGui
|
||||||
virtual MWGui::CountDialog* getCountDialog();
|
virtual MWGui::CountDialog* getCountDialog();
|
||||||
virtual MWGui::ConfirmationDialog* getConfirmationDialog();
|
virtual MWGui::ConfirmationDialog* getConfirmationDialog();
|
||||||
virtual MWGui::TradeWindow* getTradeWindow();
|
virtual MWGui::TradeWindow* getTradeWindow();
|
||||||
virtual MWGui::SpellsWindow* getSpellsWindow();
|
virtual MWGui::SpellBuyingWindow* getSpellBuyingWindow();
|
||||||
virtual MWGui::SpellWindow* getSpellWindow();
|
virtual MWGui::SpellWindow* getSpellWindow();
|
||||||
virtual MWGui::Console* getConsole();
|
virtual MWGui::Console* getConsole();
|
||||||
|
|
||||||
|
@ -213,11 +213,11 @@ namespace MWGui
|
||||||
BookWindow* mBookWindow;
|
BookWindow* mBookWindow;
|
||||||
CountDialog* mCountDialog;
|
CountDialog* mCountDialog;
|
||||||
TradeWindow* mTradeWindow;
|
TradeWindow* mTradeWindow;
|
||||||
SpellsWindow* mSpellsWindow; // Npc selling spells window
|
SpellBuyingWindow* mSpellBuyingWindow;
|
||||||
SettingsWindow* mSettingsWindow;
|
SettingsWindow* mSettingsWindow;
|
||||||
ConfirmationDialog* mConfirmationDialog;
|
ConfirmationDialog* mConfirmationDialog;
|
||||||
AlchemyWindow* mAlchemyWindow;
|
AlchemyWindow* mAlchemyWindow;
|
||||||
SpellWindow* mSpellWindow; // Player owned spells window
|
SpellWindow* mSpellWindow;
|
||||||
QuickKeysMenu* mQuickKeysMenu;
|
QuickKeysMenu* mQuickKeysMenu;
|
||||||
|
|
||||||
CharacterCreation* mCharGen;
|
CharacterCreation* mCharGen;
|
||||||
|
|
|
@ -64,7 +64,7 @@ set(MYGUI_FILES
|
||||||
openmw_text.skin.xml
|
openmw_text.skin.xml
|
||||||
openmw_tooltips.layout
|
openmw_tooltips.layout
|
||||||
openmw_trade_window.layout
|
openmw_trade_window.layout
|
||||||
openmw_spells_window.layout
|
openmw_spell_buying_window.layout
|
||||||
openmw_windows.skin.xml
|
openmw_windows.skin.xml
|
||||||
openmw_quickkeys_menu.layout
|
openmw_quickkeys_menu.layout
|
||||||
openmw_quickkeys_menu_assign.layout
|
openmw_quickkeys_menu_assign.layout
|
||||||
|
|
|
@ -17,6 +17,14 @@
|
||||||
<BasisSkin type="SimpleText" offset = "0 0 16 16" align = "ALIGN_STRETCH"/>
|
<BasisSkin type="SimpleText" offset = "0 0 16 16" align = "ALIGN_STRETCH"/>
|
||||||
</Skin>
|
</Skin>
|
||||||
|
|
||||||
|
<!-- HTML colour: #9A9074 -->
|
||||||
|
<Skin name = "SandTextGreyedOut" size = "16 16">
|
||||||
|
<Property key="FontName" value = "Default" />
|
||||||
|
<Property key="TextAlign" value = "ALIGN_LEFT ALIGN_BOTTOM" />
|
||||||
|
<Property key="TextColour" value = "0.6 0.56 0.45" />
|
||||||
|
<BasisSkin type="SimpleText" offset = "0 0 16 16" align = "ALIGN_STRETCH"/>
|
||||||
|
</Skin>
|
||||||
|
|
||||||
<!-- HTML colour: #BF9959 -->
|
<!-- HTML colour: #BF9959 -->
|
||||||
<Skin name = "SandText" size = "16 16">
|
<Skin name = "SandText" size = "16 16">
|
||||||
<Property key="FontName" value = "Default" />
|
<Property key="FontName" value = "Default" />
|
||||||
|
|
Loading…
Reference in a new issue