Skip to content

Commit 9eaec21

Browse files
committed
Added Event level information
1 parent a1fb109 commit 9eaec21

File tree

5 files changed

+76
-2
lines changed

5 files changed

+76
-2
lines changed

mod.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"geode": "4.0.0-beta.2",
2+
"geode": "4.0.1",
33
"version": "v1.4.0-beta.2",
44
"gd": {
55
"win": "2.2074",
@@ -44,7 +44,8 @@
4444
"spritesheets": {
4545
"countries": ["resources/countries/*.png"],
4646
"badges": ["resources/badges/*.png"],
47-
"scenes": ["resources/scenes/*.png"]
47+
"scenes": ["resources/scenes/*.png"],
48+
"extras": ["resources/extras/*.png"]
4849
}
4950
},
5051
"settings": {

resources/extras/info_btn.png

8.9 KB
Loading

resources/extras/ncs_album.png

977 KB
Loading
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
}

src/Styles/EventLevelInformation.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
#include "../includes.h"
3+
#include "Geode/binding/FLAlertLayer.hpp"
4+
#include "../OldBorder.hpp"
5+
6+
class EventLevelInformation : public Popup<> {
7+
protected:
8+
bool setup() override;
9+
void loadPage();
10+
11+
public:
12+
static void scene();
13+
};

0 commit comments

Comments
 (0)