1+ #include " EventLevelInformation.h"
2+ #include " Geode/Enums.hpp"
3+ #include < Geode/modify/DailyLevelPage.hpp>
4+
5+ class $modify(EventPage, DailyLevelPage) {
6+ void onInfo (CCObject* pSender) {
7+ EventLevelInformation::scene ();
8+ }
9+
10+ bool init (GJTimedLevelType type) {
11+ if (!DailyLevelPage::init (type)) return false ;
12+
13+ if (type != GJTimedLevelType::Event) return true ;
14+
15+ auto infoSpr = CCSprite::createWithSpriteFrameName (" info_btn.png" _spr);
16+ auto infoBtn = CCMenuItemSpriteExtra::create (infoSpr, this , menu_selector (EventPage::onInfo));
17+
18+ // Put on the corner top left of the background
19+ auto levelCell = as<CCLayer*>(this ->getChildByIDRecursive (" main-layer" ));
20+ auto menu = as<CCMenu*>(levelCell->getChildByIDRecursive (" main-menu" ));
21+ infoBtn->setPosition ({ -292 , -56 });
22+
23+ menu->addChild (infoBtn);
24+
25+ return true ;
26+ }
27+ };
28+
29+ void EventLevelInformation::scene () {
30+ auto popup = new EventLevelInformation ();
31+
32+ if (popup && popup->initAnchored (400 .0f , 225 .0f , " GJ_square02.png" )) {
33+ popup->autorelease ();
34+ CCDirector::sharedDirector ()->getRunningScene ()->addChild (popup, 200 );
35+ } else {
36+ CC_SAFE_DELETE (popup);
37+ }
38+ };
39+
40+ bool EventLevelInformation::setup () {
41+ auto winSize = cocos2d::CCDirector::sharedDirector ()->getWinSize ();
42+ auto director = cocos2d::CCDirector::sharedDirector ();
43+
44+ registerWithTouchDispatcher ();
45+ setTouchEnabled (true );
46+ setKeypadEnabled (true );
47+
48+ EventLevelInformation::loadPage ();
49+ return true ;
50+ }
51+
52+ void EventLevelInformation::loadPage () {
53+ auto image_spr = CCSprite::createWithSpriteFrameName (" ncs_album.png" _spr);
54+
55+ auto size = this ->m_mainLayer ->getContentSize ();
56+
57+ image_spr->setPosition ({ size.width / 2 , size.height / 2 });
58+ image_spr->setScale (1 .1f );
59+ this ->m_mainLayer ->addChild (image_spr);
60+ }
0 commit comments