MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / onNext

Method onNext

Source/TutorialLayer.cpp:115–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115void TutorialLayer::onNext()
116{
117 currentTutorialIndex++;
118 std::string fileName = "tutorial_0" + std::to_string(currentTutorialIndex) + ".png";
119 layer1->removeChildByName("tutorial_01.png");
120
121 if (fileName == "tutorial_02.png")
122 {
123 tap_label->setString("Hold to fly up.\n");
124 hold_label->setString("Release to fly down.");
125 }
126 if (fileName == "tutorial_03.png")
127 {
128 tap_label->setString(" \nYou can enter practice mode from\n the pause menu.\n");
129 tap_label->setScale(0.600f);
130 tap_label->setAlignment(TextHAlignment::CENTER);
131
132 hold_label->setString(" \nPractice mode lets you place\n checkpoints.");
133 hold_label->setScale(0.600f);
134 hold_label->setAlignment(TextHAlignment::CENTER);
135 }
136 if (fileName == "tutorial_04.png")
137 {
138 tap_label->setString(" \nYou can place checkpoints manually, or\n use the auto-checkpoint feature.\n");
139 tap_label->setScale(0.550f);
140 tap_label->setAlignment(TextHAlignment::CENTER);
141 tap_label->setPosition({ 291.600f, 222.100f });
142
143 hold_label->setString(" \nTap the delete button to remove your\n last checkpoint.");
144 hold_label->setScale(0.600f);
145 hold_label->setAlignment(TextHAlignment::CENTER);
146 }
147 if (fileName == "tutorial_05.png")
148 {
149 tap_label->setString(" \nJump rings activate when you are on\n top of them.\n");
150 tap_label->setScale(0.600f);
151 tap_label->setAlignment(TextHAlignment::CENTER);
152
153 hold_label->setString(" \nTap while touching a ring to perform\n a ring jump.");
154 hold_label->setScale(0.600f);
155 hold_label->setAlignment(TextHAlignment::CENTER);
156
157 layer1->removeChildByTag(150, true);
158 auto exitButtonSprite = ButtonSprite::create("Exit");
159 auto exitButton = MenuItemSpriteExtra::create(exitButtonSprite, [&](Node*) { this->close(); });
160 exitButton->setScale(1.0f);
161 auto exitButtonMenu = Menu::createWithItem(exitButton);
162 exitButtonMenu->setPosition({ 437.250f, 84.000f });
163 layer1->addChild(exitButtonMenu);
164 }
165 if (layer1)
166 {
167 if (currentTutorialIndex <= 5)
168 {
169 auto imageSprite = Sprite::create(GameToolbox::getTextureString(fileName));
170 imageSprite->setScale(0.950f);
171 imageSprite->setPosition({ 239.000f, 84.000f });
172 imageSprite->setContentSize({ 283.500, 55.000f });

Callers 1

initMethod · 0.95

Calls 6

createFunction · 0.85
setScaleMethod · 0.80
setPositionMethod · 0.80
to_stringFunction · 0.50
setStringMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected