Skip to content

Commit 4a39bef

Browse files
committed
Use TextAlertPopup instead of geode::Notification and other stuff
1 parent 9726d50 commit 4a39bef

File tree

10 files changed

+55
-39
lines changed

10 files changed

+55
-39
lines changed

.github/ISSUE_TEMPLATE/report-bug.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ body:
3232
- 2.0.0
3333
- 2.0.1
3434
- 2.0.2
35+
- 2.0.3
3536
validations:
3637
required: true
3738
- type: dropdown
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Feature Suggestion
2+
description: Suggest a feature
3+
title: "[Feature]: "
4+
labels: ["enhancement"]
5+
projects: "SpaghettDev/4"
6+
assignees:
7+
- SpaghettDev
8+
body:
9+
- type: textarea
10+
id: feature-text
11+
attributes:
12+
label: What is your suggested feature?
13+
description: Provide a detailed explanation of what you would want to see added to this project.
14+
placeholder: Tell us what you want!
15+
value: "I would like ..."
16+
validations:
17+
required: true

ABOUT.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ You can currently select 1 of 4 options: Normal List, Demon List, Challenge List
2626
Info about these lists can be found by clicking the corresponding info icon next to the list's button.
2727

2828
And that's pretty much it! Have fun rouletting!
29+
30+
## Contact
31+
32+
You can contact me through my personal [Discord server](https://discord.gg/WPcqK3Yt).

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [2.0.3] - 2024-03-09
9+
10+
### Changed
11+
12+
- No longer use `geode::Notification`, now use `rl::utils::createNotificationToast`
13+
814
## [2.0.2] - 2024-03-06
915

1016
### Added

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ Then open the generated solution in Visual Studio.
3737

3838
**Make sure to compile in Release Mode! Otherwise the solution will not compile.**
3939

40+
## Contact
41+
42+
You can contact me through my personal [Discord server](https://discord.gg/WPcqK3Yt) to get instant™️ support and other stuff ig.
43+
4044
## Credits
4145

4246
- SpaghettDev ([@SpaghettDev](https://github.com/SpaghettDev)): Creator & maintainer.

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"android": "2.205",
66
"mac": "2.200"
77
},
8-
"version": "v2.0.2",
8+
"version": "v2.0.3",
99
"id": "spaghettdev.gd-roulette",
1010
"name": "GD-Roulette",
1111
"developer": "SpaghettDev",

src/layers/LevelInfoLayer.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
using namespace geode::prelude;
1010

11-
std::list<int> levelIDs{};
12-
1311
class $modify(LevelInfoLayer)
1412
{
1513
bool init(GJGameLevel* level, bool p1)
@@ -18,12 +16,9 @@ class $modify(LevelInfoLayer)
1816

1917
if (g_rouletteManager.isPlaying && level->m_levelID.value() == g_rouletteManager.currentLevelID)
2018
{
21-
levelIDs.push_back(level->m_levelID);
22-
2319
CCLabelBMFont* normalPercentageLabel = static_cast<CCLabelBMFont*>(this->getChildByID("normal-mode-percentage"));
2420
float goalOffset = .0f;
2521

26-
// TODO: fix this because it only happens on platformer levels, which only happens in GD List
2722
if (!normalPercentageLabel) return true;
2823

2924
// wtf v2
@@ -51,18 +46,14 @@ class $modify(LevelInfoLayer)
5146

5247
void onBack(CCObject* sender)
5348
{
54-
if (g_rouletteManager.isPlaying)
55-
{
56-
if (levelIDs.size() != 0)
57-
levelIDs.pop_back();
58-
59-
if (g_rouletteManager.rouletteLayer && levelIDs.back() == g_rouletteManager.currentLevelID)
60-
{
61-
static_cast<CCLabelBMFont*>(
62-
g_rouletteManager.rouletteLayer->playing_menu->getChildByID("percentage-text")
63-
)->setString(fmt::format("{}%", g_rouletteManager.levelPercentageGoal).c_str());
64-
}
65-
}
49+
if (
50+
g_rouletteManager.isPlaying &&
51+
g_rouletteManager.rouletteLayer &&
52+
this->m_level->m_levelID.value() == g_rouletteManager.currentLevelID
53+
)
54+
static_cast<CCLabelBMFont*>(
55+
g_rouletteManager.rouletteLayer->playing_menu->getChildByID("percentage-text")
56+
)->setString(fmt::format("{}%", g_rouletteManager.levelPercentageGoal).c_str());
6657

6758
LevelInfoLayer::onBack(sender);
6859
}

src/layers/PauseLayer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class $modify(PauseLayer)
1919
CCLabelBMFont* normalPercentageLabel = static_cast<CCLabelBMFont*>(this->getChildByID("normal-progress-label"));
2020
float goalOffset = 24.f;
2121

22-
// TODO: fix this because it only happens on platformer levels, which only happens in GD List
2322
if (!normalPercentageLabel) return;
2423

2524
if (playLayer->m_level->m_normalPercent < 10)

src/roulette/layers/RLRouletteLayer.cpp

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "RLRouletteInfoLayer.hpp"
77
#include "../manager/RouletteManager.hpp"
88
#include "../../custom_nodes/RLDifficultyNode.hpp"
9+
#include "../../custom_layers/RLDifficultySelectLayer.hpp"
910
#include "../../utils.hpp"
1011

1112
#include <Geode/Geode.hpp>
@@ -386,8 +387,7 @@ void RLRouletteLayer::onInfoButton(CCObject*)
386387
m_roulette_info_layer->show();
387388
}
388389
else
389-
// this->addChild(TextAlertPopup::create("You are currently in a game of roulette!", 1.2f, .8f, 1, "bigFont.fnt"));
390-
Notification::create("You are currently in a game of roulette!", NotificationIcon::Error, .7f)->show();
390+
rl::utils::createNotificationToast(this, "You are currently in a game of roulette!", .5f, 85.f);
391391
}
392392

393393
void RLRouletteLayer::onDifficultyButton(CCObject* sender)
@@ -475,8 +475,7 @@ void RLRouletteLayer::onLevelInfo(CCObject* sender)
475475
}
476476

477477
clipboard::write(text);
478-
// this->addChild(TextAlertPopup::create("Copied to Clipboard", .5f, .6f, 1, "bigFont.fnt"));
479-
Notification::create("Copied to Clipboard", NotificationIcon::Success)->show();
478+
rl::utils::createNotificationToast(this, "Copied to Clipboard", .5f, 85.f);
480479
}
481480

482481
void RLRouletteLayer::onPlayButton(CCObject*)
@@ -535,16 +534,7 @@ void RLRouletteLayer::onNextButton(CCObject*)
535534
);
536535
}
537536
else
538-
// this->addChild(TextAlertPopup::create(
539-
// std::format(
540-
// "You need to get at least {}%!", static_cast<int>(g_rouletteManager.levelPercentageGoal)
541-
// ), 1.2f, .8f, 1, "bigFont.fnt"
542-
// ));
543-
Notification::create(
544-
fmt::format("You need to get at least {}%!", g_rouletteManager.levelPercentageGoal),
545-
NotificationIcon::Error,
546-
.7f
547-
)->show();
537+
rl::utils::createNotificationToast(this, fmt::format("You need to get at least {}%!", g_rouletteManager.levelPercentageGoal), .5f, 85.f);
548538
}
549539

550540
void RLRouletteLayer::onResetButton(CCObject*)
@@ -599,12 +589,7 @@ void RLRouletteLayer::onSkipButton(CCObject*)
599589
);
600590
}
601591
else
602-
// this->addChild(
603-
// TextAlertPopup::create(
604-
// "You don't have any skips left!", 1.2f, .8f, 1, "bigFont.fnt"
605-
// )
606-
// );
607-
Notification::create("You don't have any skips left!", NotificationIcon::Error, .7f)->show();
592+
rl::utils::createNotificationToast(this, "You don't have any skips left!", .5f, 85.f);
608593
}
609594

610595
void RLRouletteLayer::finishLevelRoulette()

src/utils.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ namespace rl
182182
return button;
183183
}
184184

185+
inline void createNotificationToast(CCLayer* layer, const std::string& str, float time, float yPosition)
186+
{
187+
// yeah don't ask me what this is, ask IDA 👍
188+
auto tap = TextAlertPopup::create(str, time, .6f, 0x96, "\x00\x00\x00\x00");
189+
tap->setPositionY(yPosition);
190+
191+
layer->addChild(tap);
192+
}
193+
185194
template<auto V>
186195
struct ScopedVar
187196
{

0 commit comments

Comments
 (0)