|
|
|
@ -173,6 +173,8 @@ MapWindow::MapWindow()
|
|
|
|
|
getWidget(eventbox, "EventBox");
|
|
|
|
|
eventbox->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
|
|
|
|
eventbox->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
|
|
|
|
|
|
|
|
|
LocalMapBase::init(mLocalMap, this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MapWindow::setVisible(bool b)
|
|
|
|
@ -189,40 +191,6 @@ void MapWindow::setCellName(const std::string& cellName)
|
|
|
|
|
static_cast<MyGUI::Window*>(mMainWidget)->setCaption(cellName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MapWindow::setCellPrefix(const std::string& prefix)
|
|
|
|
|
{
|
|
|
|
|
mPrefix = prefix;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MapWindow::setActiveCell(const int x, const int y, bool interior)
|
|
|
|
|
{
|
|
|
|
|
if (x==mCurX && y==mCurY && mInterior==interior) return; // don't do anything if we're still in the same cell
|
|
|
|
|
for (int mx=0; mx<3; ++mx)
|
|
|
|
|
{
|
|
|
|
|
for (int my=0; my<3; ++my)
|
|
|
|
|
{
|
|
|
|
|
std::string name = "Map_" + boost::lexical_cast<std::string>(mx) + "_"
|
|
|
|
|
+ boost::lexical_cast<std::string>(my);
|
|
|
|
|
|
|
|
|
|
std::string image = mPrefix+"_"+ boost::lexical_cast<std::string>(x + (mx-1)) + "_"
|
|
|
|
|
+ boost::lexical_cast<std::string>(y + (interior ? (my-1) : -1*(my-1)));
|
|
|
|
|
|
|
|
|
|
if (MyGUI::RenderManager::getInstance().getTexture(image) != 0)
|
|
|
|
|
setImage(name, image);
|
|
|
|
|
else
|
|
|
|
|
setImage(name, "black.png");
|
|
|
|
|
|
|
|
|
|
if (MyGUI::RenderManager::getInstance().getTexture(image+"_fog") != 0)
|
|
|
|
|
setImage(name+"_fog", image+"_fog");
|
|
|
|
|
else
|
|
|
|
|
setImage(name+"_fog", "black.png");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mInterior = interior;
|
|
|
|
|
mCurX = x;
|
|
|
|
|
mCurY = y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MapWindow::setPlayerPos(const float x, const float y)
|
|
|
|
|
{
|
|
|
|
|
if (mGlobal || mVisible) return;
|
|
|
|
@ -274,5 +242,48 @@ void MapWindow::onWorldButtonClicked(MyGUI::Widget* _sender)
|
|
|
|
|
mButton->setCaption( mGlobal ? "Local" : "World" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LocalMapBase::init(MyGUI::ScrollView* widget, OEngine::GUI::Layout* layout)
|
|
|
|
|
{
|
|
|
|
|
mLocalMap = widget;
|
|
|
|
|
mLayout = layout;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LocalMapBase::setCellPrefix(const std::string& prefix)
|
|
|
|
|
{
|
|
|
|
|
mPrefix = prefix;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LocalMapBase::setActiveCell(const int x, const int y, bool interior)
|
|
|
|
|
{
|
|
|
|
|
if (x==mCurX && y==mCurY && mInterior==interior) return; // don't do anything if we're still in the same cell
|
|
|
|
|
for (int mx=0; mx<3; ++mx)
|
|
|
|
|
{
|
|
|
|
|
for (int my=0; my<3; ++my)
|
|
|
|
|
{
|
|
|
|
|
std::string name = "Map_" + boost::lexical_cast<std::string>(mx) + "_"
|
|
|
|
|
+ boost::lexical_cast<std::string>(my);
|
|
|
|
|
|
|
|
|
|
std::string image = mPrefix+"_"+ boost::lexical_cast<std::string>(x + (mx-1)) + "_"
|
|
|
|
|
+ boost::lexical_cast<std::string>(y + (interior ? (my-1) : -1*(my-1)));
|
|
|
|
|
|
|
|
|
|
MyGUI::ImageBox* box;
|
|
|
|
|
mLayout->getWidget(box, name);
|
|
|
|
|
MyGUI::ImageBox* fog;
|
|
|
|
|
mLayout->getWidget(fog, name+"_fog");
|
|
|
|
|
|
|
|
|
|
if (MyGUI::RenderManager::getInstance().getTexture(image) != 0)
|
|
|
|
|
box->setImageTexture(image);
|
|
|
|
|
else
|
|
|
|
|
box->setImageTexture("black.png");
|
|
|
|
|
|
|
|
|
|
if (MyGUI::RenderManager::getInstance().getTexture(image+"_fog") != 0)
|
|
|
|
|
fog->setImageTexture(image+"_fog");
|
|
|
|
|
else
|
|
|
|
|
fog->setImageTexture("black.png");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mInterior = interior;
|
|
|
|
|
mCurX = x;
|
|
|
|
|
mCurY = y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|