|
@@ -1,5 +1,6 @@
|
|
|
#include "CraftingGrid.h"
|
|
|
|
|
|
+#include <DateiSystem.h>
|
|
|
#include <XML.h>
|
|
|
|
|
|
#include "DragController.h"
|
|
@@ -81,7 +82,7 @@ CraftingGridView::CraftingGridView(Text id,
|
|
|
requestetTooltipSlot(-1)
|
|
|
{
|
|
|
craft = uiFactory.createKnopf(uiFactory.initParam);
|
|
|
- craft->setPosition(rowSize * 60, 10);
|
|
|
+ craft->setPosition(rowSize * 60, 0);
|
|
|
craft->setSize(40, 20);
|
|
|
craft->setText("Craft");
|
|
|
craft->setMausEreignis([this](void* p, void* o, MausEreignis me) {
|
|
@@ -105,6 +106,26 @@ CraftingGridView::CraftingGridView(Text id,
|
|
|
}
|
|
|
return 1;
|
|
|
});
|
|
|
+ recipies = uiFactory.createKnopf(uiFactory.initParam);
|
|
|
+ recipies->setPosition(rowSize * 60, colSize * 60 - 49);
|
|
|
+ recipies->setSize(40, 40);
|
|
|
+ recipies->addStyle(
|
|
|
+ Knopf::Style::HBild | Knopf::Style::HAlpha | Knopf::Style::Hintergrund);
|
|
|
+ recipies->removeStyle(Knopf::Style::Buffered);
|
|
|
+ recipies->setRahmenBreite(1);
|
|
|
+ Framework::LTDBDatei file;
|
|
|
+ file.setDatei(new Framework::Text("data/bilder/gui_icons.ltdb"));
|
|
|
+ file.leseDaten(0);
|
|
|
+ recipies->setHintergrundBildZ(file.laden(0, new Text("recipies.png")));
|
|
|
+ recipies->setMausEreignis([this](void* p, void* o, MausEreignis me) {
|
|
|
+ if (me.id == ME_RLinks)
|
|
|
+ {
|
|
|
+ // Open Item Recipies
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ });
|
|
|
+ recipies->setToolTipText(
|
|
|
+ "Recipies", uiFactory.initParam.bildschirm, uiFactory.initParam.schrift);
|
|
|
setStyle(ZeichnungHintergrund::Style::Sichtbar
|
|
|
| ZeichnungHintergrund::Style::Erlaubt);
|
|
|
char* msg = new char[id.getLength() + 12 + 3];
|
|
@@ -156,6 +177,7 @@ CraftingGridView::~CraftingGridView()
|
|
|
target, msg, id.getLength() + 2);
|
|
|
delete[] msg;
|
|
|
craft->release();
|
|
|
+ recipies->release();
|
|
|
}
|
|
|
|
|
|
int CraftingGridView::getSlotByLocalPos(Punkt pos)
|
|
@@ -205,10 +227,17 @@ void CraftingGridView::api(char* message)
|
|
|
info.durability = *(float*)(message += 4);
|
|
|
info.maxDurability = *(float*)(message += 4);
|
|
|
info.zItem = zItemType(*(int*)(message += 4))->zIcon();
|
|
|
+ char len = *(message += 4);
|
|
|
+ char* name = new char[len + 1];
|
|
|
+ memcpy(name, message += 1, len);
|
|
|
+ name[len] = 0;
|
|
|
+ info.name = name;
|
|
|
+ delete[] name;
|
|
|
+ message += len - 4;
|
|
|
}
|
|
|
slots->add(info);
|
|
|
}
|
|
|
- postAction([this, slots]() {
|
|
|
+ window->zBildschirm()->postAction([this, slots]() {
|
|
|
if (this->slots) this->slots->release();
|
|
|
this->slots = slots;
|
|
|
});
|
|
@@ -258,6 +287,12 @@ void CraftingGridView::api(char* message)
|
|
|
info.durability = *(float*)(message + 17);
|
|
|
info.maxDurability = *(float*)(message + 21);
|
|
|
info.zItem = zItemType(*(int*)(message + 25))->zIcon();
|
|
|
+ char len = *(message + 29);
|
|
|
+ char* name = new char[len + 1];
|
|
|
+ memcpy(name, message + 30, len);
|
|
|
+ name[len] = 0;
|
|
|
+ info.name = name;
|
|
|
+ delete[] name;
|
|
|
slots->set(info, i);
|
|
|
break;
|
|
|
}
|
|
@@ -309,7 +344,7 @@ void CraftingGridView::api(char* message)
|
|
|
}
|
|
|
outputs->add(info);
|
|
|
}
|
|
|
- postAction([this, outputs]() {
|
|
|
+ window->zBildschirm()->postAction([this, outputs]() {
|
|
|
if (this->outputs) this->outputs->release();
|
|
|
this->outputs = outputs;
|
|
|
});
|
|
@@ -350,6 +385,7 @@ void CraftingGridView::render(Bild& rObj)
|
|
|
}
|
|
|
}
|
|
|
craft->render(rObj);
|
|
|
+ recipies->render(rObj);
|
|
|
rObj.fillRegion(rowSize * 60, gr.y / 2 - 5, 25, 10, 0xFF52525E);
|
|
|
rObj.drawDreieck(Punkt(rowSize * 60 + 25, gr.y / 2 - 15),
|
|
|
Punkt(rowSize * 60 + 40, gr.y / 2),
|
|
@@ -396,6 +432,7 @@ void CraftingGridView::doMausEreignis(MausEreignis& me, bool userRet)
|
|
|
}
|
|
|
}
|
|
|
craft->doPublicMausEreignis(me);
|
|
|
+ recipies->doPublicMausEreignis(me);
|
|
|
DragController<InventoryDragSource, int>* controller
|
|
|
= ((Game*)(Menu*)menuRegister->get("game"))->zInventoryDragController();
|
|
|
int x = 0;
|