UIInventory.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include "UIElement.h"
  3. class UIReference;
  4. class UIInventoryElement : public UIElement
  5. {
  6. private:
  7. UIReference* reference;
  8. int rowSize;
  9. int numSlots;
  10. Framework::Text slotNameFilter;
  11. public:
  12. UIInventoryElement();
  13. ~UIInventoryElement();
  14. void setReference(UIReference* reference);
  15. UIReference* zReference() const;
  16. void setRowSize(int rowSize);
  17. int getRowSize() const;
  18. void setNumSlots(int numSlots);
  19. int getNumSlots() const;
  20. void setSlotNameFilter(const Framework::Text& slotNameFilter);
  21. const Framework::Text& getSlotNameFilter() const;
  22. Framework::XML::Element* toUIML(Framework::Either<Block*, Entity*> zTarget,
  23. Entity* zActor) const override;
  24. };
  25. class UIInventoryElementFactory : public UIElementFactory<UIInventoryElement>
  26. {
  27. public:
  28. UIInventoryElementFactory();
  29. virtual JSONObjectValidationBuilder* addToValidator(
  30. JSONObjectValidationBuilder* builder) const override;
  31. UIInventoryElement* fromJson(
  32. Framework::JSON::JSONObject* zJson) const override;
  33. Framework::JSON::JSONObject* toJsonObject(
  34. UIInventoryElement* zObject) const override;
  35. UIInventoryElement* createElement(
  36. Framework::JSON::JSONObject* zJson) const override;
  37. const char* getTypeToken() const override;
  38. };