cleaning up hircine work
parent
9ec1e55aaf
commit
b309d245c5
@ -0,0 +1,191 @@
|
||||
#include "container.hpp"
|
||||
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include "window_manager.hpp"
|
||||
#include "widgets.hpp"
|
||||
|
||||
#include "../mwworld/environment.hpp"
|
||||
#include "../mwworld/manualref.hpp"
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
#include "../mwclass/container.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
|
||||
using namespace MWGui;
|
||||
using namespace Widgets;
|
||||
|
||||
|
||||
ContainerWindow::ContainerWindow(WindowManager& parWindowManager,MWWorld::Environment& environment)
|
||||
: WindowBase("openmw_container_window_layout.xml", parWindowManager),
|
||||
mEnvironment(environment)
|
||||
{
|
||||
setText("_Main", "Name of Container");
|
||||
setVisible(false);
|
||||
|
||||
getWidget(containerWidget, "Items");
|
||||
getWidget(takeButton, "TakeButton");
|
||||
getWidget(closeButton, "CloseButton");
|
||||
|
||||
setText("CloseButton","Close");
|
||||
setText("TakeButton","Take All");
|
||||
|
||||
//ctor
|
||||
}
|
||||
|
||||
ContainerWindow::~ContainerWindow()
|
||||
{
|
||||
//dtor
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ContainerWindow::setName(std::string contName)
|
||||
{
|
||||
setText("_Main", contName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ContainerWindow::open(MWWorld::Ptr& container)
|
||||
{
|
||||
setName(MWWorld::Class::get(container).getName(container));
|
||||
//MWWorld::ContainerStore* containerStore = container.getContainerStore();
|
||||
|
||||
MWWorld::ContainerStore& containerStore = MWWorld::Class::get(container).getContainerStore(container);
|
||||
|
||||
|
||||
MWWorld::ManualRef furRef (mWindowManager.getStore(), "fur_cuirass");
|
||||
furRef.getPtr().getRefData().setCount (5);
|
||||
MWWorld::ManualRef bukkitRef (mWindowManager.getStore(), "misc_com_bucket_01");
|
||||
MWWorld::ManualRef broomRef (mWindowManager.getStore(), "misc_com_broom_01");
|
||||
MWWorld::ManualRef goldRef (mWindowManager.getStore(), "gold_100");
|
||||
|
||||
containerStore.add(furRef.getPtr());
|
||||
containerStore.add(furRef.getPtr());
|
||||
containerStore.add(furRef.getPtr());
|
||||
containerStore.add(broomRef.getPtr());
|
||||
containerStore.add(broomRef.getPtr());
|
||||
containerStore.add(broomRef.getPtr());
|
||||
containerStore.add(broomRef.getPtr());
|
||||
containerStore.add(broomRef.getPtr());
|
||||
containerStore.add(broomRef.getPtr());
|
||||
containerStore.add(broomRef.getPtr());
|
||||
containerStore.add(broomRef.getPtr());
|
||||
containerStore.add(broomRef.getPtr());
|
||||
containerStore.add(broomRef.getPtr());
|
||||
containerStore.add(bukkitRef.getPtr());
|
||||
containerStore.add(bukkitRef.getPtr());
|
||||
containerStore.add(bukkitRef.getPtr());
|
||||
containerStore.add(bukkitRef.getPtr());
|
||||
containerStore.add(bukkitRef.getPtr());
|
||||
containerStore.add(bukkitRef.getPtr());
|
||||
containerStore.add(bukkitRef.getPtr());
|
||||
containerStore.add(bukkitRef.getPtr());
|
||||
containerStore.add(bukkitRef.getPtr());
|
||||
containerStore.add(bukkitRef.getPtr());
|
||||
containerStore.add(goldRef.getPtr());
|
||||
|
||||
|
||||
|
||||
// ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref = iter->get<ESM::Armor>();
|
||||
|
||||
|
||||
int x = 4;
|
||||
int y = 4;
|
||||
int count = 0;
|
||||
|
||||
for (MWWorld::ContainerStoreIterator iter (containerStore.begin()); iter!=containerStore.end(); ++iter)
|
||||
{
|
||||
std::string path = std::string("icons\\");
|
||||
|
||||
|
||||
path += iter.getInventoryIcon();
|
||||
// switch (iter.getType())
|
||||
// {
|
||||
//
|
||||
// case MWWorld::ContainerStore::Type_Potion:
|
||||
// path += iter->get<ESM::Potion>()->base->icon;
|
||||
// break;
|
||||
// case MWWorld::ContainerStore::Type_Apparatus:
|
||||
// path += iter->get<ESM::Apparatus>()->base->icon;
|
||||
// break;
|
||||
// case MWWorld::ContainerStore::Type_Armor:
|
||||
// path += iter->get<ESM::Armor>()->base->icon;
|
||||
// break;
|
||||
// case MWWorld::ContainerStore::Type_Book:
|
||||
// path += iter->get<ESM::Book>()->base->icon;
|
||||
// break;
|
||||
// case MWWorld::ContainerStore::Type_Clothing:
|
||||
// path += iter->get<ESM::Clothing>()->base->icon;
|
||||
// break;
|
||||
// case MWWorld::ContainerStore::Type_Ingredient:
|
||||
// path += iter->get<ESM::Ingredient>()->base->icon;
|
||||
// break;
|
||||
// case MWWorld::ContainerStore::Type_Light:
|
||||
// path += iter->get<ESM::Light>()->base->icon;
|
||||
// break;
|
||||
// case MWWorld::ContainerStore::Type_Lockpick:
|
||||
// path += iter->get<ESM::Tool>()->base->icon;
|
||||
// break;
|
||||
// case MWWorld::ContainerStore::Type_Miscellaneous:
|
||||
// path += iter->get<ESM::Miscellaneous>()->base->icon;
|
||||
// break;
|
||||
// case MWWorld::ContainerStore::Type_Probe:
|
||||
// path += iter->get<ESM::Probe>()->base->icon;
|
||||
// break;
|
||||
// case MWWorld::ContainerStore::Type_Repair:
|
||||
// path += iter->get<ESM::Repair>()->base->icon;
|
||||
// break;
|
||||
// case MWWorld::ContainerStore::Type_Weapon:
|
||||
// path += iter->get<ESM::Weapon>()->base->icon;
|
||||
// break;
|
||||
//
|
||||
//
|
||||
// }
|
||||
count++;
|
||||
|
||||
if(count % 8 == 0)
|
||||
{
|
||||
y += 36;
|
||||
x = 4;
|
||||
count = 0;
|
||||
}
|
||||
x += 36;
|
||||
|
||||
|
||||
MyGUI::ImageBox* image = containerWidget->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(x, y, 32, 32), MyGUI::Align::Default);
|
||||
MyGUI::TextBox* text = containerWidget->createWidget<MyGUI::TextBox>("SandBrightText", MyGUI::IntCoord(x, y, 18, 18), MyGUI::Align::Default, std::string("Label"));
|
||||
|
||||
if(iter->getRefData().getCount() > 1)
|
||||
text->setCaption(boost::lexical_cast<std::string>(iter->getRefData().getCount()));
|
||||
|
||||
|
||||
containerWidgets.push_back(image);
|
||||
|
||||
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
|
||||
//std::cout << path << std::endl;
|
||||
image->setImageTexture(path);
|
||||
}
|
||||
|
||||
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
#ifndef MGUI_CONTAINER_H
|
||||
#define MGUI_CONTAINER_H
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwclass/container.hpp"
|
||||
#include <sstream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include "window_base.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Environment;
|
||||
}
|
||||
|
||||
namespace MyGUI
|
||||
{
|
||||
class Gui;
|
||||
class Widget;
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowManager;
|
||||
}
|
||||
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
|
||||
class ContainerWindow : public WindowBase
|
||||
{
|
||||
public:
|
||||
ContainerWindow(WindowManager& parWindowManager,MWWorld::Environment& environment);
|
||||
|
||||
|
||||
void open(MWWorld::Ptr& container);
|
||||
void setName(std::string contName);
|
||||
void Update();
|
||||
|
||||
virtual ~ContainerWindow();
|
||||
protected:
|
||||
private:
|
||||
MWWorld::Environment& mEnvironment;
|
||||
std::vector<MyGUI::WidgetPtr> containerWidgets;
|
||||
MyGUI::WidgetPtr containerWidget;
|
||||
|
||||
MyGUI::ButtonPtr takeButton;
|
||||
MyGUI::ButtonPtr closeButton;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//MWWorld::Ptr& mContainer;
|
||||
};
|
||||
}
|
||||
#endif // CONTAINER_H
|
@ -0,0 +1,21 @@
|
||||
#include "actionopen.hpp"
|
||||
|
||||
#include "environment.hpp"
|
||||
#include "class.hpp"
|
||||
#include "world.hpp"
|
||||
#include "containerstore.hpp"
|
||||
#include "../mwclass/container.hpp"
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/container.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
ActionOpen::ActionOpen (const MWWorld::Ptr& container) : mContainer (container) {
|
||||
mContainer = container;
|
||||
}
|
||||
|
||||
void ActionOpen::execute (Environment& environment)
|
||||
{
|
||||
environment.mWindowManager->getContainerWindow()->open(mContainer);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
|
||||
#ifndef GAME_MWWORLD_ACTIONOPEN_H
|
||||
#define GAME_MWWORLD_ACTIONOPEN_H
|
||||
|
||||
#include "action.hpp"
|
||||
#include "ptr.hpp"
|
||||
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class ActionOpen : public Action
|
||||
{
|
||||
Ptr mContainer;
|
||||
|
||||
public:
|
||||
ActionOpen (const Ptr& container);
|
||||
///< \param The Container the Player has activated.
|
||||
virtual void execute (Environment& environment);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // ACTIONOPEN_H
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<MyGUI type="Layout">
|
||||
<Widget type="Window" skin="MW_Window" layer="Windows" position="900 500 600 300" name="_Main">
|
||||
|
||||
<!-- HEADER
|
||||
<Widget type="TextBox" skin="HeaderText" position="0 0 588 18" name="ContainerName" align="ALIGN_LEFT ALIGN_TOP">
|
||||
<Property key="Caption" value="Name"/>
|
||||
<Property key="TextAlign" value="ALIGN_CENTER"/>
|
||||
</Widget>-->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Items in inventory -->
|
||||
<Widget type="Widget" skin="MW_Box" position="5 10 570 220" name="Items"/>
|
||||
|
||||
<Widget type="Widget" position="300 235 300 24" align="ALIGN_TOP ALIGN_LEFT" name="Buttons">
|
||||
<Widget type="Button" skin="MW_Button" position="100 0 75 24" name="TakeButton"/>
|
||||
<Widget type="Button" skin="MW_Button" position="180 0 60 24" name="CloseButton"/>
|
||||
</Widget>
|
||||
|
||||
</Widget>
|
||||
</MyGUI>
|
Loading…
Reference in New Issue