| 1 | #include "Layout/TestFilterGlasses.h" |
| 2 | |
| 3 | #include "Library/Layout/LayoutActionFunction.h" |
| 4 | #include "Library/Layout/LayoutInitInfo.h" |
| 5 | #include "Library/Nerve/NerveSetupUtil.h" |
| 6 | #include "Library/Nerve/NerveUtil.h" |
| 7 | |
| 8 | namespace { |
| 9 | NERVE_IMPL(TestFilterGlasses, Appear); |
| 10 | NERVE_IMPL(TestFilterGlasses, End); |
| 11 | NERVE_IMPL(TestFilterGlasses, Wait); |
| 12 | |
| 13 | NERVES_MAKE_NOSTRUCT(TestFilterGlasses, Appear, End, Wait); |
| 14 | } // namespace |
| 15 | |
| 16 | TestFilterGlasses::TestFilterGlasses(const char* name, const al::LayoutInitInfo& info, |
| 17 | const char* suffix) |
| 18 | : al::LayoutActor(name) { |
| 19 | al::initLayoutActor(this, info, "FilterGlasses" , suffix); |
| 20 | initNerve(&Appear, 0); |
| 21 | kill(); |
| 22 | } |
| 23 | |
| 24 | void TestFilterGlasses::startAppear() { |
| 25 | appear(); |
| 26 | al::setNerve(user: this, nerve: &Appear); |
| 27 | } |
| 28 | |
| 29 | void TestFilterGlasses::end() { |
| 30 | al::setNerve(user: this, nerve: &End); |
| 31 | } |
| 32 | |
| 33 | void TestFilterGlasses::exeAppear() { |
| 34 | if (al::isFirstStep(user: this)) |
| 35 | al::startAction(layout: this, actionName: "Appear" , paneName: nullptr); |
| 36 | if (al::isActionEnd(layout: this, paneName: nullptr)) |
| 37 | al::setNerve(user: this, nerve: &Wait); |
| 38 | } |
| 39 | |
| 40 | void TestFilterGlasses::exeWait() { |
| 41 | if (al::isFirstStep(user: this)) |
| 42 | al::startAction(layout: this, actionName: "Wait" , paneName: nullptr); |
| 43 | } |
| 44 | |
| 45 | void TestFilterGlasses::exeEnd() { |
| 46 | if (al::isFirstStep(user: this)) |
| 47 | al::startAction(layout: this, actionName: "End" , paneName: nullptr); |
| 48 | if (al::isActionEnd(layout: this, paneName: nullptr)) |
| 49 | kill(); |
| 50 | } |
| 51 | |
| 52 | bool TestFilterGlasses::isEnd() const { |
| 53 | return !isAlive() || al::isNerve(user: this, nerve: &End); |
| 54 | } |
| 55 | |