Travel GUI

actorid
gugus 12 years ago
parent 4f5c4bf89a
commit 85d9357e3a

@ -16,7 +16,7 @@ namespace MWGui
{ {
TradeWindow::TradeWindow(MWBase::WindowManager& parWindowManager) : TradeWindow::TradeWindow(MWBase::WindowManager& parWindowManager) :
WindowBase("openmw_trade_window.layout", parWindowManager) WindowBase("openmw_trade_window.layout", parWindowManager)
, ReferenceInterface(NULL) // no drag&drop , ContainerBase(NULL) // no drag&drop
, mCurrentBalance(0) , mCurrentBalance(0)
{ {
MyGUI::ScrollView* itemView; MyGUI::ScrollView* itemView;

@ -20,7 +20,7 @@ namespace MWGui
namespace MWGui namespace MWGui
{ {
class TradeWindow : public ReferenceInterface, public WindowBase class TradeWindow : public ContainerBase, public WindowBase
{ {
public: public:
TradeWindow(MWBase::WindowManager& parWindowManager); TradeWindow(MWBase::WindowManager& parWindowManager);

@ -23,8 +23,7 @@ namespace MWGui
const int TravelWindow::sLineHeight = 18; const int TravelWindow::sLineHeight = 18;
TravelWindow::TravelWindow(MWBase::WindowManager& parWindowManager) : TravelWindow::TravelWindow(MWBase::WindowManager& parWindowManager) :
WindowBase("openmw_spell_buying_window.layout", parWindowManager) WindowBase("openmw_travel_window.layout", parWindowManager)
, ContainerBase(NULL) // no drag&drop
, mCurrentY(0) , mCurrentY(0)
, mLastPos(0) , mLastPos(0)
{ {
@ -33,8 +32,8 @@ namespace MWGui
getWidget(mCancelButton, "CancelButton"); getWidget(mCancelButton, "CancelButton");
getWidget(mPlayerGold, "PlayerGold"); getWidget(mPlayerGold, "PlayerGold");
getWidget(mSelect, "Select"); getWidget(mSelect, "Select");
getWidget(mDestinations, "Spells"); getWidget(mDestinations, "Travel");
getWidget(mDestinationsView, "SpellsView"); getWidget(mDestinationsView, "DestinationsView");
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TravelWindow::onCancelButtonClicked); mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TravelWindow::onCancelButtonClicked);
@ -61,8 +60,8 @@ namespace MWGui
toAdd->setCaptionWithReplacing(travelId+" - "+boost::lexical_cast<std::string>(price)+"#{sgp}"); toAdd->setCaptionWithReplacing(travelId+" - "+boost::lexical_cast<std::string>(price)+"#{sgp}");
toAdd->setSize(toAdd->getTextSize().width,sLineHeight); toAdd->setSize(toAdd->getTextSize().width,sLineHeight);
toAdd->eventMouseWheel += MyGUI::newDelegate(this, &TravelWindow::onMouseWheel); toAdd->eventMouseWheel += MyGUI::newDelegate(this, &TravelWindow::onMouseWheel);
toAdd->setUserString("ToolTipType", "Spell"); //toAdd->setUserString("ToolTipType", "Spell");
toAdd->setUserString("Spell", travelId); toAdd->setUserString("Destination", travelId);
toAdd->eventMouseButtonClick += MyGUI::newDelegate(this, &TravelWindow::onTravelButtonClick); toAdd->eventMouseButtonClick += MyGUI::newDelegate(this, &TravelWindow::onTravelButtonClick);
mDestinationsWidgetMap.insert(std::make_pair (toAdd, travelId)); mDestinationsWidgetMap.insert(std::make_pair (toAdd, travelId));
} }
@ -111,12 +110,13 @@ namespace MWGui
} }
updateLabels(); updateLabels();
mPtr.get<ESM::NPC>()->base->mTransport[0]. //mPtr.get<ESM::NPC>()->base->mTransport[0].
mDestinationsView->setCanvasSize (MyGUI::IntSize(mDestinationsView->getWidth(), std::max(mDestinationsView->getHeight(), mCurrentY))); mDestinationsView->setCanvasSize (MyGUI::IntSize(mDestinationsView->getWidth(), std::max(mDestinationsView->getHeight(), mCurrentY)));
} }
void TravelWindow::onTravelButtonClick(MyGUI::Widget* _sender) void TravelWindow::onTravelButtonClick(MyGUI::Widget* _sender)
{ {
std::cout << "traveling to:" << _sender->getUserString("Destination");
/*int price = *_sender->getUserData<int>(); /*int price = *_sender->getUserData<int>();
if (mWindowManager.getInventoryWindow()->getPlayerGold()>=price) if (mWindowManager.getInventoryWindow()->getPlayerGold()>=price)

@ -20,7 +20,7 @@ namespace MWGui
namespace MWGui namespace MWGui
{ {
class TravelWindow : public ContainerBase, public WindowBase class TravelWindow : public ReferenceInterface, public WindowBase
{ {
public: public:
TravelWindow(MWBase::WindowManager& parWindowManager); TravelWindow(MWBase::WindowManager& parWindowManager);
@ -35,8 +35,6 @@ namespace MWGui
MyGUI::ScrollView* mDestinationsView; MyGUI::ScrollView* mDestinationsView;
MWWorld::Ptr mActor;
std::map<MyGUI::Widget*, std::string> mDestinationsWidgetMap; std::map<MyGUI::Widget*, std::string> mDestinationsWidgetMap;
void onCancelButtonClicked(MyGUI::Widget* _sender); void onCancelButtonClicked(MyGUI::Widget* _sender);

@ -376,6 +376,7 @@ void WindowManager::updateVisible()
break; break;
case GM_Travel: case GM_Travel:
mTravelWindow->setVisible(true); mTravelWindow->setVisible(true);
break;
case GM_SpellCreation: case GM_SpellCreation:
mSpellCreationDialog->setVisible(true); mSpellCreationDialog->setVisible(true);
break; break;

@ -78,6 +78,7 @@ set(MYGUI_FILES
openmw_spellcreation_dialog.layout openmw_spellcreation_dialog.layout
openmw_edit_effect.layout openmw_edit_effect.layout
openmw_enchanting_dialog.layout openmw_enchanting_dialog.layout
openmw_travel_window.layout
smallbars.png smallbars.png
VeraMono.ttf VeraMono.ttf
markers.png markers.png

Loading…
Cancel
Save