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

Method setupIconSelect

Source/GarageLayer.cpp:187–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187void GarageLayer::setupIconSelect()
188{
189 const auto& size = Director::getInstance()->getWinSize();
190
191 auto bg = ui::Scale9Sprite::create(GameToolbox::getTextureString("square02_001.png"));
192 bg->setContentSize({385, 100});
193 bg->setOpacity(75);
194 bg->setPosition({size.width / 2, size.height / 2 - 65});
195 this->addChild(bg);
196
197 auto unlock = Sprite::createWithSpriteFrameName("GJ_unlockTxt_001.png");
198 unlock->setPosition({size.width / 2, bg->getPositionY() + bg->getContentSize().height / 2 + 12});
199 this->addChild(unlock);
200
201 auto menu = Menu::create();
202
203 for (int i = 0; i < 9; i++)
204 {
205 auto s1 = Sprite::createWithSpriteFrameName(this->getSpriteName(i, false));
206 s1->setScale(.9f);
207 auto s2 = Sprite::createWithSpriteFrameName(this->getSpriteName(i, true));
208 s2->setScale(s1->getScale());
209
210 auto i1 = MenuItemSpriteExtra::create(s1, [&](Node* a)
211 {
212 int tag = a->getTag();
213 int page = _modePages[tag];
214
215 IconType mode;
216 if (tag == 7)
217 mode = IconType::kIconTypeSpecial;
218 else if (tag == 8)
219 mode = IconType::kIconTypeDeathEffect;
220 else
221 mode = static_cast<IconType>(tag);
222
223 this->setupPage(mode, page);
224 });
225 i1->setTag(i);
226 menu->addChild(i1);
227
228 //auto i1 = MenuItemToggler::create(s1, s2, this, menu_selector(SaiGarageLayer::onSelectTab));
229 //i1->setSizeMult(1.2f);
230 //i1->setTag(i);
231 //i1->setClickable(false);
232 //menu->addChild(i1);
233 }
234
235 menu->alignItemsHorizontallyWithPadding(0);
236 menu->setPosition({size.width / 2, unlock->getPositionY() + 30 + 3});
237 this->addChild(menu);
238
239 auto menuArr = Menu::create();
240 menuArr->setPosition({0, 0});
241
242 // Robtop aqui hace otra peruanada de usar "GJ_arrow_%02d_001.png" para las flechas etc...
243
244 auto arrow1 = Sprite::createWithSpriteFrameName("GJ_arrow_01_001.png");

Callers 1

initMethod · 0.95

Calls 9

getSpriteNameMethod · 0.95
setupPageMethod · 0.95
createFunction · 0.85
logFunction · 0.85
setOpacityMethod · 0.80
setPositionMethod · 0.80
setScaleMethod · 0.80
getSelectedIconMethod · 0.80

Tested by

no test coverage detected