1#include "Layout/PlayGuideSkip.h"
2
3#include "Library/Layout/LayoutActionFunction.h"
4#include "Library/Layout/LayoutActor.h"
5#include "Library/Layout/LayoutActorUtil.h"
6#include "Library/Layout/LayoutInitInfo.h"
7#include "Library/Nerve/NerveSetupUtil.h"
8#include "Library/Nerve/NerveUtil.h"
9
10namespace {
11NERVE_IMPL(PlayGuideSkip, Appear);
12NERVE_IMPL(PlayGuideSkip, Wait);
13NERVE_IMPL(PlayGuideSkip, End);
14
15NERVES_MAKE_NOSTRUCT(PlayGuideSkip, Appear, Wait, End);
16} // namespace
17
18PlayGuideSkip::PlayGuideSkip(const char* name, const al::LayoutInitInfo& info)
19 : al::LayoutActor(name) {
20 al::initLayoutActorLocalized(this, info, "PlayGuideSkip", nullptr);
21 al::setPaneSystemMessage(this, "TxtGuide", "PlayGuideSkip", "PlayGuideDemoSkip");
22 initNerve(&Appear, 0);
23}
24
25void PlayGuideSkip::kill() {
26 al::LayoutActor::kill();
27}
28
29bool PlayGuideSkip::tryAppear() {
30 if (isAlive())
31 return true;
32
33 appearCore();
34 return true;
35}
36
37void PlayGuideSkip::appearCore() {
38 al::startAction(layout: this, actionName: "Appear", paneName: nullptr);
39 al::LayoutActor::appear();
40 al::setNerve(user: this, nerve: &Appear);
41}
42
43void PlayGuideSkip::end() {
44 if (!al::isNerve(user: this, nerve: &End))
45 al::setNerve(user: this, nerve: &End);
46}
47
48bool PlayGuideSkip::isEnableSkipDemo() const {
49 return isAlive() && al::isNerve(user: this, nerve: &Wait);
50}
51
52void PlayGuideSkip::exeAppear() {
53 if (al::isActionEnd(layout: this, paneName: nullptr))
54 al::setNerve(user: this, nerve: &Wait);
55}
56
57void PlayGuideSkip::exeWait() {
58 if (al::isFirstStep(user: this))
59 al::startAction(layout: this, actionName: "Wait", paneName: nullptr);
60}
61
62void PlayGuideSkip::exeEnd() {
63 if (al::isFirstStep(user: this))
64 al::startAction(layout: this, actionName: "End", paneName: nullptr);
65
66 if (al::isActionEnd(layout: this, paneName: nullptr))
67 kill();
68}
69