Skip to content

Commit f2d89eb

Browse files
committed
release
1 parent 58b3198 commit f2d89eb

File tree

5 files changed

+48
-48
lines changed

5 files changed

+48
-48
lines changed

src/Client/ModuleNode.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ void ModuleNode::onInfo(CCObject* sender)
212212

213213
auto menu = CCMenu::create();
214214
// この二行は怖いだ
215-
menu->setPosition(CCDirector::get()->getWinSize() / 2 - ccp(0, alert->m_mainLayer->getChildByType<CCScale9Sprite>(0)->getContentHeight() / 2) + ccp(0, 25));
216-
menu->setTouchPriority(-42069);
215+
menu->setPosition(ccp(0, 25));
217216

218217
auto btn = CCMenuItemToggler::create(CCSprite::create("favourites.png"_spr), CCSprite::create("favourites.png"_spr), alert, menu_selector(ModuleNode::onInfoToggleFavourite));
219218
btn->setPositionX(-alert->m_mainLayer->getChildByType<CCScale9Sprite>(0)->getContentWidth() / 2 + 25);
@@ -234,11 +233,11 @@ void ModuleNode::onInfo(CCObject* sender)
234233

235234
auto btnKeybind = CCMenuItemSpriteExtra::create(CCSprite::create("keybinds.png"_spr), alert, menu_selector(ModuleNode::onChangeKeybind));
236235
btnKeybind->setContentSize(btnKeybind->getContentSize() * ccp(1, 2));
237-
btnKeybind->setPositionX(alert->m_mainLayer->getChildByType<CCScale9Sprite>(0)->getContentWidth() / 2 - 25);
236+
btnKeybind->setPositionX(alert->m_mainLayer->getContentWidth() - 25);
238237
btnKeybind->getNormalImage()->setPosition(btnKeybind->getContentSize() / 2);
239238

240239
auto btnShortcut = CCMenuItemToggler::create(CCSprite::create("shortcuts.png"_spr), CCSprite::create("shortcuts.png"_spr), alert, menu_selector(ModuleNode::onChangeShortcut));
241-
btnShortcut->setPositionX(alert->m_mainLayer->getChildByType<CCScale9Sprite>(0)->getContentWidth() / 2 - 25 - 25);
240+
btnShortcut->setPositionX(alert->m_mainLayer->getContentWidth() - 25 - 25);
242241

243242
// btnShortcut->m_offButton->setColor(ccc3(150, 150, 150));
244243
// btnShortcut->m_offButton->setOpacity(150);

src/GUI/BetterAlertLayer.cpp

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@ BetterAlertLayer* BetterAlertLayer::create(FLAlertLayerProtocol* delegate, char
88
{
99
auto pRet = new BetterAlertLayer();
1010

11-
if (pRet && pRet->init(delegate, title, desc, btn1, btn2, width, scroll, height, textScale))
11+
pRet->delegate = delegate;
12+
pRet->title = title;
13+
pRet->desc = desc;
14+
pRet->btn1 = btn1;
15+
pRet->btn2 = btn2;
16+
pRet->width = width;
17+
pRet->scroll = scroll;
18+
pRet->height = height;
19+
pRet->textScale = textScale;
20+
21+
if (pRet && pRet->initAnchored(0, 0))
1222
{
1323
pRet->autorelease();
1424
return pRet;
@@ -40,73 +50,54 @@ BetterAlertLayer* BetterAlertLayer::createWithLocalisation(char const* title, co
4050
return create(lm->getLocalisedString(title).c_str(), lm->getLocalisedString(desc), lm->getLocalisedString(btn).c_str());
4151
}
4252

43-
bool BetterAlertLayer::init(FLAlertLayerProtocol* delegate, char const* title, gd::string desc, char const* btn1, char const* btn2, float width, bool scroll, float height, float textScale)
53+
bool BetterAlertLayer::setup()
4454
{
4555
this->addChild(CCBlurLayer::create(), -69);
4656

57+
m_bgSprite->setVisible(false);
58+
m_buttonMenu->setVisible(false);
59+
4760
content = AdvLabelBMFont::createWithStruct({}, "chatFont.fnt");
48-
content->setMaxWidth(width - 30);
61+
content->setMaxWidth(width - 60);
4962
content->setSplitEverySpace(true);
5063
content->setLineSpacing(3.5f);
5164
content->setAlignment(kCCTextAlignmentCenter);
5265
content->setString(desc.c_str());
5366

54-
std::string ss;
55-
56-
for (size_t i = 0; i < content->getLineCount(); i++)
57-
{
58-
ss.append("boobs\n");
59-
}
67+
float desHeight = std::max<float>(140.0, content->getScaledContentHeight() + 100);
6068

61-
if (!FLAlertLayer::init(delegate, title, ss, btn1, btn2, width, scroll, height, textScale))
62-
return false;
69+
m_mainLayer->setContentSize(ccp(width, desHeight));
6370

64-
auto oldTitle = m_mainLayer->getChildByType<CCLabelBMFont>(0);
65-
auto area = m_mainLayer->getChildByType<TextArea>(0);
66-
auto bg = m_mainLayer->getChildByType<CCScale9Sprite>(0);
67-
auto men = m_mainLayer->getChildByType<CCMenu>(0);
68-
69-
oldTitle->setVisible(false);
70-
area->setVisible(false);
71-
men->setVisible(false);
71+
bg = CCScale9Sprite::create("square01_001.png");
72+
bg->setContentSize(ccp(width, desHeight));
7273

7374
titleLabel = AdvLabelBMFont::createWithString(title, "goldFont.fnt");
74-
titleLabel->setPosition(ccp(getContentWidth() / 2, getContentHeight() / 2 + bg->getScaledContentHeight() / 2 + -15));
7575
titleLabel->setAnchorPoint(ccp(0.5f, 1));
76-
titleLabel->limitLabelWidth(width - 30, 0.9f, 0);
77-
78-
auto bg2 = EasyBG::create();
79-
bg2->setTargettingNode(titleLabel);
80-
bg2->setTargettingOffset(ccp(4, 4));
81-
bg2->setPosition(titleLabel->getPosition() + ccp(0, -titleLabel->getScaledContentHeight() / 2));
82-
bg2->setVisible(titleLabel->isUsingTTFCurrently());
83-
84-
content->setPosition(ccp(getContentWidth() / 2, getContentHeight() / 2 + 5));
76+
titleLabel->limitLabelWidth(width - 60, 0.9f, 0);
8577

8678
auto menu = CCMenu::create();
87-
menu->setTouchPriority(-512);
88-
menu->setPosition(ccp(getContentWidth() / 2, getContentHeight() / 2 - bg->getScaledContentHeight() / 2 + 30));
79+
menu->setZOrder(8);
8980

9081
auto spr = BetterButtonSprite::create(ccp(54.25f, 30), btn1, "goldFont.fnt", "GJ_button_01.png");
9182
auto btn = CCMenuItemSpriteExtra::create(spr, this, menu_selector(BetterAlertLayer::onButton));
9283
btn->setTag(1);
9384
menu->addChild(btn);
9485

95-
m_mainLayer->addChild(content, 6);
96-
m_mainLayer->addChild(titleLabel, 7);
97-
m_mainLayer->addChild(bg2, 5);
98-
m_mainLayer->addChild(menu, 8);
86+
m_mainLayer->addChildAtPosition(bg, Anchor::Center);
87+
m_mainLayer->addChildAtPosition(content, Anchor::Center, ccp(0, 5));
88+
m_mainLayer->addChildAtPosition(titleLabel, Anchor::Top, ccp(0, -15));
89+
m_mainLayer->addChildAtPosition(menu, Anchor::Bottom, ccp(0, 30));
9990
return true;
10091
}
10192

10293
void BetterAlertLayer::onButton(CCObject* sender)
10394
{
10495
if (sender->getTag() == 1)
10596
{
106-
this->onBtn1(m_button1->getParent());
97+
this->onBtn1(sender);
10798
}
10899
else
109100
{
110-
this->onBtn2(m_button2->getParent());
101+
this->onBtn2(sender);
111102
}
112103
}

src/GUI/BetterAlertLayer.hpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,23 @@
55

66
using namespace geode::prelude;
77

8-
class BetterAlertLayer : public FLAlertLayer
8+
class BetterAlertLayer : public geode::Popup<>
99
{
1010
protected:
11+
CCScale9Sprite* bg = nullptr;
1112
AdvLabelBMFont* titleLabel = nullptr;
1213
AdvLabelBMFont* content = nullptr;
1314

15+
FLAlertLayerProtocol* delegate;
16+
char const* title;
17+
std::string desc;
18+
char const* btn1;
19+
char const* btn2;
20+
float width;
21+
bool scroll;
22+
float height;
23+
float textScale;
24+
1425
public:
1526
static BetterAlertLayer* create(FLAlertLayerProtocol* delegate, char const* title, gd::string desc, char const* btn1, char const* btn2, float width, bool scroll, float height, float textScale);
1627
static BetterAlertLayer* create(FLAlertLayerProtocol* delegate, char const* title, gd::string desc, char const* btn1, char const* btn2, float width);
@@ -20,5 +31,5 @@ class BetterAlertLayer : public FLAlertLayer
2031

2132
void onButton(CCObject* sender);
2233

23-
bool init(FLAlertLayerProtocol* delegate, char const* title, gd::string desc, char const* btn1, char const* btn2, float width, bool scroll, float height, float textScale);
34+
virtual bool setup();
2435
};

src/GUI/OptionsUI.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ void OptionsUI::onInfo(CCObject* sender)
117117

118118
auto menu = CCMenu::create();
119119
// この二行は怖いだ
120-
menu->setPosition(CCDirector::get()->getWinSize() / 2 - ccp(0, alert->m_mainLayer->getChildByType<CCScale9Sprite>(0)->getContentHeight() / 2) + ccp(0, 25));
121-
menu->setTouchPriority(-42069);
120+
menu->setPosition(ccp(0, 25));
122121

123122
auto btn = CCMenuItemToggler::create(CCSprite::create("favourites.png"_spr), CCSprite::create("favourites.png"_spr), alert, menu_selector(OptionsUI::onInfoToggleFavourite));
124123
btn->setPositionX(-alert->m_mainLayer->getChildByType<CCScale9Sprite>(0)->getContentWidth() / 2 + 25);
@@ -139,11 +138,11 @@ void OptionsUI::onInfo(CCObject* sender)
139138

140139
auto btnKeybind = CCMenuItemSpriteExtra::create(CCSprite::create("keybinds.png"_spr), alert, menu_selector(ModuleNode::onChangeKeybind));
141140
btnKeybind->setContentSize(btnKeybind->getContentSize() * ccp(1, 2));
142-
btnKeybind->setPositionX(alert->m_mainLayer->getChildByType<CCScale9Sprite>(0)->getContentWidth() / 2 - 25);
141+
btnKeybind->setPositionX(alert->m_mainLayer->getContentWidth() - 25);
143142
btnKeybind->getNormalImage()->setPosition(btnKeybind->getContentSize() / 2);
144143

145144
auto btnShortcut = CCMenuItemToggler::create(CCSprite::create("shortcuts.png"_spr), CCSprite::create("shortcuts.png"_spr), alert, menu_selector(ModuleNode::onChangeShortcut));
146-
btnShortcut->setPositionX(alert->m_mainLayer->getChildByType<CCScale9Sprite>(0)->getContentWidth() / 2 - 25 - 25);
145+
btnShortcut->setPositionX(alert->m_mainLayer->getContentWidth() - 25 - 25);
147146

148147
// btnShortcut->m_offButton->setColor(ccc3(150, 150, 150));
149148
// btnShortcut->m_offButton->setOpacity(150);

0 commit comments

Comments
 (0)