| 1 | #include "Library/Play/Layout/SimpleLayoutAppearWaitEnd.h" |
| 2 | |
| 3 | #include "Library/Layout/LayoutActionFunction.h" |
| 4 | #include "Library/Layout/LayoutActor.h" |
| 5 | #include "Library/Layout/LayoutInitInfo.h" |
| 6 | #include "Library/Nerve/NerveSetupUtil.h" |
| 7 | #include "Library/Nerve/NerveUtil.h" |
| 8 | |
| 9 | namespace { |
| 10 | using namespace al; |
| 11 | NERVE_HOST_TYPE_IMPL(SimpleLayoutAppearWaitEnd, Appear); |
| 12 | NERVE_HOST_TYPE_IMPL(SimpleLayoutAppearWaitEnd, End); |
| 13 | NERVE_HOST_TYPE_IMPL(SimpleLayoutAppearWaitEnd, Wait); |
| 14 | |
| 15 | NERVES_MAKE_NOSTRUCT(HostType, End); |
| 16 | NERVES_MAKE_STRUCT(HostType, Appear, Wait); |
| 17 | } // namespace |
| 18 | |
| 19 | namespace al { |
| 20 | |
| 21 | SimpleLayoutAppearWaitEnd::SimpleLayoutAppearWaitEnd(const char* name, const char* layoutName, |
| 22 | const LayoutInitInfo& info, |
| 23 | const char* archiveName, bool localize) |
| 24 | : LayoutActor(name) { |
| 25 | if (localize) |
| 26 | initLayoutActorLocalized(this, info, layoutName, archiveName); |
| 27 | else |
| 28 | initLayoutActor(this, info, layoutName, archiveName); |
| 29 | initNerve(&NrvHostType.Appear, 0); |
| 30 | } |
| 31 | |
| 32 | SimpleLayoutAppearWaitEnd::SimpleLayoutAppearWaitEnd(LayoutActor* parentActor, const char* name, |
| 33 | const char* layoutName, |
| 34 | const LayoutInitInfo& info, |
| 35 | const char* archiveName) |
| 36 | : LayoutActor(name) { |
| 37 | initLayoutPartsActor(this, parentActor, info, layoutName, archiveName); |
| 38 | initNerve(&NrvHostType.Appear, 0); |
| 39 | }; |
| 40 | |
| 41 | void SimpleLayoutAppearWaitEnd::appear() { |
| 42 | startAction(layout: this, actionName: "Appear" , paneName: nullptr); |
| 43 | LayoutActor::appear(); |
| 44 | setNerve(user: this, nerve: &NrvHostType.Appear); |
| 45 | } |
| 46 | |
| 47 | void SimpleLayoutAppearWaitEnd::end() { |
| 48 | if (!isNerve(user: this, nerve: &End)) |
| 49 | setNerve(user: this, nerve: &End); |
| 50 | } |
| 51 | |
| 52 | void SimpleLayoutAppearWaitEnd::startWait() { |
| 53 | startAction(layout: this, actionName: "Wait" , paneName: nullptr); |
| 54 | LayoutActor::appear(); |
| 55 | setNerve(user: this, nerve: &NrvHostType.Wait); |
| 56 | } |
| 57 | |
| 58 | void SimpleLayoutAppearWaitEnd::exeAppear() { |
| 59 | if (isActionEnd(layout: this, paneName: nullptr)) |
| 60 | setNerve(user: this, nerve: &NrvHostType.Wait); |
| 61 | } |
| 62 | |
| 63 | void SimpleLayoutAppearWaitEnd::exeWait() { |
| 64 | if (isFirstStep(user: this)) |
| 65 | startAction(layout: this, actionName: "Wait" , paneName: nullptr); |
| 66 | if (mLifetime >= 0 && isGreaterEqualStep(user: this, step: mLifetime)) |
| 67 | setNerve(user: this, nerve: &End); |
| 68 | } |
| 69 | |
| 70 | void SimpleLayoutAppearWaitEnd::exeEnd() { |
| 71 | if (isFirstStep(user: this)) |
| 72 | startAction(layout: this, actionName: "End" , paneName: nullptr); |
| 73 | if (isActionEnd(layout: this, paneName: nullptr)) |
| 74 | kill(); |
| 75 | } |
| 76 | |
| 77 | bool SimpleLayoutAppearWaitEnd::isWait() const { |
| 78 | return isNerve(user: this, nerve: &NrvHostType.Wait); |
| 79 | } |
| 80 | |
| 81 | bool SimpleLayoutAppearWaitEnd::isAppearOrWait() const { |
| 82 | return isWait() || isNerve(user: this, nerve: &NrvHostType.Appear); |
| 83 | } |
| 84 | |
| 85 | } // namespace al |
| 86 | |