123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- #pragma once
- #include <TextFeld.h>
- #include <UIMLView.h>
- class LogicTree;
- class RecipieIngredientElement : public Framework::UIMLElement
- {
- private:
- LogicTree* parse(Framework::XML::Element* zElement);
- public:
- RecipieIngredientElement();
- //! prüft, ob dieses UIML Element für ein bestimmtes xml Element zuständig
- //! ist
- bool isApplicableFor(Framework::XML::Element& element) override;
- //! erstellt eine neue Zeichnung zu einem gegebenen xml Element
- Framework::Zeichnung* parseElement(Framework::XML::Element& element,
- Framework::UIMLContainer& generalFactory) override;
- bool updateElement(Framework::XML::Element& element,
- Framework::Zeichnung& z,
- Framework::UIMLContainer& generalFactory) override;
- //! wendet die layout parameter zu einer Zeichnung an
- void layout(Framework::XML::Element& element,
- Framework::Zeichnung& z,
- int pWidth,
- int pHeight,
- Framework::UIMLContainer& generalLayouter) override;
- };
- class RecipieIngredient : public Framework::ZeichnungHintergrund
- {
- private:
- Framework::RCArray<Framework::Bild> icons;
- Framework::RCArray<Framework::Text> toolTips;
- Framework::Array<int> itemTypes;
- Framework::TextFeld* toolTip;
- int currentIconIndex;
- double timtUntilNextIcon;
- int amount;
- public:
- RecipieIngredient(int amount);
- void addPossibleItem(
- Framework::Bild* icon, Framework::Text* toolTip, int itemType);
- bool tick(double tickVal) override;
- void render(Framework::Bild& rObj) override;
- void doMausEreignis(Framework::MausEreignis& me, bool userRet) override;
- };
- enum class AttributeOperator
- {
- Equals,
- NotEquals,
- GreaterThan,
- GreaterThanOrEquals,
- LessThan,
- LessThanOrEquals
- };
- class Requirement : public Framework::ReferenceCounter
- {
- private:
- Framework::Text attribute;
- Framework::Text value;
- AttributeOperator op;
- public:
- Requirement(
- Framework::Text attribute, Framework::Text value, AttributeOperator op);
- void negate();
- Requirement* clone();
- bool contradicts(Requirement* zOther);
- bool merge(Requirement* zOther);
- int getItemType();
- Framework::Text getDescription();
- };
- class RequirementSet : public Framework::ReferenceCounter
- {
- private:
- Framework::RCArray<Requirement> requirements;
- public:
- RequirementSet();
- void addRequirement(Requirement* zReq);
- RequirementSet* clone();
- void addRequirements(RequirementSet* zOther);
- void negate(LogicTree* zNode);
- bool isNoneMatch() const;
- bool isAnyMatch() const;
- Framework::Text renderToTooltip() const;
- Framework::Bild* getIcon() const;
- int getItemType() const;
- };
- enum class LogicalOperator
- {
- AND,
- OR
- };
- class LogicTree : public Framework::ReferenceCounter
- {
- private:
- LogicalOperator op;
- RequirementSet* requirementSet;
- Framework::RCArray<LogicTree> children;
- Framework::RCArray<RequirementSet>* multiply(
- Framework::RCArray<RequirementSet>* a,
- Framework::RCArray<RequirementSet>* b);
- public:
- LogicTree(LogicalOperator op, RequirementSet* set);
- ~LogicTree();
- void addChildren(LogicTree* tree);
- LogicTree* clone();
- void negate();
- Framework::RCArray<RequirementSet>* resolve();
- };
|