| 1 | #include "Layout/AmiiboNpcLayout.h" |
| 2 | |
| 3 | #include "Library/Layout/LayoutActionFunction.h" |
| 4 | #include "Library/Layout/LayoutActor.h" |
| 5 | #include "Library/Layout/LayoutInitInfo.h" |
| 6 | #include "Library/Message/MessageHolder.h" |
| 7 | #include "Library/Nerve/NerveSetupUtil.h" |
| 8 | #include "Library/Nerve/NerveUtil.h" |
| 9 | |
| 10 | #include "Layout/FooterParts.h" |
| 11 | |
| 12 | namespace { |
| 13 | NERVE_IMPL(AmiiboNpcLayout, Appear); |
| 14 | NERVE_IMPL(AmiiboNpcLayout, Decide); |
| 15 | NERVE_IMPL(AmiiboNpcLayout, End); |
| 16 | NERVE_IMPL(AmiiboNpcLayout, Wait); |
| 17 | |
| 18 | NERVES_MAKE_NOSTRUCT(AmiiboNpcLayout, Appear, Decide, End, Wait); |
| 19 | } // namespace |
| 20 | |
| 21 | AmiiboNpcLayout::AmiiboNpcLayout(const al::LayoutInitInfo& info) |
| 22 | : al::LayoutActor("AmiiboNpc用レイアウト" ) { |
| 23 | al::initLayoutActor(this, info, "ControllerGuideAmiibo" , nullptr); |
| 24 | initNerve(&Appear, 0); |
| 25 | al::startAction(layout: this, actionName: "Appear" , paneName: nullptr); |
| 26 | mFooterParts = new FooterParts(this, info, al::getSystemMessageString(this, "Footer" , "Return" ), |
| 27 | "TxtGuide" , "ParFooter" ); |
| 28 | mAmiiboIcon = new al::LayoutActor("AmiiboNpc用レイアウト[アイコン]" ); |
| 29 | al::initLayoutPartsActor(mAmiiboIcon, this, info, "ParAmiiboIcon" , nullptr); |
| 30 | kill(); |
| 31 | } |
| 32 | |
| 33 | void AmiiboNpcLayout::startTouch() { |
| 34 | mAmiiboIcon->appear(); |
| 35 | al::startAction(layout: mAmiiboIcon, actionName: "Appear" , paneName: nullptr); |
| 36 | } |
| 37 | |
| 38 | void AmiiboNpcLayout::endTouch() { |
| 39 | al::startAction(layout: mAmiiboIcon, actionName: "End" , paneName: nullptr); |
| 40 | } |
| 41 | |
| 42 | void AmiiboNpcLayout::appear() { |
| 43 | al::LayoutActor::appear(); |
| 44 | al::setNerve(user: this, nerve: &Appear); |
| 45 | al::startAction(layout: mAmiiboIcon, actionName: "Hide" , paneName: nullptr); |
| 46 | } |
| 47 | |
| 48 | void AmiiboNpcLayout::control() { |
| 49 | if (isIconEndActionEnd()) |
| 50 | al::startAction(layout: mAmiiboIcon, actionName: "Wait" , paneName: nullptr); |
| 51 | } |
| 52 | |
| 53 | void AmiiboNpcLayout::decide() { |
| 54 | al::setNerve(user: this, nerve: &Decide); |
| 55 | } |
| 56 | |
| 57 | void AmiiboNpcLayout::end() { |
| 58 | al::startAction(layout: mAmiiboIcon, actionName: "Hide" , paneName: nullptr); |
| 59 | al::setNerve(user: this, nerve: &End); |
| 60 | } |
| 61 | |
| 62 | bool AmiiboNpcLayout::isIconEndActionEnd() const { |
| 63 | return al::isActionPlaying(layout: mAmiiboIcon, actionName: "End" , paneName: nullptr) && |
| 64 | al::isActionEnd(layout: mAmiiboIcon, paneName: nullptr); |
| 65 | } |
| 66 | |
| 67 | void AmiiboNpcLayout::exeAppear() { |
| 68 | if (al::isFirstStep(user: this)) { |
| 69 | al::startAction(layout: this, actionName: "Appear" , paneName: nullptr); |
| 70 | al::startAction(layout: this, actionName: "Loop" , paneName: "Loop" ); |
| 71 | } |
| 72 | if (al::isActionEnd(layout: this, paneName: nullptr)) |
| 73 | al::setNerve(user: this, nerve: &Wait); |
| 74 | } |
| 75 | |
| 76 | void AmiiboNpcLayout::exeWait() { |
| 77 | if (al::isFirstStep(user: this)) |
| 78 | al::startAction(layout: this, actionName: "Wait" , paneName: nullptr); |
| 79 | } |
| 80 | |
| 81 | void AmiiboNpcLayout::exeDecide() { |
| 82 | if (al::isFirstStep(user: this)) { |
| 83 | al::startAction(layout: this, actionName: "Decide" , paneName: nullptr); |
| 84 | al::startHitReaction(this, "タッチ" , nullptr); |
| 85 | } |
| 86 | if (al::isActionEnd(layout: this, paneName: nullptr)) |
| 87 | kill(); |
| 88 | } |
| 89 | |
| 90 | void AmiiboNpcLayout::exeEnd() { |
| 91 | if (al::isFirstStep(user: this)) |
| 92 | al::startAction(layout: this, actionName: "End" , paneName: nullptr); |
| 93 | if (al::isActionEnd(layout: this, paneName: nullptr)) |
| 94 | kill(); |
| 95 | } |
| 96 | |