Continue refactor
This commit is contained in:
parent
18cf2b01bd
commit
219fbfb4c7
14 changed files with 104 additions and 125 deletions
|
|
@ -21,7 +21,10 @@ void Actor::performAction()
|
|||
{
|
||||
if(active)
|
||||
{
|
||||
sigValue(triggerValue);
|
||||
ItemUpdateRequest request;
|
||||
request.type = ITEM_UPDATE_ACTOR;
|
||||
request.payload = ItemData(QRandomGenerator::global()->generate(), "Item", triggerValue);
|
||||
sigItemUpdate(request);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,9 +89,9 @@ uint8_t Actor::getTriggerValue()
|
|||
return triggerValue;
|
||||
}
|
||||
|
||||
void Actor::onValueChanged(uint8_t value)
|
||||
void Actor::onItemUpdated(ItemUpdateRequest update)
|
||||
{
|
||||
(void)value;
|
||||
(void) update;
|
||||
}
|
||||
|
||||
std::shared_ptr<Actor> Actor::createActor(const QString& type)
|
||||
|
|
@ -112,9 +115,7 @@ std::shared_ptr<Actor> Actor::loadActor(const QJsonObject &json)
|
|||
return actor;
|
||||
}
|
||||
|
||||
void Actor::setValue(uint8_t value)
|
||||
void Actor::enactValue(uint8_t value)
|
||||
{
|
||||
Item::setValue(value);
|
||||
setActive(value);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,18 +19,17 @@ protected:
|
|||
bool exausted = false;
|
||||
|
||||
void performAction();
|
||||
virtual void enactValue(uint8_t value) override;
|
||||
|
||||
signals:
|
||||
|
||||
void sigValue(uint8_t value);
|
||||
void sigItemUpdate(ItemUpdateRequest update);
|
||||
|
||||
public slots:
|
||||
virtual void makeActive();
|
||||
virtual void makeInactive();
|
||||
virtual void setActive(uint8_t state);
|
||||
virtual void onValueChanged(uint8_t state);
|
||||
|
||||
virtual void setValue(uint8_t value);
|
||||
virtual void onItemUpdated(ItemUpdateRequest update);
|
||||
|
||||
public:
|
||||
Actor(QObject* parent = nullptr);
|
||||
|
|
@ -46,8 +45,8 @@ public:
|
|||
|
||||
static std::shared_ptr<Actor> createActor(const QString& type);
|
||||
|
||||
virtual void store(QJsonObject& json);
|
||||
virtual void load(const QJsonObject& json, const bool preserve = false);
|
||||
virtual void store(QJsonObject& json) override;
|
||||
virtual void load(const QJsonObject& json, const bool preserve = false) override;
|
||||
static std::shared_ptr<Actor> loadActor(const QJsonObject& json);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue