Skip to content

Commit

Permalink
Added Event level information
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouca committed Nov 21, 2024
1 parent a1fb109 commit 9eaec21
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"geode": "4.0.0-beta.2",
"geode": "4.0.1",
"version": "v1.4.0-beta.2",
"gd": {
"win": "2.2074",
Expand Down Expand Up @@ -44,7 +44,8 @@
"spritesheets": {
"countries": ["resources/countries/*.png"],
"badges": ["resources/badges/*.png"],
"scenes": ["resources/scenes/*.png"]
"scenes": ["resources/scenes/*.png"],
"extras": ["resources/extras/*.png"]
}
},
"settings": {
Expand Down
Binary file added resources/extras/info_btn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/extras/ncs_album.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions src/Styles/EventLevelInformation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#include "EventLevelInformation.h"
#include "Geode/Enums.hpp"
#include <Geode/modify/DailyLevelPage.hpp>

class $modify(EventPage, DailyLevelPage) {
void onInfo(CCObject* pSender) {
EventLevelInformation::scene();
}

bool init(GJTimedLevelType type) {
if (!DailyLevelPage::init(type)) return false;

if (type != GJTimedLevelType::Event) return true;

auto infoSpr = CCSprite::createWithSpriteFrameName("info_btn.png"_spr);
auto infoBtn = CCMenuItemSpriteExtra::create(infoSpr, this, menu_selector(EventPage::onInfo));

// Put on the corner top left of the background
auto levelCell = as<CCLayer*>(this->getChildByIDRecursive("main-layer"));
auto menu = as<CCMenu*>(levelCell->getChildByIDRecursive("main-menu"));
infoBtn->setPosition({ -292, -56 });

menu->addChild(infoBtn);

return true;
}
};

void EventLevelInformation::scene() {
auto popup = new EventLevelInformation();

if (popup && popup->initAnchored(400.0f, 225.0f, "GJ_square02.png")) {
popup->autorelease();
CCDirector::sharedDirector()->getRunningScene()->addChild(popup, 200);
} else {
CC_SAFE_DELETE(popup);
}
};

bool EventLevelInformation::setup() {
auto winSize = cocos2d::CCDirector::sharedDirector()->getWinSize();
auto director = cocos2d::CCDirector::sharedDirector();

registerWithTouchDispatcher();
setTouchEnabled(true);
setKeypadEnabled(true);

EventLevelInformation::loadPage();
return true;
}

void EventLevelInformation::loadPage() {
auto image_spr = CCSprite::createWithSpriteFrameName("ncs_album.png"_spr);

auto size = this->m_mainLayer->getContentSize();

image_spr->setPosition({ size.width / 2, size.height / 2 });
image_spr->setScale(1.1f);
this->m_mainLayer->addChild(image_spr);
}
13 changes: 13 additions & 0 deletions src/Styles/EventLevelInformation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once
#include "../includes.h"
#include "Geode/binding/FLAlertLayer.hpp"
#include "../OldBorder.hpp"

class EventLevelInformation : public Popup<> {
protected:
bool setup() override;
void loadPage();

public:
static void scene();
};

0 comments on commit 9eaec21

Please sign in to comment.